akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)


signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    int e[12];
    rep(i, 12)scanf("%d", e+i);
    sort(e, e + 12);
    bool is = true;
    rep(i, 3)is = is && (e[i * 4 + 0] == e[i * 4 + 1]) && (e[i * 4 + 0] == e[i * 4 + 2]) && (e[i * 4 + 0] == e[i * 4 + 3]);
    puts(is ? "yes" : "no");


/*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 3208
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        s: String,
    };
    let mut c_vec: Vec<char> = s.chars().collect();
    if *c_vec.last().unwrap() != 's' {
        c_vec.push('s');
    } else {
        c_vec.append(&mut vec!['e', 's']);
    }
    println!("{}", c_vec.iter().collect::<String>());
}


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


int main()
{
	int n;
	int cnt = 0;
	cin>> n;
	vector<int> s(n);
	for(int i=0;i<n;i++){
		cin>>s[i];
	}
	int q;
	cin>>q;
	vector<int> t(q);
	for(int i=0;i<q;i++){
		cin>>t[i];
	}
	for(int i=0;i<q;i++){
		int a, b;
		int low=0, high=n-1;
		while(low<=high){
			int mid = (low+high)/2;
			if(s[mid] == t[i]){
				cnt++;
				break;
			}else if(t[i] < s[mid]){
				high = mid - 1;
			}else if(s[mid] < t[i]){
				low = mid + 1;
			}
		}
		
	}
	cout<<cnt<<endl;
}



Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
struct P
{
    //string r;
    int x,y;

    bool operator<(const P &a)const{
       // if(y!=a.y)
       // return y>a.y;
       return x>a.x;
//        return z>a.z;
    }
};
struct S
{
    //double a;
    int x,y;
};
vector<int> v[33110];

int a,b,c,i,k,d,n,m,e,dy[15]={0,1,0,-1,-1,1,-1,1},dx[15]={1,0,-1,0,1,1,-1,-1};
int l[218111];
int o[212000];
//int dx[10]={1,0,1,-1,-1,0},dy[10]={0,1,1,1,-1,-1};

long long x,y,z[555];
P u[1222];
int j[2];
//priority_queue<int,vector<int>,greater<int> > q,q1;
stack<int> s,s1;
queue<int> q;

//deque<int> de;
//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
map<int,int > p;
string r,r1;
//char r[10010];

bool as(P a,P b)
{

    return a.x<b.x;
}



int main()
{
    scanf("%lld %lld",&x,&y);
    for(;x<=y;x<<=1,i++);
    printf("%d",i);
}


Measured memory_bytes: 1024
n,m = gets.split.map(&:to_i)

s = []
m.times do 
    _,*y = gets.split.map(&:to_i)
    s << y
end

pp = gets.split.map(&:to_i)

ans = 0
(2 ** n).times do |i|
    bs = "%0#{n}b" % i
    
    k = true
    m.times do |j|
        count = 0
        s[j].each{|e| count += 1 if bs[e-1] == "1"}
        if count % 2 != pp[j]
            k = false
            break
        end
    end

    ans += 1 if k
end

puts ans

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li lim = 10000000ll;

int main() {
    li k;
    cin >> k;
    li res = 0;
    li now = 0;
    while (res < lim) {
        res++;
        now += 7;
        now %= k;
        if (now == 0) {
            cout << res << endl;
            return 0;
        }
        now = (now * 10) % k;
    }
    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
typedef pair<int, int> P;

int main(){
    int n;
    while(cin >> n && n > 0){
        if(n == 1){
            cout << 0 << endl;
            continue;
        }
        if(n == 2) {
            int p1, t1, p2, t2;
            cin >> p1 >> t1 >> p2 >> t2;
            cout << abs(p1 - p2) << endl;
            continue;
        }
        vector<int> p1;
        vector<int> p2;
        p2.reserve(n * n);
        vector<P> pv;
        REP(i, n) {
            int p, t;
            cin >> p >> t;
            if(t == 1){
                p1.push_back(p);
            }else{
                pv.push_back(P(p, t));
            }
        }

        sort(pv.begin(), pv.end());
        REP(i, pv.size() - 1) pv[i].second --;
        REP(i, pv.size() - 1) pv[i + 1].second --;
        REP(i, pv.size()){
            REP(_, pv[i].second){
                p2.push_back(pv[i].first);
            }
        }

        int n1 = p1.size();
        int n2 = p2.size();

        if(n1 > n2) {
            cout << -1 << endl;
            continue;
        }

        sort(p1.begin(), p1.end());
        sort(p2.begin(), p2.end());

        long long ans = *max_element(p2.begin(), p2.end()) - *min_element(p2.begin(), p2.end());
        // cout << ans << endl;
        // cout << "p1 : "; REP(i, p1.size()) cout << p1[i] << " "; cout << endl;
        // cout << "p2 : "; REP(i, p2.size()) cout << p2[i] << " "; cout << endl;

        long long dp[2][10000] = {};
        long long* cur = dp[0];
        long long* next = dp[1];
        int last_base2 = -1;

        for(int i1 = 0; i1 < n1; i1++){
            fill(next, next + 2 * n1, LLONG_MAX);

            int base2 = lower_bound(p2.begin(), p2.end(), p1[i1]) - p2.begin();

            for(int di = 0; di < 2 * n1; di++){
                int i2 = di - n1 + base2;
                if(i2 < 0) continue;
                if(i2 >= n2) break;

                if(i1 == 0) {
                    next[di] = abs(p1[i1] - p2[i2]);
                    continue;
                }

                int lastdi = di + (base2 - last_base2) - 1;
                if(lastdi < 0) continue;

                long long last = (lastdi < 2 * n1 ? cur[lastdi] : cur[2 * n1 - 1]);
                if(last == LLONG_MAX) continue;

                next[di] = last + abs(p1[i1] - p2[i2]);
                // printf("i1 = %d i2 = %d di = %d base = %d lastdi = %d last = %lld next[%d] <- %lld + %lld = %lld\n", i1, i2, di, base2, lastdi, last, di, last, abs(p1[i1] - p2[i2]), next[di]);
            }

            for(int j = 1; j < 2 * n1; j++){
                next[j] = min(next[j], next[j - 1]);
            }

            last_base2 = base2;
            swap(cur, next);
        }

        cout << ans + (n1 != 0 ? cur[2 * n1 - 1] : 0) << endl;
    }

    return 0;
}

Measured memory_bytes: 65944
//median time 40

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init,t) for (ll i = init; i < (n); i+=(t))
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)

int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N * 3);
    repi(i, 3 * N, 0,1)
    {
        cin >> A[i];
    }
    ll sum = 0;
    sort(all(A));
    repi(i, 3 * N, N,2)
    {
        sum += A.at(i);
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9;
const ll mod = 1e9+7;
typedef pair<int,int> P;
#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,m,N) for(int i=m;i<N;i++)
#define mm(n,m) memset(n,m,sizeof(n))

int main(){
  ll x;
  cin>>x;
  // int l[6];
  // rep(i,6){
  //   l[i] = 100+i;
  // }
  // int can[1000];
  // mm(can,0);
  // for (int i=0; i<(pow(2,6)); i++) {
  //   for (int j=0; j<6; j++) {
  //     if ((1&i>>j) == 1) {can[i] += l[j];}
  //   }
  // }
  // sort(can,can+1000);
  // rep(i,1000){
  //   if(can[i]==0)continue;
  //   cout<<can[i]<<endl;
  // }
  // rep(i,1000){
  //   if(can[i]==0)continue;
  //   if(x%can[i]==0){
  //     cout<<1<<endl;
  //     return 0;
  //   }
  // }
  // cout<<0<<endl;

  int a = (x/100) * 5;
  if((x%100)<=a){
    cout<<1<<endl;
  }else{
    cout<<0<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define dbg(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)

using namespace std;

int main() {
//    freopen("a.inp", "r", stdin);
    long long x, y;
    cin >> x >> y;
    int xx = abs(x), yy = abs(y);
//    dbg(xx);
//    dbg(yy);
    if (xx > yy) xx = -xx, yy = -yy;
    int ans = 0;
    if (xx != x) ++ans;
    if (yy != y) ++ans;
//    dbg(ans);
//    dbg(abs(abs(x)-abs(y)));
    cout << ans + abs(abs(x)-abs(y));
    return 0;
}

Measured memory_bytes: 256
from sys import stdin


def main():
    N = int(stdin.readline().rstrip())
    a = [int(x) for x in stdin.readline().rstrip().split()]
    count = 0
    for x in a:
        while x % 2 == 0:
            count += 1
            x = x // 2
    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4148
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;
int main() {
  int X;
  cin >> X;
  if (X % 2 && X % 8 - 1) {
	  cout << "YES" << endl;
	} else {
	  cout << "NO" << endl;
	}
  return 0;
}


Measured memory_bytes: 256
N , M = map(int,input().split())
birth = []
for i in range(M):
    a , b = map(int,input().split())
    birth.append([a,b,i])
#print(birth)
work_list = sorted(birth,key=lambda x: x[1])
work_list.sort()
#print(birth)
lower = 1
ans = []
for i in range(1,len(birth)):
    ans.append([work_list[i-1][2],str(work_list[i-1][0]).zfill(6) + str(lower).zfill(6)])
    if work_list[i][0] == work_list[i-1][0]:
        lower += 1
    else:
        lower = 1
ans.append([work_list[M - 1][2],str(work_list[M-1][0]).zfill(6) + str(lower).zfill(6)])
ans.sort()
for val in ans:
    print(val[1])

Measured memory_bytes: 41904
#include<bits/stdc++.h>
using namespace std;
int cnt2(int x){
	int n = 0;
    while(!(x&1)){
    	n++;
        x >>= 1;
    }
    return n;
}

int main(){
	int n; cin >> n;
    int ans = 1001001001;
    for(int i = 0; i < n; ++i){
    	int x; cin >> x;
       	x = cnt2(x);
        ans = min(ans, x);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stack>
using namespace std;

int main(){
	string a;
	while (getline(cin, a)){
		for (int i = 0; i < 26; i++){
			if (a.find("the") != string::npos || a.find("this") != string::npos || a.find("that") != string::npos){
				cout << a << endl;
			}

			for (int j = 0; j < a.size(); j++){
				if (a[j] == ' '){
					continue;
				}
				else if (a[j] == 'z'){
					a[j] = 'a';
				}
				else if (a[j] == '.'){
					continue;
				}
				else {
					a[j]++;
				}
			}

		}

	}

	return 0;
}


Measured memory_bytes: 3020
#coding:utf-8
n = int(input())

def check(num):
    for i in  range(2,int(num ** 0.5)+1):
        if num % i == 0:
            return False
    else:
        return True
            
cnt = 0
p = 0
List = []
while cnt != n:
    p += 1
    num = 5 * p + 1
    if check(num):
        cnt += 1
        List.append(num)
    

print(" ".join([str(num) for num in List]))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll INF = ll(1e18)+1;
vector<ll> a;
ll n, k;
ll ok(ll x0, ll ai){
    ll r, l;
    ll ans;
    if(ai<0){
        l = -1;r = n;
        while(l+1<r){
            ll x = (r+l)/2;
            if(ai*a[x]<x0) r=x;
            else l=x;
        }
        ans = n-r;      
    }else{
        l = -1; r = n;
        while(l+1<r){
            ll x = (r+l)/2;
            if(ai*a[x]<x0) l = x;
            else r=x;
        }
        ans = r;
    }
    if(ai*ai<x0)ans--;
    return ans;
}

int main(){
    cin >> n >> k;
    a.resize(n);
    rep(i,n){
        cin >>  a[i];
    }
    sort(a.begin(), a.end());
    ll l=-INF, r=INF;
    while(l+1<r){
        ll x = (l+r)/2;
        ll tot = 0;
        rep(i,n){
            tot += ok(x, a[i]);
        }
        tot /= 2;
        if(tot < k) l=x;
        else r=x;
    }
    cout << l << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> vec(3);
  for(int i = 0; i < 3; i++) {
    cin >> vec[i];
  }
  sort(vec.begin(), vec.end());
  if(vec[0] = 5 && vec[1] == 5 && vec[2] == 7) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 3624
import sys
sys.setrecursionlimit(100000)
def intinput():return map(int,input().split())

n=int(input())
s={}
for i in range(n):
    t=list(input())
    t.sort()
    t="".join(t)
    try:
        s[t]+=1
    except:
        s[t]=1
ans=0
for i in s.values():
    if i!=1:
        ans+=i*(i-1)//2
print(ans)

Measured memory_bytes: 17924
c = [
    list(map(int, input().split()))
    for _ in range(3)
]

f = True
for j in range(2):
    x = c[j][0] - c[j + 1][0]
    y = c[0][j] - c[0][j + 1]
    for i in range(3):
        if c[j][i] - c[j + 1][i] != x:
            f = False
        if c[i][j] - c[i][j + 1] != y:
            f = False
print(['No', 'Yes'][int(f)])

Measured memory_bytes: 9196
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////
bool check(int N) {
	vector<bool> res(3, false);
	vector<int> ter = { 3,5,7 };
	while (N) {
		for (int i = 0; i < 3; ++i) {
			if (N % 10 == ter[i]) { res[i] = true; }
		}
		N /= 10;
	}
	return res[0] && res[1] && res[2];
}
void solve() {
	LL N;
	cin >> N;
	
	int ans = INF;
	while (N >= 100) {
		int ter = N % 1000;
		if (ans > abs(753 - ter)) {
			ans = abs(753 - ter);
		}
		N /= 10;
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	double W, H, x, y;
    cin >> W >> H >> x >> y ;
    cout << W * H / 2 << " ";
    if(x == W / 2 && y == H / 2)
      cout << 1;
  	else
      cout << 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>

#define INT_MAX 2000000000

using namespace std;

int main(void){
  int h,w;
  int dp[50][50];
  int semi[50][50];
  string str;

  //fill(dp,dp+50*50,INT_MAX);

  cin >> h >> w;

  for(int i=0;i<h;i++){
    cin >> str;
    for(int j=0;j<w;j++){
      semi[i][j] = str[j] - '0';
      dp[i][j] = INT_MAX;
    }
  }

  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(i==0 && j==0){
	dp[i][j] = 0;
      }else if(i==0){
	dp[i][j] = dp[i][j-1] + semi[i][j];
      }else if(j==0){
	dp[i][j] = dp[i-1][j] + semi[i][j];
      }else{
	dp[i][j] = semi[i][j] + min(dp[i-1][j], dp[i][j-1]);
      }
    }
  }
  cout << dp[h-1][w-1] << endl;
}

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


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1010;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code
int main()
{
	int n;
	cin>>n;
	vector<pair<ll ,int >> v;
	v.pb({-1, -1});
	repn(i, 1, n)
	{
		ll x;
		cin>>x;
		v.pb({x, i});
	}
	sort(all(v));
	int mid = n / 2;
	int la = v[mid].f;
	int ra = v[mid+1].f;

	int ans[n+1];
	repn(i, 1, mid)
	{
		ans[v[i].s] = ra;
	}
	repn(i, mid+1, n)
	{
		ans[v[i].s] = la;
	}
	repn(i, 1, n)
		cout<<ans[i]<<endl;
}


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

using namespace std;

int main(){
  int N;
  map<string,int> number;
  string tmp;

  cin >> N;

  number["AC"] = 0;
  number["WA"] = 0;
  number["TLE"] = 0;
  number["RE"] = 0;

  for(int i=0;i<N;i++){
    cin >> tmp;
    number[tmp]++;
  }

  cout << "AC x " << number["AC"] << endl;
  cout << "WA x " << number["WA"] << endl;
  cout << "TLE x " << number["TLE"] << endl;
  cout << "RE x " << number["RE"] << endl;

  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
using namespace std;

int main(){
string c;
cin>>c;
if(c.at(2)==c.at(3) && c.at(4)==c.at(5)){
  cout<<"Yes"<<endl;
}else{
  cout<<"No"<<endl;
}
}

Measured memory_bytes: 764
#include<iostream>
using namespace std;

int main(){
	int n; cin >> n;
	int ans = 0;
	bool used[n] = {0};
	int a[n];
	int now = 0;
	for(int i = 0; i < n; ++i){
		int b; cin >> b;
		a[i] = b - 1;
	}
	while(1){
		++ans;
		if(a[now] == 1){
			cout << ans << endl;
			break;
		}else if(used[a[now]]){
			cout << -1 << endl;
			break;
		}else{
			used[a[now]] = 1;
			now = a[now];
		}
	}
	return 0;
}


Measured memory_bytes: 768
using System;
using System.Collections.Generic;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine());//500
            int B = int.Parse(Console.ReadLine());//100
            int C = int.Parse(Console.ReadLine());//50
            int X = int.Parse(Console.ReadLine());//sum
            int count = 0; 
            for(int i=0;i<=A;i++){
                for(int j=0;j<=B;j++){
                    for(int k=0;k<=C;k++){
                        if(500*i+100*j+50*k==X) count++;
                    }
                }
            }
            Console.WriteLine(count);
        }
    }
}

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

int main() {
    int n;
    cin >> n;
    long long int res = 0;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        while(a % 2 == 0){
            a /= 2;
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

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

int main() {
  
  int n,k;
  cin >> n >> k;
  
  int a = 1;
  
  for ( int i = 0; i < n; i++){
    if ( a * 2 >= a + k ){
      a += k;
    }else{
      a *= 2;
    }
  }
  
  cout << a << endl;
  
  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define first fi;
#define second se;
using namespace std;
typedef pair<int, int> P;

bool contain(string a, string b){
    int now = 0;
    rep(i, 0, a.size()){
        if(a[i] == b[now]){
            now++;
            if(now == b.size()) return true;
        }
    }
    return false;
}

signed main(){
    string s, t;
    cin >> s >> t;
    string s1 = "", s2 = "";
    rep(i, 0, s.size()){
        if(i % 2 == 0) s1 += s[i];
        else s2 += s[i];
    }
    if(contain(t, s1) || contain(t, s2) || s.size() == 1) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3224
import sys
import math
sys.setrecursionlimit(10**8)
stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N, K = na()
A_array = na()

min_length = 0
max_length = 2 * 10 ** 9

while(max_length - min_length > 0.01):
    mid = (min_length + max_length) / 2
    cut_cnt = 0
    for a in A_array:
        c = a // mid
        if a - mid * c > 0:
            c += 1
        cut_cnt += (c - 1)
    # print(mid, cut_cnt)
    if cut_cnt <= K:
        max_length = mid
    else:
        min_length = mid

# print(max_length)


ans1 = math.floor(max_length)
ans2 = math.ceil(max_length)

if ans1 == 0:
    print(1)
    exit()

cut_cnt = 0
for a in A_array:
    c = a // ans1
    if a - ans1 * c > 0:
        c += 1
    cut_cnt += (c - 1)

if cut_cnt <= K:
    print(ans1)
else:
    print(ans2)


Measured memory_bytes: 92296
#include <iostream>
#include <string>

using namespace std;

int main(void){
  int n;
  string str1, str2;
  int tp = 0, hp = 0;

  cin >> n;
  
  for (int i = 0; i < n; i++){
    cin >> str1 >> str2;

    if(str1 > str2)
      tp += 3;
    else if(str1 < str2)
      hp += 3;
    else {
      tp++;
      hp++;
    }
  }

  cout << tp << " " << hp << endl;

  return 0;
}

Measured memory_bytes: 1208
#include <stdio.h>

using namespace std;

int main(void)
{
    int x, y, i, temp;
    
    while (true) {
        scanf("%d %d", &x, &y);
        if (!(x | y)) {
            break;
        }
        if (x > y) {
            temp = x;
            x = y;
            y = temp;
        }
        printf("%d %d\n", x, y);
    }
    
    return 0;
}


Measured memory_bytes: 2588
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
 
using namespace std;
 
typedef pair<long long int,long long int> P;
 
P prod[200];
 
vector<long long int> v[4];
vector<long long int> v_sum[4];
 
int main(){
	
	int N;
	
	long long int W;
	
	cin >> N >> W;
	
	for(int i = 0; i < N; i++){
		cin >> prod[i].first >> prod[i].second;
		v[prod[i].first - prod[0].first].push_back(-prod[i].second);
	}
	
	for(int i = 0; i < 4; i++){
		sort(v[i].begin(), v[i].end());
	}
	
	for(int i = 0; i < 4; i++){
		long long int sum = 0;
		v_sum[i].push_back(sum);
		for(int j = 0; j < v[i].size(); j++){
			sum += -v[i][j];
			v_sum[i].push_back(sum);
		}
	}
	
	long long int ans = 0;
	
	for(int i = 0; i < v_sum[0].size(); i++){
	for(int j = 0; j < v_sum[1].size(); j++){
	for(int k = 0; k < v_sum[2].size(); k++){
	for(int l = 0; l < v_sum[3].size(); l++){
		if((i + j + k + l) * prod[0].first + j + 2 * k + 3 * l <= W){
			ans = max(ans, v_sum[0][i] + v_sum[1][j] + v_sum[2][k] + v_sum[3][l]);
		}
	}
	}
	}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    int A, B; std::cin >> A >> B;
    if ((A >= 1 && A <= 9) && (B >= 1 && B <= 9))
    {
        std::cout << A * B << std::endl;
    }
    else{
        std::cout << -1 << std::endl;
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
typedef pair<int,int> P;
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i, n) for (lint i = 0; i < (n); i++)
#define INF LLONG_MAX
#define all(x) (x).begin(),(x).end()
#define pb push_back
int main(){
    int n; 
    int y;
    cin>>n>>y;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n-i;j++){
            int k=n-i-j;
            if(10000*i+5000*j+1000*k==y){
                cout<<i<<" "<<j<<" "<<k<<endl;
                return 0;
            }
        }
    }
    cout<<-1<<" "<<-1<<" "<<-1<<endl;
    return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {
	auto S = readln.split[0];
	auto K = readln.split[0].to!long;
	foreach (c; S) {
		if (K == 1 || c != '1') { writeln(c); return; }
		else K--;
	}
	writeln(1);
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n,a[100],i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++){
		printf("%d",a[n-i-1]);
		if(i!=(n-1)){
			printf(" ");
		}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 600
S = input()

ACGT = ["", ""]
lenACGT = [0, 0]
idx = 1
for s in S:
#    print("s = {}, ACGT = {}".format(s, ACGT))
    if("A" == s):
        add = 1
    elif("C" == s):
        add = 1
    elif("G" == s):
        add = 1
    elif("T" == s):
        add = 1
    else:
        if("" != ACGT[idx]):
            ACGT.append("")
            lenACGT.append(0)
            idx += 1
        add = 0
        continue
    if(1 == add):
        ACGT[idx] += s
        lenACGT[idx] += 1

#print("ACGT = {}".format(ACGT))
#print("lenACGT = {}".format(lenACGT))
print(str(max(lenACGT)))


Measured memory_bytes: 3064
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include <ctime>
#include<list>
#include <numeric>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(int i = 0; i < n; i++)
#define FORAB(i, a, b) for(int i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))
#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int128 LLL;
typedef long long LLL;

typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII > VP;
typedef vector<PLL > VPL;
typedef vector<double> VD;
typedef long double ld;

int dp[200][100001];
int n, x, S[201];
LL ncr[202][202];
LL fact[202];
const LL MOD = 1000000000 + 7;

int DP(int at, int x) {
	if (at == -1) return x;
	int& ret = dp[at][x];
	if (ret != -1) return ret;
	ret = 0;
	LL xx = 0;

	for (int i = at; i >= 0; i--) {
		int now = (((ncr[at][at - i])) * DP(i - 1, x % S[i])) % MOD;
		xx += now;
	}
	xx %= MOD;
	return ret = xx;
}

void solve(int ks) {
	scanf("%d %d", &n, &x);
	for (int i = 0; i < n; i++) {
		scanf("%d", &S[i]);
	}
	sort(S, S + n);

	MEM(dp, -1);
	int ans = DP(n - 1, x);
	printf("%d\n", ans);
}

void gen() {
	ncr[0][0] = 1;
	int limncr = 200;
	for (int i = 1; i <= limncr; i++)
		for (int j = 0; j <= limncr; j++)
		{
			if (j>i) ncr[i][j] = 0;
			else if (j == i || j == 0) ncr[i][j] = 1;
			else ncr[i][j] = (ncr[i - 1][j - 1] + ncr[i - 1][j]) % MOD;
		}
	fact[0] = 1;
	for (LL i = 1; i <= 200; i++) {
		fact[i] = (i * fact[i - 1]) % MOD;
	}

	for (int i = 1; i <= limncr; i++) {
		for (int j = 0; j <= limncr; j++) {
			ncr[i][j] *= fact[j];
			ncr[i][j] %= MOD;
		}
	}
}

int main()
{
#ifdef LOCAL
	double start_time = clock();
	freopen("C:\\Home\\ContestCodes\\sample.in", "r", stdin);
	//	freopen("out.out", "w", stdout);
#endif


	gen();

	if (0) {
		int T = 1000;
		scanf("%d", &T);
		for (int ks = 1; ks <= T; ks++) solve(ks);
	}
	else {
		solve(0);
	}

#ifdef LOCAL
	double end_time = clock();
	fprintf(stderr, "Time = %lf\n", (end_time - start_time) / CLOCKS_PER_SEC);
#endif

	return 0;
}


Measured memory_bytes: 78848
#!/usr/local/bin/python3
# https://atcoder.jp/contests/abc098/tasks/abc098_b

N = int(input())
S = input()


def check(i):
    return len(set(S[:i]) & set(S[i:]))


ans = [0] * N
for i in range(N):
    ans[i] = check(i)

print(max(ans))


Measured memory_bytes: 9052
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

ll a[300010];
priority_queue<ll, vector<ll>, greater<ll> > x;  //小さい順に出す
priority_queue<ll, vector<ll>, less<ll> > y;  //大きい順に出す
ll a_max[1000010];
ll a_min[1000010];

int main(){
    int N;  cin >> N;

    for(int i = 0; i < 3*N; i++){
        cin >> a[i];
    }

    ll a1 = 0, a2 = 0;

    for(int i = 0; i < N; i++){
        x.push(a[i]);
        a1 += a[i];
    }
    a_max[0] = a1;
    for(int i = N; i < 2*N; i++){
        x.push(a[i]);
        a1 += a[i];
        a1 -= x.top();
        a_max[i-N+1] = a1;
        x.pop();
    }


    for(int i = 2*N; i < 3*N; i++){
        y.push(a[i]);
        a2 += a[i];
    }
    a_min[N] = a2;
    for(int i = 2*N-1; i >= N; i--){
        y.push(a[i]);
        a2 += a[i];
        a2 -= y.top();
        a_min[i-N] = a2;
        y.pop();
    }

    ll res = LONG_LONG_MIN;
    for(int i = 0; i <= N; i++){
        res = max(res, a_max[i] - a_min[i]);
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 10484
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,d;
    cin>>n>>d;
    long long x,y;
    int ans=0;
    for(int i=0;i<n;i++)
     {
       cin>>x>>y;
       if((x*x+y*y)<=d*d)
         ans++;
     }
     cout<<ans<<endl;
   return 0; 
}

Measured memory_bytes: 3636
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons;
import std.math, std.numeric;

void main() {
    int N, L; scan(N, L);
    auto a = readln.split.to!(int[]);

    int r = -1;
    foreach (i ; 1 .. N) {
        if (a[i] + a[i-1] >= L) {
            r = i;
            break;
        }
    }
    if (r == -1) {
        writeln("Impossible");
        return;
    }
    writeln("Possible");
    
    foreach_reverse (i ; r + 1 .. N) {
        writeln(i);
    }
    foreach (i ; 1 .. r) {
        writeln(i);
    }
    writeln(r);
}






void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 5020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

ll mod_fact(ll a, ll mod)
{
    ll ans = 1;
    while (a > 1)
    {
        ans = ans * a % mod;
        a--;
    }
    return ans;
}
ll mod_pow(ll a, ll b, ll mod)
{
    ll ans = 1;
    while (b > 0)
    {
        if (b & 1)
            ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}
ll mod_inv(ll a, ll mod)
{
    return mod_pow(a, mod - 2, mod);
}
ll mod_binomial(ll a, ll b, ll mod){
    return (mod_fact(a, mod) * mod_inv(mod_fact(b, mod), mod) % MOD * mod_inv(mod_fact((a - b), mod), mod)) % MOD;
}
int main(){
    ll s;
    cin >> s;
    ll ans = 0;
    for (int i = 1; i <= s / 3; i++){
        ll cur = s - 3 * i;
        ans = (ans + mod_binomial(cur + i - 1, i - 1, MOD)) % MOD;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int num[200001];
int main(void){
    // Your code here!
    int n, k, a;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> a;
        num[a]++;
    }
    sort(num, num + 200001, greater<int>());
    int res = 0;
    for (int i = 0; i < k; i++) res += num[i];
    if (res < n) cout << n - res << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){

  int ans,max,n,h;
  ans = 0;
  max = 1;

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> h;
    if(h>=max){
      max = h;
      ans++;
    }
  }

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)

int n,x,y,h,W,s[]={60,80,100,120,140,160,1000},w[]={2,5,10,15,20,25,1000},p[]={600,800,1000,1200,1400,1600,0};

int main(){
	while(cin>>n&&n){
		int ans=0;
		rep(i,n){
			cin>>x>>y>>h>>W;
			int S=x+y+h,cur=0;
			while(S>s[cur]||W>w[cur])cur++;
			ans+=p[cur];
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 0
//这道题是...
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> PII;
int n;
int a[100001],b[100001];
ll res;
int main()
{	
	cin>>n;
	for(int i=0;i<=n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		cin>>b[i];
	}
	for(int i=0;i<n;i++){
		res+=min(a[i]+a[i+1],b[i]);
		if(b[i]>a[i]) a[i+1]=max(0,a[i+1]-b[i]+a[i]);
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

/**
 * @author ??\???
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		for (int x = scanner.nextInt(), y = scanner.nextInt();
				(x != 0) || (y != 0);
				x = scanner.nextInt(), y = scanner.nextInt()) {
			if (x < y) {
				System.out.println("" + x + " " + y);
			} else {
				System.out.println("" + y + " " + x);
			}
		}
		scanner.close();
	}

}

Measured memory_bytes: 34844
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// const ll MOD = 1000000007;
const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    int x, y;
    cin >> x >> y;
    for (int a = 0; a <= x; a++) {
        int b = x - a;
        int d = a * 2 + b * 4;
        if (d == y) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
     int R[MAX],n;

 cin >> n;
 for ( int i = 0; i < n; i++ ) cin >> R[i];

int maxv = -2000000000;
int minv = R[0];

for ( int i = 1; i < n; i++ ) {
  maxv = max(maxv, R[i] - minv);
 minv = min(minv,R[i]);
}
 cout << maxv << endl;
 return 0;
}

Measured memory_bytes: 1940
#include<iostream>
using namespace std;
int main() {
	int N, a[100009], b[100009], sum = 0, max = 0;
	for (int i = 0; i < 100009;i++)b[i] = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		b[a[i]]++;
	}
	for (int i = 1; i < 100008; i++) {
		sum = b[i - 1] + b[i] + b[i + 1];
		if (sum > max) {
			max = sum;
		}
	}
	cout << max << endl;
}


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

using namespace std;
int main(){
	int H, N;
	cin >> H >> N;
	for(int i = 0; i < N; i++){
		int a;
	    cin >> a;
	    H -= a; 
	}

	if(H <= 0)
	    cout << "Yes\n";
	else
	    cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  string s; cin >> s;
  ll cur = 0;
  ll ans = 1;
  rep(i, 2*n) {
    if(s[i] == 'W') {
      if(cur&1) {
        cur++;
      } else {
        (ans *= cur) %= mod;
        cur--;
        if(cur < 0) ans = 0;
      }
    } else {
      if(cur&1) {
        (ans *= cur) %= mod;
        cur--;
        if(cur < 0) ans = 0;
      } else {
        cur++;
      }
    }
  }
  for(int i=1; i<=n; i++) {
    (ans *= i) %= mod;
  }
  cout << (cur != 0 ? 0 : ans) << "\n";
  return 0;
}


Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

void outputV(vector<ll> v){
  for(ll i=0;i<v.size();i++){
    if(i){
      cout<<' ';
    }
    cout<<v[i];
  }
  cout<<endl;
}

int main(){
  ll n;
  cin>>n;
  vector<ll> list(n+1,0);
  for(ll i=1;i*i<=n;i++){
    for(ll j=i;i*j<=n;j++){
      if(i==j){
        list[i*j]++;
      }else{
        list[i * j] += 2;
      }
    }
  }
  ll sum=0;
  for(ll i=1;i<n;i++){
    sum+=list[i];
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 10984
#include<iostream>
#include<algorithm>
using namespace std;

const int N = 2e5+10;
long long int v[N];


int main(){
	int n, k;
	cin >> n >> k;
	for(int i=0; i < n; i++) cin >> v[i];
	sort(v, v+n);

	long long int sum = 0;
	for(int i=0; i < max(0, n-k); i++) sum += v[i];

	cout << sum << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cmath>

using namespace std;

int n,x, t;
int main()
{
	cin>>n>>x>>t;
	double a=n*1.0/x;
	int ans=ceil(a);
	ans=ans*t;
	cout<<ans<<endl;
	
	return 0;
 } 

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

const int MAX_N = 21;
const int MOD = 1000000007;
ll dp[(1<<MAX_N)];
int a[MAX_N][MAX_N];
int n;

int dfs(int k){
    if(dp[k]!=-1)return dp[k];

    int flag[n] = {};
    int count = 0;
    int kk = k;
    rep(i,n){
        flag[i] = kk%2;
        count += flag[i];
        kk /= 2;
    }
    if(count == 1){
        int x;
        rep(i,n){
            if(flag[i]==1){
                x = i;
                break;
            }
        }
        if(a[0][x]==1){
            dp[k] = 1;
        }else{
            dp[k] = 0;
        }
        return dp[k];
    }else{
        dp[k] = 0;
        rep(i,n){
            if(flag[i]==0)continue;
            if(a[count-1][i]==0)continue;
            dp[k] += dfs(k - (1<<i));
            dp[k] %= MOD;
        }
        return dp[k];
    }
}

int main() {
    cin >> n;
    rep(i,n){
        rep(j,n){
            cin >> a[i][j];
        }
    }
    rep(i,(1<<n)){
        dp[i] = -1;
    }

    int ans = dfs((1<<n) - 1);



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


Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=100;
int n;
int a[maxn+5];
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++) scanf("%d",&a[i]);
    int mn=0x3f3f3f3f;
    for (int k=-100;k<=100;k++) {
        int cost=0;
        for (int i=1;i<=n;i++) cost+=(a[i]-k)*(a[i]-k);
        if (cost<mn) mn=cost;
    }
    printf("%d\n",mn);
    return 0;
}


Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))
c = 0
for i in range(1,n-2+1):
  if (p[i-1] < p[i] < p[i+1]) or (p[i+1] < p[i] < p[i-1]):
    c += 1
print(c)

Measured memory_bytes: 2940
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

const int N = 100000 + 1000;

int n, a, b;
int F[N], v[N << 1], nex[N << 1], EID = 1;
int f[N], g[N], d[N];

inline int read()
{
	int a = 0;
	char ch;
	int f = 1;
	while(!((((ch = getchar()) >= '0') && (ch <= '9')) || (ch == '-')));
	if(ch == '-')
		f = -1;
	else
	{
		a = a * 10;
		a += ch - '0';
	}
	while((((ch = getchar()) >= '0') && (ch <= '9')) || (ch == '-'))
	{
		a = a * 10;
		a += ch - '0';
	}
	return a * f;
}

inline void add(int f, int t)
{
	nex[EID] = F[f];
	v[EID] = t;
	F[f] = EID++;
}

inline void rd(int &x)
{
	x = read();
}

inline void wr()
{
	a = read(), b = read();
	add(a, b);
	add(b, a);
	++d[a], ++d[b];
}

inline void dp(int x, int fa)
{
	
	g[x] = 1, f[x] = 0;
	for(int i = F[x];i;i = nex[i])
	{
		int t = v[i];
		if(t == fa)
			continue;
		dp(t, x);
		g[x] &= f[t];
		f[x] |= g[t];
	}
}

inline void ch(int x, int fa)
{
	if(g[x] == 1)
	{
		printf("First\n");
		exit(0);
	}
	int of = f[x], og = g[x];
	for(int i = F[x];i;i = nex[i])
	{
		int t = v[i];
		if(t == fa)
			continue;
		int uf = f[t], ug = g[t];
		f[x] = 0, g[x] = 1;
		for(int j = F[x];j;j = nex[j])
		{
			int t1 = v[j];
			if(t1 == fa || t1 == t)
				continue;
			f[x] |= g[t1];
			g[x] &= f[t1];
		}
		f[t] |= g[x], g[t] &= f[x];
		ch(t, x);
		f[t] = uf, g[t] = ug;
	}
	f[x] = of, g[x] = og;
}

int main()
{
	rd(n);
	for(int i = 1;i < n;++i)
		wr();
	dp(1, -1);
	ch(1, -1);
	printf("Second\n");
	return 0;
} 

Measured memory_bytes: 3456
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
typedef unsigned long long ull;
#define rep(i,a) for(int i=0;i<a;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
using namespace std;
const double eps = 1e-10;
const double pi = acos(-1);
const double inf = (int)1e8;

void solve(){
  int N,P;
  while(cin>>N>>P,N+P){
    int to=0;
    int w=P;
    vector<int> in(N);
    while(true){
      if(w){
	w--;
	in[to]++;
      }else{
	w+=in[to];
	in[to]=0;
      }      
      if(in[to]==P)break;
      to++;
      if(to==N)to=0;
    }						
    cout<<to<<endl;
  }
}

int main(void){
  solve();
  return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    ll A;
    string strB;
    cin >> A >> strB;
    int B[3];
    B[0] = strB[0] - '0';
    B[1] = strB[2] - '0';
    B[2] = strB[3] - '0';
    
    ll Ans = 0;
    for (int i = 2; i >= 0; --i) {
        Ans += A*B[i];
        if (i != 0) Ans /= 10;
    }
    cout << Ans << endl;

    return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>

int main(void) {
  int n;
  scanf("%d", &n);

  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (1 <= i && i <= 9) ans++;
    if (100 <= i && i <= 999) ans++;
    if (10000 <= i && i <= 99999) ans++;
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long ll;
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

//const int dy[] = { 0, 0, 1, -1 };
//const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);

//vector<ll> a;

int main()
{
	ll a, b, c;
	cin >> a >> b >> c;
	if (a == b && a == c && b==c) {
		cout << "No" << endl;
	}else if (a != b && a != c && b != c) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	
	
	return 0;
}


Measured memory_bytes: 256