akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC119 {
	class ABC119_A {
		static void Main(string[] args) {
			var input = Console.ReadLine().Split('/').Select(int.Parse).ToArray();
			var year = input[0];
			var month = input[1];
			var day = input[2];
			var inDate = new DateTime(year, month, day);
			var borderDate = new DateTime(2019, 5, 1);
			Console.WriteLine(inDate < borderDate ? "Heisei" : "TBD");
		}
	}
}


Measured memory_bytes: 13396
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

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

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  rep(i, M) cin >> A[i];
  int sum {};
  rep(i, M) {
    sum += A[i];
  }
  if (sum > N) {
    cout << "-1\n";
  } else {
    cout << N - sum << '\n';
  }
}


Measured memory_bytes: 3196
# ABC084B

a, b = map(int, input().split())
s = input()
ans = 'Yes'
if s[a] != '-':
    ans = 'No'
else:
    for i, c in enumerate(s):
        if (c < '0' or c > '9') and i != a:
            ans = 'No'
            break
print(ans)


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

using namespace std;

int main()
{
    long long int n,i,z,s=0;
    cin>>n;
    vector<long long int> v;
    for (i=0;i<n;++i){

        cin>>z;
        v.push_back(z);
        s+=z;

    }
    sort(v.begin(),v.end());
    cout<<v[0]<<' '<<v[n-1]<<' '<<s<<endl;
    return 0;

}



Measured memory_bytes: 3280
#include<bits/stdc++.h>
typedef  long long int ll;
typedef  long double ld;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define mod 1000000007
#define F first
#define S second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//recursions\
#pragma comment(linker, "/stack:200000000")
//loops\
#pragma GCC optimize("unroll-loops")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;

const int N = 1e6 + 5;
int main()
{
	sync;
		
	ll x;
	cin >> x;
	cout << (x ^ 1);	
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  string S;
  cin>>S;
  int N=S.size();
  string ans;
  rep(i,0,N){
    if(S[i]=='B'){
      if(ans[0]=='0'||ans[0]=='1')
      ans.pop_back();
      }
    else
      ans+=S[i];
  }
  cout<<ans<<endl;
  }



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

int main()
{
  int n, x, t;
  cin >> n >> x >> t;

  int time = 0;
  if(n%x!=0) {
    n /= x;
    n++;
  }
  else
    n /= x;
  time = n * t;

  cout << time << endl;


  return 0;
}


Measured memory_bytes: 3556
#include<stdio.h>
int main()
{
  int x,y;

  while(1){
    scanf("%d%d",&x,&y);
    if(x==0 && y==0) break;
    if(x>y) printf("%d %d\n",y,x);
    else printf("%d %d\n",x,y);
  }
  return 0;
}

Measured memory_bytes: 600
K, N = map(int, input().split())
A = list(map(int, input().split()))
load = 0

A = sorted(A)

for i in range (N-1):
    n = A[i + 1]
    m = A[i]
    if n - m > load:
        load = n - m

if A[0] + (K-A[N-1]) > load:
    load = A[0] + (K-A[N-1])

print(K-load)


Measured memory_bytes: 26444
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define rusha scanf("%d",&n);rep(i,1,n)scanf("%d",&a[i]);
#define rushb scanf("%d",&t);while(t--)
#define debug(x) cout<<" L-B-W-- "<<x<<" --N-B\n"
#define pb push_back
//#define pii pair<int,int>
#define vii vector<int>
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof a)
#define all(x) (x.begin(),x.end())
#define judgef printf("%s\n",f?"Yes":"No")
#define Judgef printf("%s\n",f?"YES":"NO")
#define sz(x) ((int)(x).size())
#define sf(x) (sizeof(x))
using namespace std;
typedef long long ll;
typedef double db;
const double pai = acos(-1.0);
const double eps = 1e-8;
const int mod=998244353;
//const int mod=1e9+7;
const int inf=1e9+7;
//const ll inf=0x7f7f7f7f1234abcd;
const int maxn=1e5+10;
inline ll ksm(ll x,ll y){ ll res=1; while(y){if(y&1) res=res*x%mod;x=x*x%mod; y>>=1;} return res; }
inline ll inv(ll a,ll p){if(a==1)return 1;return (p-p/a)*inv(p%a,p)%p;}
ll lcm(ll a, ll b) { return a * b / __gcd(a, b); }

int t,n,m,k;
ll a[maxn];
int main(){
    ll x;
    scanf("%lld",&x);
    for(ll i=0;i<=1000;i++) a[i]=i*i*i*i*i;
    rep(i,0,1000) rep(j,0,1000) if(a[i]+a[j]==x) {printf("%d %d\n",i,-j);return 0;}
    rep(i,0,1000) rep(j,0,1000) if(a[i]-a[j]==x) {printf("%d %d\n",i,j);return 0;}
    return 0;
}


Measured memory_bytes: 3792
#include<iostream>

using namespace std;

int main()
{
	int n,i,j;
	int sum;
	int ans[1024]={0};
	
	
	for(i=1;i+i+1<1001;i++)
	{
		sum=i+i+1;
		for(j=i+2;sum<1001;j++)
		{
			ans[sum]++;
			sum+=j;
		}
	}
	
	for(;;)
	{
		cin >> n ;
		if(n==0)
			break;
		cout << ans[n] << endl;
	}
}

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

using namespace std;

int main()
{
	int N, A[110], B[110];
	int i,sum = 0;
	cin >> N;
	for(i=1;i<=N-1;i++) {
		cin >> B[i];
	}
	for(i = 1; i <= N-2; i++) {
		sum += min(B[i],B[i+1]);
//		cout << "i:" << i << "  sum:" << sum << endl;
	}
	sum += B[1]+B[N-1];
	cout << sum << endl;
	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

long long num[200];
char s[210000];

int main(){
	scanf("%s",s+1);
	int len=strlen(s+1);
	for (int i=1;i<=len;i++){
		num[s[i]]++;
	}
	long long ans=0;
	for (int i='a';i<='z';i++){
		long long tmp1=0;
		for(int j=i+1;j<='z';j++){
			tmp1+=num[j];
		}
		ans=ans+tmp1*num[i];
	}
	cout<<ans+1<<endl;
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;

#define LL long long
#define N 1010

int a[N],n;
double b[N];

int main() {
    scanf("%d",&n);
    for(int i = 1 ; i <= n ; i++)
        scanf("%d",&a[i]);
    sort(a + 1,a + n + 1);
    int p1 = 2,p2 = 3;
    b[p1] = ((double)a[1] + (double)a[2]) / 2;
    while(p2 <= n) {
        //printf("%d %d\n",&a[p1],&a[p2]);
        b[p2] = ((double)b[p1] + (double)a[p2]) / 2;
       // printf("%lf \n",b[p2]);
        p1++,p2++;
        //printf("%d %d \n",p1,p2);
    }
    //for(int i = 1 ; i <= n ; i++) printf("%d ",a[i]);
    printf("%lf \n",b[n]);
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.StringTokenizer;

public class Main  implements Runnable {
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 64 * 1024 * 1024).start();
    }
    public void run() {
    	FastScanner sc = new FastScanner(System.in);
    	int n = Integer.parseInt(sc.next());
		PrintWriter out = new PrintWriter(System.out);
		int[] a = new int[n];
		for(int i = 0; i < n; i++)
		{
			a[i] = Integer.parseInt(sc.next());
		}
		long ans = 1;
		int r=0;
		int l=0;
		int cv = a[0];
		while(r < n-1)
		{
			if((cv^a[r+1]) == cv+a[r+1])
			{
				r++;
				ans += (long)(r-l+1);
				cv = cv ^ a[r];
			}
			else
			{
				if(r==l)
				{
					r++;
					l++;
					ans++;
					cv = a[r];
				}
				else
				{
					cv = cv ^ a[l];
					l++;
				}
			}
		}
		out.printf("%d\n",ans);
		out.flush();
    }

    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;
        public FastScanner(String in) {
        	StringReader sr = new StringReader(in);
            reader = new BufferedReader(new BufferedReader(sr));
            tokenizer = null;
        }
        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }
        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
    }
}

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

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

    vector<int> l(n);

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

    int count = 0;
    vector<int> a(n+1);

    a[0] = 0;

    for(int i=1;i<n+1;i++){
        a[i] = a[i-1]+l[i-1];
        if(a[i]>x){
            cout<<i<<endl;
            return 0;
        }
    }
    if(a[n]<=x) cout<<n+1<<endl;

    return 0; 

}

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

using namespace std;

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

int main(){
  int n,k; cin >> n >> k;
  vector<bool> human(n+1); for(auto v : human) v=false;

  int ans=0;
  for(int i=0;i<k;i++){
    int d; cin >> d;
    for(int j=0;j<d;j++){
      int num; cin >> num;
      human[num]=true;
    }
  } 

  for(auto v : human){
    if(!v) ans++;
  }

  cout << ans-1 << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> st(n);
  vector <int> cost(n,0);
  for(int i =0;i<n;i++)
  {
    cin>>st[i];
  }
  cost[0] = 0;
  cost[1] = abs(st[1]-st[0]);
  for(int i =2;i<n;i++)
  {
    cost[i] = min(cost[i-1]+abs(st[i] -st[i-1]),cost[i-2] + abs(st[i]-st[i-2]));
  }
  cout<<cost[n-1];
  return 0;
}

Measured memory_bytes: 4000
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>
#include <math.h>
#include <deque>
#include <stack>

using namespace std;

typedef long long ll;

int main(void){
    ll n, d;
    cin >> n >> d;
    ll r = d * 2 + 1;
    ll cnt = 0;
    while(n > 0){
        cnt++;
        n -= r;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())

mpA = dict()
mpB = dict()
for n in range(N-1):
    u, v, w = list(map(int, input().split()))
    if u in mpA:
        mpA[u].append((v, w))
    else:
        mpA[u] = [(v, w)]
    if v in mpB:
        mpB[v].append((u, w))
    else:
        mpB[v] = [(u, w)]

Z = [-1] * (N+1)

A = 0
Z[1] = A

nxt = [(1, A)]
while(len(nxt) > 0):
    nxt2 = []
    for x in nxt:
        xx, xA = x[0], x[1]
        if xx in mpA:
            vA = mpA[xx]
            for wa in vA:
                v, w = wa[0], wa[1]
                if Z[v] == -1:
                    if w % 2 == 0:
                        Z[v] = xA
                        nxt2.append((v, Z[v]))
                    else:
                        Z[v] = 1 - xA
                        nxt2.append((v, Z[v]))
        if xx in mpB:
            vB = mpB[xx]
            for wb in vB:
                u, w = wb[0], wb[1]
                if Z[u] == -1:
                    if w % 2 == 0:
                        Z[u] = xA
                        nxt2.append((u, Z[u]))
                    else:
                        Z[u] = 1 - xA
                        nxt2.append((u, Z[u]))
    nxt = nxt2

for n in range(1, N+1):
    print(Z[n])

Measured memory_bytes: 47172
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define _GLIBCXX_DEBUG // ArrayOutofBounds
#define rep(i, N) for (int i = 0; i < N; i++) //制御変数iを用いてN回転
using namespace std;
using ll = long long;

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

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

int main(){
string S;
  cin>>S;
  
  for(int i=0; i<26; i++){
   char key='a'+ i ;
    bool flag=false;
    for(int j=0; j<S.size(); j++){
     if(S[j]==key){flag=true;}
    }
    if(!flag){cout<<key<<endl;
    return 0;}   //return0;をつけることで、このプログラムはそこで処理を終了する。
  }
cout<<"None"<<endl;
  return 0;  //したがって、上記のreturn 0;が成立する場合は、この"None"は出力されない。
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long H[] = new long[N];
		for (int i = 0; i < H.length; i++) {
			H[i] = sc.nextLong();
		}

		long max = H[0];
		for (int i = 0; i < H.length-1; i++) {
			if (max-H[i+1] >1) {
				System.out.println("No");
				return;
			} else if (max == H[i+1]) {
				continue;
			} else if (max-H[i+1] == 1) {
				continue;
			} else {
				max = H[i+1];
			}

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


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	int n;
	cin >> n;

	vector<int> l(n);
	int sm = 0;
	rep(i, n){
		cin >> l[i];
		sm += l[i];
	}

	sort(l.begin(), l.end(), greater<int>());
	sm -= l[0];

	if(sm > l[0]){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define EPS 10e-8

using namespace std;
typedef pair<llong, llong> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }

string S;
llong chars[500000];

vector<ipair> split_sections(llong *arr, int length) {
    vector<ipair> res;
    llong cnt = 0;
    for(int i = 0; i < length; ++i)
        if(i == 0 || arr[i] == arr[i - 1])
            ++cnt;
        else {
            res.push_back(make_pair(arr[i - 1], cnt));
            cnt = 1;
        }
    res.push_back(make_pair(arr[length - 1], cnt));
    return res;
}

llong sum(llong ed) { return (ed * (ed + 1)) / 2; }
llong sum(llong st, llong ed) { return sum(ed) - sum(st - 1); }

int main(int argc, char **argv) {
    cin >> S;
    for(int i = 0; i < S.size(); ++i)
        chars[i] = S[i];
    
    vector<ipair> sections = split_sections(chars, S.size());

    llong res = 0;
    llong prev = 0;
    for(int i = 0; i < sections.size(); ++i) {
        if(sections[i].first == '<') {
            res += sum(prev + 1, prev + sections[i].second);
            prev += sections[i].second;
        } else {
            if(prev - sections[i].second < 0)
                res -= prev - sections[i].second;

            res += sum(0, sections[i].second - 1);
            prev = 0;
        }
    }

    cout << res << endl;
}

Measured memory_bytes: 11000
N = int(input())
A = list(map(int, input().split()))
B = []
CCC = 0
j = 1
max_A = max(A)
for j in range(101):#部屋の座標最大値までのループ
    if j == 0:
        continue
    CCC = 0
    for k in range(N):#各部屋からの計算
        CCC += (A[k] - j) ** 2
    B.append(CCC)
x = min(B)
print(x)

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

int main(void){
    int a[3][3],x[3],y[3];
    bool ok = true;
    x[0] = 0;
    for(int i = 0;i < 3;i++){
        for(int j = 0;j < 3;j++){
            cin >> a[i][j];
        }
    }
    for(int i = 0;i < 3;i++)y[i] = a[0][i] - x[0];
    for(int i = 0;i < 3;i++)x[i] = a[i][0] - y[0];
    for(int i = 0;i < 3;i++){
        for(int j = 0;j < 3;j++){
            if(x[i] + y[j] != a[i][j])ok = false;
        }
    }
    if(ok == true)cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using coord= pair<int, int>;
constexpr char block = '@';
constexpr char vacant= '.';
constexpr int TBC= INT_MAX;

int BFS(const vector<string> &board, coord s, coord g, int sz_step, vector<vector<int>> *dist){  
  const int H= board.size();
  const int W= board.at(0).size();

  const vector<coord> diff= {make_pair(0,-1), make_pair(-1,0), make_pair(1,0), make_pair(0,1) // 上下4方向
                               // make_pair(-1,-1), make_pair(1,-1), make_pair(-1,1), make_pair(1,1) // 斜め4方向
                            }; // 探索方向

  vector<vector<int>> checked(H, vector<int>(W, TBC));
  queue<coord> bfs;
  dist->at(s.first).at(s.second)= 0;
  bfs.push(s);

  while( !bfs.empty() ){
    coord p= bfs.front();
    auto [x, y]= p;
    bfs.pop();

    if(p==g){ break; }
    else{
      for(const auto& [dx_e, dy_e]:diff){
        for(int sz=1; sz <= sz_step; sz++){
          int dx= sz* dx_e;
          int dy= sz* dy_e;
          if(x+dx <= -1 || x+dx >= H || y+dy <= -1 || y+dy >= W) break;
          else if(board.at(x+dx).at(y+dy)==block){
            break;
          }
          else if(dist->at(x+dx).at(y+dy) > dist->at(x).at(y)+ 1){
            dist->at(x+dx).at(y+dy)= dist->at(x).at(y)+ 1;
            bfs.push(make_pair(x+dx, y+dy));
          }
          else if(dist->at(x+dx).at(y+dy) < dist->at(x).at(y)+ 1){
            break;
          }
        }
      }
    }
  }

  return dist->at(g.first).at(g.second);
}

int main() {
  int H,W,K;
  cin >> H >> W >> K;

  coord s,g;
  cin >> s.first >> s.second >> g.first >> g.second;
  s.first--; s.second--; g.first--; g.second--; // 1-indexed -> 0-indexed

   vector<string> board(H);
   for(int i=0; i<H; i++){
     cin >> board.at(i);
   }
  vector<vector<int>> dist(H, vector<int>(W, TBC));

  int dist_s2g= BFS(board, s, g, K, &dist);

  int ans= (dist_s2g != TBC) ? dist_s2g
                             : -1;
  cout << ans << endl;
}

Measured memory_bytes: 16004
#include <stdio.h>

int main(char *argv[]) {
  int a;
  int b;

  scanf("%d", &a);

  if(a % 2 == 1) {
    b = a * 2;
  } else if(a == 1) {
    b = 2;
  } else {
    b = a;
  }

  printf("%d\n", b);
}


Measured memory_bytes: 128
import java.util.Scanner;
public class Main {
	static int[] Competition;
	static int[] Member;
	static int[] Voting;
	
	static void MemberStandard(int std, int Competition_num) {
		for(int r = 0; r < Competition_num; r++) {
			if(Competition[r] <= std) {
				Voting[r]++;
				break;
			}
		}
	}
	
	static int MaxVotedIdx(int Competition_num) {
		int max = Voting[0];
		int idx = 0;
		
		for(int r = 1; r < Competition_num; r++)
			if(Voting[r] > max) {
				max = Voting[r];
				idx = r;
			}
		return(idx + 1);
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		
		final int Competition_num = stdIn.nextInt();//競技数
		final int Member_num = stdIn.nextInt();//委員数
		
		Competition = new int[Competition_num];
		for(int r = 0; r < Competition_num; r++)
			Competition[r] = stdIn.nextInt();
		
		Member = new int[Member_num];
		Voting = new int[Competition_num];
		for(int r = 0; r < Member_num; r++) {
			Member[r] = stdIn.nextInt();
			MemberStandard(Member[r], Competition_num);
		}
		
		System.out.println(MaxVotedIdx(Competition_num));
	}

}

Measured memory_bytes: 24868
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes                \
    cout << "Yes" << endl; \
    return 0;
#define No                \
    cout << "No" << endl; \
    return 0;
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

template <typename T>
void print(const T &v);

int main()
{
    int N;
    cin >> N;
    vector<int> upper(N), lower(N);
    rep(i, N) cin >> upper[i];
    rep(i, N) cin >> lower[i];

    int maxi = 0;
    for (int i = 0; i < N; i++)
    {
        int total = 0;
        for (int j = 0; j <= i; j++)
        {
            total += upper[j];
        }
        for (int j = i; j < N; j++)
        {
            total += lower[j];
        }
        maxi = max(total, maxi);
    }
    cout << maxi << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


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

int main() {
  int q; cin >> q;
  vector<int> n;
  for (int i = 0; i < q; i++) {
    int op; cin >> op;
    if (op == 0) {
      int x; cin >> x;
      n.push_back(x);
    }
    if (op == 1) {
      int p; cin >> p;
      cout << n[p] << endl;
    }
    if (op == 2) n.pop_back();
  }
  return 0;
}


Measured memory_bytes: 3812
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
#include <iterator>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

int main() {
    int n, m;
    string s;
    cin >> n >> m >> s;
    vector<int> res;
    int r = n;
    for (int i = r, l = i; i >= 0; --i) {
        if (s[i] == '0') l = i;
        if (r - i == m || i == 0) {
            if (r == l) {
                cout << -1 << endl;
                return 0;
            }
            res.push_back(r - l);
            r = l;
        }
    }
    reverse(begin(res), end(res));
    for (int x : res) {
        cout << x << ' ';
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1144
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]){
   int N;
   cin >> N;
   switch(N%10){
      case 3:cout << "bon" << endl; break;
      case 0:
      case 1:
      case 6:
      case 8:cout << "pon" << endl; break;
      default:cout << "hon" << endl; break;
   }
   return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std ;
void solve() {
	int n;
	cin >> n;
	int arr[n];
	for (int i = 0; i < n; ++i)
		cin >> arr[i];
	int dp[n];
	for (int i = n - 1; i >= 0; --i) {
		dp[i] = 0;
		if (i + 1 < n) {
			dp[i] = dp[i + 1] + abs(arr[i + 1] - arr[i]);
		}
		if (i + 2 < n) {
			dp[i] = min(dp[i], dp[i + 2] + abs(arr[i + 2] - arr[i]));
		}
	}
	cout << dp[0];
}

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


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

#define F first
#define S second
#define nl '\n'
#define gcd __gcd
#define nset __builtin_popcount
#define pb push_back
#define pf push_front
#define mp make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define rep(i, a, b)  for (int i = int(a); i <= int(b); i++)
#define nrep(i, a, b) for (int i = int(a); i >= int(b); i--)
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL)

using ll  = long long;
using ull = unsigned long long;
using vi  = vector<int>;
using vl  = vector<ll>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvl = vector<vl>;
using ii  = pair<int, int>;
using vii = vector<ii>;
using vs  = vector<string>;
using msi = map<string, int>;
using iss = istringstream;

int main()
{
    FASTIO;
    int n; cin >> n;
    int X = 1000*(n/1000 + (n % 1000 != 0));
    cout << X - n << nl;
    return 0;
}


Measured memory_bytes: 3644
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int h = Integer.parseInt(sc.next());
        int w = Integer.parseInt(sc.next());
        int[][] a = new int[h+w+1][h+w+1];
        
        for(int i=0; i<h; i++){
            String line = sc.next();
            for(int j=0; j<w; j++){
                if(line.charAt(j)=='#'){
                    a[1+i+j][w+i-j] = 1;
                }
            }
        }
        
        int[][] hs = new int[h+w+1][h+w+1];
        int[][] vs = new int[h+w+1][h+w+1];
        
        for(int i=1; i<=h+w; i++){
            for(int j=1; j<h+w; j++){
                hs[i][j] += a[i][j] + hs[i][j-1];
                vs[i][j] += a[i][j] + vs[i-1][j];
            }
        }
        
        long cnt = 0;
        for(int i=0; i<h+w; i++){
            for(int j=0; j<h+w; j++){
                for(int k=j+1; k<h+w; k++){
                    int d = k-j;
                    if(a[i][j]==1 && a[i][k]==1){
                        if(0 <= i-d){
                            cnt += hs[i-d][k] - hs[i-d][j-1];
                            cnt -= a[i-d][j] + a[i-d][k];
                        }
                        if(i+d <= h+w){
                            cnt += hs[i+d][k] - hs[i+d][j-1];
                            cnt -= a[i+d][j] + a[i+d][k];
                        }
                    }
                    if(a[j][i]==1 && a[k][i]==1){
                        if(0 <= i-d){
                            cnt += vs[k][i-d] - vs[j-1][i-d];
                        }
                        if(i+d <= h+w){
                            cnt += vs[k][i+d] - vs[j-1][i+d];
                        }
                    }
                }
            }
        }
        
        System.out.println(cnt);
    }
}



Measured memory_bytes: 32752
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;
typedef long long int ll;

int x[3],y[3];
const int N=5000*5000+50;
ll dp[N];

ll cal(int n,vector<pair<int,int>> p){
	for(int i=0;i<N;i++){
		dp[i]=0;
	}
	for(int i=0;i<n;i++){
		dp[i+1]=max(dp[i+1],dp[i]+1);
		for(int j=0;j<p.size();j++){
			dp[i+p[j].first]=max(dp[i+p[j].first],dp[i]+p[j].second);
		}
	}
	return dp[n];
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	vector<pair<int,int>> p,q;
	int n; cin >> n;
	for(int i=0;i<3;i++){
		cin >> x[i];
	}
	for(int i=0;i<3;i++){
		cin >> y[i];
	}
	for(int i=0;i<3;i++){
		if(x[i]<y[i]){
			p.push_back({x[i],y[i]});
		}
		if(x[i]>y[i]){
			q.push_back({y[i],x[i]});
		}
	}
	cout << cal(cal(n,p),q) << endl;
}

Measured memory_bytes: 195584
#include<cstdio>
#include<algorithm>

int main(int argc, char const *argv[]) {
  int a=0,b=0,k=0,koubai[100],t=0,n=0;
  scanf("%d %d %d",&a,&b,&k );
  if (a<b) {
    n = a;
  }else n = b;
  for (int i = 1; i <= n; i++) {
    if (a%i==0&&b%i==0) {
      koubai[t]=i;
      t++;
    }
  }
  printf("%d\n",koubai[t-k] );
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
	int n,q;
	int input;
	int a[10000];
	int counter=0;

	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	cin >> q;
	for(int i=1;i<=q;i++){
		cin >> input;
		for(int j=0;j<n;j++){
			if(input == a[j]){
				counter++;
				break;
			}
		}
	}
	cout << counter << endl;
	return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

#define MAX_L 50

int graph[MAX_L+2][MAX_L+2];

void search(int x, int y, int num){
	graph[x][y]=num;
	for(int i=-1; i<=1; i++){
	    for(int j=-1; j<=1; j++){
	      if(graph[x+i][y+j] == 1){search(x+i, y+j, num);}
	    }
	}
}

int main()
{
	int w, h, label;
 
	while(true){
		scanf("%d%d\n",&w, &h);
		if(w==0 && h==0){return 0;}

		for(int i=0; i<h+2; i++){
			for(int j=0; j<w+2; j++){
				graph[i][j]=0;
			}
		}

		for(int i=1; i<h+1; i++){
			for(int j=1; j<w+1; j++){
				cin >> graph[i][j];
			}
		}

		label = 1;
		for(int i=1; i<h+1; i++){
			for(int j=1; j<w+1; j++){
				if(graph[i][j]==1){
					label++;
					search(i,j,label);
				}
			}
		}
		cout << label-1 << endl;		
	}	
}

Measured memory_bytes: 1436
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    if(str.length() == 2){
        System.out.println(str);
    }else{
        StringBuffer sb = new StringBuffer(str);
		System.out.println(sb.reverse().toString());
    }
  }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define MAX 1007
#define INF 100000007

using namespace std;

typedef pair<int,int> di;
typedef pair<int, di> pii;

int a[32] = {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};
int main(){
    long double a, b, c; cin >> a >> b >> c;

    long double sa = sqrt(a);
    long double sb  = sqrt(b);
    long double one = a+b+2.0*sa*sb;
    if(one < c) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


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

int first_bit(int x) {
    int res = 0;
    while (1) {
        if (x & (1 << res))
            return res + 1;
        else
            res++;
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            cout << first_bit(i ^ j);
            if (j == n - 1)
                cout << endl;
            else
                cout << " ";
        }
    }
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
int dp[2][17000];
int main(){

    string s;
    cin>>s;
    int x,y;
    cin>>x>>y;
    vector<int> list[2];
    int isrow=1,sum=0;
    for(int i=0;i<s.length();i++)
    {
        char c=s[i];
        if(c=='F')
        sum++;
        else if(c=='T')
        {
            list[isrow].push_back(sum);
            sum=0;
            isrow=(isrow+1)%2;
        }
    }
    list[isrow].push_back(sum);
    dp[0][8500]=1;
    dp[1][8500]=1;
    for(int ff=0;ff<2;ff++)
    {
        for(int i=0;i<list[ff].size();i++)
        {
            int x=list[ff][i];
            int temp[17000];
            memset(temp,0,sizeof(temp));
            for(int j=0;j<17000;j++)
            {
                if(dp[ff][j]==1)
                {
                    if(i==0&&ff==1)
                    temp[j+x]=1;
                    else
                    {
                        temp[j+x]=1;
                        temp[j-x]=1;
                    }
                }
            }
            memcpy(dp[ff],temp,sizeof(temp));
        }
    }
    if(dp[0][y+8500]&&dp[1][x+8500])
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 512
N, K = map(int, input().split())

a = 0
for i in range(1, N+1):
  if i % K == 0:
    a += 1

b = 0
for i in range(1, N+1):
  if i % K == K / 2:
    b += 1

ans = a ** 3
if K % 2 == 0:
  ans += b ** 3

print(ans)

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

class UnionFind {
    vector<int> data;
    ll num;
public:
    UnionFind(int size) : data(size, -1), num(size) { }
    bool unite(int x, int y) {//xとyの集合を統合する
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        num -= (x != y);
        return x != y;
    }
    bool findSet(int x, int y) {//xとyが同じ集合か返す
        return root(x) == root(y);
    }
    int root(int x) {//xのルートを返す
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    ll size(int x) {//xの集合のサイズを返す
        return -data[root(x)];
    }
    ll numSet() {//集合の数を返す
        return num;
    }
};
 int main(){
ll n,m;
   cin>>n>>m;
   UnionFind uf(n);
   rep(i,m){
     ll a,b;
     cin>>a>>b;
     a--;b--;
   uf.unite(a,b);
   }
   ll ans=0;
   rep(i,n){
     ans=max(ans,uf.size(i));
   }
   cout<<ans<<endl;
}

     


Measured memory_bytes: 4032
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>

using namespace std;

long long N, M, K,a,b,c,d,e,g,mi;
long long ans[3];
long long A[200001];
long long total[200001];
bool f[601][601];
string S;
set <long long>sll;
vector <long long>vll;
typedef pair<long long, long long> pl;
pl buf;

int main() {
	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> M;
		ans[0] += M - 1;
	}

	cout << ans[0] << endl;
	

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
while(true) {
int n, m;
vector<int> ns, ms;
scanf("%d%d", &n, &m);
if(n == 0)
break;
ns.resize(n);
ms.resize(m);
for(int i = 0; i < n; ++i)
scanf("%d", &ns[i]);
for(int i = 0; i < m; ++i)
scanf("%d", &ms[i]);
int pos = 0;

for(int i = 0; i < m; ++i) {
pos += ms[i];
if(pos >= n - 1) {
printf("%d\n", i + 1);
break;
}
pos += ns[pos];
if(pos >= n - 1) {
printf("%d\n", i + 1);
break;
}
}
}
return 0;
}

Measured memory_bytes: 1040
string = input()
n = int(input())

tail = ''
head = ''
reverted = False

for _ in range(n):
    q = input().split()
    if q[0] == '1':
        reverted = not reverted
    else:
        if not reverted:
            if q[1] == '1':
                tail = q[2] + tail
            
            elif q[1] == '2':
                head  = head + q[2]
        
        elif reverted:
            if q[1] == '1':
                head  = head + q[2]
            elif q[1] == '2':
                tail = q[2] + tail

ans = tail+string+head
if not reverted:
    print(ans)
else:
    print(ans[::-1])

Measured memory_bytes: 4620
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int M;
  cin >> M;
  cout << 48-M << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>

using namespace std;

int main(){
	string A;
	string B;
	int A_int;
	int B_int;

	cin >> A >> B;

	if(A.length() != B.length()){
		if(A.length() > B.length()){
			cout << "GREATER" << endl;
		}else if(A.length() < B.length()){
			cout << "LESS" << endl;
		}
	}else{
		for(int i = 0; i < (int)A.length(); i++){
			A_int = A.at(i);
			B_int = B.at(i);
			if(A_int > B_int){
				cout << "GREATER" << endl;
				break;
			}else if(A_int < B_int){
				cout << "LESS" << endl;
				break;
			}else{
				if(i == (int)A.length() - 1){
					cout << "EQUAL" << endl;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int k;
    scanf("%d",&k);
    string s;
    cin >> s;
    for (int i = 0; i < min(k,(int)s.size()); i++){
        if (i > k) printf(".");
        else printf("%c",s[i]);
    }
    if (s.size() > k){
        printf("...");
    }
}


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

using namespace std;



int main(){
    int n;
    cin>>n;
    long double sum=0;
    vector<vector<long double>> sp(n,vector<long double>(2));

    for(int i=0;i<n;i++){
        cin>>sp.at(i).at(0)>>sp.at(i).at(1);

    }



    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i>=j){
                continue;
            }else{
                sum += sqrt(
                        ((sp.at(i).at(0)-sp.at(j).at(0))*(sp.at(i).at(0)-sp.at(j).at(0)))
                        + ((sp.at(i).at(1)-sp.at(j).at(1))*(sp.at(i).at(1)-sp.at(j).at(1))));
            }

        }
    }

    sum = (sum*2)/n;

    cout<< fixed << setprecision(8) << sum << endl;



}


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

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    string s;
    cin >> s;
    if(s[s.size()-1]=='s'){
        rep(i,s.size()) cout << s[i];
        cout << "es" << endl;
    }else{
        cout << s ;
        cout << 's' << endl;
    }

    return 0;
}











Measured memory_bytes: 3624
class StrSet
  attr_reader :str, :len, :num
  def initialize(s = "")
    @str = s
    @len = s.length()
    @num = 1
  end
  
  def check_len(s)
    if (@len < s.length())
      @str = s
      @len = s.length()
    end
  end
  def check_num(s, n)
    if (@num < n)
      @str = s
      @num = n
    end
  end
  def count
    @num += 1
  end
end

max = StrSet.new()
requency = StrSet.new()
str_ary = []

gets().split().each() do |word|
  max.check_len(word)
  
  a_length = str_ary.length()
  str_ary.each() do |set|
    if (set.str == word)
      set.count()
      break
    end
    a_length -= 1
  end
  if (a_length == 0)
    str_ary << StrSet.new(word)
  end
end

requency = StrSet.new()
str_ary.each() do |set|
  requency.check_num(set.str, set.num)
end

puts("#{requency.str} #{max.str}")

Measured memory_bytes: 6108
module.exports=function(r){var t={};function e(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=r,e.c=t,e.d=function(r,t,n){e.o(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:n})},e.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},e.t=function(r,t){if(1&t&&(r=e(r)),8&t)return r;if(4&t&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&t&&"string"!=typeof r)for(var o in r)e.d(n,o,function(t){return r[t]}.bind(null,o));return n},e.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(t,"a",t),t},e.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},e.p="",e(e.s=0)}([function(r,t,e){e(1)(e(2).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(r,t,e){"use strict";function n(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var e=[],n=!0,o=!1,u=void 0;try{for(var i,f=r[Symbol.iterator]();!(n=(i=f.next()).done)&&(e.push(i.value),!t||e.length!==t);n=!0);}catch(r){o=!0,u=r}finally{try{n||null==f.return||f.return()}finally{if(o)throw u}}return e}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}r.exports=function(r){for(var t=n(r[0].split(" ").map(function(r){return Number(r)}),2),e=t[0],o=t[1],u=[],i=[],f=[],l=0;l<o;l++){var a=n(r[2*l+1].split(" ").map(function(r){return Number(r)}),2),c=a[0],p=a[1],s=r[2*l+2].split(" ").map(function(r){return Number(r)-1});u.push(c),i.push(p),f.push(s)}for(var d=1<<e,y=[],v=0;v<=o;v++)y.push(new Array(d).fill(9999999999));y[0][0]=0;for(var b=0;b<o;b++)for(var m=0;m<d;m++){y[b+1][m]=Math.min(y[b+1][m],y[b][m]);for(var h=0,g=0;g<i[b];g++)h+=1<<f[b][g];h|=m,y[b+1][h]=Math.min(y[b+1][h],y[b][m]+u[b])}9999999999==y[o][d-1]?console.log(-1):console.log(y[o][d-1])}},function(r,t){r.exports=require("fs")}]);

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < n; i++) {
    cout << s[i] << t[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define inf 1000000007
#define ll long long
using namespace std;
signed main(){
	int n;
	cin>>n;
	vector<int> a;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		a.pb(x);
	}
	sort(a.begin(),a.end(),greater<ll>());
	a.pb(0);
	for(int i=0;i<n;i++){
		if( i+1 >= a[i+1] ){
			//cout<<i+1<<" "<<a[i+1]<<" "<<a[i+2]<<endl;
			int len1 = a[i] - i;
			int len2 = 0;
			int last = -1;;
			for(int j=i+1;j<=n;j++){
				if( i < a[j]){ len2++; last=j;}
				if( i==a[j] ){ len2++; last=j; j=n+1;}
			}
			if(last != -1)len2+=a[last]-i;
			//cout<<i<<" "<<len1<<" "<<len2<<endl;
			if( len1%2==0 || (len2!=0 && len2%2==0)){
				cout<<"First"<<endl;
				return 0;
			}
			else {
				cout<<"Second"<<endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
int n,t,c,T,ans=1e5;
int main() {
cin>>n>>T;
while(n--) {
cin>>c>>t;
if(t<=T)ans=min(ans,c);
}
if(ans>=10000)puts("TLE");
else
cout<<ans<<endl;
}

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

const int MAX_N = 100;

int main() {
  ll n, h;
  cin >> n;
  int ans = 0, active = 0;
  rep(i, n) {
    cin >> h;
    if (active >= h) {
      active = h;
    } else {
      ans += h - active;
      active = h;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int i,j,H,W;
    while(1){
        cin >> H >> W;
        if (H==0 && W==0) {
            break;
        }
        for (j=0;j<W;j++){
            cout <<'#';
        }
        cout << endl;
        
        for (i=1;i<H-1;i++){
            cout << '#';
            for (j=1;j<W-1;j++){
                cout << '.';
            }
            cout <<'#';
            cout << endl;
        }
        
        for (j=0;j<W;j++){
            cout <<'#';
        }
        cout << endl;
        cout << endl;
    }
}


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

int main()
{
    int n;
    cin >> n;
    set<int> s;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        if(s.count(a) > 0){
            cout << "NO" << endl;
            return 0;
        }
        s.insert(a);
    }
    cout << "YES" << endl;
    return 0;
}


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

#define SWAP(type, a, b) do { type t = a; a = b; b = t; } while(0)

int partition(int *array, int left, int right) {
    int x = array[right];

    int bnd = 0;
    for(int i = left; i < right; i++) {
        if(array[i] <= x) {
            SWAP(int, array[i], array[bnd]);
            bnd++;
        }
    }

    SWAP(int, array[right], array[bnd]);
    return bnd;
}

int main(void) {
    int n;
    int *array;

    scanf("%d", &n);
    if((array = malloc(n * sizeof(int))) == NULL) {
        return 1;
    }

    for(int i = 0; i < n; i++) {
        scanf("%d", &array[i]);
    }

    int bnd = partition(array, 0, n - 1);

    for(int i = 0; i < n; i++) {
        if(i == bnd) {
            printf("[%d]", array[i]);
        } else {
            printf("%d", array[i]);
        }
        if(i != n - 1) {
            printf(" ");
        }
    }
    
    printf("\n");

    return 0;
}


Measured memory_bytes: 2244
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
  int t, c, a[5000], p=0;
  bool f, pr[30001];

  fill(pr, pr+30001, false);
  pr[2] = true;
  a[p++] = 2;
  for(int i = 3; i <= 30000; i+=2){
    f = true;
    for(int j = 3; j*j <= i; j+=2){
      if(i%j == 0){
	f = false;
	break;
      }
    }
    pr[i] = f;
    if(f){
      a[p++] = i;
    }
  }

  while(1){
    cin >> t;
    if(t == 0){
      break;
    }
    c = 0;

    for(int i = 0; a[i] <= t/3; i++){
      int s = t - a[i];
      for(int j = i; s-a[j] < t && s-a[j] >= a[j]; j++){
	if(pr[s-a[j]]){
	  if(a[i] == a[j] && a[i] == s-a[j]){
	    c++;
	    break;
	  } else if(a[i]+a[j] > s-a[j]){
	    c++;
	  }
	}
      }
    }

    cout << c << endl;
  }

  return 0;
}

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

typedef unsigned uint;
typedef long long INT;
typedef unsigned long long UINT;
const int INF = 1001001001;
const INT INFLL = 1001001001001001001LL;

 int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
INT lin() { INT x; scanf("%lld", &x); return x; }

int main(){
    int a, b, c;
    double fa, fb, fc;
    char S[128], sa[128], sb[128], sc[128];
    // int N = in();
    // int K = in();
    // scanf("%s", S);

    int AHP = in();
    int AAT = in();
    int BHP = in();
    int BAT = in();

    while(1) {
        BHP -= AAT;
        if (BHP <= 0) {
            printf("Yes");
            break;
        }
        AHP -= BAT;
        if (AHP <= 0) {
            printf("No");
            break;
        }
    }



    return 0;
}







Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
#define  ll long long 
int main(){
	ll n,ans=2;//初始值包括n和n-1两种. 
	cin>>n;
	if(n==2) ans=1;//特判 
	for(ll k=2,i=n;k*k<=n;k++){ 
		while(i>=k) i%k?i%=k:i/=k;//这里是计算[2,sqrt[n]的情况. 
		if(i==1) {ans++;} 
		if((n-1)%k==0&&k*k!=(n-1)){ans++;}
		i=n; //这里是计算 [sqrt(n),n]n-1的因数情况，这里k*k!=(n-1)是去重 
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,k;
	cin>>n>>k;
	vector<ll> x(n);
	FOR(i,0,n)cin>>x[i];
	ll ans = INF;
	vector<ll> mi,pl;
	FOR(i,0,n){
		if(x[i]<0)mi.push_back(x[i]);
		else pl.push_back(x[i]);
	}
	REV(mi);
	FOR(i,0,k+1){
		if(mi.size()<i)continue;
		if(pl.size()<(k-i))continue;
		ll m;
		if(i==0)m=0;
		else m=-mi[i-1];
		ll p;
		if(i==k)p=0;
		else p=pl[k-i-1];
		ll w = min(p,m)*2+max(p,m);
		ans = min(ans,w);
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 2424
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007;
int main()
{
	long long int n,k,i,j;
	cin>>n>>k;
	long long int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];


	long long int dp[2][k+1],b[k+1]={};
	memset(dp,0,sizeof(dp));
	b[0]=1;
	for(i=0;i<n;i++)
	{
		for(j=0;j<=k;j++)
		{
			if(i==0)
			{
				if(j<=a[i])
					dp[(i%2)][j]=1;
				continue;
			}
			else if(j==0)
			{
				dp[(i%2)][j]=1;
				continue;
			}
			b[j]=(b[j-1]+dp[((i-1)%2)][j])%M;
			if(j<=a[i])
				dp[(i%2)][j]=b[j];
			else
				dp[(i%2)][j]=(b[j]-b[j-a[i]-1]+1000000007)%M;
		}
	}
	cout<<dp[((n+1)%2)][k]<<endl;

}


Measured memory_bytes: 2560