akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n;
    cin>>n;
    int h[n];
    rep(i,n)cin>>h[i];
    ll ans=0;
    while(1){
        int idx=-1;
        int mi=inf;
        rep(i,n){
            if(h[i]<mi&&h[i]!=0)idx=i,mi=h[i];
        }
        if(mi==inf)break;
        ans+=h[idx];
        while(idx>0&&h[idx-1]>=mi)--idx;
        while(h[idx]>=mi&&idx<n){
            h[idx]-=mi;
            idx++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
a,b = map(int,input().split(" "))
c,d = map(int,input().split(" "))
e,f = map(int,input().split(" "))

dic = {1:0,2:0,3:0,4:0}
dic[a] += 1
dic[b] += 1
dic[c] += 1
dic[d] += 1
dic[e] += 1
dic[f] += 1

for key , val in dic.items():
    if val == 0 or val >= 3:
        print("NO")
        exit(0)

print("YES")

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
int main(void)
{
	int q,a,b,i,j,num;
	char str[1001],S[8],C[1001];
	scanf("%s",str);
	scanf("%d",&q);
	for(j=0;j<1001;j++){if(str[j]=='\0'){break;}}
	num=j;
	for(i=0;i<q;i++)
	{
		for(j=0;j<1001;j++){C[j]='\0';}
		scanf("%s %d %d",S,&a,&b);
		if(!strcmp(S,"print")){
			for(j=a;j<=b;j++){printf("%c",str[j]);}
			printf("\n");
			continue;
		} else if(!strcmp(S,"reverse")){
			for(j=a;j<=b;j++){C[j]=str[b-j+a];}
			for(j=a;j<=b;j++){str[j]=C[j];}
			continue;
		} else if(!strcmp(S,"replace")){
			scanf("%s",C);
			for(j=a;j<=b;j++){str[j]=C[j-a];}
			continue;
		}
	}
	return 0;
}

Measured memory_bytes: 576
H, W = list(map(int,input().split()))

D = []
f = [0] * W
for i in range(H):
    d = input()
    if d.count('.') == W:
        continue
    D.append(d)
    for j in range(W):
        if d[j] == '.':
            f[j] += 1

re = [''] * len(D)
for i in range(len(D)):
    str = D[i]
    for j in range(len(str)):
        if f[j] != len(D):
            re[i] += str[j]

for str in re:
    print(str)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<vector<int>> schedule(n + 1, vector<int> (3));
    for (int i = 1; i < n + 1; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> schedule.at(i).at(j);
        }
    }
    for (int i = 0; i < n; i++) {
        int dis = abs(schedule.at(i).at(1) - schedule.at(i + 1).at(1)) + abs(schedule.at(i).at(2) - schedule.at(i + 1).at(2));
        int time = schedule.at(i + 1).at(0) - schedule.at(i).at(0);
        if (dis > time) {
            goto no;
        }
        else if (dis % 2 != time % 2) {
            goto no;
        }
    }
    cout << "Yes" << endl;
    return 0;
    no:
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 5760
# coding: utf-8

# https://atcoder.jp/contests/abc099/tasks
# 15:00-


def main():
    N, C = map(int, input().split())
    D = [None] * C
    for i in range(C):
        D[i] = list(map(int, input().split()))

    c = [None] * N
    for i in range(N):
        c[i] = list(map(int, input().split()))
        c[i] = [x-1 for x in c[i]]  # 0-index

    STU = [[0] * C, [0] * C, [0] * C]

    for k in range(C):
        for i in range(N):
            for j in range(N):
                STU[(i+j) % 3][k] += D[c[i][j]][k]

    ans = 1000 * N * N
    for i in range(C):

        for j in range(C):
            if j == i:
                continue

            for k in range(C):
                if k == i or k == j:
                    continue
                cand = STU[0][i] + STU[1][j] + STU[2][k]

                if cand < ans:
                    ans = cand

    return ans


print(main())


Measured memory_bytes: 5492
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<String>();
    println!(
        "{}{}{}",
        v[0].to_uppercase().chars().collect::<Vec<_>>()[0],
        v[1].to_uppercase().chars().collect::<Vec<_>>()[0],
        v[2].to_uppercase().chars().collect::<Vec<_>>()[0]
    );
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	N := getInt()
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = getInt()
	}
	sort.Ints(a)

	sum := a[0]
	n := 0
	for i := 1; i < N; i++ {
		if a[i] > 2*sum {
			n = i
			//out("start = ", n)
		}
		sum += a[i]
	}
	out(N - n)
}


Measured memory_bytes: 3072
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <algorithm>
using namespace std;
bool cmp(int a,int b){
    return a > b;
}
int main()
{
    char s[105],t[105];
    int ss[105],tt[105];
    while(cin>>s>>t){
        bool flag = false;
        memset(ss,0,sizeof(ss));
        memset(tt,0,sizeof(tt));
        int s1 = strlen(s);
        int t1 = strlen(t);
        for(int i = 0;i < s1;i++){
            ss[i] = s[i] - '0';
        }
        for(int i = 0;i < t1;i++){
            tt[i] = t[i] - '0';
        }
        sort(ss,ss+s1);
        sort(tt,tt+t1,cmp);
        int len = max(s1,t1);
        for(int i = 0;i < len;i++){
            if(ss[i] < tt[i]) {flag = true;break;}
            if(ss[i] == tt[i]) continue;
            if(ss[i] > tt[i]) {flag = false;break;}
        }
        if(flag) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }

    return 0;
}



Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int n;

	cin >> n;

	int ans = 0;
	for (int i = 3; i <= n; i+=2) {
		int count = 0;
		for (int j = 1; j <= i; j++) {
			if (i % j == 0) {
				count++;
			}
		}

		if (count == 8) {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
//	"sort"
//	"math"
//	"regexp"
)


var s,ans string

func main(){
	fmt.Scan(&s)

	for i, str := range s{
		if i % 2 ==0{
			ans = ans + string(str)
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 6656
n = int(input())
words = set()
s = input()
pre = s[-1]
words.add(s)
for i in range(n-1):
    s = input()
    if s in words:
        print('No')
        exit()
    if s[0] != pre:
        print('No')
        exit()
    words.add(s)
    pre = s[-1]
print('Yes')


Measured memory_bytes: 3060
n=int(input())
s=sorted([int(input()) for _ in range(n)])
m=sum(s)
if m%10!=0:
    print(m)
    exit()
for i in range(n):
    k=m
    k-=s[i]
    if k%10!=0:
        print(k)
        exit()
print(0)

Measured memory_bytes: 9148
#include<bits/stdc++.h>
using namespace std;

char S[100010] = {0};

int main()
{
    scanf("%s",S);

    int N = strlen(S);

    for(int i = 0; i < N - 1; i++)
    {
        if(S[i] == 'A' && S[i + 1] == 'C')
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<vector>

using namespace std;
int main(){
    string X, Y;
    cin >> X >> Y;
    if(X > Y){
        cout << ">" << endl;
    }else if(X < Y){
        cout << "<" << endl;
    }else{
        cout << "=" << endl;
    }
    return 0;
}   
          

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N,L;
  cin >> N>>L;
  vector<string> vec(N);
  
  for(int i=0;i<N;i++){
      cin>>vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  
  for(int i=0;i<N;i++){
      cout<<vec.at(i);
  }  
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans = "";
		for(int i = 0; i < s.length(); i++) {
			String temp = s.substring(i, i + 1);
			if(temp.equals("0")) {
				ans += "0";
			} else if(temp.equals("1")) {
				ans += "1";
			} else {
				if(ans.length() > 0) {
					ans = ans.substring(0, ans.length() - 1);
				}
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n=0;
  cin>>n;
  bool ans=false;
  
  if(n%10==7){
    ans=true;
  }
  n/=10;
  if(n%10==7){
    ans=true;
  }
  n/=10;
  if(n%10==7){
    ans=true;
  }
  n/=10;
  
  if(ans){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
}

Measured memory_bytes: 3640
#include "bits/stdc++.h"
using namespace std;
#define REP(i,a) for(int i = 0; i < (a);i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using Graph = vector < vector<int>>;
long int sum[200020] = {};
int main() {
	float A, T;
	int B;
	int sum = 0;
	cin >> A >> B >> T;
	T = T + 0.5;
	float time = A;

	while (time <= T) {
		sum = sum + B;
		time = time + A;
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const int d5 = 114514;
const double EPS = 1e-10;
const double INF = 1e+10;
const double PI = acos(-1.0);
signed main(){
    string res = "";
    int n;
    cin>>n;
    if(n==0){
        cout<<0<<endl;
        return 0;
    }
    while(n!=0){
        int k;
        if(n%2!=0) k = (n-1)/(-2);
        else k=n/(-2);
        char c = n-(-2)*k+'0';
        res+=c;
        n=k;
    }
    reverse(All(res));
    cout<<res<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(ll i=0;i<((ll)n);i++)
#define rep1(i,n) for(ll i=1;i<=((ll)n);i++)
#define mp make_pair
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define F first
#define S second
#define maxn 100005
using namespace std;
typedef pair<long long,long long> pii;
typedef vector<pii> vii;
typedef long long ll;
ll n,m;
vector<int> graph[maxn];
ll visited[maxn];
void dfs(int node)
{
    for(auto i:graph[node])
    {
        if(!visited[i])
        {
            visited[i]=1;
            dfs(i);
        }
    }
}
int main()
{

  IOS;  
  while(cin>>n>>m)
    {
      memset(visited,0,sizeof(visited));
      ll u,v,w;
      rep(i,m)
      {

          cin>>u>>v>>w;
          graph[u].pb(v);
          graph[v].pb(u);
      }
      ll countt=0;
      rep1(i,n)
      {
          if(!visited[i])
          {
              dfs(i);
              countt++;
          }
      }
      cout<<countt<<"\n";
    }

}


Measured memory_bytes: 9600
#include <iostream>
#include <cstdio>
#define int long long
#define N 200002
using namespace std;
const int mod=1000000007;
int n,i,j,a[N],b[N],f[4002][4002],fac[N],inv[N],ans;
int read()
{
	char c=getchar();
	int w=0;
	while(c<'0'||c>'9') c=getchar();
	while(c<='9'&&c>='0'){
		w=w*10+c-'0';
		c=getchar();
	}
	return w;
}
int poww(int a,int b)
{
	int ans=1,base=a;
	while(b){
		if(b&1) ans=ans*base%mod;
		base=base*base%mod;
		b>>=1;
	}
	return ans;
}
int C(int n,int m)
{
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
signed main()
{
	fac[0]=1;
	for(i=1;i<=8000;i++) fac[i]=fac[i-1]*i%mod;
	inv[8000]=poww(fac[8000],mod-2);
	for(i=7999;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
	n=read();
	for(i=1;i<=n;i++){
		a[i]=read(),b[i]=read();
		f[2000-a[i]][2000-b[i]]++;
	}
	for(i=0;i<=4000;i++){
		for(j=0;j<=4000;j++) f[i][j]=(f[i][j]+f[i-1][j]+f[i][j-1])%mod;
	}
	for(i=1;i<=n;i++){
		ans=(ans+f[a[i]+2000][b[i]+2000])%mod;
		ans=(ans-C(2*(a[i]+b[i]),2*a[i])+mod)%mod;
	}
	ans=ans*poww(2,mod-2)%mod;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 129664
#include<bits/stdc++.h>

using namespace std;

int main(void)
{
    int N, M;
    cin >> N >> M;
    vector<int> L(M);
    vector<int> R(M);

    for(int i = 0; i < M; i++){
        cin >> L[i] >> R[i];
    }

    sort(L.begin(), L.end());
    sort(R.begin(), R.end());
    
    int ans = R[0] - L[M-1] + 1;
    if(ans < 0 ){
        ans = 0;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;

int main(){
    int x,y;
    cin >> x >> y;
    vector<int> group={0,1,3,1,2,1,2,1,1,2,1,2,1};
    if(group.at(x)==group.at(y)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll, ll> Pll;
typedef pair<int, Pii > P1;

#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define mp1(a,b,c) P1(a,P(b,c))
#define get_arsize(a) (sizeof(a)/sizeof(a[0]))

const ll MOD = 1000000007;
const double EPS = 1e-10;
const int MAX = 200000;

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n, 0);
  rep(i, n) {
    cin >> a[i];
    a[i]--;
  }
  ll state = 0;
  ll counter = 0;
  ll sho = -1;
  vector<ll> b(n, -1);
  b[0] = 0;
  while(true) {
    state = a[state];
    if (b[state] != -1) {
      sho = counter - b[state] + 1;
      break;
    }
    counter++;
    b[state] = counter;
    if (counter == k) {
      cout << state + 1 << endl;
      return 0;
    }
  }
  k = (k - counter - 1) % sho;
  rep(i,k) {
    state = a[state];
  }
  cout << state + 1 << endl;
  return 0;
}


Measured memory_bytes: 6376
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//ABC118C
int compare_int(const void *a, const void *b) { //sort
  return *(int*) a-*(int*) b;
}
int main(void) {
  int a, b, n, k, i, cou=0, tmp;
  scanf("%d %d", &n, &b);

  for(i=1; i<n; i++){
    scanf(" %d", &a);
    if(a<b) tmp=a, a=b, b=tmp; //ユークリッドの互除法//gcd(a,b)=>b
    while(a%b!=0){
      a=a%b;
      if(a<b) tmp=a, a=b, b=tmp; //swap
    }
    if(b==1)break;
  }
  printf("%d",b);
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

int main(){
  int n, k, r, s, p;
  string t;
  cin >> n >> k >> r >> s >> p >> t;
  map<char, int> score;
  score['r'] = p;
  score['s'] = r;
  score['p'] = s;

  int ans = 0;
  vector<bool> used(n, false);
  for(int i = 0; i < n; ++i){
  	if(i - k >= 0){
  		if(t[i] == t[i - k] && used[i - k])continue;
  	}
  	ans += score[t[i]];
  	used[i] = true;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>

#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;
typedef long double ld;

const int max_n = 100111, inf = 1000111222;
ll mod = 1000000007;

ll powm(ll a, ll b) {
    if (b == 0) return 1;
    if (b % 2 == 0) {
        return powm((a * a) % mod, b / 2);
    } else {
        return (a * powm(a, b - 1)) % mod;
    }
}

ll dp[max_n];

int dumb(int L) {
    int ans = 0;
    for (int a = 0; a <= L; ++a) {
        for (int b = 0; b <= L; ++b) {
            if ((a ^ b) == a + b && (a + b <= L)) {
                ++ans;
            }
        }
    }
    return ans;
}

int strtoi(string s) {
    int res = 0;
    int p2 = 1;
    for (char c : s) {
        res += (c - '0') * p2;
        p2 *= 2;
    }
    return res;
}

int main()
{
    //freopen("input.txt", "r", stdin);
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '1') {
            dp[i] += powm(3, i);
            if (i) {
                dp[i] += (2 * dp[i - 1]) % mod;
            } else {
                dp[i] += (2 * 1) % mod;
            }
            dp[i] %= mod;
        } else {
            if (i) {
                dp[i] = dp[i - 1];
            } else {
                dp[i] = 1;
            }
        }
    }
    cout << dp[s.size() - 1] << endl;
    return 0;
}




Measured memory_bytes: 1280
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n ==1) {
			System.out.println(0);
			return;
		}
		int answer = 0;
		int tmpAnswer = 0;
		int left = sc.nextInt();
		int right = 0;
		for(int i =1; i <n;i++) {
			right = sc.nextInt();
			if(left >= right) {
				tmpAnswer++;
			}else {
				if(answer < tmpAnswer) {
					answer = tmpAnswer;
				}
				tmpAnswer =0;
			}
			left = right;
			if(i == n-1) {
				if(answer < tmpAnswer) {
					answer = tmpAnswer;
				}
			}
		}
		System.out.println(answer);
	}
}

Measured memory_bytes: 48408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e9;

int main() {
    int N; cin >> N;
    vector<int> V(N), D(N+1); for(int i = 0; i < N; i++) cin >> V[i];
    D[0] = abs(V[0]);
    for(int i = 1; i < N; i++) D[i] = abs(V[i]- V[i-1]);
    D[N] = abs(V[N-1]);
    ll SUM = 0; for(int i = 0; i <= N; i++) SUM += D[i];
    for(int i = 0; i < N; i++){
        ll tmp, tmp_;
        if(i == 0) tmp = 0;
        else tmp = V[i-1];
        if(i == N-1) tmp_ = 0;
        else tmp_ = V[i+1];
        if (tmp < V[i] && V[i] < tmp_) cout << SUM << endl;
        else if(tmp > V[i] && V[i] > tmp_) cout << SUM << endl;
        else{
            cout << SUM - 2*min(abs(tmp-V[i]), abs(tmp_-V[i])) << endl;
        }
    }
}

Measured memory_bytes: 2048
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static uint64_t gcd(uint64_t m, uint64_t n)
{
	uint64_t temp;

	while (m%n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}

	return n;
}

int main(void) {
	int64_t N, T, A;
	int64_t H[1000];

	double diffMin = (double)UINT32_MAX;
	size_t diffMinIdx = (size_t)UINT32_MAX;

	scanf("%"PRId64"\n%"PRId64" %"PRId64"\n", &N, &T, &A);
	for (int64_t idx = 0; idx < N; idx++) {
		scanf("%"PRId64, &H[idx]);
		if (idx < N - 1) {
			scanf(" ");
		}

		const double abss = ABSS((double)A, (double)T - (double)(H[idx]) * 0.006f);
		if (abss < diffMin) {
			diffMin = abss;
			diffMinIdx = (size_t)idx;
		}
	}

	printf("%zu\n", diffMinIdx + 1);

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define mkp make_pair
#define fi first
#define se second
void read(int &x){
	char ch=getchar();x=0;
	for (;ch==' '||ch=='\n';ch=getchar());
	for (;ch!=' '&&ch!='\n';x=x*10+ch-'0',ch=getchar());
}
void readi(ll &x){
	char ch=getchar();x=0;
	for (;ch==' '||ch=='\n';ch=getchar());
	for (;ch!=' '&&ch!='\n';x=x*10+ch-'0',ch=getchar());
}
void write(ll x){
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
bool cmp(pii A,pii B){
	return 1ll*B.fi*(A.se+1)<1ll*A.fi*(B.se+1);
}
int n,cnt,cntd;
int ans;
ll dp[40],T;
pii a[200004];
int d[200004];
int main(){
	read(n),readi(T);
	for (int i=1;i<=n;i++){
		read(a[++cnt].fi),read(a[cnt].se);
		if (a[cnt].fi==0)d[++cntd]=a[cnt].se,cnt--; 
	}
	sort (a+1,a+1+cnt,cmp);
	sort (d+1,d+1+cntd);
	for (int i=0;i<40;i++) dp[i]=T+1;
	dp[0]=0;
	for (int i=1;i<=cnt;i++)
		for (int j=39;j>=1;j--)if (dp[j-1]<T+1)
			dp[j]=min(dp[j],dp[j-1]+1+(dp[j-1]+1)*a[i].fi+a[i].se);
	if (cntd==0){
		for (int i=39;i>=0;i--) if (dp[i]!=T+1){
			write(i);return 0;
		}
	}
	for (int i=0;i<40;i++){
		if (dp[i]==T+1) break;
		int more_=1;dp[i]+=1+d[1];
		while (more_<=cntd && dp[i]<=T)
			more_++,dp[i]+=1+d[more_];
		ans=max(ans,i+more_-1);
	}
	write(ans);
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() { 
  int n,k,r,s,p;string t; 
  cin >> n >> k >> r >> s >> p >> t;
  auto f = [&](int i, char c){ 
    if(t[i]=='r'&&c=='p') return p;
    else if(t[i]=='s'&&c=='r') return r;
    else if(t[i]=='p'&&c=='s') return s;
    else return 0;
  };
  ll ans = 0;
  rep(ki,k){
    vector<int> vr(n/k+1),vs(n/k+1),vp(n/k+1);
    vr[0] = f(ki,'r');
    vs[0] = f(ki,'s');
    vp[0] = f(ki,'p');
    int I = 0;
    for(int i = ki+k; i < n; i += k) {
      int ii = i/k;
      vr[ii] = max(vs[ii-1],vp[ii-1])+f(i,'r');
      vs[ii] = max(vr[ii-1],vp[ii-1])+f(i,'s');
      vp[ii] = max(vr[ii-1],vs[ii-1])+f(i,'p');
      ++I;
    }
    ans += max(vr[I],max(vs[I],vp[I]));
  }
  cout << ans << endl;
}

Measured memory_bytes: 1600
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

#define min(a, b) ( (a) < (b) ? (a) : (b) )
#define max(a, b) ( (a) > (b) ? (a) : (b) )
#define sz(x) (int)((x).size())
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define Repeat_Forever for (;;)
#define FOR(i, a, n, step) for (int (i) = (a); (i) < (n); (i) += (step))
#define FOREACH(it, v) for (auto (it) : (v))
#define ENDL cout << "\n"

using namespace std;

typedef unsigned long long ull;
typedef long long ll ;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector<ll> vll;

template <class T>
const bool is_impar(T x) {return (bool) (x & 1);}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    if (s.size() == 3)
        reverse(s.begin(), s.end());
    cout << s;

}


Measured memory_bytes: 384
N = int(input())
array = list(map(int,input().split()))
array.sort(reverse=True)
array2 = []
tmp = array[0]
for i in range(1,N):
    if tmp == array[i]:
        array2.append(array[i])
    tmp = array[i]
if len(array2) >= 1 and array2.count(max(array2)) >= 4:
    print(max(array2)**2)
    exit()
array3 = list(set(array2))
array3.sort(reverse=True)
if 2 <= len(array3):
    print(array3[0]*array3[1])
else:
    print(0)

Measured memory_bytes: 14244
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const double EPS = 1e-9;
typedef vector<ll> vecl;
typedef pair<ll, ll> pairl;

template<typename T, typename U>
using mapv = map<T,vector<U>>;

#define ALL(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

#define MOD097 1000000007

///// For Debug

#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

// 提出時はコメントアウト
// #define LOCAL
#define DEBUG_

#ifndef LOCAL
#undef DEBUG_
#endif

#ifdef DEBUG_

#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)

#endif

//////////

int main() {
    #ifdef LOCAL
    ifstream in("../../Atcoder/input.txt");
    cin.rdbuf(in.rdbuf());
    #endif

    ll K;
    string S;
    cin>>K>>S;

    if (S.length() <= K) {
        cout << S << endl;
        return 0;
    }

    
    cout << S.substr(0,K) + "..." << endl;
    return 0;
}


Measured memory_bytes: 3604
#!/usr/bin/env python3
import sys
from collections import Counter
INF = float("inf")


def yes():
    print("Yes")  # type: str


def no():
    print("No")  # type: str


def solve(N: int, K: int, Q: int, A: "List[int]"):
    c = Counter(A)
    for i in range(1, N+1):
        if K-(Q-c[i]) > 0:
            yes()
        else:
            no()
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(Q)]  # type: "List[int]"
    solve(N, K, Q, A)


if __name__ == '__main__':
    main()


Measured memory_bytes: 11908
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

int main() {
	
	int n;
	cin >> n;
	vector<ll> a(n+1), b(n);
	for (int i = 0; i < n+1; i++)
	{
		cin >> a[i];
	}
	for (int i = 0; i < n; i++)
	{
		cin >> b[i];
	}
	ll cnt = 0;
	for (int i = 0; i < n; i++)
	{
		if (a[i] < b[i]) {
            // iを全滅させる
			cnt += a[i];
			b[i] -= a[i];
			a[i] = 0;
			if (a[i + 1] < b[i]) {
				cnt += a[i + 1];
				b[i] -= a[i + 1];
				a[i + 1] = 0;
			}
			else {
				cnt += b[i];
				a[i + 1] -= b[i];
				b[i] = 0;
			}
		}
		else {
			cnt += b[i];
			a[i] -= b[i];
			b[i] = 0;
		}
	}
	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------

int N;

void _main() {
	cin >> N;
	int ans = 1;
	///111 211

	rep(i, 0, N-1) {
		rep(j, 0, N) {
			rep(k, 0, N) {
				ans++;
			}
		}
	}

	rep(j, 0, N - 1) {
		rep(k, 0, N) ans++;
	}

	rep(k, 0, N-1) ans++;


	cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
int INF=1000000000;
int cnt=0;
void merge(int x[],int left,int mid,int right){
  int n1,n2;
  n1=mid-left;
  n2=right-mid;
  int L[n1+1];
  int R[n2+1];
  for(int i=0;i<n1;i++){
    L[i]=x[left+i];
  }
  for(int i=0;i<n2;i++){
    R[i]=x[mid+i];
  }
  L[n1]=R[n2]=INF;
  int i=0,j=0;
  for(int k=left;k<right;k++){
    if(L[i]<=R[j]){
      x[k]=L[i];
      i++;
      cnt++;
    }else{
      x[k]=R[j];
      j++;
      cnt++;
    }
  }
}

void mergeSort(int x[],int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(x,left,mid);
    mergeSort(x,mid,right);
    merge(x,left,mid,right);
  }
}

int main(){
  int n;
  std::cin>>n;
  int x[n];
  for(int i=0;i<n;i++){
    std::cin>>x[i];
  }
  int left=0;
  int right=n;
  mergeSort(x,left,right);
  for(int i=0;i<n-1;i++){
    std::cout<<x[i]<<" ";
  }
  std::cout<<x[n-1]<<"\n";
  std::cout<<cnt<<"\n";
}



Measured memory_bytes: 6960
S,T=[q=0,0].map{[q,*gets.chars.map{|c|q-=~c.count(?A)}]};$<.map{|l|a,b,c,d=l.split.map &:to_i;d&&puts((S[b]-S[a-1]-T[d]+T[c-1])%3<1?:YES: :NO)}

Measured memory_bytes: 23628
list = %w(dream dreamer erase eraser).map{_1.reverse}
s = gets.chomp.reverse
until s.empty?
  is_match = false
  list.each do |word|
    if s.start_with?(word)
      s.delete_prefix!(word)
      is_match = true
    end
  end
  if is_match
    next
  end
  puts 'NO'
  exit
end
puts 'YES'

Measured memory_bytes: 107496
#include <iostream>
#include <vector>
using namespace std;
class UnionFind {
    public:
        vector<int> Parent;

        UnionFind(int N) {
            Parent = vector<int>(N, -1);
        }

        int getRoot(int X) {
            if(Parent[X] < 0) return X;
            else return Parent[X] = getRoot(Parent[X]);
        }

        int getSize(int X) {
            return -Parent[getRoot(X)];
        }

        bool merge(int X, int Y) {
            X = getRoot(X);
            Y = getRoot(Y);
            if(X == Y) return false;
            if(getSize(X) < getSize(Y)) swap(X, Y);

            Parent[X] += Parent[Y];
            Parent[Y] = X;

            return true;
        }
};
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin >> n >> m;
    UnionFind uni(n);
    vector<int> a(m), b(m);
    for(int i = 0; i < m; ++i){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }
    vector<long long> ans(m);
    ans[m-1] = (long long) n*(n-1)/2;
    for(int i = m-1; i >=1; --i){
        ans[i-1] = ans[i];
        if(uni.getRoot(a[i]) != uni.getRoot(b[i])){
            ans[i-1] -= (long long) uni.getSize(a[i])*uni.getSize(b[i]);
            uni.merge(a[i], b[i]);
        }
    }
    
    for(int i = 0; i < m; ++i){
        cout << ans[i] << endl;
    }
    return 0;
}
//Saw the solution video
//写経

Measured memory_bytes: 5272
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

bool ishamming(int n) {
	if(n == 1) return true;
	if(n % 2 == 0) return ishamming(n / 2);
	if(n % 3 == 0) return ishamming(n / 3);
	if(n % 5 == 0) return ishamming(n / 5);
	return false;
}

int main(void) {
#if 0
	int n;
	scanf("%d", &n);
	printf("%d\n", ishamming(n));
#endif

#if 1
	int m,n;
	for(;scanf("%d", &m), m;) {
		int cnt = 0;
		int i;
		scanf("%d", &n);
		for(i = m; i <= n; i++)
			if(ishamming(i)) cnt++;
		printf("%d\n", cnt);
	}
#endif

	return 0;
}

Measured memory_bytes: 0
S = input()
T = input()
s = len(S)
t = len(T)
A = []

for i in range(s-t+1):
  if all(S[i+j]==T[j] or S[i+j]=="?" for j in range(t)):
    A.append(S[:i]+T+S[i+t:])

A = [a.replace("?","a") for a in A]

if len(A)==0:
  print("UNRESTORABLE")
else:
  print(min(A))

Measured memory_bytes: 8892
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N,L,Q;
  cin>>N;
  vector<ll> A(N);
  cin>>A;
  cin>>L>>Q;
  vector<vector<int>> idx(N);
  int mx=0;
  for(int i=0;i<N;i++){
    while(mx<N && A[mx]-A[i]<=L){mx++;}
    idx[i].push_back(mx-1);
  }
  for(int i=2;i<=N;i<<=1){
    for(int j=0;j<N;j++){
      int bk=idx[j].back();
      int bk2=idx[bk].back();
      idx[j].push_back(bk2);
    }
  }
  // for(auto &I:idx){cout<<I<<endl;}
  mx=idx[0].size();
  for(int i=0;i<Q;i++){
    ll A,B;
    cin>>A>>B;
    A--; B--;
    if(A>B){swap(A,B);}
    ll ans=0;
    for(int j=mx-1;j>=0;j--){
      if(idx[A][j]>=B){continue;}
      A=idx[A][j];
      ans+=1<<j;
    }
    ans++;
    cout<<ans<<endl;
  }
  


  return 0;
}


Measured memory_bytes: 19968
#define _USE_MATH_DEFINES
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<set>
#include<vector>
#include<queue>

#define LLD long long int
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))
 


using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const long long int INF=1001001001001001001;
int N,M,K,S;
////////
int P,Q;
bool C[100002];
///////
const int MAX_V=100002;
struct edge{ 
	int to,cost;
};
vector<edge> edges[MAX_V];//V??????????????????
LLD d[MAX_V];//???????????????????????¢


void dijkstra(int s){//?§????s??????????????????????????????????±???????
	priority_queue< pair<LLD,int> , vector< pair<LLD,int> > , greater<pair<LLD,int> > > que;
	memset(d,INF,sizeof(d) );//fill(d,d+V,INF);
	d[s]=0;
	que.push(make_pair(0,s) );

	while(!que.empty() ){
		pair<LLD,int> p=que.top(); que.pop();
		int v=p.sc;
		int cst=0;////cst->e.cost
		if( d[v] < p.first ) continue;
		if(v!=s){
			if(C[v])cst=Q;
			else cst=P;
		}////special
		rep(i,edges[v].size()){
			edge e=edges[v][i];
			if(d[e.to] > d[v]+cst){
				d[e.to]=d[v] + cst;
				que.push( make_pair(d[e.to], e.to ) );
			}
		}
	}
}


vector<int> Ks;
int main(){
	//FILE *f;
	//f=fopen("C:\\Users\\Ray\\Desktop\\JOI?????????\\0623-in4.txt","r");
	scanf("%d %d %d %d",&N,&M,&K,&S);
	fill(C,C+N,false);
	
	scanf("%d %d",&P,&Q);

	queue< pair<int,int> > kiken;
	rep(i,K){
		int k;
		scanf("%d",&k);
		k--;
		Ks.pb(k);
		kiken.push( mp(k,S) );
	}

	rep(i,M){
		int a,b;
		scanf("%d %d",&a,&b);
		a--;b--;
		edge e;
		e.to=b;e.cost=0;
		edges[a].pb(e);
		e.to=a;e.cost=0;
		edges[b].pb(e);
	}
	//??±?????????
	while(kiken.size()){
		pair<int,int> p=kiken.front();kiken.pop();
		if(C[p.fr])continue;
		C[p.fr]=true;
		if(p.sc==0)continue;
		rep(i,edges[p.fr].size() ){
			kiken.push( mp(edges[p.fr][i].to,p.sc-1) );
		}
	}
	rep(i,K){
		if(edges[Ks[i]].size())edges[Ks[i]].clear();
	}

	//dijkstra
	dijkstra(0);
	printf("%lld\n",d[N-1]);
}

Measured memory_bytes: 12520
#include <iostream>

using namespace std;

int main() {
	int n, k;
	char s[51];

	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}

	s[k-1] += 32;

	for (int i = 0; i < n; i++) {
		cout << s[i];
	}


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#define r(i, n) for(int i = 0; i < n; i++)
#define ri(i, from, n) for(int i = from; i < n; i++)
#define MODULO 1000000007

int main () {
    int row, col;
    cin >> row >> col;

    string grid[row];
    int dp[row][col];
    
    r(i, row) cin >> grid[i];
    r(i, row) r(j, col) if(grid[i][j] == '#') dp[i][j] = 0;
    
    // UNIT TEST START
    // cout << grid[1] << endl;
    // UNIT TEST END

    int i = 0, j = 0;

    // First row fill
    for(i = 0; i < col; i++) {
        if(grid[0][i] == '#') {
            while(i < col) dp[0][i++] = 0;
        } else {
            dp[0][i] = 1;
        }
    }
    // First column fill
    for(i = 0; i < row; i++) {
        if(grid[i][0] == '#') {
            while(i < row) dp[i++][0] = 0;
        } else {
            dp[i][0] = 1;
        }
    }

    for(i = 1; i < row; i++) { 
        for(j = 1; j < col; j++) {
            if(grid[i][j] == '#') {
                dp[i][j] = 0;
            } else {
                dp[i][j] = (dp[i - 1][j] % MODULO + dp[i][j - 1] % MODULO) % MODULO;
            } 
        }
    }
    // r(i, row) {
    //     r(j, col) cout << dp[i][j] << " "; cout << endl;
    // }

    cout << dp[row - 1][col - 1] << endl;
    
    return 0;
}


Measured memory_bytes: 8580
#include <cstdio>

int main()
{
	int S, h, m, s;

	scanf(" %d", &S);

	h = S / 3600;
	S %= 3600;
	m = S / 60;
	s = S % 60;

	printf("%d:%d:%d\n", h, m, s);
	return 0;
}

Measured memory_bytes: 1020
#pragma GCC optimize("O3")

#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define sz size
#define f first
#define s second

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    vector<int> arr(n);
    F0R(i,n)
        cin >> arr[i];
    arr[0]--;
    FOR(i,1,n)
    {
        if(arr[i]-1>=arr[i-1])
            arr[i]--;
    }
    FOR(i,1,n)
    {
        // cout << arr[i] << " ";
        if(arr[i]<arr[i-1])
        {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";

    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
int main(void){
	int n,i,j,k,a[1000],t,f=0,max=-1;
	char tmp[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++){
		for(j=i+1;j<n;j++){
			f=1;
			t=a[i]*a[j];
			sprintf(tmp,"%d",t);
			for(k=1;tmp[k];k++){
				if(tmp[k]-tmp[k-1]!=1){
					f=0;
					break;
				}
			}
			if(f&&max<t){
				max=t;
			}
		}
	}
	printf("%d\n",max);
	return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
#define int long long int
#define ld long double
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define MAXN 200005
#define MOD2 998244353
#define MOD1 1e9+7
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define piii pair<pii,int>
#define precise(i) cout<<fixed<<setprecision(i)
#define codejam cout<<"Case #"<<ii+1<<": ";
#define impossible cout<<"IMPOSSIBLE"<<endl;
#define error(s) throw runtime_error(s)
using namespace std;
const long double PI = atan(1.0)*4;
const int64_t INF=8e18;
const int32_t LOG=21;
const int MOD=MOD2;


vector<int> v[100005];
int32_t main()
{ 
      getFaster;
      int tests=1;
      //cin>>tests;
      rep(ii,0,tests)
      {
         int n,m;
         cin>>n>>m;
         int h[n+1];
         rep(i,1,n+1)cin>>h[i];
         rep(i,0,m)
         {
             int x,y;
             cin>>x>>y;
             v[x].push_back(y);
             v[y].push_back(x);

         }
         int cnt=0;
         rep(i,1,n+1)
         {
              bool g=true;
              rep(j,0,v[i].size())
              {
                 if(h[v[i][j]]>=h[i])
                 {
                    g=false;
                    break;
                 }   
              }
              cnt+=g;
         }
         cout<<cnt<<endl;
      }

      return 0;                         
}

/*
 TIPS:
 1.) Check for corner cases (like 0 is exception case)
 2.) Check for global memory sizes,memory refreshments and its complexity 
 3.) Check for sorting criteria (if used 1-based indexing)
 4.) Check for numbers overflow (while multiplying and doing MOD)
 5.) Check for typecasting issues like int to float( while dividing numbers)
*/

Measured memory_bytes: 10260
#include <bits/stdc++.h>

using namespace std;

using ll = int64_t;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

//===


int ans[510][510];

int main()
{
	int N, M, Q;
	scanf("%d %d %d", &N, &M, &Q);

	memset(ans, 0, sizeof(ans));
	for (int i = 0; i < M; ++i) {
		int L, R;
		scanf("%d %d", &L, &R);
		--L; --R;
		++ans[0][R];
		--ans[L + 1][R];
		--ans[0][N];
		++ans[L + 1][N];
	}
	for (int i = 0; i < N; ++i) {
		for (int j = i; j < N; ++j) {
			ans[i + 1][j] += ans[i][j];
		}
	}
	for (int i = 0; i < N; ++i) {
		for (int j = i; j < N; ++j) {
			ans[i][j + 1] += ans[i][j];
		}
	}

	for (int i = 0; i < Q; ++i) {
		int L, R;
		scanf("%d %d", &L, &R);
		--L; --R;
		printf("%d\n", ans[L][R]);
	}

	return 0;
}

Measured memory_bytes: 1920
#include <stdio.h>
#include <string.h>
int main(void){
    int n,l,i,j;
    char word[101][101],tmp[101];
    scanf("%d %d",&n,&l);
    for(i=0;i<n;i++)
        scanf("%s",word[i]);
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            if(strcmp(word[i],word[j])>0){
                strcpy(tmp,word[i]);
                strcpy(word[i],word[j]);
                strcpy(word[j],tmp);
            }
        }
    }
    for(i=0;i<n;i++){
        printf("%s",word[i]);
    }
    printf("\n");
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ll long long
using namespace std;

int main() {
  int n,m; cin>>n>>m;
  vector<vector<char>> A(n, vector<char>(n));
  vector<vector<char>> B(m, vector<char>(m));
  rep(i, n) rep(j, n) cin>>A[i][j];
  rep(i, m) rep(j, m) cin>>B[i][j];

  bool ans=false;
  rep(lx, n) {
    rep(ly, n) {
      if(ly+m-1>=n||lx+m-1>=n) continue;
      bool tmp=true;
      rep(x, m) {
        rep(y, m) {
          if(A[lx+x][ly+y]!=B[x][y]) tmp=false;
        }
      }
      if(tmp) ans=true;
    }
  }
  if(ans) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
//by Top1
#include <bits/stdc++.h>
     
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
 
const int inf = (1e9) + 1;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 111;
     
using namespace std;

int n, q, a[maxn], dp[maxn], k, mn = inf;
                           
void solve(){
	cin >> n >> k;

    for (int i = 1; i <= n; i++){
    	cin >> a[i];
    	mn = min(mn, a[i]);
    }

    sort(a + 1, a + n + 1);

   	for (int i = mn; i <= k; i++){
   		for (int j = 1; j <= n; j++){
   			if (i - a[j] >= 0){
   				if (dp[i - a[j]] == 0)
   					dp[i] = 1;
   			}
   			else
   				break;
   		}
   	}

   	if (dp[k] == 1)
   		cout << "First";
   	else
   		cout << "Second";
}

main(){
    boost;
	    
	q = 1;

	while (q--){
		solve();
	}
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 1e18
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const double PI = acos(-1.0);
const double EPS = 1e-10;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    map<int,int> mp;
    string ans = "No";
    REP(i,n){
        int a;cin>>a;
        mp[a]++;
    }
    if(n%3!=0){
        if(mp.size()==1){
            for(auto x:mp) if(x.first==0) ans = "Yes";
        }
    }
    else{
        if(mp.size()==3){
            int Xor = 0;
            for(auto x:mp){
                Xor ^= x.first;
                if(3*x.second!=n){
                    ans = "No";
                    break;
                }
            }
            if(Xor==0) ans = "Yes";
        }
        else if(mp.size()==2){
            int zero=0,num=0;
            for(auto x:mp){
                if(x.first==0) zero=x.second;
                else num = x.second;
            }
            if(3*zero==n && 3*num == 2*n) ans = "Yes";
        }
        else if(mp.size()==1){
            for(auto x:mp) if(x.first==0) ans = "Yes";
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3840