akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<LL> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const int MOD = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;
const int MAX = 200*1000 + 7;

int cnt[MAX];


int t[MAX << 2];
int a[MAX];
int C[MAX];

void u(int v, int tl, int tr, int p) {
    if (tl == tr) {
        t[v] = !!C[tl];
        return ;
    }
    int tm = tl + tr >> 1;
    if (p <= tm)u(v+v, tl, tm, p);
    else u(v+v+1, tm+1, tr, p);
    t[v] = t[v+v+1] + t[v+v];
}



int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    FOR(i, 1, n+1) {
        scanf("%d", a+i);
        cnt[a[i]]++;
      //  cout << a[i] << endl;
    }
    FOR(i, 1, n+1)
    FOR(j, max(1, i - cnt[i] + 1), i+1) {
       // cout << j << endl;
        C[j]++;
        u(1, 1, n, j);
    }
    
   
    //cout << "x" << endl;
    FOR(q, 0, m) {
        int x, y;
        scanf("%d%d", &x, &y);
        int idx = a[x] - cnt[a[x]] + 1;
        if (idx >= 1) {
            C[idx]--;
            u(1, 1,n, idx);
        }
        cnt[a[x]]--;
        a[x] = y;
        cnt[a[x]]++;
        idx = a[x] - cnt[a[x]] + 1;
        if (idx >= 1) {
            C[idx]++;
            u(1, 1, n, idx);
        }
        
        /*
        FOR(i, 1, n+1) {
            cout << C[i] << " ";
        }
        cout << endl;
        
        cout << "!" << t[1] << endl;
         */
        
        printf("%d\n", n - t[1]);
    }
    
    
    return 0;
}


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

using namespace std; 

int main() {
	int n,a[10007],i,sum=0,j,mn,mx;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i];
		mn=a[i];
		mx=a[i];
	}
	for(i=0;i<n;i++){
			if(a[i]>mx){
				mx=a[i];
			}
	}
	for(i=0;i<n;i++){
			if(a[i]<mn){
				mn=a[i];
			}
	}
	cout<<mx-mn;
}

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

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int a, b;
  cin >> a >> b;
  if (a > 0 && a < 10 && b > 0 && b < 10) {
    cout << a * b << endl;
  } else {
    cout << -1 << endl;
  }
}

Measured memory_bytes: 256
import sys
from collections import Counter
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    s=input()
    c_s=Counter(s)
    sum_a=0
    for diff in range(1,(n-1)//2+1):
        for i in range(n-2*diff):
            if s[i]!=s[i+diff] and s[i+diff]!=s[i+2*diff] and s[i]!=s[i+2*diff]:
                sum_a+=1
    print(c_s['R']*c_s['G']*c_s['B']-sum_a)

if __name__=='__main__':
    main()

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1, 0};

bool is_boin(char c){
    return c == 'a' ||
        c == 'i' ||
        c == 'u' ||
        c == 'e' ||
        c == 'o';
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    while(true){
        int n;
        cin >> n;
        if(n == 0) break;
        vector<string> s(n);
        for(int i = 0; i < n; ++i){
            cin >> s[i];
        }
        vector<string> t(n);
        int k_max = 0;
        for(int i = 0; i < n; ++i){
            t[i].push_back(s[i][0]);
            for(int j = 1; j < s[i].size(); ++j){
                if(is_boin(s[i][j-1])) t[i].push_back(s[i][j]);
            }
            k_max = max(k_max, (int)t[i].size());
        }
        int ans = -1;
        for(int k = 1; k <= k_max; ++k){
            for(int i = 0; i < n; ++i){
                for(int j = i + 1; j < n; ++j){
                    if(t[i].size() != t[j].size() && (t[i].size() < k || t[j].size() < k)) continue;
                    bool flg = true;
                    for(int l = 0; l < min({k, (int)t[i].size(), (int)t[j].size()}); ++l){
                        flg &= t[i][l] == t[j][l];
                    }
                    if(flg) goto NG;
                }
            }
            ans = k;
            break;
            NG:;
        }
        cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define p 1000000000000000000
#define test ll t; cin>>t; while(t--)
typedef long long int ll;
int main() {
    FIO;
    //test
    {
        ll n,i,x;
        cin>>n;
        ll a[n];
        ll flag=0;
        for(i=0;i<n;i++){
            cin>>a[i];
            if(a[i]==0){
                flag=1;
            }
        }
        if(flag==1){
            cout<<0<<endl;
        }
        else{
        ll ans=1,flag=0;
        for(i=0;i<n;i++){
            x=p/ans;
            if(a[i]>x){
                cout<<-1<<endl;
                flag=1;
                i=n;
            }
            ans*=a[i];
        }
        if(flag==0 && ans<=p && ans>=1){
            cout<<ans<<endl;
        }
      }
    }
	return 0;
}


Measured memory_bytes: 4440
#include<bits/stdc++.h>
using namespace std;
int n;
long long x,x1,x2;
int main(){
	cin>>n;
	x2=2;
	x1=1;
	if(n==0)
		return cout<<x2<<"\n",0;
	if(n==1)
		return cout<<x1<<"\n",0;
	for(int i=3;i<=n+1;i++){
		x=x1+x2;
		x2=x1;
		x1=x;
	}
	cout<<x;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long a, b, k;
    cin >> a >> b >> k;
    if(a>k){
        a = a - k;
    }else if(a<=k && (a+b)>k){
        b = b + a - k;
        a = 0;
    }else{
        a = 0;
        b = 0;
    }
    cout << a << ' ';
    cout << b;
}

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

int main(void){
    int i;
    int num;
    int tmp;
    cin >> num;
    for (i = 1; i <= num; i++){
        tmp = i;
        if (i % 3 == 0 && !(i == 0)){
            cout << " " << i; 
        }
        else {
            while(tmp > 0){
                if (tmp%10 == 3){
                    cout << " " << i;
                    break;
                }
            tmp /= 10;
            }
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3116
/// You just can't beat the person who never gives up
/// ICPC next year

//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<bits/stdc++.h>
using namespace std ;
const int N = 2e5+5 ;

int n ,m ,u ,v ,ans=1 ;
int parent[N] ,Rank[N] ,sz[N] ;
int find_set(int i){
    if(parent[i]==i)return i;
    return parent[i]=find_set(parent[i]);
}
void join(int i,int j){
    i=find_set(i);
    j=find_set(j);
    if(i==j)return ;
    if(Rank[i]>Rank[j])swap(i,j);
    sz[j] += sz[i] ;
    parent[i]=j;
    if(Rank[i]==Rank[j])++Rank[j];
    ans = max(ans,sz[j]);
}
bool Never_give_up(){
    scanf("%d%d",&n,&m);
    iota(parent,parent+n+1,0);
    fill(sz,sz+n+1,1);
    while(m--){
        scanf("%d%d",&u,&v);
        join(u,v);
    }
    cout << ans << endl ;
    return 0;
}
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt" ,"r" ,stdin);
    freopen("output.txt" ,"w" ,stdout);
#endif
    //std::ios::sync_with_stdio(0);
    //cin.tie(0) ,cout.tie(0);
    int t = 1 ;
    //scanf("%d",&t);
    while(t--){
        Never_give_up();
    }
    return 0;
}


Measured memory_bytes: 5972
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;

typedef long long ll;
#define INF 2020202022

int main(){
	ll N; cin >> N;
	vector<ll> A(N);
	vector<ll> mul(N+1);

	for(int i = 0; i < N; ++i) cin >> A[i];

	mul[0] = 0;
	for(int i = 1; i <= N; ++i){
		mul[i] = mul[i-1] + A[i-1];
	}

	ll min = INF;
	for(int i = 1; i <= N-1; ++i){
		ll big = mul[N] - mul[i];
		ll sml = mul[i];
		// cout << big << " " << sml << endl;
		if(min > abs(big-sml)){
			min = abs(big-sml);
		}
	}

	cout << min << endl;


	return 0;
}


Measured memory_bytes: 3328
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int d = 0,n,x,count = 1;
        
        n = sc.nextInt();
        x = sc.nextInt();
        
        for(int i = 0; i < n ; i++){
            d += sc.nextInt();
            if(d <= x) count++;
            else break;
        }
        System.out.println(count);
        
    }
}

Measured memory_bytes: 22868
#include<stdio.h>
#include<stdlib.h>

typedef struct{
  int parent;
  int left;
  int right;
  int key;
}Node;

Node Tree[25];

void inorder(int x){

  if(x != -1){
    inorder(Tree[x].left);
    printf(" %d", Tree[x].key);
    inorder(Tree[x].right);
  }
}

void preorder(int x){

  if(x != -1){
    printf(" %d", Tree[x].key);
    preorder(Tree[x].left);
    preorder(Tree[x].right);
  }
}

void postorder(int x){

  if(x != -1){
    postorder(Tree[x].left);
    postorder(Tree[x].right);
    printf(" %d", Tree[x].key);
  }
}

int main(){

  int n,i,j,id,child,root;
 
  scanf("%d",&n);

  for(i = 0 ; i < n ; i++){
    Tree[i].parent = -1;
    Tree[i].left = -1;
    Tree[i].right = -1;
  }

  for(i = 0 ; i < n ; i++){
    scanf("%d",&id);
    Tree[id].key = id;

    for(j = 0 ; j < 2 ; j++){

      scanf("%d",&child);
      if(child != -1) 
	Tree[child].parent = id;

      if(j == 0)
	Tree[id].left = child;
      else if(j == 1){
	Tree[id].right = child;
      }
    }
  }

  for(i=0; i<n; i++){
    if(Tree[i].parent == -1){
      root = i;
      break;
    }
  }

  printf("Preorder\n");
  preorder(root);
  printf("\n");

  printf("Inorder\n");
  inorder(root);
  printf("\n");

  printf("Postorder\n");
  postorder(root);
  printf("\n");



  return 0;

}

Measured memory_bytes: 616
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define  boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ull unsigned long long
#define deb(x) cout<<#x<<" "<<x<<endl;
#define deb2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define deb2l(x,y,i) cout<<#x<<i<<" "<<x<<" "<<#y<<i<<" "<<y<<endl;

#define fr(i,l,r) for(ll i=l;i<r;i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x,y) push_back(make_pair(x,y))
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void solve(){
    ll h,a;
    cin>>h>>a;
    vll v(a);
    ll ans=0;
    for(int i=0;i<a;i++)
    cin>>v[i],ans+=v[i];
    if(ans<h){
        cout<<"No";
    }
    else cout<<"Yes";


}

int main(){
    ll t=1;
//cin>>t;
    while(t--){
     solve();
     cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 100000000;
const long INF64 = 1000000000000000ll;
const int MOD = 1000000007;
int main(){
  int a,b,c;
  std::cin >> a>>b>>c;
  c=c+a*100+b*10;
  if(c%4==0)std::cout << "YES" << std::endl;
  else std::cout << "NO" << std::endl;
}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    int n;
    cin>> n;

    int s[n], a[n], sum= 0;

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

    for(int i= n-1; i>0; i--)
        sum += (a[i]* s[i-1]);

    cout << sum << '\n';

    return 0;
}




Measured memory_bytes: 3636
# -*- coding: utf-8 -*-


def main():
    from collections import defaultdict
    from collections import deque

    n = int(input())
    graph = [defaultdict(int) for _ in range(n)]
    visited = [False for _ in range(n)]
    dist = [float('inf') for _ in range(n)]

    for i in range(n - 1):
        ai, bi, ci = map(int, input().split())
        ai -= 1
        bi -= 1
        graph[ai][bi] = ci
        graph[bi][ai] = ci

    q, k = map(int, input().split())
    k -= 1
    dist[k] = 0
    d = deque()
    d.append(k)

    while d:
        di = d.popleft()
        visited[di] = True

        for bi, ci in graph[di].items():
            if visited[bi]:
                continue

            dist[bi] = dist[di] + ci
            d.append(bi)

    ans = [0 for _ in range(q)]

    for j in range(q):
        xi, yi = map(int, input().split())
        xi -= 1
        yi -= 1
        ans[j] = dist[xi] + dist[yi]

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()


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

int main(){
  int D, N;
  cin >> D >> N;
  long long ans = 1;
  for(int i = 0; i < D; i++){
    ans *= 100;
  }
  if(N == 100){
    N += 1;
  }
  ans *= N;

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<random>
#include<map>
#include<queue>
using namespace std;

int main(){

  int w, h;
  while(cin >> w >> h){
    if( w == 0 && h == 0 ) break;

    vector<string> t(h);
    for(int i=0; i<h; i++) cin >> t[i];
    int x, y;
    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        if( t[i][j] == '@' ){
          x = j;
          y = i;
        }
      }
    }

    vector< vector<bool> > b(h, vector<bool> (w, false));
    b[y][x] = true;
    queue< pair<int, int> > q;
    q.push( make_pair(x, y) );
    int dx[4] = {0, 1, 0, -1};
    int dy[4] = {1, 0, -1, 0};
    while(true){
      if( q.empty() ) break;

      pair<int, int> p = q.front();
      q.pop();
      int px = p.first;
      int py = p.second;

      for(int dir=0; dir<4; dir++){
        int tx = px + dx[dir];
        int ty = py + dy[dir];

        if( tx < 0 || tx >= w || ty < 0 || ty >= h ) continue;
        if( b[ty][tx] ) continue;
        if( t[ty][tx] == '#' ) continue;

        b[ty][tx] = true;
        q.push( make_pair(tx, ty) );
      }
    }
    int cnt = 0;
    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        if( b[i][j] ) cnt++;
      }
    }
    cout << cnt << endl;
  }

  return 0;
}

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

const long long mod = 1e9 + 7;

long long modpow(long long a, long long b) {
	if (b == 0) return 1;
	return modpow(a * a % mod, b / 2) * (b & 1 ? a : 1) % mod;
}

long long modinv(long long a) {
	return modpow(a, mod - 2);
}

void add(long long &x, long long y) {
	x += y;
	if (x >= mod) x -= mod;
}

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

	string s;
	cin >> s;

	int m = s.size();

	static long long dp0[5050];
	static long long dp1[5050];

	dp0[0] = 1;

	for (int i = 0; i < n; i++) {
		memset(dp1, 0, sizeof(dp1));
		for (int j = 0; j <= i; j++) {
			add(dp1[j + 1], dp0[j]);
			add(dp1[j + 1], dp0[j]);
			if (j - 1 >= 0) {
				add(dp1[j - 1], dp0[j]);
			} else {
				add(dp1[j], dp0[j]);
			}
		}
		swap(dp0, dp1);
	}

	long long ans = dp0[m] * modpow(modinv(2), m) % mod;
	cout << ans << endl;
}

Measured memory_bytes: 384
N, M = map(int, input().split())
 
A = []
b = []
 
for _ in range(N):
   A.append([int(i) for i in input().split()])
 
for _ in range(M):
   b.append(int(input()))
 
for i in range(N):
   print(sum([A[i][j] * b[j] for j in range(M)]))


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

int n, m, Pow[20];
int a[1100][1100];

void build(int sx, int sy, int ex, int ey)
{
	if(sx == ex && sy == ey)
	{
		a[sx][sy] = 1;
		return;
	}
	int mix = (sx + ex) >> 1, miy = (sy + ey) >> 1;
	build(sx, sy, mix - 1, miy - 1);
	build(sx, miy + 1, mix - 1, ey);
	build(mix + 1, sy, ex, miy - 1);
	build(mix + 1, miy + 1, ex, ey);
	a[mix][miy] = 1;
}

int main()
{
	Pow[0] = 1; for(int i = 1; i < 20; ++i) Pow[i] = Pow[i - 1] * 2;
	scanf("%d %d", &n, &m); int k = max(n, m);
	build(1, 1, Pow[k] - 1, Pow[k] - 1);
	for(int i = 1; i <= Pow[n] - 1; ++i, puts(""))
		for(int j = 1; j <= Pow[m] - 1; ++j) printf("%d", a[i][j]);
	return 0;
}

Measured memory_bytes: 5632
//  *In The Name Of GOD* //
#include <bits/stdc++.h>
#include <bitset>
using namespace std;
#define ll              long long
#define pb              push_back
#define vec             vector
#define str             string
#define S               second
#define pii             pair<int,int>
#define F               first
const int MAXN = 1e6 + 10 ;
const int MOD  = 1e9 +  7 ;
ll inp[MAXN] ;
void solve(){
	int a[5] , ans = 0 ;
	for(int i = 0 ; i < 5 ; i++){
		cin >> a[i] ;
		if(a[i] == 0) ans = i + 1 ;
	}
	cout << ans ;
}

int main(){
	ios::sync_with_stdio(0) ; cin.tie(0); cout.tie(0);


	solve() ;
	/*
	int t ;
	cin >> t ;
	while(t--){
	}
	*/


}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

vector<int> e[200000];
vector<bool> vis;
int c;

void rec(int i){
    if(vis[i]) return;
    vis[i]=true;
    ++c;
    for(auto j:e[i]) rec(j);
}

void solve(){
    int n,m;
    cin>>n>>m;
    {
        int a,b;
        fr(i,m){
            cin>>a>>b;
            --a,--b;
            e[a].emplace_back(b);
            e[b].emplace_back(a);
        }
    }
    vis.assign(n,false);
    int ans{};
    fr(i,n){
        c=0;
        rec(i);
        chmax(ans,c);
    }
    cout<<ans<<'\n';
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int t{1};
    //cin>>t;
    fr(i,t) solve();
}

Measured memory_bytes: 20780
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int idoukaisuu = sc.nextInt();

		int preT = 0;
		int preX = 0;
		int preY = 0;

		for (int i = 0; i < idoukaisuu; i++) {
			int postT = sc.nextInt();
			int postX = sc.nextInt();
			int postY = sc.nextInt();

			int dt = postT - preT;
			int dist = Math.abs(postX - preX) + Math.abs(postY - preY);
			if (dt < dist || (dist - dt) % 2 != 0) {
				System.out.println("No");
				return;
			}
		}

		System.out.println("Yes");
	}
}


Measured memory_bytes: 87280
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;


int main(){
  string S;
  cin >> S;

  int ans = 0;
  int cnt = 0;
  for(int i = 0; i <S.length(); i++){
    if(S[i] =='A' || S[i] =='T' || S[i] =='G' || S[i] =='C') cnt++;
    else ans = max(ans, cnt), cnt = 0;
  }
  ans = max(ans, cnt);
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
#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) for (ll i = init; i < (n); i++)
#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++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)

int main()
{
    ll N, M, cnt = 0;
    cin >> N >> M;
    vector<ll> A(N);
    repi(i, N, 0)
    {
        cin >> A[i];
    }
    double total = accumulate(all(A), 0.);
    total /= 4.0 * M;
    repi(i, N, 0)
    {
        if (A.at(i) >= total){
            cnt ++ ;
        }
    }
    cout << (cnt>=M?"Yes":"No") << endl;
    return 0;
}

Measured memory_bytes: 256
/*
　　　　　　 ＿＿
　　　　　／＞　　 フ
　　　　　|   _　 _l
　 　　　／` ミ＿x ノ   Zzz..
　　 　 /　 　 　 |   コード見ちゃだめ！！
　　　 /　 ヽ　　  ﾉ
　 　 │　　|　|  |
　／￣|　　 |　|  |
　| (￣ヽ＿_ヽ_)_ _)
　＼二つ
*/

#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define REP(i, n) for (int i = 0; i < n; i++)
const int MOD = 1e9 + 7;
typedef long long ll;
const long long INF = 1LL << 60;
using Graph = vector<vector<int>>;

int main() {
  int n, k, r, s, p;
  string t;
  cin >> n >> k >> r >> s >> p >> t;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    if (t[i] == 'r') a[i] = p;
    if (t[i] == 's') a[i] = r;
    if (t[i] == 'p') a[i] = s;
  }
  int total = 0;
  for (int i = 0; i < n; i++) {
    if (i - k >= 0) {
      if (t[i] == t[i - k]) {
        if (t[i] == 'r') total += p;
        if (t[i] == 's') total += r;
        if (t[i] == 'p') total += s;
        t[i] = p;
      }
    }
  }
  int total2 = 0;
  for (int i = 0; i < n; i++) {
    total2 += a[i];
  }
  cout << total2 - total << endl;
}

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

int main(){
  int n,x;
  cin >> n >> x;
  vector<int> l(n);
  int cnt=0,d=0;
  for(int i=0; i < n; i++) cin >> l[i];
  if (d <= x) cnt++;
  for (int j=0; j < n; j++){
      d+=l[j];
      if (d <= x) cnt++;
      else break;
  }
  cout << cnt << endl;
  return 0;
}
    
    

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a[3], b;
    int i, j, k;
    
    for(i = 0; i < 3; i++){
        a[i] = 0;
    }
    
    for(i = 0; i < 10; i++){
        scanf("%d", &b);
        for(j = 0; j < 3; j++){
            if(a[j] < b){
                for(k = 2; k > j; k--){
                    a[k] = a[k-1];
                }
                a[j] = b;
                break;
            }
        }
    }
    
    for(i = 0; i < 3; i++){
        printf("%d\n", a[i]);
    }
    
    return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
char in[110000];
int main(){
	scanf("%s",in);
	int ret=mod;
	for(int i=0;i<2;i++){
		int tmp=0;
		for(int j=0;in[j];j++){
			if(in[j]=='0'+(i+j)%2)tmp++;
		}
		ret=min(ret,tmp);
	}printf("%d\n",ret);
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.*;
import java.math.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main {


    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String in[] = br.readLine().trim().split(" ");
        long a = Long.parseLong(in[0]);
        long b = Long.parseLong(in[1]);
        long mult = a*b;
        System.out.println(mult);

        br.close();

    }
}

Measured memory_bytes: 32712
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#define maxn 5010
#define maxint 0x7fffffff/2
using namespace std;
int main() {
	string str;
	cin>>str;
	for(int i=0; i<str.length(); i++) {
		if(str[i]=='7') {cout<<"Yes"<<endl;return 0;}
	}cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  ll A;
  ll B;
   ll C;
   ll D;
  cin >>A>>B>>C>>D;
  
  ll c1=B/C;
  ll c2=(A-1)/C;
  ll cf=c1-c2;
  ll d1=B/D;
  ll d2=(A-1)/D;
  ll df=d1-d2;
  ll x=__gcd(C,D);
  ll lcm=(C/x)*D;
  ll e1=B/lcm;
  ll e2=(A-1)/lcm;
  ll ef=e1-e2;
  ll finale=cf+df-ef;
  ll finalele=B-A+1-finale;
  cout<<finalele<<endl;
}
    
 

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

using namespace std;
using ull = unsigned long long;
using ll = long long;
using lli = long long int;
using ld = long double;
using pa = pair<int, int>;
using ppa = pair<pa, int>;
#define SORT(v, n) sort(v, v + n);
#define ALL(v) v.begin(), v.end()
#define VSORT(v) sort(ALL(v))
#define GRESORT(v) sort(ALL(v), greater<ll>())
#define REVERSE(v) reverse(ALL(v))
#define overlap(v) v.erase(unique(ALL(v)), v.end())
#define debug(x) cout << #x << ": " << x << endl
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for (int i = (b - 1); i >= a; i--)
#define rrep(i, n) RFOR(i, 0, n)
#define INF INT_MAX
#define SUP INT_MIN
#define mins(a, b) a = min(a, b)
#define maxs(a, b) a = max(a, b)

// 4近傍
// int dy[]={0, 1, 0, -1};
// int dx[]={1, 0, -1, 0};

// 8近傍
// int dy[]={0,0,1,-1,1,1,-1,-1};
// int dx[]={1,-1,0,0,1,-1,1,-1};

// const ll MOD = 1000000007;

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

ll gcd(ll x,ll y){
    if(x == 0) return y;
    return gcd(y%x,x);
}

ll a,b,x;

ll f(ll n){ return (n == -1 ? 0 : n / x + 1);}

void solve(){
    cin >> a >> b >> x;
    cout << f(b) - f(a - 1) << endl;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    solve();

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define Rep(var,init,cnt) for(int (var)=(init); (var)<(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(rall(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) (flag)?1:0
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<"P("<<p.first<<", "<<p.second<<") ";
  return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ================================================

// Template End ======================================================

constexpr int MOD=1e9+7;

int main(void){
  int a,b,c; cin>>a>>b>>c;
  if((a*100+b*10+c)%4==0) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}













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

ll lpow(ll x, ll y, ll m){
  ll r = 1;
  x %= m;
  while (y) {
    if (y & 1) r = (r * x) % m;
    x = (x * x) % m;
    y >>= 1;
  }
  return r;
}

void fast_io() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
}

int main() {
  fast_io();

  ll n, a, mod;
  cin >> n >> a >> mod;

  ll ans = 0, an = a, fv, gap, nxt;
  ll intv = -1;
  unordered_map<ll, int> u;
  for (int i = 1; i <= n; i++) {
    u.insert({an, i});
    nxt = (an * an) % mod;

    if (u.count(nxt) && i < n) {
      intv = i - u[nxt] + 1;
      gap = u[nxt] - 1;
      fv = nxt;
      ans += an;
      break;
    }
    else {
      ans += an;
      an = nxt;
    }

    if (!an) break;
  }

  if (intv == -1) {
    cout << ans << '\n';
    return 0;
  }
  else {
    ll rep = 0;

    an = fv;
    for (int i = 1; i <= intv; i++) {
      rep += an;
      an = (an * an) % mod;
    }

    ll rept = (n - gap) / intv - 1;
    while (rept--) ans += rep;

    ll nn = (n - gap) % intv;
    for (int i = 1; i <= nn; i++) {
      ans += an;
      an = (an * an) % mod;
    }

    cout << ans << '\n';
  }
}


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

using namespace std;

using ll = long long;
using ii = pair<int,int>;

#define ff first
#define ss second

const double PI = 3.141592653589;

const int maxn = 1e5+10;

vector<int> g[maxn];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,m;
	cin >> n >> m;
	vector<int> h(n+1);
	for(int i=1;i<=n;++i){
		cin >> h[i];
	}
	for(int i=0;i<m;++i){
		int a,b;
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	int ans=0;
	for(int i=1;i<=n;++i){
		if(g[i].size()==0){
			++ans;
			continue;
		}
		int mxh=-1;
		for(int j=0;j<g[i].size();++j){
			mxh=max(mxh,h[g[i][j]]);
		}
		if(h[i]>mxh)
			++ans;
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 8708
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int n,m;cin>>n>>m;
  vector<P> res(m);
  int f=1;
  int r=1+m+1;
  bool pos=true;
  for(int i=m;i>0;--i){
    if(pos){
      pos=false;
      res[i-1].first=f;
      res[i-1].second=f+i;
      f++;
    }
    else{
      res[i-1].first=r;
      res[i-1].second=r+i;
      pos=true;
      r++;
    }
  }
  rep(i,m){
    cout<<res[i].first<<" "<<res[i].second<<"\n";
  }
  return 0;
}


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

using namespace std;

int main()
{
	int m,f,b;

	cin >> m>>f>>b;

	if (m >= b)
	{
		cout << "0" << endl;
	}
	else if(m+f >=b)
	{
		cout << b-m << endl;
	}
	else 
	{
		cout << "NA" << endl;
	}
	return 0;
}



Measured memory_bytes: 3096
#!/usr/bin/env python3
import os
from sys import stdin, stdout
    
    
def solve(tc):
    MOD = int(1e9) + 7
    n = int(stdin.readline().strip())
    seq = list(map(int, stdin.readline().split()))

    suffix = [0 for i in range(n)]
    suffix[n-1] = seq[n-1]
    for i in range(n-2, -1, -1):
        suffix[i] = suffix[i+1] + seq[i]
    
    ans = 0
    for i in range(n-1):
        ans += seq[i] * suffix[i+1]
        ans %= MOD
    
    print(ans)


    
tcs = 1
tc = 1
while tc <= tcs:
    solve(tc)
    tc += 1

Measured memory_bytes: 100096
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;

void solve(){
  int n, m, X, Y; cin >> n >> m >> X >> Y;
  vector<int> x(n), y(m);
  for(int i = 0; i < n; i++) cin >> x[i];
  for(int i = 0; i < m; i++) cin >> y[i];
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  int maxx = max(X, x[x.size() - 1]);
  int miny = min(Y, y[0]);
  if(miny - maxx > 0) cout << "No War\n";
  else cout << "War\n";
  return;
}

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


Measured memory_bytes: 256
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	m := scanInt()

	a := make([]int, m)
	b := make([]int, m)

	for i := 0; i < m; i++ {
		a[i] = scanInt()-1
		b[i] = scanInt()-1
	}

	uf := make(unionFind, n)
	uf.init()

	ans := make([]int, m+1)
	ans[m] = n*(n-1)/2
	for i := 0; i < m; i++ {
		ans[m-1-i] = ans[m-i]
		if uf.find(a[m-1-i]) != uf.find(b[m-1-i]) {
			ans[m-1-i] -= uf.size(a[m-1-i])*uf.size(b[m-1-i])
			uf.unite(a[m-1-i], b[m-1-i])
		}
	}

	for i := 0; i < m; i++ {
		fmt.Fprintln(wr, ans[i+1])
	}
}

type unionFind []int

func (uf *unionFind) init() {
	for i := 0; i < len(*uf); i++ { (*uf)[i] = -1 }
}

func (uf *unionFind) find(x int) int {
	if (*uf)[x] < 0 { return x }
	(*uf)[x] = uf.find((*uf)[x])
	return (*uf)[x]
}

func (uf *unionFind) unite(x, y int) {
	x, y = uf.find(x), uf.find(y)
	if x != y {
		if (*uf)[x] > (*uf)[y] { x,y = y,x }
		(*uf)[x] += (*uf)[y]
		(*uf)[y] = x
	}
}

func (uf *unionFind) size(x int) int {
	return -(*uf)[uf.find(x)]
}


Measured memory_bytes: 6528
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

string S;

signed main(){
	cin>>S;
	if(S.size()%2==1){
		cout<<"No"<<endl;
		return 0;
	}
	for(int i=0;i<S.size();i+=2){
		if(S[i]!='h'||S[i+1]!='i'){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int N, M, X, Y; cin >> N >> M >> X >> Y;
    int mx = -1000, my = 1000;
    REP(i, N)
    {
        int x; cin >> x;
        mx = max(mx, x);
    }
    REP(i, M)
    {
        int y; cin >> y;
        my = min(my, y);
    }
    if(X < mx && mx <= Y && X < my && my <= Y && mx < my)
    {
        cout << "No War" << endl;
    }
    else cout << "War" << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000000;
const int mod = 1000000007;
int test[12345678], ok[12345678];
signed main() {
	int n, m, a, b, ans = 0; cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> test[h];
		if (test[h] % 2 == 1) { ans++; }
	}
	if (ans == 0) { cout << "second" << endl; return 0; }
	cout << "first" << endl;
	return 0;
}

Measured memory_bytes: 2304
import java.util.*;

public class Main {
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            String s = sc.nextLine();
            int a = s.length();
            String b[] = s.split("");
            String[] comp1 = new String[a];
            String[] comp2 = new String[a];
            for(int i=0;i<a;i++) {
                comp1[i] = String.valueOf((i + 1)%2); //白スタート
                comp2[i] = String.valueOf((i)%2);
            }
            //差分比較
            int sum1=0;
            int sum2=0;
            for(int i=0;i<a;i++){
                if(!b[i].equals(comp1[i])){
                    sum1++;
                }else if(!b[i].equals(comp2[i])){
                    sum2++;
                }
            }
            int sum;
            if (sum1 < sum2) {
                sum = sum1;
            }else{
                sum = sum2;
            }
            System.out.println(sum);
        }

}



Measured memory_bytes: 55108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

int main() {
    int a,b;
    cin >> a >> b;
    int road = a + b - 1;
    cout << a * b - road << endl;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    std::ios::sync_with_stdio(false);

    char X; char Y;
    cin >> X >> Y;
    if (X < Y)
        cout << "<" << endl;
    else if (X == Y)
        cout << "=" << endl;
    else
        cout << ">" << endl;
}


Measured memory_bytes: 256
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(i64 ngtkana_is_a_genius=0; ngtkana_is_a_genius<(i64)k; ngtkana_is_a_genius++)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    std::string s;
    std::cin >> s;
    i32 l=0, r=s.length();
    while (1<r-l) {
        i32 mid = (l + r) / 2;
        bool ok = false;
        for (i32 p=0; p<2; p++) {
            i32 a = p, b = mid;
            if (p%2!=mid%2) b--;
            bool ng = false;
            for (char c: s) {
                if (c=='0') a++, b++;
                if (c=='1') a--, b--;
                if (c=='?') a--, b++;
                if (a<0) a += 2;
                if (mid<b) b -= 2;
                if (b<a) {
                    ng = true;
                    break;
                }
            }
            if (!ng) {
                ok = true;
                break;
            }
        }
        (ok ? r : l) = mid;
    }
    std::cout << r << '\n';
}


Measured memory_bytes: 4288
#include <bits/stdc++.h>
#define int long long
const int MOD=1e9+7;
using pii=std::pair<int,int>;
using namespace std;

int n, m, u, v;
set<int> adj[200005];
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    for(int i = 0; i < m; i++)
    {
        cin >> u >> v;
        u--; v--;
        adj[u].insert(v);
    }
    for(int i = 1; i < n; i++)
        if(adj[0].count(i) && adj[i].count(n - 1))
        {
            cout << "POSSIBLE\n";
            return 0;
        }
    cout << "IMPOSSIBLE\n";
    return 0;
}

Measured memory_bytes: 19072
#include<bits/stdc++.h>
using namespace std;
#define int long long
int a[1005];
signed main()
{
	int n,k,i,sum=0;
	cin>>n>>k;
	for(i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	for(i=0;i<k;i++)
		sum+=a[i];
	cout<<sum;
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define pb(a) push_back(a)
#define fs first
#define sc second
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

int m;
int ans;
vector<int> used, X, Y;
vector<P> p;

bool parallel(int i, int j, int k, int l){
	LL dx1 = X[i] - X[j];
	LL dy1 = Y[i] - Y[j];
	LL dx2 = X[k] - X[l];
	LL dy2 = Y[k] - Y[l];
	return dx1 * dy2 == dx2 * dy1;
}

void dfs(int d){
    rep(i, m){
        if(!used[i]){
            used[i] = 1;
            for(int j=i; j<m; j++){
                if(!used[j]){
                    used[j] = 1;
                    p[d] = make_pair(i,j);
                    if(d == m/2-1){
                        int ret = 0;
                        rep(k,m/2)for(int l=k+1; l<m/2; l++){
                            if(parallel(p[k].fs, p[k].sc, p[l].fs, p[l].sc)){
                                ret++;
                            }
                        }
                        ans = max(ans, ret);
                    }else{
                        dfs(d+1);
                    }
                    used[j] = 0;
                }
            }
            used[i] = 0;
            break;
        }
    }
}

int main(){
    cin>>m;
    used = vector<int>(m);
    p  = vector<P>(m);
    X = vector<int>(m);
    Y = vector<int>(m);
    rep(i, m) cin >> X[i] >> Y[i];
    dfs(0);
    cout << ans << endl;
}



Measured memory_bytes: 3124
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
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; }
typedef long long ll;
#define pint pair<int,int>
#define pll pair<ll,ll>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s, t; cin >> s >> t;
    int a, b; cin >> a >> b;
    string u; cin >> u;
    if(s==u) a--;
    if(t==u) b--;
    cout << a << " " << b << endl;


    return 0;
}

Measured memory_bytes: 256