akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 1000000007
//#define mod2 20071027
//#define MOD 998244353
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a) for(int i=1;i<=a;i++)
#define base 139
//#define mod 1000074259
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case %lld: ", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
const ll N=200010;
ll x, y, a, b, c, res, va[N], vb[N], vc[N];
vector<ll>v;
int main()
{
    in2(x,y);
    in2(a,b);
    in1(c);
    ll k;
    for(int i=0;i<a;i++)
    {
        in1(va[i]);
    }
    for(int i=0;i<b;i++)
    {
        in1(vb[i]);
    }
    for(int i=0;i<c;i++)
    {
        in1(vc[i]);
    }
    sort(va, va+a);
    sort(vb, vb+b);
    sort(vc, vc+c);
    for(int i=a-1, j=0;i>=0 && j<x;i--, j++)
    {
        v.pb(va[i]);
    }
    for(int i=b-1, j=0;i>=0 && j<y;i--, j++)
        v.pb(vb[i]);
    sort(v.begin(), v.end());
    for(int i=0, j=c-1;i<(x+y); i++)
    {
        if(j>=0 && v[i]<vc[j] )
        {
            res+=vc[j];
            j--;
        }
        else res+=v[i];
    }
    cout<<res<<endl;
    return 0;
}

/*

*/


Measured memory_bytes: 5748
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<stdio.h>
#include<iostream>
#include<numeric>
using namespace std;

int main() {
	int a, b, k;
	cin >> a >> b;
	if (a == b || (a + b) % 2 == 0) {
		k = (a + b) / 2;
		cout << k << endl;
	}
	else
		cout << "IMPOSSIBLE" << endl;
}

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

int main(){
    int n,a,b,c;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a;
        cin >> b;
        cin >> c;
        if(a*a==b*b+c*c || b*b==c*c+a*a || c*c==a*a+b*b){
            cout << "YES" << "\n";
        }else{
            cout << "NO" << "\n";
        }
    }
}

Measured memory_bytes: 2980
N,M,X,Y = map(int, input().split())
num_list = [list(map(int, input().split())) for _ in range(2)]
 
x_max = max(num_list[0])
y_min = min(num_list[1])
 
if x_max >= y_min:
    print('War')
elif x_max < X or y_min > Y:
    print('War')
else:
    print('No War')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define MAXN 3009
using namespace std;

double memo[MAXN][MAXN];

int main(){
  int n; cin >> n;
  vector<double> p(n);
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) memo[i][j] = -1;
  function<double(int, int)> dp = [&](int i, int cnt) {
    if (i == n) {
      if (cnt * 2 > n) return 1.0;
      else return 0.0;
    }
    else if (memo[i][cnt] != -1) return memo[i][cnt];
    else {
      return memo[i][cnt] = p[i] * dp(i + 1, cnt + 1) + (1 - p[i]) * dp(i + 1, cnt);
    }
  };
  printf("%.10f\n", dp(0, 0));
  return 0;
}


Measured memory_bytes: 71040
#include <stdio.h>

int abs(int x){
  if(x<0){
    x*=-1;
  }
  return x;
}

int main(){
  int i,k,n,max=0;
  scanf("%d %d",&k,&n);
  int a[n];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  a[n]=a[0]+k;
  for(i=0;i<n;i++){
    if(abs(a[i]-a[i+1])>=max){
      max=abs(a[i]-a[i+1]);
    }
  }
  printf("%d",k-max);
  return 0;
}

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

using namespace std;
int main() {
	int n;
	int now = 1;
	int tmp;
	int brick = 0;
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> tmp;
		if (now == tmp) {
			now++;
		}

	}
	brick = n - now+1;
	if (brick == n) {
		brick = -1;
	}
	cout << brick;

	return 0;
}

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

int main() {
    string S;
    cin >> S;
    int Ncnt = 0, Wcnt = 0, Scnt = 0, Ecnt = 0;
    for (int i = 0; i < S.length(); i++) {
        switch (S[i]) {
            case 'N': Ncnt++; break;
            case 'W': Wcnt++; break;
            case 'S': Scnt++; break;
            case 'E': Ecnt++; break;
        }
    }
    if ((Ncnt == 0 && Scnt > 0) || (Ncnt > 0 && Scnt == 0) || (Wcnt == 0 && Ecnt > 0) || (Wcnt > 0 && Ecnt == 0)) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int> >v[57];
long long dp[1<<20];
int x[57];
bool dfs(int a,int b,int c,int d){
    if(a==c)
        return 1;
    for(auto it:v[a]){
        if(it.first!=b&&dfs(it.first,a,c,d)){
            x[it.second]^=1<<d;
            return 1;
        }
    }
    return 0;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	for(int i=1;i<n;++i){
        int a,b;
        cin>>a>>b;
        v[a].emplace_back(b,i);
        v[b].emplace_back(a,i);
	}
	int m;
	cin>>m;
	for(int i=0;i<m;++i){
        int a,b;
        cin>>a>>b;
        dfs(a,0,b,i);
	}
	dp[0]=1;
	for(int i=1;i<n;++i)
        for(int j=(1<<m)-1;j>=0;--j)
            dp[j|x[i]]+=dp[j];
    cout<<dp[(1<<m)-1];
	return 0;
}


Measured memory_bytes: 8448
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#define int long long

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template <class T>
bool chmax(T &a, const T &b) {if (a < b){ a = b; return 1;} return 0;}
template <class T>
bool chmin(T &a, const T &b) {if (a > b){ a = b; return 1;}return 0;}
template <class T>
void printv(vector<T> v) {for (T t : v) {cout << t << " ";}cout << '\n';}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" <<endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main()
{
    string s;
    cin >> s;
    int end = s.length() -1;
    int beg = 0;

    int ans = 0;
    while (beg<= end)
    {
        if (s[beg] != s[end]) ans++;
        beg++;
        end--;
    }

    cout << ans << endl;
    



    return 0;
}


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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    if (n == 1) {
        cout << m << endl;
        return 0;
    }
    int ans = 0;
    for (int i=1; i<=(m/n)+1; ++i) {
        if (m%i == 0 and m/i >= n) {
            ans = i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long x = sc.nextLong();
		sc.close();
		
		long ans = 0;
		for(long n = 0;;n += x)
			if(n >= a) {
				if(n <= b)
					ans = (b-n)/x + 1;
				break;
			}
		System.out.println(ans);
	}
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

const int N=3000+5;
const int MOD=(int)1e9+7;

int add(int a,int b)
{
    a+=b;
    if(a>=MOD)
    {
        a-=MOD;
    }
    if(a<0)
    {
        a+=MOD;
    }
    return a;
}

int mul(int a,int b)
{
    return a*(long long)b%MOD;
}

int n;
string s;
int dp[N][N];
int ps[N][N];

int ask(int i,int l,int r)
{
    return add(ps[i][r],-ps[i][l-1]);
}

void build(int i)
{
    for(int j=1;j<N;j++)
    {
        ps[i][j]=add(ps[i][j-1],dp[i][j]);
    }
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n>>s;
    s="."+s;
    if(s[1]=='<')
    {
        dp[1][2]=1;
    }
    else
    {
        dp[1][1]=1;
    }
    build(1);
    for(int i=2;i<n;i++)
    {
        for(int j=1;j<=i+1;j++)
        {
            if(s[i]=='>')
            {
                dp[i][j]=ask(i-1,j,N-1);
            }
            else
            {
                dp[i][j]=ask(i-1,1,j-1);
            }
        }
        build(i);
    }
    int res=0;
    for(int i=1;i<=n;i++)
    {
        res=add(res,dp[n-1][i]);
    }
    cout<<res<<"\n";
    return 0;
}
/**



**/


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

def solve(n, m, *lines):

    
    rows = []
    for line in lines:
        rows.append([int(e) for e in line.split(" ")])

    # print(n)
    # print(m)
    # print(rows)

    result = []
    for k in range(1, m + 1):
        tmp = []
        for i in range(0, n):
#            print(rows[i])
            r = rows[i]
#            print(r[1:r[0] + 1])
            if k in r[1:r[0]+1]:
               tmp.append(i+1)
        if len(tmp) == n:
            result.append(k)

    return str(len(result))

def main():
    # 出力
    params = []
    nm = input().split(" ")
    n = int(nm[0])
    m = int(nm[1])
    params.append(n)
    params.append(m)

    for i in range(0, n):
        params.append(input())   
    print(solve(*params))

if __name__ == '__main__':

    main()


Measured memory_bytes: 3064
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<int> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
ll i,j,k;
ll a[500],b[500],c=0;
ll n,m,q;
ll ans;
 
int main(){
 
	cin>>q;
 
	for(i=0;i<q;i++){
		cin>>a[i]>>b[i];
	}
	for(i=0;i<q;i++){
		ans=0;
		if(a[i]>b[i])swap(a[i],b[i]);
		ll r=sqrt((b[i]*a[i])*1.0);
		if(r*r==a[i]*b[i])r--;
		if(r*r+r>b[i]*a[i]-1){
			ans=2*r-2;
		}else{
			ans=2*r-1;
		}
		if(b[i]==a[i])ans=2*a[i]-2;
		cout<<ans<<endl;
	}
	return 0;
}

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

struct edge {
    int from, to;
    string w;
};

using edges = vector<edge>;

const string INF = "NO";

string solve(edges const& es, int s, int t, const int V) {
    vector<string> d(V, INF);
    d[t] = "";
    for(int i=0; i<V*7; ++i) {
        vector<string> tmp = d;
        for(auto& e : es) {
            if(tmp[e.to] != INF && (tmp[e.from] == INF || tmp[e.from] > e.w + tmp[e.to])) {
                tmp[e.from] = e.w + tmp[e.to];
                
                if(i >= V && e.from == s) {
                    return "NO";
                }
            }
        }
        d.swap(tmp);
    }
    return d[s];
}

int main() {
    int n, a, s, g;
    while(cin >> n >> a >> s >> g, n) {
        edges es(a);
        for(int i=0; i<a; ++i) {
            cin >> es[i].from >> es[i].to >> es[i].w;
        }
        cout << solve(es, s, g, n) << endl;
    }
}


Measured memory_bytes: 3880
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX


void solve()
{
    int n,m;
    cin >> n >> m;
    int h[n];
    inp(h,n);
    bool ans[n] = {0};
    rep(i,0,m-1)
    {
        int l,r;
        cin >> l >> r;
        l--,r--;
        if(h[l]>h[r])
            ans[r] = 1;
        else if(h[r]>h[l])
                ans[l] = 1;
        else
            ans[l] = 1, ans[r] = 1;
    }

    int tot = 0;
    rep(i,0,n-1)
        tot += ans[i]==0;
    cout << tot << endl;
}


signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

Measured memory_bytes: 4524
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

long long modpow(long long x, long long n,int mod) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = (ret * x) % mod;  
        x = (x * x) % mod;
        n >>= 1;  
    }
    return ret;
}

int main(){
    ll n;
    cin >> n;
    string x;
    cin >> x;
    ll p = 0;
    rep(i,n) p += (int)(x[i]-'0');
    ll m1 = p+1,m2 = p-1;
    ll c1 = 1;
    ll c2 = 1;
    ll now1 = 0;
    ll now2 = 0;
    //cout << m2 << endl;
    for(ll i=n-1;i>=0;i--){
        now1 = (now1 + (c1 * (x[i]-'0')))%m1;
        if(m2>0) now2 = (now2 + (c2 * (x[i]-'0')))%m2;
        c1 = (c1*2)%m1;
        if(m2>0) c2 = (c2*2)%m2;
    }
    /*
    cout << now1 << "  "<< now2 << endl;
    cout << m1 <<  " "<< m2 << endl;
    */

    vector<ll> ans(n);
    rep(i,n){
        ll res = 1;
        if(x[i]=='1'){
            ll now = 0;
            if(m2>0) now = (now2 - modpow(2,n-i-1,m2) + m2 )%m2;
            else res = 0;
            //cout << now <<" " << i << endl;
            while(now>0&&m2>0){
                now %= (__builtin_popcount(now));
                ++res;
            }
        }else{
            ll now = (now1 + modpow(2,n-i-1,m1) )%m1;
            //cout << now <<" " << i << endl;
            while(now>0){
                now %= (__builtin_popcount(now));
                ++res;
            }
        }
        ans[i] = res;
    }

    rep(i,n) cout << ans[i] << endl;


    return 0;
}

Measured memory_bytes: 5236
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
s = input()
ans = 0
for i in range(n):
    if i < n-2:
        if s[i:i+3] == 'ABC':
            ans += 1
print(ans)

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


int main(){

    int N;
    cin >> N;

    string s;
    cin >> s;

    int red = 0;
    for(int i = 0; i < s.length(); i++)
    {
        string a = s.substr(i, 1);
        if (a == "R") {
            red += 1;
        }
    }
    
    if ((N - red) < red) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}



Measured memory_bytes: 256
h, w = map(int,input().split())
s = [[0]*(w) for _ in range(h)]

# 外堀は作らない
# 代わりに、8方向の差分を計算する配列を用意




for i in range(h):
    array = list(input())   
        # マス目はスペースで区切られてないから、input split ではだめ
        # list関数を使わないといけない

    for j in range(w):
        s[i][j] = array[j]
        

dxdy = [[1,1],[1,0],[1,-1],[0,1],[0,-1],[-1,1],[-1,0],[-1,-1]]


for i in range(h):
    for j in range(w):
        count = 0
        if s[i][j] == '.':
            for k in range(8):
                dx = dxdy[k][0]
                dy = dxdy[k][1]
                xx = i + dx
                yy = j + dy

                if xx <0 :
                    continue
                if xx > h-1:
                    continue
                if yy <0 :
                    continue
                if yy > w-1:
                    continue

                if s[xx][yy] == '#':
                    count += 1

            s[i][j] = count

            

for i in range(h):
    text = ''
    for j in range(w):
        text += str(s[i][j])
    print(text)







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

using namespace std;

int main() {
	int a, b;
	string op;

	while (true) {
		cin >> a >> op >> b;
		if (op == "+")
			cout << a + b << endl;
		else if(op== "-")
			cout << a - b << endl;
		else if (op == "*")
			cout << a * b << endl;
		else if (op == "/")
			cout << a / b << endl;
		else
			break;		
	}
		
}



Measured memory_bytes: 3172
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int64_t N;
  cin >> N;
  vector<int64_t> A(N);
  rep(i, N) { cin >> A[i]; }
  int64_t mod = 1e9 + 7;
  int64_t answer = 0;
  int64_t sum = A[0];
  for (int i = 1; i < N; ++i) {
    answer += (A[i] * sum) % mod;
    answer %= mod;
    sum = (sum + A[i]) % mod;
  }
  cout << answer << endl;
  return 0;
}


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

int main() {
   // freopen("input.in","r",stdin);
//    freopen("output.out","w",stdout);

    int N, M, K;
    cin >> N >> M >> K;
    for(int x = 0;x <= M;x++) {
        if(M-2*x == 0) {
            if(N*x == K) {
                cout<<"Yes"<<endl;
                return 0;
            }
        } else if((K-N*x)%(M-2*x) == 0 and
                  (K-N*x)/(M-2*x) >= 0 and
                  (K-N*x)/(M-2*x) <= N) {
                      cout<<"Yes"<<endl;
                      return 0;
                  }
    }

    cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
long double pi = 2 * acos(0.0);
const ll mod = 1e9 + 7;

void solve() {
    ll n;
    cin >> n;
    ll a[n], cnt = 0;
    for(ll i = 0; i < n; i++) cin >> a[i];
    for(ll i = 0; i < n; i++) {
        for(ll j = i + 1; j < n; j++) {
            for(ll k = j + 1; k < n; k++) {
                if(a[i] + a[j] > a[k] && a[j] + a[k] > a[i] && a[i] + a[k] > a[j] && a[i] != a[j] && a[j] != a[k] && a[i] != a[k]) cnt++;
            }
        }
    }
    cout << cnt << "\n";
}   

int main() {
    ios_base :: sync_with_stdio(false); 
    cin.tie(nullptr);   
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3632
while line = gets
  a,b =line.chomp.split(" ").map(&:to_i);
  array =gets.chomp.split(" ").map(&:to_i);

  index = 0
  while true
    now = (a + index).to_s

    flg = true
    (now.length).times do|i|
      flg = false if array.any?{|c| c.to_s == now[i]}
    end
    if flg
      puts now
      break;
    end
    index += 1;
  end

end



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

int main(){
    int n;
    cin >> n;
    vector<int> a;
    for(int i=0; i<n; i++){
        int aa;
        cin >> aa;
        a.push_back(aa);
    }
    int m;
    cin >> m;
    vector<int> b;
    for(int i=0; i<m; i++){
        int bb;
        cin >> bb;
        b.push_back(bb);
    }

    vector<int> result;
    // a, bの互いに素な集合を作る->O(N+M)
    set_symmetric_difference(begin(a), end(a), begin(b), end(b), inserter(result, end(result)));

    for(int i=0; i<result.size(); i++){
        cout << result[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 6488
n, m = map(int, input().split())
ok = [0]*n
x = [0]*n
ac, wa = 0, 0

for i in range(m):
  p, s = input().split()
  p = int(p)-1
  if s == "AC" and ok[p] == 0:
    ac += 1
    ok[p] = 1
    wa += x[p]
  elif s == "WA" and ok[p] == 0:
    x[p] += 1
#正解した問題についてのwaを出力しなければいけないのでxについてもリストが必要
print(ac, wa)

   


Measured memory_bytes: 4596
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 
 
 typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
 
#define ll          long long
#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
//#define hell          1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
// mp::cpp_int
 
const int hell=1000000007;

int a[1000010]={0};

int power(int a,int b)
{
  if(b==0)return 1;
   int t=power(a,b/2);
   t*=t;
   t%=hell;
   if(b&1)t*=a;
   t%=hell;
   return t;
}

int inverse(int a)
{
  return power(a,hell-2);
}




int solve()
{
  
int n;
cin>>n;
vi a(n);
rep(i,0,n)cin>>a[i];
int ans=1;
int cnt=1;
for(int i=n-2;i>=0;i--)
{
  if(a[i]>=a[i+1])
    {
      cnt++;
      ans=max(ans,cnt);
    }
    else 
      cnt=1;
    ans=max(ans,cnt);
}

cout<<ans-1;

 return 0;

}
 

signed main()
{  int t=1;

//pri();
  
 ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
  
   cin.exceptions(cin.failbit);                                                                    
 
 

 
  clock_t time_req;
 
    // Without ung pow function
                                                                                                                   
// cin>>t;
 
    int k=1;
     
   while(t--)
     {
      // cout<<"Case #"<<k<<":"<<endl;k++;
     // cout<<endl;
      solve();
     }
        exit(0);
 
         time_req = clock() - time_req;
    cout <<endl<< "Processor time taken is "
      << (double)time_req/CLOCKS_PER_SEC << " seconds" << endl;
 
 
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long  a,b,x,count=0;
	cin>>a>>b>>x;
	count+=b/x;
	if(a!=0)count-=(a-1)/x;
	if(a!=0)cout<<count<<endl;
	else cout<<count+1<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int i;
float t,n,m,a[1000],ans;
int main(){
	cin>>n>>m;
	for(i=0;i<n;i++) cin>>a[i];
	for(i=0;i<n;i++) t+=a[i];
	for(i=0;i<n;i++) if(a[i]/t>=1/(4*m)) ans++;
	if(ans>=m) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;
using vs  = vector<string>;
using pii = pair<int,int>;
constexpr ll inf = 1ll<<61;
constexpr ll mod = 1e9+7;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>void add(T &a, const T &b){a += b; a %= mod;}

constexpr int MAX = 150;
struct edge { int to, cap, rev; };
vector<edge> G[MAX];
bool used[MAX];

void add_edge(int from, int to, int cap) {
  G[from].push_back((edge){to, cap, int(G[to].size())});
  G[to].push_back((edge){from, 0, int(G[from].size()-1)});
}

int dfs(int v, int t, int f) {
  if(v == t) return f;
  used[v] = 1;
  for(int i = 0 ; i < G[v].size(); i++){
    edge &e = G[v][i];
    if(used[e.to] or e.cap <= 0) continue;
    int d = dfs(e.to, t, min(f, e.cap));
    if(d > 0){
      e.cap -= d;
      G[e.to][e.rev].cap += d;
      return d;
    }
  }
  return 0;
}

int ford_fulkerson(int s, int t) {
  int flow = 0, f;
  while(1){
    memset(used, 0, sizeof(used));
    f = dfs(s, t, inf);
    if(f == 0) return flow;
    flow += f;
  }
}

signed main(){
  int n; cin >> n;
  vi a(n+1), b(n+1);
  rep(i,n+1) cin >> a[i];
  rep(i,n+1) cin >> b[i];
  if(accumulate(all(a),0) != n or accumulate(all(b),0) != n){
    cout << "NO\n";
    return 0;
  }
  int an = 0, bn = 0;
  rep(i,n+1){
    an += i * a[i];
    bn += i * b[i];
  }
  if(an != bn){
    cout << "NO\n";
    return 0;
  }

  vi c(n), d(n); // どのノードの次数がいくつか
  int j = 0, k = 0;
  rep(i,n+1){
    rep(_,a[i]){
      c[j] = i;
      j++;
    }
    rep(_,b[i]){
      d[k] = i;
      k++;
    }
  }
  // G は0~n-1が出,n~2n-1が入,2nが始点2n+1が終点
  rep(i,n) rep(j,n) add_edge(i,n+j,1);
  rep(i,n){
    add_edge(2*n,i,d[i]);
    add_edge(n+i,2*n+1,c[i]);
  }
  int cn = ford_fulkerson(2*n,2*n+1);
  dump(an, cn);
  vvi g(n, vi(n,0));
  rep(i,n) rep(j, G[i].size()){
    // cout << i << " " << G[i][j].to << " " << G[i][j].cap << " " << G[i][j].rev << endl;
    if(n <= G[i][j].to and G[i][j].to < 2*n and G[i][j].cap == 0)
      g[i][G[i][j].to-n] = 1;
  }
  dump(g);
  cout << "YES\n";
  rep(i,n){
    cout << g[i][0];
    FOR(j,1,n) cout << " " << g[i][j];
    cout << endl;
  }
}



Measured memory_bytes: 3244
#include<cstdio>
#define For(i,j,k) for(int i=j;i<=k;i++)
using namespace std;
int read(){
	int l=1,x=0; char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') ch=getchar(),l=-1;
	while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x*l;
}
int main(){
	int ans=0,n=read(),a[100005]={0},x;
	For(i,1,n){
		x=read(); if (x==i) a[i]=1;
	}
	x=0;
	For(i,1,n){
		if (a[i]==0){if (x!=0) ans+=(x+1)/2,x=0;}
		else x++;
	}
	printf("%d\n",ans+(x+1)/2);
	return 0;
}

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

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if((a==b&&a!=c)||(b==c&&c!=a)||(c==a&&b!=a))
        cout<<"Yes\n";

        else
            cout<<"No\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define SHOW(x) cout << #x << ": " << x << endl;
template<class T> ll sumArr(const T& a){ return accumulate(all(a), 0LL);}
template<class T> auto minArr(const T& a){ return *min_element(all(a));}
template<class T> auto maxArr(const T& a){ return *max_element(all(a));}
template<class T> void DEBUG_PRINT(T tmp){cout<<tmp<<'\n';}
template<class T1,class... T2> void DEBUG_PRINT(T1 tmp,T2... tmp2){cout<<tmp<<" ";DEBUG_PRINT(tmp2...);}
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a / gcd(a, b) * b; }
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

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

    int a,b,c,d;
    int arr[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    string str;

    cin>>a;
    cout<<arr[a-1]<<endl;



    return 0;
}


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

using ll    = long long;
using ull   = unsigned long long;
using veci  = vector<int>;
using vecll = vector<ll>;
#define EPS (1e-7)
#define INF (1e9)
#define PI  (acos(-1))
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define REP(i,n) for(int i= 0;i<(int)(n);++i)
#define pb push_back

veci enum_div(int n){
	veci ret;
	ret.pb(1);
	for(int i=1;i*i<n;i++){
		if(n%i==0){
			ret.pb(i);
			if(i != n/i){ret.pb(n/i);}
		}
	}
	ret.pb(n);
	return ret;
}
int gcb(int a,int b){return ((b == 0)? a : gcb(b,a%b));}
int gcd(int a,int b){return (a*b) / gcb(a,b);}

int main(){
    int n;
    cin >> n;
    int ans = n/3;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;
#define rep(i, n)  for (int i = 0; i <  (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(), (x).end()
const ll INF = ll(1e18)+1;

bool check_number(ll target_number,vector<ll> target_list){
    rep(i,target_list.size()){
        if(target_number == target_list[i]){
            return false;
        }
    }
    return true;
}

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

    ll x,n;
    cin >> x >> n;
    vector<ll> pn(n);
    rep(i,n) cin >> pn[i];

    bool flag = true;
    ll count = 0;
    while(flag){
        if(count == 0){
            if(check_number(x,pn)){
                cout << x;
                return 0;
            }
        }
        else{
            if(check_number(x - count,pn)){
                cout << x - count;
                return 0;
            }
            else if(check_number(x + count,pn)){
                cout << x + count;
                return 0;
            }
        }
        count++;
    }
}

Measured memory_bytes: 3612
N = int(input())
h = list(map(int, input().split()))

def chk(n, ls):
    ret = 0
    flag = False
    for i in ls:
        if i >= n and flag == False:
            ret += 1
            flag = True
        elif i < n:
            flag = False
    return ret

ans = 0
i = 1
hmax = max(h)
while i <= hmax:
    ans += chk(i, h)
    i += 1
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;

template <class T> using V = vector<T>;

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

const long long INF = 1LL << 60;

using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;



#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);



ll Sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}



const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}


#define comuse Comuse()

ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll perm(int n,int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] % MOD) % MOD;
}


ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}

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

    a=a*a%mod;
    
    n>>=1;
  }

  return ans;
}

void Solve();


const int MAX_N = 131072;
//segment tree 
int NN;
int seg[MAX_N*2-1];
void seguse(){
  for(int i=0;i<2*NN-1;i++){
    seg[i]=INT_MAX;
  }
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
//segtreeの葉の先頭の添え字はn-1
void Solve(){
  //vll segtree(524287);
  //ll N=262144;
  ll a,b,c,d;
    cin>>a>>b>>c>>d;
  cout<<c-a<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T> void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T> void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U> bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U> bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T> bool even(T n) { return ! (n & 1); }
template<class T> bool odd(T n) { return n & 1; }
template<class T> ll rup(T a, T b) { return a % b ? a / b + 1 : a / b; }
template<class T> ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T> ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
ll intpow(ll a, ll n, ll _mod=numeric_limits<ll>::max()) { ll p=1; while (n) { if (n&1) p=p*a%_mod; a=a*a%_mod; n>>=1; } return p; } 
ll modc(ll a, char op, ll b, ll _mod=mod)
{
        a %= _mod; b %= _mod; ll res = 1;
        switch (op) {
        case '+': res = (a + b) % _mod; break;
        case '-': res = (a - b) % _mod; break;
        case '*': res = a * b % _mod; break;
        case '/': res = modc(a, '*', modc(b, '^', _mod-2, _mod), _mod); break;
        case '^': res = intpow(a, b, _mod); break;
        case 'P': rep(i, a-b+1, a+1) res = modc(res, '*', i, _mod); break;
        case 'C': res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod)); break;
        } 
        if (res < 0) { res += _mod; } return res;
}



int main()
{
        ll S;
        cin >> S;
        vll dp(S+1);

        dp[0] = 1;
        rep(i, 1, S+1) {
                rep(j, 0, i-2) {
                        dp[i] = modc(dp[i], '+', dp[j]);
                }
        }

        cout << dp[S] << endl;
}


Measured memory_bytes: 3636
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		N = N%1000;
		if(N != 0)
			System.out.println(1000 - N);
		else
			System.out.println(0);

	}
}



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

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


signed main() {
    ll i, o, _, l, j;
    cin >> i >> o >> _ >> l >> j >> _ >> _;

    ll ans = 2 * o;
    vl a = {i, l, j};

    rep (i, a.size()) {
        if (a[i] % 2 == 1) {
            ans += (a[i] - 1) * 2;
            a[i] = 1;
        }
        else {
            if (a[i] > 0) {
                ans += (a[i] - 2) * 2;
                a[i] = 2;
            }
        }
    }

    sort(all(a));

    if (a[0] == 2) {
        ans += 12;
    }
    else if (a[1] == 2) {
        ans += 8;
    }
    else if (a[0] == 1) {
        ans += 6;
    }
    else if (a[2] == 2) {
        ans += 4;
    }
    cout << ans / 2 << endl;
}

Measured memory_bytes: 3612
a, b, c = map(int, input().split())
a1, a2 = a//2, (a+1)//2
x = b*c*(a2-a1)
b1, b2 = b//2, (b+1)//2
y = a*c*(b2-b1)
c1, c2 = c//2, (c+1)//2
z = a*b*(c2-c1)
print(min(x, y, z))


Measured memory_bytes: 9160
import scala.annotation.tailrec

object Main extends App {

  import scala.io.StdIn._

  solve
  @tailrec
  def solve: Unit = {
    val n = readLine.trim.toInt
    if (n == 0) return
    val teams = Array.tabulate(n){_ ⇒
      readLine.trim.split(' ').map(_.toInt)
    }.sortBy(l ⇒ (1 until 8).by(2).map(i ⇒ l(i) * 60 + l(i + 1)).sum)
    println(teams(0).head)
    println(teams(1).head)
    println(teams(n - 2).head)
    solve
  }
  implicit class Extension[T](value :T){
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
    @inline
    def also(@inline func: T ⇒ Unit): T = {func(value); value}
  }
}


Measured memory_bytes: 173072
using System;
using System.Linq;
using System.Collections.Generic;

namespace Atcoder
{
    class Program
    {
        public static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int[] intInput = new int[3];
            for (int i = 0; i < 3;i++){
                intInput[i] = int.Parse(input[i]);
            }

            for (int i = 0; i < 9;i++){
                for (int j = 0; j < 3;j++){
                    if (intInput[j] == 9 - i)
                    {
                        int max = 10 * intInput[j] + intInput[0] + intInput[1] + intInput[2] - intInput[j];
                        Console.WriteLine(max);
                        return;
                    }  
                 
                }
            }

        }

    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
	int A, B;
	cin >> A >> B;
	if (A >= 10 || B >= 10) {
		cout << -1 << endl;
	}
	else {
		cout << A * B << endl;
	}
	return 0;
}

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

int main() {
  int N ,D;
  cin >> N >>D;
  if (N%(2*D+1) == 0){
      cout << (N/(2*D+1)) << endl;
  }
  else{
        cout << (N/(2*D+1))+1 << endl; 
        }  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

lint log_pow(lint base, lint bit) {
	lint res = 1;
	while (bit) {
		if (bit & 1) res *= base;
		base = base * base;
		bit >>= 1;
	}
	return res;
}

int main() {
	lint N, P;
	cin >> N >> P;
	
	unordered_map<lint, lint> m;
	
	lint i = 2;
	while (i * i <= P) {
		if (P % i == 0) {
			P /= i;
			m[i]++;
		}
		else {
			i++;
		}
	}
	if (P != 1) m[P]++;
	
	lint res = 1;
	
	for (auto&& p : m) {
		lint t = p.second / N;
		res *= log_pow(p.first, t);
	}
	
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int n,m,i,j;
    int A[100][100],B[100],C[100]={0};/*0で初期化*/
    scanf("%d%d",&n,&m);
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            scanf("%d",&A[i][j]);
        }
    }
    for(i=0;i<m;i++)
    {
        scanf("%d",&B[i]);
    }
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        { 
            C[i]+=A[i][j]*B[j];
        }
        printf("%d\n",C[i]);
    }
    return 0;
}


Measured memory_bytes: 2112
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
		int c=sc.nextInt();
    
 	if(a>=b+c){
    		System.out.println(0);
    	}else{
     		System.out.println(b+c-a);
   	 }

    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
long long a,b,x;
long long f(long long n){
  if(n>=0)return n/x+1;
  else return 0;
}
int main(){
  std::cin>>a>>b>>x;
  std::cout<<f(b)-f(a-1);
  return 0;
}

Measured memory_bytes: 3580
N,K=map(int,input().split())
A=sorted(map(int,input().split()))
F=sorted(map(int,input().split()))[::-1]

left,right=-1,10**12
while left + 1 < right:
    mid = (left + right)//2
    if sum([max(0,a-mid//f) for a,f in zip(A,F)])>K:
        left = mid
    else:
        right = mid
print(right)

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

int main(){
  int N;
  cin>>N;
  int X[N];
  int Y[N];
  for(int i=0;i<N;i++){
    cin>>X[i];
    Y[i]=X[i];
  }
  sort(Y,Y+N);
  int M1=Y[(N-2)/2];
  int M2=Y[N/2];
  for(int i=0;i<N;i++){
    if(X[i]<M2){
      cout<<M2<<endl;
    }
    else cout<<M1<<endl;
  }
  return 0;
}  

Measured memory_bytes: 3840
M, K = [int(_) for _ in input().split()]
if [M, K] == [1, 0]:
    print(0, 0, 1, 1)
elif K >= 2**M or K == M == 1:
    print(-1)
else:
    ans = list(range(2**M))
    ans.pop(K)
    print(*([K] + ans + [K] + ans[::-1]))
# https://img.atcoder.jp/abc126/editorial.pdf


Measured memory_bytes: 14184
# B - Buffet
N = int(input())
Alist = list(map(int, input().split()))
Blist = list(map(int, input().split()))
Clist = list(map(int, input().split()))

ans = 0
for i in range(N):
    ans += Blist[Alist[i] - 1]
    if i > 0 and Alist[i] - Alist[i - 1] == 1:
        ans += Clist[Alist[i - 1] - 1]
    
print(ans)

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




int main()
{
	int n;
	cin >> n;
	vector<string> s(n);
	bool check = true;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (s[i] == s[j] && i != j) {
				check = false;
				break;
			}
		}
	}
	string t;
	t = s[0];
	string temp = t;
	for (int i = 1; i < n; i++) {
		t = s[i];
		if (temp[temp.length() - 1] != t[0]) {
			check = false;
			break;
		}
		temp = t;

	}

	if (!check)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
	
	return 0;
}

Measured memory_bytes: 256
void main() {
	auto ip = readAs!(int[]), N = ip[0], T = ip[1];
	auto t = readAs!(int[]);
	ulong tmp = t[0];
	ulong res;
	foreach(i; t) {
		if(tmp+T > i) res += i-tmp;
		else res += T;
		tmp = i;
	}
	writeln(res+T);
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 11224