akhauriyash/Code-Regression huggingface dataset:
//By Tushar Gautam
#include <bits/stdc++.h>
using namespace std;
#define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout," "))
#define printintv(s,e) copy(s,e, ostream_iterator<int>(cout," "))
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (for ints only diff for ll)
//https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for other in built
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
#pragma GCC optimize ("-O2")
const int LIM = 5e5+5, MOD = 1e9+7;
int t,n,m,k,x,y,a,b;
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    cin>>a>>b;
    if(b==100) b++;
    if(a==0) cout<<b;
    else if(a==1) cout<<100*(ll)b;
    else cout<<100*100*(ll)b;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define BIGINF (int) 4e18 + 7
#define MOD7 1000000007
#define MOD9 1e9 + 9
#define INF  (int)2e9 + 7
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
typedef long long ll;
typedef long double ld;
typedef string str;
typedef double d;
typedef unsigned u;
typedef unsigned long long ull;

int main () {
    //freopen("inputf.txt", "r", stdin);
    //freopen("outputf.txt", "w", stdout);
    int n, a[100005], b[100005], c[100005];
    int dp[100005][3];
    SCD(n);
    MEM(dp, 0);
    for (int i = 0; i < n; i++) {
    	SCD(a[i]);
    	SCD(b[i]);
    	SCD(c[i]);
    }
    for (int i = 1; i <= n; i++) {
    	dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i - 1];
    	dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b[i - 1];
    	dp[i][2] = max(dp[i - 1][1], dp[i - 1][0]) + c[i - 1];
    }
    int ans = max(dp[n][0], max(dp[n][1], dp[n][2]));
    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    int N;
    cin >> N;
    if(!(N%1000)) cout << 0 << endl;
    else cout << 1000-N%1000 << endl;
    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vs vector<string>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-7
//#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; 

int main() 
{
    fastio
    cout<<fixed<<setprecision(10);
    ld n;
    cin>>n;
    cout<<2*PI*n<<endl;
}   

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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Paste snippets here!!

//

void solve(long long N, std::vector<long long> A) {
  unordered_map<ll,ll> S;
  rep(i,N) S[A[i]]++;
  ll ret = 0;
  for(auto kv : S){
    if(kv.second>1)
      ret += kv.second * (kv.second-1) / 2;
  }
  rep(i,N){
    ll ans = ret;
    if(S[A[i]]>1){
      ans -= S[A[i]] * (S[A[i]]-1) / 2;
    }
    if(S[A[i]]>2){
      ans += (S[A[i]]-1) * (S[A[i]]-2) / 2;
    }
    cout << ans << endl;
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  long long N;
  std::cin >> N;
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    std::cin >> A[i];
  }
  solve(N, std::move(A));
  return 0;
}


Measured memory_bytes: 11780
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
const ll inf = 1e18;
const ll mod = 1e9 + 7;

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

// mod. m での a の逆元 a^(-1) を計算する。
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll modpow(ll a, ll n){
    ll res = 1;
    while(n>0){
        if(n&1){
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>=1;
    }
    return res;
}


int main(){
    int n;
    int state[4] = {0};
    cin >> n;
    rep(i,n){
        string s;
        cin >> s;
        // cout << s.compare("AC") << endl;
        if(s=="AC"){
            state[0]++;
        }else if(s=="WA"){
            state[1]++;
        }else if(s=="TLE"){
            state[2]++;
        }else{
            state[3]++;
        }
    }
    cout << "AC x " << state[0] << endl;
    cout << "WA x " << state[1] << endl;
    cout << "TLE x " << state[2] << endl;
    cout << "RE x " << state[3] << endl;
}



Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

using P = pair<int, int>;

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

    int h, w;
    cin >> h >> w;

    int sy, sx;
    cin >> sy >> sx;
    --sy, --sx;

    int ty, tx;
    cin >> ty >> tx;
    --ty, --tx;

    vector< string > field(h);
    rep (i, h)
    {
        cin >> field[i];
    }

    const int inf = 1e9;
    vector< vs32 > d(h, vs32(w, inf));
    d[sy][sx] = 0;

    deque< P > dq;
    dq.push_front(P{sy, sx});
    while (!dq.empty())
    {
        int y = dq.front().first;
        int x = dq.front().second;
        dq.pop_front();
        for (int dy = -2; dy <= 2; ++dy)
        {
            for (int dx = -2; dx <= 2; ++dx)
            {
                if (dy == 0 && dx == 0) continue;
                if ((dy == -1 & dx == 0) || (dy == 0 && dx == -1) || (dy == 1 && dx == 0) || (dy == 0 && dx == 1))
                {
                    int ny = y + dy;
                    int nx = x + dx;
                    if (IN(0, h, ny) && IN(0, w, nx) && field[ny][nx] == '.' && d[ny][nx] > d[y][x])
                    {
                        dq.push_front(P{ny, nx});
                        d[ny][nx] = d[y][x];
                    }
                }
                else
                {
                    int ny = y + dy;
                    int nx = x + dx;
                    if (IN(0, h, ny) && IN(0, w, nx) && field[ny][nx] == '.' && d[ny][nx] > d[y][x] + 1)
                    {
                        dq.push_back(P{ny, nx});
                        d[ny][nx] = d[y][x] + 1;
                    }
                }
            }
        }
    }

    int  ans = d[ty][tx];
    if (d[ty][tx] == inf) ans = -1;
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 8732
/*
 
 Main
 
 */

import java.util.Scanner;
import java.util.Arrays;

public class Main
{
    
    int T;
    int[] card = new int[9];
    
    public void Main()
    {
        
    }
    
    private boolean isGoodSet(int a, int b, int c)
    {
        return isSameNumber(a, b, c) || isSequence(a, b, c);
    }
    
    private boolean isSameNumber(int a, int b, int c)
    {
        return a == b && b == c;
    }
    
    private boolean isSequence(int a, int b, int c)
    {
        return (a+2) == (b+1) && (b+1) == c;
    }
    
    private boolean isAllGoodSet()
    {
        return
        (
            isGoodSet(card[0], card[1], card[2])
            && isGoodSet(card[3], card[4], card[5])
            && isGoodSet(card[6], card[7], card[8])
        );
    }
    
    int win()
    {
        Arrays.sort(card);
        
        do
        {
            if( isAllGoodSet() ) { return 1; }
            
        } while (next_permutation(card));
        
        return 0;
    }
    
    public boolean next_permutation(int A[])
    {
        int first = 0;
        int last = A.length;
        
        if (first == last)
        {
            return false;
        }
        
        int i = first;
        ++i;
        
        if (i == last)
        {
            return false;
        }
        
        i = last;
        --i;
        
        for(;;)
        {
            int ii = i;
            --i;
            
            if (A[i] < A[ii])
            {
                int j = last;
                while (!(A[i] < A[--j])){}
                swap(A, i, j);
                reverse(A, ii, last);
                return true;
            }
            if (i == first)
            {
                reverse(A, first, last);
                return false;
            }
        }
    }
    
    private void swap(int A[], int a, int b)
    {
        int buff;
        buff=A[a];
        A[a]=A[b];
        A[b]=buff;
    }
    
    private void reverse(int A[] ,int first, int last)
    {
        while(first < --last)
        {
            swap(A, first, last);
            first++;
        }
    }
    
    public static void main(String[] args)
    {
        Main main = new Main();
        Scanner scan = new Scanner(System.in);
        
        int T = scan.nextInt();
        for (int t=0; t<T; ++t)
        {
            for (int i=0; i<9; ++i)
            {
                main.card[i] = scan.nextInt();
            }

            
            String color;
            for (int i=0; i<9; ++i)
            {
                color = scan.next();
                if (color.equals("G")) { main.card[i] += 10; }
                else if (color.equals("B")) { main.card[i] += 20; }
            }
            
            int ans = main.win();
            System.out.println(ans);
        
        }
    }
    
}

Measured memory_bytes: 21172
import java.io.BufferedReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Set;
import java.util.StringTokenizer;


public class Main {
	 static class FastReader 
	    { 
	        BufferedReader br; 
	        StringTokenizer st; 
	       
	  
	        public FastReader() 
	        { 
	            br = new BufferedReader(new
	                     InputStreamReader(System.in)); 
	        } 
	  
	        String next() 
	        { 
	            while (st == null || !st.hasMoreTokens()) 
	            { 
	                try
	                { 
	                    st = new StringTokenizer(br.readLine()); 
	                } 
	                catch (IOException  e) 
	                { 
	                    e.printStackTrace(); 
	                } 
	            } 
	            return st.nextToken();
	            
	        } 
	  
	        int nextInt() 
	        { 
	            return Integer.parseInt(next()); 
	        } 
	  
	        long nextLong() 
	        { 
	            return Long.parseLong(next()); 
	        } 
	  
	        double nextDouble() 
	        { 
	            return Double.parseDouble(next()); 
	        } 
	  
	        String nextLine() 
	        { 
	            String str = ""; 
	            try
	            { 
	                str = br.readLine(); 
	            } 
	            catch (IOException e) 
	            { 
	                e.printStackTrace(); 
	            } 
	            return str; 
	        }

			public Character charAt(int i) {
				// TODO Auto-generated method stub
				return null;
			} 
	    } 
	public static boolean solve(long r, long g, long b, long w) {
		 if((r%2+g%2+b%2+w%2)>1)return false;
		 else return true;
	}
	public static void main(String[] args)throws IOException  {
		FastReader s=new FastReader();		
		int n = s.nextInt(); 
		long sum=0;
        long[] ar = new long[n];
        for (int i=0; i<n; i++) {
        	ar[i]=s.nextLong();
        	
        }
        for (int i=1; i<n; i++) {
        	if(ar[i-1]>=ar[i]) {
        		sum+=ar[i-1]-ar[i];
        		ar[i]=ar[i-1];
        		
        	}
        }
        System.out.println(sum);
        
      
	}
	
}


Measured memory_bytes: 56040
def sep(c):
    count=0
    while c%2==0:
        c=c/2
        count+=1
    return count

n=int(input())
a=list(map(int,input().split()))
ans=sep(a[0])
for i in range(1,n):
    ans=min(ans,sep(a[i]))
print(ans)

Measured memory_bytes: 3060
#include <stdio.h>
int main(void){
 
    int sum , i;
    char num[1000];
     
    while(1){
        scanf("%s",num);
        if (num[0]=='0')break;
        for (sum=0,i=0; num[i]!='\0'; i++) {
            sum+=(num[i]-'0');
        }
        printf("%d\n",sum);
        }
 
    return 0;
}

Measured memory_bytes: 536
#include<bits/stdc++.h>
using namespace std;
inline long long int read()
{
    char c=getchar();
    long long int x=0,f=1;
    while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
    while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return x*f;
}
int main()
{
    int n =read(),m = 0;
    map<string,int> _map;
    for(int i = 0; i < n; i++)
    {
        string str;
        cin>>str;
        if(!_map.count(str)) _map[str] = 1;
        else _map[str]++;
        m = max(m,_map[str]);
    }
    map<string,int>::iterator it;
    for(it = _map.begin(); it !=_map.end(); it++)
    {
        if(it->second == m) cout<<it->first<<endl;
    }
}

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

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define SORT(v, n) sort(v, v+n)
#define VREV(v) reverse(v.begin(),v.end())
#define REV(v,n) reverse(v,v+n)
#define vi vector<int>
#define pf push_front
#define pb push_back

template<class T, size_t N> size_t countof(const T (&array)[N]) { return N; }
template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }

void print(){cout<<"\n";}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}

void mprint(auto *matrix,auto N){
	REP(i,N) cout<<matrix<<(i!=N-1?' ':'\n');
	return;
}

const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const long MOD =1e+9+7;
#define PI 3.14159265258979

#define P pair<int,int>
#define Pll pair<ll,ll>
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

inline int in(){int x; cin>>x; return x;}

struct UnionFind{
	vector<int> par; //データiが属する親の番号
	vector<int> sizes; //根ノードiの木に含まれるデータの数

	// 最初は全てのデータiがグループiに存在するものとして初期化
	UnionFind(int n):par(n),sizes(n, 1){
		REP(i,n) par[i] = i;
	}

	// 根を張り替えながら再帰的に根ノードを探す
	int find(int x){
		if(x==par[x]) return x;
		return par[x]=find(par[x]);
	}

	// 2つのデータx, yが属する木をマージする
	void unite(int x, int y) {
		// データの根ノードを得る
		x = find(x);
		y = find(y);

		// 既に同じ木に属しているならマージしない
		if (x == y) return;

		// xの木がyの木より大きくなるようにする
		if (sizes[x] < sizes[y]) swap(x, y);

		// xがyの親になるように連結する
		par[y] = x;
		sizes[x] += sizes[y];
		sizes[y] = 0;  // sizes[y]は無意味な値となるため
	}

	// 2つのデータx, yが属する木が同じならtrueを返す
	bool same(int x, int y) {
		return find(x) == find(y);
	}

	// データxが含まれる木の大きさを返す
	int size(int x) {
		return sizes[find(x)];
	}
};
int gcd(int n,int m){
	if(m>n) return gcd(m,n);
	if(m==0) return n;
	else return gcd(m,n%m);
}

const int MAX_N=100000;
int main(void){
	cin.tie(0);
	ios_base::sync_with_stdio(false);

  int N;
  int A[10000];

  cin>>N;
  REP(i,N) cin>>A[i];

  ll count=0;
  REP(i,N){
    while(A[i]%2==0){
      A[i]/=2;
      count++;
    }
  }

  print(count);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int b[3], i;
	
	for (i = 0; i < 3; i++){
		scanf("%d", &b[i]);
	}
	
	if (b[0] + b[1] == 2 || b[2]){
		printf("Open\n");
	}
	else {
		printf("Close\n");
	}
	
	return (0);
}

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

using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<n; i++)


int main() {
    int N, x=0, ans=0;
    string S;

    cin >> N >> S;

    for(int i =0; i <N ; i++ ){
        if (S[i] == 'I'){
            x ++;
        }
        else{
            x --;
        }
        ans = max(ans,x);

    }

    cout << ans << endl;

}

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

using std::cin;
using std::cout;
using std::endl;
using std::vector;

vector<int> his;

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

  vector<vector<int>> dp(N + 1, vector<int>(3, 0));
  int a, b, c;
  cin >> a >> b >> c;
  dp[1] = {a, b, c};

  for (int i = 2; i <= N; i++) {
    cin >> a >> b >> c;
    dp[i][0] = std::max(dp[i - 1][1], dp[i - 1][2]) + a;
    dp[i][1] = std::max(dp[i - 1][0], dp[i - 1][2]) + b;
    dp[i][2] = std::max(dp[i - 1][0], dp[i - 1][1]) + c;
  }

  int ans = *std::max_element(dp[N].begin(), dp[N].end());
  cout << ans << endl;
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;

int main(){
    ll i,j;
    ll n;
    cin>>n;
    ll x;
    int f=0;
    for(i=0;i<n;i++){
        cin>>x;
        if(x%2==1) f=1;
    }

    if(f==1) cout<<"first"<<endl;
    else cout<<"second"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <functional>

using namespace std;

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

	int conta = 0;
	for (int a = 0; a < N; ++a)
	{
		int val1, val2;
		cin >> val1 >> val2;

		conta += (abs(val1 - val2)+1);
	}
	cout << conta << endl;
	return 0;
}

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

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};



int main(){
  int x,y;
  cin>>x>>y;
  
  if((2*y-x)%3!=0||(2*x-y)%3!=0||2*y-x<0||2*x-y<0){
    cout << 0 << endl;
    return 0;
  }
  
  mint p = (x+y)/3;
  mint q = (2*y-x)/3;
  
  mint ans = 1;
  rep(i,q.x){
    ans = ans*(p-i)/(i+1);
  }
  
  cout << ans.x << endl;
}

Measured memory_bytes: 256
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <string>
#define ll long long
#define ull unsigned long long
#define make(type,x) type x; cin>>x
#define make2(type,x,y) type x,y; cin>>x>>y
#define fr(x,y) for(long long x=0;x<y;x++)
#define makevec(x,y,n) vector <x> y(n); for(ll i=0;i<n;i++) cin>>y[i]
#define M (ll)1000000007
#define MM (ll) 1e8
#define INF (ll) 1e18

# define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)


using namespace std;


template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
bool sortbysec(const pair <ll,ll> &a,const pair <ll,ll> &b){
    return a.second<b.second;
}

struct cmp {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		int lena = a.second - a.first + 1;
		int lenb = b.second - b.first + 1;
		if (lena == lenb) return a.first < b.first;
		return lena > lenb;
	}
};


struct c_h {
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        x ^= FIXED_RANDOM;
        return x ^ (x >> 16);
    }
};

ll calcpow(ll x, ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = calcpow(x, y / 2);
    if (y % 2 == 0)
        return temp * temp;
    else
    {
        if(y > 0)
            return x * temp * temp;
        else
            return (temp * temp) / x;
    }
}
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b,a%b);

}
ll egcd(ll a, ll b, ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1;
    ll y1;
    ll g=egcd(b,a%b,x1,y1);
    x=y1;
    y=x1-y1*(a/b);
    return g;
}


bool isprime(ll a){
bool flag=1;
for(ll i=2;i*i<=a;i++){
    if(a%i==0) {flag=0; break;}
}
return flag;
}

ll dx8[8]={1,0,-1,0,1,-1,1,-1};
ll dy8[8]={0,1,0,-1,1,-1,-1,1};
ll dx4[4]={0,0,1,-1};
ll dy4[4]={1,-1,0,0};


int main(){
    IOS;
    vector <string> s={"AC","WA","TLE","RE"};
    make(ll,n);
    vector <ll> ans(4);
    fr(i,n){
        make(string,t);
        fr(i,4) if(s[i]==t) ans[i]++;
    }
    fr(i,4){
        cout<<s[i]<<" x "<<ans[i]<<endl;
    }



    return 0;
}


Measured memory_bytes: 3592
mod=10**9+7
s=input()
n=len(s)
DP=[[0]*13 for _ in range(n+1)]
DP[0][0]=1
for i in range(n):
  r=pow(10,n-1-i,13)
  if s[i]=="?":
    for j in range(10):
      rr=(r*j)%13
      for k in range(13):
        if k>=rr:
          DP[i+1][k]+=DP[i][k-rr]
        else:
          DP[i+1][k]+=DP[i][k-rr+13]
        DP[i+1][k]%=mod
  else:
    rr=(r*int(s[i]))%13
    for k in range(13):
      if k>=rr:
        DP[i+1][k]+=DP[i][k-rr]
      else:
        DP[i+1][k]+=DP[i][k-rr+13]
      DP[i+1][k]%=mod
print(DP[n][5]%mod)


Measured memory_bytes: 62044
#include<iostream>
#include<stdio.h>
#include<math.h>
#include    <iomanip>
#include    <map>
#include    <set>
#include    <deque>
#include    <vector>
#include    <stack>
using namespace std;
template <class X>
void prr(X test) {
    for(auto it:test){
        cout<<it;
    }
    cout<<endl;
}
int main(){
    map<string, set<int>> ma;
    string a;
    int aa;
    vector<int> b;
    while((cin>>a >>aa)&&(a!="0")){
        ma[a].insert(aa);
    }
    
    for(auto it:ma){
        cout<<it.first<<endl;
        for (set<int>::iterator itt=it.second.begin();itt!=it.second.end();itt++) {
            cout<<*itt;
            if (itt!=it.second.end().operator--()) {
                cout<<" ";
            }
        }
        cout<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1236
#include <cstdio>
#include <cctype>
int N,A[200005],F[200005];
long long Ans;
inline void read(int &Res){
	char ch=getchar();
	for (Res=0;!isdigit(ch);ch=getchar());
	for (;isdigit(ch);ch=getchar()) Res=(Res<<3)+(Res<<1)+ch-48;
}
int main(){
	read(N);
	for (int i=1;i<=N;++i) read(A[i]);
	if (A[1]) return puts("-1"),0;
	for (int i=1;i<N;++i) if (A[i+1]-A[i]>1){return puts("-1"),0;}
	for (int i=2;i<=N;++i) if (A[i]-A[i-1]==1) F[i]=F[i-1]+1,F[i-1]=0; else F[i]=A[i];
	for (int i=1;i<=N;++i) Ans+=F[i];
	printf("%lld\n",Ans);
	return 0;
}

Measured memory_bytes: 1664
#![allow(unused_imports)]

//input
use proconio::input;
use proconio::marker::{Bytes, Chars};
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;
//use std::collections::VecDeque;
//use std::collections::BinaryHeap;

//use std::cmp::*;

fn main() {
    input! {
        n: usize,
        mut a: [u64;n],
    }
    let mut ans = 0;
    for i in 1..n {
        if a[i] < a[i - 1] {
            ans += a[i - 1] - a[i];
            a[i] = a[i - 1];
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 5520
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,temp;
	while(1){
		c=0;
		cin >> a >> b;
		if(a==b && a==0){
			break;
		}
		while(1){
			if(a<b){
				temp=a;
				a=b;
				b=temp;
			}
			a=a%b;
			c++;
			if(a==0){
				cout << b << ' ' << c << endl;
				break;
			}else{
				temp=a;
				a=b;
				b=temp;
			}
		}
	}
}
				
				


Measured memory_bytes: 3068
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char al[300005];
int n,a[300005],b[300005],c=0,d=0,ans=(1<<30);
int main(){
	scanf("%d",&n);
	scanf("%s",&al);
	for(int i=0;i<n;i++){
		if(al[i]=='E') a[i]=a[i-1]+1;//to east
		else a[i]=a[i-1];
		if(al[i]=='W') b[i]=b[i-1]+1;//to west
		else b[i]=b[i-1];
	}
	ans=a[n-1];
	for(int i=1;i<n;i++){
		int k=b[i]+a[n-1]-a[i-1]-1;
		ans=min(k,ans);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2944
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = in.nextInt();
			y[i] = in.nextInt();
		}
		double r = solve(n, x, y);
		System.out.println(r);
		in.close();
	}

	private static double solve(int n, int[] x, int[] y) {
		float r = 0;
		for (int i = 0; i < n; i++)
			r += sum(i, 1 << i, n, x, y);
		return r / n;
	}

	private static double sum(int p, int st, int n, int[] x, int[] y) {
		double r = 0;
		int c = 0;
		for (int i = 0; i < n; i++)
			if ((st & (1 << i)) == 0) {
				c++;
				r += sum(i, st | (1 << i), n, x, y)
						+ Math.pow(Math.pow(x[p] - x[i], 2) + Math.pow(y[p] - y[i], 2), 0.5);
			}
		if (c > 0)
			return r / c;
		else
			return 0;
	}

}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;
int w[110];
int sum[110];
int sumall=0;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>w[i];
	}
	sum[0]=w[0];
	sumall=w[0];
	for(int i=1;i<n;i++){
		sum[i]=w[i]+sum[i-1];
		sumall+=w[i];
	}
	int ans=sumall;
	for(int i=0;i<n-1;i++){
			int tem=abs(sum[i]-(sumall-sum[i]));
			ans=min(ans,tem);
			
	}
	cout<<ans<<endl;
	return 0;
}
	

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.parseLong;
//import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		HashMap<String, Integer> s = new HashMap<>();
		String str;
		Integer cnt;
		for (i = 0; i < n; i++) {
			str = sc.next();
			if((cnt = s.get(str)) == null) {
				s.put(str, 1);
			} else {
				s.put(str, cnt+1);
			}
		}
		int m = parseInt(sc.next());
		for (i = 0; i < m; i++) {
			str = sc.next();
			if((cnt = s.get(str)) == null) {
				s.put(str, -1);
			} else {
				s.put(str, cnt-1);
			}
		}
		sc.close();
		ArrayList<Integer> list = new ArrayList<>(s.values());
		Collections.sort(list, Comparator.reverseOrder());
		out.println(list.get(0)<0?0:list.get(0));
	}
}


Measured memory_bytes: 21844
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

int main() {
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if (x >= r && x <= W - r && y >= r && y <= H - r) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
typedef long long ll;

int main() {
	fast;
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	int ans = 0;
	for (int a = 0; a < n; a++) {
		for (int b = a + 1; b < n; b++) {
			for (int c = b + 1; c < n; c++) {
				if (v[a] == v[b] || v[a] == v[c] || v[b] == v[c]) {
					continue;
				}
				int mx = max(v[a], max(v[b], v[c]));
				if (mx == v[a] && v[b] + v[c] <= mx) {
					continue;
				}
				if (mx == v[b] && v[a] + v[c] <= mx) {
					continue;
				}
				if (mx == v[c] && v[a] + v[b] <= mx) {
					continue;
				}
				ans++;
			}
		}
	}
	cout << ans;
	return 0;
}



















Measured memory_bytes: 3644
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main() {
  int n;
  cin >> n;
  
  int sum = 0;
  vector<int> p(n);
  rep(i,n){
  cin>>p[i]; 
  sum+=p[i];
  }
    
  int m;
  cin>>m;
  rep(i,m){
  int a,b;
  cin >> a >> b;
  cout << sum-p[a-1]+b << endl;  
  }
    
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<cmath>
#include<math.h>
#include <iomanip>
#include<algorithm>
#include<vector>
#include <map>
#define rep(i,N) for(int (i)=0;(i) < (N); ++(i))

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int x,a;
  cin >> x >> a;
  if(x >= a) {
    cout << 10;
  } else {
    cout << 0;
  }
  return 0;
}


Measured memory_bytes: 256
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n,k=n1()
X=n1()

x0=bisect_left(X,0)

if x0<n and X[x0]==0:
    k=k-1
    P=X[x0+1:]
    M=X[:x0]
else:
    P=X[x0:]
    M=X[:x0]

if k==0:
    print(0)
else:
    ans1=ans2=ans3=float("inf")
    if len(P)>=k:
        ans1=P[k-1]
    if len(M)>=k:
        ans2=-M[-k]

    for i in range(1,k):
        j=k-i
        if len(P)>=i and len(M)>=j:
            ans3=min(ans3,P[i-1]*2-M[-j],P[i-1]-2*M[-j])
    print(min(ans1,ans2,ans3))

Measured memory_bytes: 62576
#include <bits/stdc++.h>
using namespace std;
 
#define int long long 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define bp __builtin_popcountll
#define f(i,l,n) for(int i=l;i<n;i++)
#define E "\n"
#define MOD  (int)(1e9+7)
#define float long double
 
const int N = 10000005;
int n;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));
 
int32_t main()
{


    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    int h1,m1,h2,m2,s;
    cin >> h1 >> m1 >> h2 >> m2 >> s;
    int st=h1*60+m1,ed=h2*60+m2;
    cout<<(ed-s)-st<<E;
  return 0;
}

Measured memory_bytes: 3636
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int k = Integer.parseInt(sc.next());
    int[] a = new int[n];
    for(int i = 0; i < n; i++) a[i] = Integer.parseInt(sc.next());
    long ans = (long)Math.ceil((double)(n - 1) / (k - 1));
    System.out.println(ans);
  }
}


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

typedef pair<int,int> P;

int n;
P v[1000];

void solve(){
  int sum = 0, ans;
  int dp[1000][1000];
  fill(dp[0],dp[1000],0);
  sort(v,v+n);
  for(int i=0;i<n-1;i++) sum += v[i].first;
  ans = sum + v[n-1].first;
  for(int i=0;i<n;i++) ans += v[i].second;

  if(sum < v[n-1].first){
    int sum2 = 0;
    for(int i=0;i<n-1;i++){
      sum2 += v[i].second;
      for(int j=0; j<=v[n-1].first-sum; j++){
        if(j >= v[i].second) dp[i+1][j] = max(dp[i+1][j], dp[i][j-v[i].second] + v[i].second);
        dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
      }
    }
    ans += v[n-1].first - dp[n-1][v[n-1].first-sum] - sum;
    //cout << sum << ' ' << dp[n-1][v[n-1].first-sum] << endl;
  }

  cout << ans << endl;
}

int main(){
  while(cin >> n && n){
    for(int i=0;i<n;i++) cin >> v[i].first >> v[i].second;
    solve();
  }
}

Measured memory_bytes: 5076
#include<iostream>
using namespace std;
int rate(int,int,int,int,int);
int main(){
    int a,b,c,d,p;
    cin>>a>>b>>c>>d>>p;
    cout<<rate(a,b,c,d,p)<<endl;
    return 0;
}

int rate(int a,int b,int c,int d,int p){
    int x,y;
    x=a*p;
    if(p>c){
        y=b+d*(p-c);
    }else{
        y=b;
    }
    if(x>y){
        return y;
    }else{
        return x;
    }
}

Measured memory_bytes: 3024
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  int a,b;
  cin >> a >> b;
  if (a%3==0 || b%3==0 || (a+b)%3==0) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
const ll inf=1e9+7;
ll gcd(ll a, ll b) { return (b ? gcd(b, a % b) : a); }
ll lcm(ll a, ll b) { return a / (gcd(a, b)) * b; }

int main(){
  int k,x;
  cin>>k>>x;

  rep(i,x-k+1,x+k-1) cout<<i<<' ';
  
}

Measured memory_bytes: 384
n = input()
hon = {"2", "4", "5", "7", "9"}
pon = {"0", "1", "6", "8"}
bon = {"3"}

if n[-1] in hon:
    print("hon")
if n[-1] in pon:
    print("pon")
if n[-1] in bon:
    print("bon")


Measured memory_bytes: 9044
#include<bits/stdc++.h>
using namespace std;
#define int int64_t
signed main(){	
  int l,r,d,ans=0;
  cin>>l>>r>>d;
  for(int i=l;i<=r;i++){
    if(i%d==0) ans++;
  }
  cout<<ans<<"\n";
  
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define nn 3000008
#define mod 1000000007
int qpow(int x,int y=mod-2){
	int res=1;while(y){
		if(y&1) res=res*x%mod;
		x=x*x%mod;y=y/2;
	}
	return res;
}
int f[nn],rf[nn];
int C(int n,int m){
	return f[n]*rf[m]%mod*rf[n-m]%mod;
}
int y2[2],x2[2];
int go(int x,int y){
	if(x<0 or y<0) return 0;
	return C(x+y,x);
}
int solve(int x1,int yy1,int x3,int y3){
	int ans=0;
	for(int i=y2[0];i<=y2[1];i++){
		ans-=(i-yy1+x2[0]-x1-1)*go(x2[0]-x1-1,i-yy1)%mod*go(x3-x2[0],y3-i)%mod;
		ans+=(i-yy1+x2[1]-x1)*go(x2[1]-x1,i-yy1)%mod*go(x3-1-x2[1],y3-i)%mod;
	}
	for(int i=x2[0];i<=x2[1];i++){
		ans-=(i-x1+y2[0]-yy1-1)*go(i-x1,y2[0]-yy1-1)%mod*go(x3-i,y3-y2[0])%mod;
		ans+=(i-x1+y2[1]-yy1)*go(i-x1,y2[1]-yy1)%mod*go(x3-i,y3-1-y2[1])%mod;
	}
	return ans%mod;
}
int x1[2],x3[2],yy1[2],y3[2];
void in(int a[]){
	for(int i=0;i<2;i++) scanf("%lld",&a[i]);
}
signed main(){
	f[0]=1;for(int i=1;i<nn;i++) f[i]=f[i-1]*i%mod;
	rf[nn-1]=qpow(f[nn-1]);
	for(int i=nn-2;i>=0;i--) rf[i]=rf[i+1]*(i+1)%mod;
	
	in(x1);in(x2);in(x3);in(yy1);in(y2);in(y3);	
	x1[0]--,yy1[0]--;
	x3[1]++,y3[1]++;
		
	int ans=0;
//	for(int i=x1[0];i<=x1[1];i++) for(int j=yy1[0];j<=yy1[1];j++)
//		for(int k=x3[0];k<=x3[1];k++) for(int l=y3[0];l<=y3[1];l++)
//			ans+=solve(i,j,k,l);
	
	for(int i=0;i<2;i++) for(int j=0;j<2;j++) for(int k=0;k<2;k++) for(int l=0;l<2;l++){
		int ret=solve(x1[i],yy1[j],x3[k],y3[l]);
		if(i^j^k^l) ans-=ret;else ans+=ret;ans%=mod;
	}
	ans+=mod;ans%=mod;printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 47228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
//const ll MOD=998244353;

int main(){
  ll A,B,K; cin>>A>>B>>K;
  cout<<max(0LL,A-K)<<" "<<max(0LL,B-max(0LL,K-A))<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<cmath>
using namespace std;
int main()
{
    int n,d,x,a,c;
    cin>>n>>d>>x;
    c=x;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        c+=(d-1)/a+1;
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(n) for (int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t T=0; T<v.size(); ++T){cout << " " << #v << "[" << T << "]=" << v[T];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n, a, b;
    cin >> n >> a >> b;
    vector<lint> v(n);
    repeat(i, n) cin >> v[i];
    sort(v.begin(), v.end(), greater<lint>());
    
    vector<lint> descende;
    map<lint, int> count;
    descende.emplace_back(v[0]);
    count[v[0]] = 1;

    repeat_from(i, 1, n) {
        if (descende.back() == v[i]) {
            ++count[descende.back()];
        }
        else {
            descende.emplace_back(v[i]);
            count[v[i]] = 1;
        }
    }
    
    auto comb = [](int x, int y) -> lint {
        assert(x >= 0 && y >= 0);
        vector<vector<lint>> dp(51, vector<lint>(51, 1));
        repeat(i, 51) {
            repeat(j, 51) {
                if (j == 0 || i == j || i < j) continue;
                dp[i][j] = dp[i-1][j-1] + dp[i-1][j];
            }
        }
        return dp[x][y];
    };
    
    lint ans = 0;
    double ave;
    if (a <= count[descende[0]]) {
        int u = count[descende[0]];
        repeat_from_to(i, a, min(u, b)) {
            ans += comb(u, i);
        }
        ave = descende[0];
    }
    else {
        lint sum = 0;
        int countsum = 0;
        repeat(i, (int)descende.size()) {
            if (countsum + count[descende[i]] > a) {
                ans = comb(count[descende[i]], a - countsum);
                sum += (a - countsum) * descende[i];
                ave = sum / (double)a;
                break;
            }
            else {
                countsum += count[descende[i]];
                sum += count[descende[i]] * descende[i];
            }
        }
    }
    cout << setprecision(20) << ave << endl;   
    cout << setprecision(0)  << ans << endl;
    return 0;
}

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

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

  char c[4] = {'A','C','G','T'};

  int max = 0;
  int count = 0;
  rep(i, s.length()){
    bool flag = false;
    for(char a : c){
      if(s[i] == a){
        flag = true;
        break;
      }
    }
    //cout << flag << endl;
    if(flag){
      count++;
    }else{
      count = 0;
    }
    max = std::max(count, max);
  }

  cout << max << endl;
}


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

int main(){
  int n;
  cin>>n;
  vector<int> a(n+1);
  rep(i,n) cin>>a[i];
  ll ans=0;
  bool odd=0;
  rep(i,n){
    if(a[i]%2!=0 && a[i+1]!=0) a[i+1]++;
    ans+=a[i]/2;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3788
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <stack>
#define MAX_INPUT 100000
#define MAX 1000000000
#define INFTY 2000000000//>MAX

using namespace std;
//常に心してかかれ
//簡単なことを簡単にできるように練習する
//びっくりするくらいつまらないことで詰まってることも多い
//それでも不具合の可能性は常にある


class card{
public:
	char mark;
	int number;

	/*
	card(char MARK,int NUMBER){
		mark = MARK;
		number = NUMBER;
	}
	*/

	/*
	 *デフォルトコンストラクタが自動で生成されるのは、
	 *プログラマがコンストラクタを一つも記述しなかった時のみ
	 *http://brain.cc.kogakuin.ac.jp/~kanamaru/lecture/C++2/09/09-01.html
	 */
	card(){//デフォルトコンストラクタ
	}
};

card deck[MAX_INPUT+1];
card deck_to_check[MAX_INPUT+1];//バブルソートを用いたクイックソートの安定性検証用配列
int n;//num of input


int partition(card A[],int p,int r){//rは配列の最後を指す添え字
	int x = A[r].number;
	int i = p;
	card tmp;
	
	for(int j=p;j<r;j++){
		if(A[j].number <= x){
			tmp = A[i];
			A[i] = A[j];
			A[j] = tmp;
			i++;
		}
	}
	tmp = A[i];
	A[i] = A[r];
	A[r] = tmp;

	return i;
}

//クイックソートの安定性のチェックのため
void bubbleSort(card A[],int N){
	bool flag = true;
	card tmp;

	while(flag){
		flag = false;

		//交換が一回も行われなかった場合flag = trueでforループを抜ける
		for(int j=N-1;j>0;j--){
			if(A[j].number < A[j-1].number){
				tmp = A[j];
				A[j] = A[j-1];
				A[j-1] = tmp;
				flag = true;
			}
		}
	}
}

//すでに整列済みの二つの数列からそれらを合わせた数列を整列させる関数
void merge(card A[],int left,int mid,int right){int n1,n2;
	
	n1 = mid -left;
	n2 = right - mid;
	//n2-n1=right-left

	card L[MAX_INPUT];//n1
	card R[MAX_INPUT];//n2

	for(int i=0;i<n1;i++){
		L[i] = A[left + i];
	}

	for(int i=0;i<n2;i++){
		R[i] = A[mid + i];
	}

	L[n1].number = INFTY;
	R[n2].number = INFTY;

	int i_L=0;
	int i_R=0;
	for(int k=left;k < right;k++){//整列後の数列のk番目の値を決める
		if(L[i_L].number <= R[i_R].number){
			A[k] = L[i_L];//昇順なので小さい方が採用される
			i_L++;
		}else{
			A[k] = R[i_R];//昇順なので小さい方が採用される
			i_R++;
		}
	}
}

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

void quickSort(card A[],int p,int r){
	int q;
	if(p < r){
		q = partition(A,p,r);
		quickSort(A,p,q-1);
		quickSort(A,q+1,r);
	}
}

int main(){
	char tmp_char;
	int tmp_num;
	scanf("%d",&n);
	//printf("%d",n);

	for(int i=0;i<n;i++){
		cin >>tmp_char;//なぜかscanf("%c",&tmp_char)では失敗する
		//printf("%c",tmp_char);
		scanf("%d",&tmp_num);
		//printf("%d",tmp_num);

		deck[i].mark = tmp_char;
		deck_to_check[i].mark = tmp_char;
		deck[i].number = tmp_num;
		deck_to_check[i].number = tmp_num;
	}

	quickSort(deck,0,n-1);
	//bubbleSort(deck_to_check,n);//バブルソートだと途中からTLEになっちゃう
	mergeSort(deck_to_check,0,n);

	for(int i=0;i<n;i++){
		if(deck[i].mark != deck_to_check[i].mark){
			printf("Not stable\n");
			break;
		}
		if(i == n-1){
			printf("Stable\n");
			break;
		}
	}
	for(int i=0;i<n;i++){
		cout <<deck[i].mark <<" " <<deck[i].number <<endl;
	}

	return 0;
}

Measured memory_bytes: 3580