akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <deque>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#define ll              long long
#define pii             pair<int, int>
#define rep(i,a,b)      for(int  i=a;i<=b;i++)
#define dec(i,a,b)      for(int  i=a;i>=b;i--)
using namespace std;
int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846;
const double eps = 1e-6;
const int mod =1e9+7;
const int N = 1e3+5;
//if(x<0 || x>=r || y<0 || y>=c)

inline ll read()
{
	ll x = 0; bool f = true; char c = getchar();
	while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
	while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
	return f ? x : -x;
}
ll gcd(ll m, ll n)
{
	return n == 0 ? m : gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
	return m * n / gcd(m, n);
}
bool prime(int x) {
    if (x < 2) return false;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}
ll qpow(ll m, ll k, ll mod)
{
    ll res = 1, t = m;
    while (k)
    {
        if (k & 1)
            res = res * t % mod;
        t = t * t % mod;
        k >>= 1;
    }
    return res;
}      
bool vis[N][N];
queue<pii> q;
int cnt[N][N];
int main()
{
    int n, m;
    cin >> n >> m;
    vector<string> g(n);
    for (int i = 0; i < n; i++)
        cin >> g[i];
    q.push({ 0,0 });
    vis[0][0] = 1;
    cnt[0][0] = 1;
    while (!q.empty())
    {
        pii f = q.front();
        q.pop();
        for (int i = 0; i < 2; i++)
        {
            int x = f.first + dir[i][0], y = f.second + dir[i][1];
            if (x >= 0 && x < n && y >= 0 && y < m && g[x][y] == '.')
            {
                cnt[x][y] = (cnt[f.first][f.second] + cnt[x][y]) % mod;
                if (!vis[x][y])
                {
                    vis[x][y] = 1;
                    q.push({ x,y });
                }
            }
        }
    }
    cout << cnt[n - 1][m - 1] << endl;
    return 0;
}



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

using namespace std;
#define int long long
const int MOD = 1000000007;
bitset<12805> X[80][80];
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H, W;
	cin >> H >> W;
	vector<vector<int> > A(H, vector<int>(W));
	vector<vector<int> > B(H, vector<int>(W));
	int res = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> A[i][j];
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> B[i][j];
		}
	}
	int C = 12805 / 2;
	X[0][0][C + A[0][0] - B[0][0]] = 1;
	X[0][0][C - A[0][0] + B[0][0]] = 1;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			int diff = abs(A[i][j] - B[i][j]);
			if (i > 0) {
				X[i][j] |= (X[i - 1][j] << diff);
				X[i][j] |= (X[i - 1][j] >> diff);
			}
			if (j > 0) {
				X[i][j] |= (X[i][j - 1] << diff);
				X[i][j] |= (X[i][j - 1] >> diff);
			}
		}
	}
	res = 12805;
	for (int i = 0; i < 12805; i++) {
		if (X[H - 1][W - 1][i]) {
			res = min(res, abs(C - i));
		}
	}
	cout << res << endl;
}

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

int main()
{
	int N,a[100],ans = 100000000;

	cin >> N;

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

	for (int i = -100; i <= 100; i++) {
		int sum = 0;
		for (int n = 0; n < N; n++) {
			sum += (a[n] - i)*(a[n] - i);
		}
		ans = min(ans, sum);
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, x, n) for(int i = x; i < (int)(n); i++)
#define ALL(n) begin(n), end(n)
//struct cww{cww(){ios::sync_with_stdio(false);cin.tie(nullptr);}}star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;

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

  int num = (n * (n - 1)) / 2 + (m * (m - 1)) / 2;

  printf("%d\n", num);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
using namespace std;
using ll=long long;

int main(){
    int n;
    cin>>n;
    vector<ll> x(n),y(n);
    for(int i=0;i<n;i++) cin>>x[i]>>y[i];
    set<pair<ll,ll>> s;
    for(int i=0;i<n;i++) s.insert({x[i],y[i]});
    map<pair<ll,ll>,int> mp;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            ll p=x[i]-x[j];
            ll q=y[i]-y[j];
            if(p==0 && q==0) continue;
            mp[{p,q}]++;
        }
    }
    int res=n;
    for(auto &e:mp){
        res=min(res,n-e.second);
    }
    cout<<res<<endl;
    return 0;
}

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

int N,Z,W;
#define rep(i,s,n) for(int i=s;i<n;i++)

int main(void){
    cin>>N>>Z>>W;
    int a[N];
    rep(i,0,N)cin>>a[i];
    if(N==1){cout<<abs(a[0]-W)<<endl; return 0;}
    //a nとn-1を比較するか、anとWを比較するか
    cout<<((abs(a[N-1]-a[N-2])>abs(a[N-1]-W))?abs(a[N-1]-a[N-2]):abs(a[N-1]-W))<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
 
const int INF = 1000000007;
const int MAX_V = 1000007;
 
typedef long long ll;
typedef pair<int, int> P; //first: ???????????¢???second: ??????????????? 

struct edge{
    int to;
    int cost;
};

int V=0;
vector<edge > G[MAX_V];
int d[MAX_V];

void dijkstra(int s){
  priority_queue<P, vector<P>, greater<P> > qu;
  fill(d, d + V, INF);
  d[s] = 0;
  qu.push(P(0,s));
  while(!qu.empty()){
    P p = qu.top(); qu.pop();
    int v = p.second;    
    if(d[v] < p.first) continue;
    for(int i = 0; i < G[v].size(); i++){
      edge e = G[v][i];
      if(d[e.to] > d[v] + e.cost){
	d[e.to] = d[v] + e.cost;
	qu.push(P( d[e.to], e.to ));
      }
    }
  }
}


int main(){

  int E,r;
  cin >> V >> E >> r;
  for(int i = 0 ; i < E; i++){
    int s , t , d;
    cin >> s >> t >> d;
    edge e = {t,d};
    //    e.to = t; e.cost = d;
    G[s].push_back(e);
  }
  dijkstra(r);
  for(int i = 0; i < V ; i++){
    if (d[i] == INF) cout << "INF" << endl;
    else cout << d[i] << endl;
  }

  return 0;
}

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

int main(){
    int k;
    string s;

    cin>>k;
    cin>>s;

    if(k>=s.size()){
        cout<<s<<endl;
    }else{
        string ans;
        rep(i,k){
            ans += s[i];
        }
        ans +="...";
        cout<<ans<<endl;
    }

}


Measured memory_bytes: 3628
using System;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();

            int n = 1,m = S.Length -2;
            int[] SI = new int[S.Length];
            int maxcnt = 0;

            SI[0] = 1;SI[S.Length - 1] = -1;
            for(int i=1;i<S.Length;i++)
            {
                if(S[n] == 'L')
                {
                    if(S[n-1] == 'L' )
                    {
                        SI[n] = SI[n-1] - 1; 
                    }
                    else
                    {
                        SI[n] = -1;
                    }
                }

                if (S[m] == 'R')
                {
                    if (S[m + 1] == 'R')
                    {
                        SI[m] = SI[m + 1] + 1;
                    }
                    else
                    {
                        SI[m] = 1;
                    }
                }

                if(Math.Abs(SI[n]) > maxcnt )
                {
                    maxcnt = Math.Abs(SI[n]);
                }
                if(Math.Abs(SI[m]) > maxcnt)
                {
                    maxcnt = Math.Abs(SI[m]);
                }
                n++;m--;

            }

            int[] N = new int[S.Length];
            for (int i=0;i<S.Length;i++)
            {
                int w = SI[i];
                if(w % 2 == 0)
                {
                    if(w > 0)
                    {
                        N[i+SI[i]]  += 1;
                    }
                    else
                    {
                        N[i+SI[i]] += 1;
                    }
                }
                else
                {
                    if (w > 0)
                    {
                        N[i+SI[i] - 1] += 1;
                    }
                    else
                    {
                        N[i+SI[i] + 1] += 1;

                    }
                }
            }
            /* 
            Console.WriteLine(" ");
            for (int i=0;i<S.Length;i++)
            {
                Console.Write(SI[i].ToString() + " ");
            }
            Console.WriteLine(" ");
            Console.WriteLine(maxcnt);
            */
            for (int i = 0; i < S.Length; i++)
            {
                Console.Write(N[i].ToString() + ' ');
            }
        }
    }
}


Measured memory_bytes: 17440
import Data.List
main = do
    [n, x] <- map read . words <$> getLine
    as <- sort . map read . words <$> getLine
    let ss = scanl (+) 0 as
    let cs = takeWhile (<=x) ss
    print $ if length cs == n + 1 then
                if last cs == x then n else n-1
            else
                length cs - 1

Measured memory_bytes: 1020
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>

using namespace std;

int main() {
    string s;

    cin >> s;
    for (char c = 'a'; c <= 'z'; c++) {
        bool flag = false;
        for (int i = 0; i < s.length(); i++) {
            if (s[i] == c) flag = true;
        }
        if (flag != true) {
            cout << c << endl;
            return 0;
        }
    }

    cout << "None" << endl;

    return 0;
}



Measured memory_bytes: 512
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>

#define MOD 998244353

#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))

typedef long long int64;

int main(void){
    int N;
    scanf("%d",&N);
    
    char S[N];

    int BL[N],BR[N],B=0;

    for(int i = 0; i < N; i++)
    {
        BL[i]=BR[i]=0;
    }

    scanf("%s",S);
    

    for(int i = 0; i < N; i++)
    {
        if(S[i]=='#'){
            if(i!=0) BL[i]=BL[i-1]+1;
            else BL[i]=1;
            B++;
        }else{
            if(i!=0) BL[i]=BL[i-1];
            else BL[i]=0;
        }
        if(S[N-1-i]=='#'){
            if(i!=0) BR[N-1-i]=BR[N-i]+1;
            else BR[N-1-i]=1;
        }else{
            if(i!=0) BR[N-1-i]=BR[N-i];
            else BR[N-1-i]=0;
        }
    }

    int dp[N];

    for(int i = 0; i < N-1; i++)
    {
        dp[i]=BL[i]+N-i-1-BR[i+1];
        //printf("%3d %3d %3d\n",BL[i],BR[i],dp[i]);
    }

    dp[N-1]=N-B;
    
    int ans=MIN(B,N);

    for(int i = 0; i < N; i++)
    {
        ans=MIN(ans,dp[i]);
    }
    
    printf("%d",ans);
    

    
    
    return 0;
}

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

#define ll long long 
#define sz(x) (int)x.size()

using namespace std;

int main(){
	int x,y,z;
	cin>>x>>y>>z;
	x-=z*2;
	int cnt=x/(y+z);
	int ans=x-cnt*(y+z);
	cout<<cnt+(ans>=y);
}





Measured memory_bytes: 3636
#include <algorithm>
#include <climits>
#include <iostream>
#include <vector>

const int N = 26, D = 365;

using namespace std;
int main() {
    int d;
    cin >> d;
    vector<int> c(N);
    vector<vector<int>> s(D, vector<int>(N));
    for (int i = 0; i < N; ++i)
        cin >> c[i];
    for (int i = 0; i < d; ++i)
        for (int j = 0; j < N; ++j)
            cin >> s[i][j];
    vector<int> ans;
    vector<int> last(N, 0);
    for (int i = 1; i <= d; ++i) {
        int maxt = 0;
        double maxg = LLONG_MIN;
        for (int j = 0; j < N; ++j) {
            double gain = s[i - 1][j];
            for (int k = 0; k < N; ++k)
                if (k != j)
                    gain -= (double)s[i - 1][k] * c[k] * (i - last[k]);
            if (gain > maxg) {
                maxg = gain;
                maxt = j;
            }
        }
        last[maxt] = i;
        ans.emplace_back(maxt + 1);
    }
    for (int i : ans)
        cout << i << endl;
}


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

signed main() {
  std::ios::sync_with_stdio(false);
  int N;
  std::cin >> N;
  std::vector<std::vector<int>> A(2, std::vector<int>(N));
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < N; ++j) {
      std::cin >> A[i][j];
    }
  }
  std::vector<std::vector<int>> dp(2, std::vector<int>(N));
  dp[0][0] = A[0][0];
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < N; ++j) {
      if (i + 1 < 2) {
        dp[i + 1][j] = std::max(dp[i + 1][j], dp[i][j] + A[i + 1][j]);
      }
      if (j + 1 < N) {
        dp[i][j + 1] = std::max(dp[i][j + 1], dp[i][j] + A[i][j + 1]);
      }
    }
  }
  std::cout << dp[1][N - 1] << std::endl;
  return 0;
}


Measured memory_bytes: 256
use std::io::prelude::*;

fn main() {
    let stdin = std::io::stdin();
    let mut reader = std::io::BufReader::new(stdin.lock());
    let mut s = String::new();
    reader.read_line(&mut s).unwrap();
    let s = s.trim();
    for c in s.chars() {
        print!("{}", if c == '9' { '1' } else { '9' });
    }
    println!("");
}


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

using namespace std;

const int N=2e5+5;

int32_t main(){
    ios_base::sync_with_stdio(false);
    int64_t n,d,k;
    cin>>n>>k>>d;
    n=labs(n);
    int64_t t=n/d;
    if(k<t){
        return cout<<n-d*k<<'\n',0;
    }
    if((k-t)%2==0) cout<<n-d*t<<'\n';
    else cout<<abs(n-d*(t+1))<<'\n';
}


Measured memory_bytes: 3612
N=input()

if N[-1]=='2' or N[-1]=='4' or N[-1]=='5' or N[-1]=='7' or N[-1]=='9':
    print('hon')
elif N[-1]=='0' or N[-1]=='1' or N[-1]=='6' or N[-1]=='8':
    print('pon')
else:
    print('bon')


Measured memory_bytes: 9108
#include <bits/stdc++.h>
#include <unordered_map>
/*
**
Success doesn't come to you ,
You Go To IT .
**
*/
using namespace std;
#define all(v)          ((v).begin()), ((v).end())
#define finish(x) return cout << x << endl, 0;
#define pb push_back
#define Compiler_Beso ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define clr(v,d)        memset(v, d, sizeof(v))
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;


ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }


enum dir       { DOWN = 0, UP, RIGHT, LEFT, DOWN_RIGHT, DOWN_LEFT, UP_RIGHT, UP_LEFT };
int  dir_r[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int  dir_c[] = { 0, 0, 1, -1, 1, -1, 1, -1 };


int main()
{
	Compiler_Beso


		int n, a, b;
	cin >> n >> a >> b;
	int l1 = 0, l2 = 0, l3 = 0;
	while (n--)
	{
		int x;
		cin >> x;
		if (x <= a)l1++;
		if (x > a && x <= b)l2++;
		if (x > b)l3++;
	}
	cout << min(l1, min(l2, l3));
	return 0;
}

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

int abs(int a){
  if(a>0) return a;
  return -a;
}

int main(){
  int n;
  cin >> n;
  vector<int> t(n+1,0);
  vector<int> x(n+1,0);
  vector<int> y(n+1,0);
  rep1(i,n){
    cin >> t[i] >> x[i] >> y[i];
    int t_d = t[i] - t[i-1];
    int x_d = abs(x[i] - x[i-1]);
    int y_d = abs(y[i] - y[i-1]);
    if(t_d%2 == (x_d+y_d)%2){
      if(t_d >= x_d+y_d){
        continue;
      }
    }
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

vector<string> calc(string s){
    vector<string> v;
    int pre = 0;
    for(int i=0; i<s.size(); i++){
        if(s[i] == '\"'){
            string t = s.substr(pre, i - pre + 1);
            v.eb(t);

            pre = i;
        }
    }

    string t = s.substr(pre, s.size() - 1 - pre + 1);
    v.eb(t);

    return v;
}

int main(){
    while(1){
        string s1; cin>>s1;
        if(s1 == ".") return 0;
        string s2; cin>>s2;

        if(s1 == s2){
            cout << "IDENTICAL" << endl;
            continue;
        }

        auto ans1 = calc(s1);
        auto ans2 = calc(s2);        

        int dif = 0;
        for(int i=0; i<ans1.size() && i<ans2.size(); i++){
            if(i % 2 == 0){
                if(ans1[i] != ans2[i]) dif = 2;
            }
            else{
                if(ans1[i] != ans2[i]) dif++;
            }
        }

        if(dif == 1){
            cout << "CLOSE" << endl;
        }
        else{
            cout << "DIFFERENT" << endl;
        }
    }
}


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

int main()
{
    ll n,XOR=0,i,ans;
    cin>>n;
    ll arr[n+3];
    for(i=0; i<n; i++)
    {
        cin>>arr[i];
        XOR=XOR^arr[i];
    }
    for(i=0; i<n; i++)
    {
        ans=arr[i]^XOR;
        if(i<n-1)cout<<ans<<" ";
        else cout<<ans<<endl;
    }



    return 0;
}


Measured memory_bytes: 5056
#include <stdio.h>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <math.h>
#include <queue>
#include <string.h>
#include <stdlib.h>
#include <map>
#include <set>

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

const long long INF = 1LL << 60;

using namespace std;
typedef unsigned long long ull;
typedef  long long ll;



int main()
{
	ll N, W;
	cin >> N >> W;
	vector<ll>w, v;
	vector<vector<ll>> dp;
	dp.resize(N+1);
	for (ll i = 0; i < N; i++) {
		ll temp1, temp2;
		cin >> temp1 >> temp2;
		v.push_back(temp1);
		w.push_back(temp2);
	}
	for (ll i = 0; i < N + 1; i++) {
		dp[i] = vector<ll>(W + 1, 0);
	}

	for (ll i = 0; i < N; i++) {
		for (ll sum_w = 0; sum_w <= W; sum_w++) {
			if (sum_w - w[i] >= 0) {
				chmax(dp[i + 1][sum_w], dp[i][sum_w - w[i]] + v[i]);
			}
			chmax(dp[i + 1][sum_w], dp[i][sum_w]);
		}
	}
	
	cout << dp[N][W] << endl;
	return 0;
}


Measured memory_bytes: 10748
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

    string S;
    cin >> S;
    int N = S.size();

    int ans = 0;
    map<int, int> mp{};
    int num = 0, kai = 1;
    mp[0]++;
    int P = 2019;
    for(int i=N-1;i>=0;i--){
        num += (S[i]-'0') * kai;
        num %= P;
        mp[num]++;
        kai = (kai * 10) % P;
    }
    for(auto p : mp){
        int n = p.second;
        ans += n * (n-1) / 2;
    }


    cout << ans << endl;
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  string s;
  cin >> s;

  string prefix = "";
  int st = 0, op = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == ')') {
      if (st == 0) {
        prefix += "(";
      } else {
        st--;
      }
    } else {
      st++;
    }
  }

  string suffix = "";
  for (int i = 0; i < st; ++i) {
    suffix += ")";
  }

  cout << prefix + s + suffix << '\n';

  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<int, int>;
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; }

// auto mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
    ll x; // typedef long long ll;
    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 { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

// combination mod prime
// mintと併用
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
    int k; cin >> k;
    string s; cin >> s;
    int slen = s.length();
    combination comb(2000200);

    mint ans = 0;
    int len = slen+k;
    for(int i = slen-1; i < len; ++i) {
        // snlen:snまでで何個占めてるか
        // rest:26のべき乗できるやつ
        int snlen = i+1;
        int rest = len-snlen;
        mint wl = 25;
        mint wr = 26;
        // snの位置は右端、残りのn-1個の並べ方
        mint sum = comb(snlen-1, slen-1);
        sum *= wl.pow(k-rest);
        sum *= wr.pow(rest);
        ans += sum;
    }
    cout << ans << endl;
}

Measured memory_bytes: 35616
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			String[] str = sc.next().split("/");
			
			final int y = Integer.parseInt(str[0]);
			final int m = Integer.parseInt(str[1]);
			final int d = Integer.parseInt(str[2]);
			
			if(y < 2019) {
				System.out.println("Heisei");
			}else if(y >= 2020) {
				System.out.println("TBD");
			}else if(m <= 4) {
				System.out.println("Heisei");
			}else {
				System.out.println("TBD");
			}
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 23124
import math
N = int(input())
A = [int(_) for _ in input().split()]

ans = A[0]
isOver = False

if 0 in A:
    print(0)
else:
    for i in range(1, N):
        ans *= A[i]
        ans_size = int(math.log10(ans) + 1)
        if ans_size >= 19 and ans - (10**18) >= 1:
            isOver = True
            break

    if isOver:
        print(-1)
    else:
        print(ans)


Measured memory_bytes: 22648
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  int n; scan(n);
  set<int> si;
  rep (i, n) {
    int d; scan(d);
    si.insert(d);
  }
  print((int)si.size());
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
  int a,b,k; cin >> a >> b >> k;
  int ans,count=0;
  vector<int> v;
  for(int i=1;i<=min(a,b);i++){
    if(a%i==0){
      if(b%i==0) v.push_back(i);
    }
  }
  sort(v.rbegin(), v.rend()); //逆順ソートしてk番目を出力
  cout << v[k-1] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

signed main(){
	int a, b;
	scanf("%lld%lld", &a, &b);
	printf("%lld\n",a*b);
	return 0;
}








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

signed main () {
    int x, y, z, k;
    cin >> x >> y >> z >> k;
    vector < int64_t > a(x), b(y), c(z);
    for (int i = 0; i < x; ++i)
        cin >> a[i];
    for (int i = 0; i < y; ++i)
        cin >> b[i];
    for (int i = 0; i < z; ++i)
        cin >> c[i];
    vector < int64_t > ab, abc;
    for (int i = 0; i < x; ++i) {
        for (int j = 0; j < y; ++j)
            ab.push_back(a[i] + b[j]);
    }
    sort(ab.rbegin(), ab.rend());
    for (int i = 0; i < z; ++i) {
        for (int j = 0; j < min(k, int(ab.size())); ++j) 
            abc.push_back(c[i] + ab[j]);
    }
    sort(abc.rbegin(), abc.rend());
    for (int i = 0; i < k; ++i)
        cout << abc[i] << '\n';
}


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

typedef long long ll;

ll MOD = 998244353;

vector<ll> p(200010, 1), q(200010, 0);

struct S{
    long long value;
    int size;
};
using F = long long;

const F ID = 8e18;

S op(S a, S b){ return {(a.value * p[b.size] + b.value) % MOD, a.size+b.size}; }
S e(){ return {0, 0}; }
S mapping(F f, S x){
    if(f != ID) x.value = f*q[x.size];
    return x;
}
F composition(F f, F g){ return (f == ID ? g : f); }
F id(){ return ID; }

int main(){
    rep(i, 200009) p[i + 1] = (p[i] * 10) % MOD;
    q[1] = 1;
    rep(i, 200008) q[i + 2] = (q[i + 1] * 10 + 1) % MOD;
    int N, Q, L, R, D;
    cin >> N >> Q;
    std::vector<S> v(N, {1, 1});
    atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(v);
    rep(i, Q) {
        cin >> L >> R >> D;
        seg.apply(L - 1, R, D);
        cout << seg.all_prod().value << "\n";
    }
}

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


int main() {
    string s;
    cin >> s;
    if(s[0] != s[1] || s[1] != s[2] || s[0] != s[2]){
        cout << "Yes" <<endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#include <vector>

int main() {
  int n,i;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++) {
    scanf("%d",&a[i]);
  }
  int ans = 0;
  for(i=0;i<n;i++) {
    int k = a[i];
    while(k%2==0) {
      ans++;
      k = k/2;
    }
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 256
/*author @dhanush*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define se second
#define fi first
ll MOD = 998244353;
vector<ll>adj[100005];
ll pref[200005];
ll add(ll l, ll r, ll i)
{
  if (l >= i)
    return 0;

  r = max(0LL, i - r - 1);
  return pref[i - l] - pref[r];

}

void icchhipadey()
{

  ll n, k;
  cin >> n >> k;
  vector<pair<ll, ll>>v;
  for (int i = 0; i < k; i++)
  {
    ll a, b;
    cin >> a >> b;
    v.pb({a, b});
  }

  ll dp[n + 1] = {0};
  dp[0] = pref[0] = 0;
  dp[1] = pref[1] = 1;
  for (ll i = 2; i <= n; i++)
  {
    for (auto x : v)
    {
      dp[i] = (dp[i] % MOD + add(x.fi, x.se, i) % MOD);
      dp[i] = (dp[i] + MOD) % MOD;
    }
    pref[i] = (pref[i - 1] % MOD + dp[i] % MOD) % MOD;
  }
  cout << dp[n] << endl;

}

int main()
{


  boost;
  icchhipadey();
}









Measured memory_bytes: 9104
S = input()
MOD = 10 ** 9 + 7

dp = [[0] * 4 for _ in range(len(S) + 1)]
dp[0][0] = 1
for i in range(len(S)):
    for j in range(4):
        if S[i] == '?':
            dp[i + 1][j] = (dp[i + 1][j] + dp[i][j] * 3) % MOD
        else:
            dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MOD
    
    if S[i] == 'A' or S[i] == '?': dp[i + 1][1] = (dp[i + 1][1] + dp[i][0]) % MOD
    if S[i] == 'B' or S[i] == '?': dp[i + 1][2] = (dp[i + 1][2] + dp[i][1]) % MOD
    if S[i] == 'C' or S[i] == '?': dp[i + 1][3] = (dp[i + 1][3] + dp[i][2]) % MOD

print(dp[len(S)][3] % MOD)

Measured memory_bytes: 27624
#include<stdio.h>
#include<string.h>
int main()
{
char a[100], b[100], c[100];
int i, j, m,n,t;
gets(a);
gets(b);
m=strlen(a)+1;
n=strlen(b)+1;
if(m=n)
t=2*n;
else
t=m+n;
for(i=0;i<t;i++)
{ 
if((i)%2==0)
 c[i]=a[i/2];
else
c[i]=b[i/2];
}
c[t]='\0';
puts(c);
return 0;
}

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

main(){
 int n;
cin>>n;
vector <long long int > a(n),b(n),c(n);
for ( int i=0;i<n;i++)
{
cin>>a[i]>>b[i]>>c[i];
}

long long int maxa=a[0];
long long int maxb=b[0];
long long int maxc=c[0];
for(long long int i=1;i<n;i++)
{
long long int maxa1=maxa;
long long int maxb1=maxb;
long long int maxc1=maxc;

maxa=max(maxb1+a[i],maxc1+a[i]);
maxb=max(maxa1+b[i],maxc1+b[i]);
maxc=max(maxa1+c[i],maxb1+c[i]);



}


cout<<max(maxa,max(maxb,maxc));

}


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

using namespace std;

int main()
{
  int n;
  cin >> n;
  vector<int> array;
  array.resize(n);
  for( int i = 0;i < n;++i )
    cin >> array[i];

  for( int i = 0;i < n;++i )
  {
    int index = ( n - 1 - i * 2 );
    if( index < 0 ) index = -index - 1;
    cout << array[index] << " ";
  }
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
#define ll long long
using namespace std;
 
const int sz=4e6+5;

ll k;


int f(ll rem)
{
    cout<<rem<<endl;
    if(rem==0)
        return 0;
    else
        return 1+f((rem*10+7)%k);
}


 
  
int main() 
{ 
    // #ifndef ONLINE_JUDGE 
      
    //     // For getting input from input.txt file 
    //     freopen("input.txt", "r", stdin); 
      
    //     // Printing the Output to output.txt file 
    //     freopen("output.txt", "w", stdout); 
      
    // #endif 
 
    int t=1;
    // cin>>t;
    while(t--)
    {
        
        
        int n;
        cin>>n;
        string s;
        cin>>s;
        int w[n+1]={0},r[n+1]={0};
        for(int i=0;i<n;i++)
        {
            if(s[i]=='W')
            {
                w[i+1]++;
            }
            else
                r[i+1]++;
            w[i+1]+=w[i];
            r[i+1]+=r[i];
        }
        int res=n;
        res=min(res,w[n]);
        res=min(res,r[n]);
        res=min(res,w[r[n]]);
        // cout<<w[n]<<" "<<r[n]<<" "<<w[r[n]]<<endl;
        cout<<res<<endl;




 
    }
    return 0; 
} 

Measured memory_bytes: 5300
#from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N
#math.ceilで切り上げ
#dp = [[0] * 4 for i in range(3)] #2次元配列初期化
#dp = [[[0] * 2 for i in range(3)] for j in range(5)]
#(ord('A'))でASCII出力 Aは65
import math
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

n,r = splitintinput()

if n >= 10:
    print(r)
else:
    print(r+100*(10-n))


Measured memory_bytes: 3772
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define M 1000000007
#define sz(a) (ll)a.size()
#define pll pair<ll,ll>
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll x;
    cin>>x;
    cout<<(360)/__gcd(360LL,x);
}


Measured memory_bytes: 3652
n, m = map(int, input().split())
x = [list(map(int, input().split())) for i in range(m)]
count = 0
for i in range(1000):
    count = 0
    i = str(i)
    if len(i) == n:
        for s, c in x:
            if i[s-1] == str(c):
                count += 1
            else:
                break
        if count == m:
            print(i)
            exit()
print(-1)

Measured memory_bytes: 38256
#include <stdio.h>

int main(void)
{
	int W, H, x, y, r;

	scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);

	if (((x - r < 0) || (x + r > W)) || ((y - r < 0) || (y + r > H)))
	{
		printf("No\n");
	}
	else
	{
		printf("Yes\n");
	}

	return 0;
}


Measured memory_bytes: 2104
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();

        int[] abc = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var a = abc[0];
        var b = abc[1];
        var c = abc[2];
        var k = int.Parse(Console.ReadLine());

        var ans = "";
        for (int i = 0; i < k; i++)
        {
            if (a >= b) b *= 2;
            else if (b >= c) c *= 2;
            else break;
        }

        if (a < b && b < c) ans = "Yes";
        else ans = "No";

        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 28228
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) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s = scan.next();
        System.out.println(s.substring(0, s.length()-8));
    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <algorithm>
using namespace std;


int main () {
	vector<string> v;
	v.push_back("A");
	v.push_back("C");
	v.push_back("G");
	v.push_back("T");
	const int mod = 1000000007;
	int n;
	int res = 0;
	cin >> n;
	unordered_map<string, int> um;

	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 0; k < 4; k++) {
				um[v[i] + v[j] + v[k]] = 1;
			}
		}
	}
	um["AGC"] = 0;
	um["GAC"] = 0;
	um["ACG"] = 0;

	for (int i = 4; i <= n; i++) {
		unordered_map<string, int> uum;

		for (int a = 0; a < 4; a++) {
			for (int b = 0; b < 4; b++) {
				for (int c = 0; c < 4; c++) {
					if (c == 3 && b == 2 && a == 0) {
						uum[v[b] + v[c] + v[0]] += um[v[a] + v[b] + v[c]] % mod;
						// uum[v[b] + v[c] + v[1]] += um[v[a] + v[b] + v[c]];
						uum[v[b] + v[c] + v[2]] += um[v[a] + v[b] + v[c]] % mod;
						uum[v[b] + v[c] + v[3]] += um[v[a] + v[b] + v[c]] % mod;
					}
					else if (c == 0 && b == 2) {
						uum[v[b] + v[c] + v[0]] += um[v[a] + v[b] + v[c]] % mod;
						// uum[v[b] + v[c] + v[1]] += um[v[a] + v[b] + v[c]];
						uum[v[b] + v[c] + v[2]] += um[v[a] + v[b] + v[c]] % mod;
						uum[v[b] + v[c] + v[3]] += um[v[a] + v[b] + v[c]] % mod;
					}
					else if (c == 1 && b == 0) {
						uum[v[b] + v[c] + v[0]] += um[v[a] + v[b] + v[c]] % mod;
						uum[v[b] + v[c] + v[1]] += um[v[a] + v[b] + v[c]] % mod;
						// uum[v[b] + v[c] + v[2]] += um[v[a] + v[b] + v[c]];
						uum[v[b] + v[c] + v[3]] += um[v[a] + v[b] + v[c]] % mod;
					}
					else if (c == 2 && (a == 0 || b == 0)){
						uum[v[b] + v[c] + v[0]] += um[v[a] + v[b] + v[c]] % mod;
						// uum[v[b] + v[c] + v[1]] += um[v[a] + v[b] + v[c]];
						uum[v[b] + v[c] + v[2]] += um[v[a] + v[b] + v[c]] % mod;
						uum[v[b] + v[c] + v[3]] += um[v[a] + v[b] + v[c]] % mod;
					}
					else {
						uum[v[b] + v[c] + v[0]] += um[v[a] + v[b] + v[c]] % mod;
						uum[v[b] + v[c] + v[1]] += um[v[a] + v[b] + v[c]] % mod;
						uum[v[b] + v[c] + v[2]] += um[v[a] + v[b] + v[c]] % mod;
						uum[v[b] + v[c] + v[3]] += um[v[a] + v[b] + v[c]] % mod;
					}
					uum[v[b] + v[c] + v[0]] %= mod;
					
					uum[v[b] + v[c] + v[1]] %= mod;
					uum[v[b] + v[c] + v[2]] %= mod;
					uum[v[b] + v[c] + v[3]] %= mod;
				}
			}
		}
		um = uum;
	}
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 0; k < 4; k++) {
				res += um[v[i] + v[j] + v[k]];
				res %= mod;
			}
		}
	}
	cout << res;
}

Measured memory_bytes: 764
while true
  n, x = $stdin.readline.split(" ").map {|s| s.to_i }

  if n == 0 && x == 0
    break
  end

  count = 0
  (1..n-2).each do |i|
    (i+1..n-1).each do |j|
      (j+1..n).each do |k|
        if i + j + k == x then
          count += 1
        end
      end
    end
  end

  puts count
end



Measured memory_bytes: 6860
#include<iostream>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<algorithm>
#include<functional>
#include<string>
using namespace std;

int main(){
    int A,B,X;
    cin>>A;
    cin>>B;
    abs(X=A-B);
    if(A<9&&B<9&&A+B<17){
    if(X<2){
        cout<<"Yay!"<<endl;
    }
    else{
        cout<<":("<<endl;
    }
    }
    else{
                cout<<":("<<endl;
    }
    
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int x,y,i,k;
  	scanf("%d %d",&x,&y);
  	k=0;
  	for(i=0;i<=x;i++){
      	if(i*2+(x-i)*4==y){k=1;}
    }
  	if(k==0){
    	printf("No\n");
    }else{
    	printf("Yes\n");
    }  
	return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> P;
//priority_queue<int> pque;
//priority_queue<int, vector<int>, greater<int>> pque;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2000000000;//10^9
ll MOD  = 1000000007;

int main(void){
    string S;
    cin >> S;
    int m = 1000;
    for(int i = 0; i < S.size() - 2; i++){
        int ans = 0;
        for(int j = i; j < i + 3; j++){
            ans += (S.at(j) - '0') * pow(10, 2 + i - j);
        }
        ans = abs(ans - 753);
        m = min(m, ans);
    }
    cout << m << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
  float n;
  float a = 0;
  cin >> n;
  for (int i = 1; i <= (int)n; ++i) {
    if (i % 2 != 0) {
      ++a;
    }
  }
  cout << a/n << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int INF=INT_MAX,MOD=1e9+7;

int main(){
    int n,a,b; cin>>n>>a>>b;
    string ans;
    if((b-a)%2==0) ans="Alice";
    else ans="Borys";
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)


	string str[112345];

int main() {

	int N, M, P[112345], Y[112345];
	scanf("%d%d", &N, &M);

	rep(i, M) scanf("%d%d", &P[i], &Y[i]);

	vector<pair<pair<int, int>, int>> city;

	rep(i, M) city.push_back({ { P[i], Y[i] }, (int)i });

	sort(city.begin(), city.end());
	int n,cp=-1;
	rep(i, M) {
		if (cp != city[i].first.first) {
			cp = city[i].first.first;
			n = 1;
		}
		char substr[123];

		sprintf(substr, "%06d%06d", city[i].first.first, n);
		++n;

		str[city[i].second] = substr;
	}

	rep(i, M) {
		printf("%s\n", str[i].c_str());
	}


	return 0;
}


Measured memory_bytes: 9076
import sys
n, k = list(map(int, input().split()))

ws = list(map(int, sys.stdin.read().split()))

def check(A, n, k, mid):
    j = 0
    for i in range(k):
        p = mid
        s = 0
        while (s + A[j]) <= p:
            s += A[j]
            j += 1
            if ( j == n ):
                return n
    return j

def solve(A, n, k):
    h = 100000 * 10000
    l = 0
    while 1 < (h - l):
        mid = (h + l) // 2
        v = check(A, n, k, mid)
        if v < n:
            l = mid
        else:
            h = mid
    return h

print(solve(ws, n, k))

Measured memory_bytes: 18508
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in sys.stdin.readline().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v

def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    A, B, T = li_input()
    print((T // A) * B)


main()


Measured memory_bytes: 5108
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str = scan.nextLine();
		scan.close();
		String[] i = str.split(" ");
		int a = Integer.parseInt(i[0]);
		int b = Integer.parseInt(i[1]);
		int c = a - 2 * b;
		if(c < 0) {
			System.out.println(0);
		}else {
			System.out.println(c);
		}
	}
}


Measured memory_bytes: 23764