akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <limits>
#include <cmath>

using namespace std;

int main() {
    size_t n, m;
    cin >> n >> m;
    vector<long long> z(n, -1);
    for (size_t i = 0; i < m; ++i) {
        size_t s, c;
        cin >> s >> c;
        --s;
        if (z[s] >= 0 && z[s] != c) {
            cout << -1 << endl;
            return 0;
        }
        if (z[s] == -1 || c < z[s])
            z[s] = c;
    }
    if (n > 1) {
        if (z[0] == 0) {
            cout << -1 << endl;
            return 0;
        }
        if(z[0] < 0)
            z[0] = 1;
        for (size_t i = 1; i < n; ++i) {
            if (z[i] < 0)
                z[i] = 0;
        }
    } else if (z[0] == -1)
        z[0] = 0;
    for (size_t i = 0; i < n; ++i)
        cout << z[i];
    cout << endl;
    return 0;
}


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

int main() {
    char x,y;
    cin >> x >> y;
    if(x > y){
        cout << ">";
    } else if(x == y){
        cout << "=";
    } else{
        cout << "<";
    }
    return 0;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 233;
int main()
{
 	ios::sync_with_stdio(false);
	string a,b;cin>>a>>b;
//	cout<<a.length()<<" "<<b.length()<<endl;
	if(a.length()+1==b.length()){
		bool ok = 1;
		for(int i=0;i<a.length();i++)
			if(b[i]!=a[i])
				ok = 0;
		if(ok){
			puts("Yes");
			return 0;
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3612
if __name__ == '__main__':
  n, l = map(int, input().split(" "))
  app_list = []
  abs_min = 10000000000
  delete_member = 0
  for i in range(n):
    score = l + i
    app_list.append(score)
    if abs(score) < abs_min:
      delete_member = score
      abs_min = abs(score)
  app_list.remove(delete_member)
  print(sum(app_list))

Measured memory_bytes: 3064
#D
N=int(input())
A=list(map(int,input().split()))
A=sorted(A)
flag=[False for i in range(10**6+1)]

re=[]
for i in range(N):
    if flag[A[i]]:
        re.append(A[i])
    flag[A[i]]=True

ans=0
for i in range(1,10**6+1):
    if flag[i]:
        ans+=1
        for j in range(i*2,10**6+1,i):
            flag[j]=False

for i in set(re):
    if flag[i]:
        ans-=1
print(ans)

Measured memory_bytes: 167660
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N,D,A;
  cin>>N>>D>>A;
  vector<pair<int,int>> B(N);
  for(pair<int,int> &p:B)
    cin>>p.first>>p.second;
  sort(B.begin(),B.end());
  vector<int> C(N+2,0);
  int ans=0;
  for(int i=0;i<N;i++){
    C[i+1]+=C[i];
    B[i].second-=C[i+1];
    if(B[i].second<=0)
      continue;
    int K=(B[i].second+A-1)/A;
    ans+=K;
    C[i+1]+=K*A;
    C[(upper_bound(B.begin(),B.end(),make_pair(B[i].first+D*2,1000000000LL))-B.begin())+1]-=K*A;
  }
  cout<<ans<<endl;
}

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

int main() {
  string s;
  cin>>s;
  for(int i=0;i<19;i++){
    if(i==5||i==13){
      cout<<" ";
      continue;
    }
      cout<<s.at(i);
  }
  cout<<"\n";
}


Measured memory_bytes: 256
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[1]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):return [[tb//(n**bt)%n for bt in range(k)] for tb in range(n**k)]
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

h,w=LI()
h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0})
dp=[1e6]*(h*w)
dp[w+1]=g[w+1]

for r in range(1,h-1):
    for c in range(1,w-1):
        j=r*w+c
        dp[j+1]=min(dp[j]+1 if (g[j],g[j+1])==(0,1) else dp[j],dp[j+1])
        dp[j+w]=min(dp[j]+1 if (g[j],g[j+w])==(0,1) else dp[j],dp[j+w])

print(dp[(h-2)*w+w-2])


Measured memory_bytes: 43884
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<vector<pair<ll, ll>>> g(n);
    rep(i, n - 1) {
        ll a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(make_pair(b, i));
        g[b].push_back(make_pair(a, i));
    }
    vector<ll> ans(n - 1, -1);
    vector<set<ll>> color(n);
    queue<ll> q;
    q.push(0);
    while(!q.empty()) {
        ll v = q.front(); q.pop();
        ll cur = 0;
        for(auto x : g[v]) {
            ll u = x.first, idx = x.second;
            if (ans[idx] != -1) continue;
            reps(i, cur, n) {
                if ((color[u].count(i) == 0) && (color[v].count(i) == 0)) {
                    cur = i + 1;
                    color[u].insert(i);
                    color[v].insert(i);
                    ans[idx] = i;
                    q.push(u);
                    break;
                }
            }
        }
    }
    printf("%lld\n", *max_element(all(ans)) + 1);
    rep(i, n - 1) printf("%lld\n", ans[i] + 1);
    return 0;
}


Measured memory_bytes: 22784
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	string s1,s2;
	cin>>s1>>s2;
	ll p=0;
	for(ll i=0;i<s1.length();i++)
	{
		if(s1[i]!=s2[i])
		p++;
	}
	cout<<p;
}

Measured memory_bytes: 3912
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <locale.h>
#include <ctype.h>
#include <signal.h>
#include <stdarg.h>
#include <string.h>
#include <time.h>
int main()
{
int n,x,i,cha;
int a[100000];
long long sum=0;
scanf("%d%d",&n,&x);
for(i=0;i<n;i++)
{
    scanf("%d",&a[i]);
}
for(i=0;i<n-1;i++)
{
    cha=a[i]+a[i+1]-x;
    if(cha>0)
    {
        sum+=cha;
        if(a[i+1]>=cha)
        {
            a[i+1]-=cha;

        }
        else
        {
            a[i]-=cha-a[i+1];
        a[i+1]=0;
        }
    }
}
printf("%lld",sum);
    return 0;
}


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

int main(){
    int N, K;
    int sum = 0;
    cin >> N;
    int a[N];
    cin >> K;
    for(int i = 0; i < N; i++)
        cin >> a[i];
    sort(a, a + N, greater<int>());
    for(int i = 0; i < K; i++)
        sum += a[i];
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
																								   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;																								   
typedef long long LL; 																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra	   
																													   																				   
vector<ii>::iterator iter;																							   
																							   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////


///////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////

/////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	int n;
	cin >> n;
	
	cout << 3 * (pow(n, 2)) << endl;
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll N;
    cin >> N;
    string S;
    cin >> S;
    ll dp[N];
    dp[0] = 0;
    for(ll i = 1; i < N; i++)
        if(S[i] == 'E') dp[0]++;
    for(ll i = 1; i < N; i++){
        ll tmp = dp[i-1];
        if(S[i-1] == 'W') tmp++;
        if(S[i] == 'E') tmp--;
        dp[i] = tmp;
    }
    sort(dp,dp+N);
    cout << dp[0] << "\n";
    return 0;
}


Measured memory_bytes: 2948
#include <bits/stdc++.h>
#include<iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll a,b;
    cin >> a >> b;
    cout << (a*b)/__gcd(a,b) << "\n";
    return 0;
}



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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<pair<T, T>>& vp) {
	for (int i = 0; i < vp.size(); ++i) {
		s << "(" << vp[i].first << "," << vp[i].second << ")" << ( i+1 == vp.size() ? "" : ",\t" );
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	string s,t;
	cin >> s >> t;
	string ans;
	for (int i = 0; i < n; i++) {
		ans.push_back(s[i]);
		ans.push_back(t[i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long
#define pii pair<int,int>
#define pll pair<LL,LL>

using namespace std;

int main(){

    string s;cin>>s;

    if(s.size()>=4&&s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I'){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

    return 0;
}

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

int main()
{
	int n, k,count = 0;
	int h[100000];

	cin >> n >> k;
	
	for (int i = 0; i < n; i++)
		cin >> h[i];

	for (int i = 0; i < n; i++) {
		if (h[i] >= k)
			count++;
	}
	cout << count << endl;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
  public static void main(String[]$) {
    int n = new Scanner(System.in).nextInt();
    long sum = 0;
    for (int i = 5; n > 0; i++) {
      if (n == 2) {
        i = (i + 60) / 30 * 30;
        System.out.println(sum % 2 + 2);
        System.out.println(i - (sum + sum % 2 + 2) % 30);
        return;
      }
      if (i % 2 != 0 && i % 3 != 0 && i % 5 != 0) {
        continue;
      }
      System.out.println(i);
      sum += i;
      n--;
    }
  }
}


Measured memory_bytes: 28744
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

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

    int r = 0;
    for (int i = 1; i < n - i; i++) {
        r++;
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
S = str(input())
ans = []
for i in range(len(S)):
    preans = []
    if S[i] == "A" or S[i] == "C" or S[i]  == "G" or S[i] =="T":
        preans.append(S[i])
        for j in range(1,len(S)-i):
            if S[i+j] == "A" or S[i+j] == "C" or S[i+j]  == "G" or S[i+j] =="T":
                preans.append(S[i+j])
            else:
                break
    if len(preans) > len(ans):
        ans = preans
if len(ans) == 2 and ans[0] == "A" and ans[1] == "C":
    print(0)
else:
    print(len(ans))

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  //input
  int A,B,C,D;  cin>>A>>B>>C>>D;
  //compute
  if(B<=C ||D<=A){
    cout<<0<<endl;
  }
  else if(A<=C && D<=B){
    cout<<D-C<<endl;
  }
  else if(C<=A && B<=D){
    cout<<B-A<<endl;
  }
  else if(A<=C && C<=B && B<<D){
    cout<<B-C<<endl;
  }
  else if(C<=A && A<=D && D<<B){
    cout<<D-A<<endl;
  }
}
  



Measured memory_bytes: 256
import java.util.Scanner;

class Main{

	public static void main(String[] args) {




		Scanner scan = new Scanner(System.in);
		int x1 = scan.nextInt();
		int y1 = scan.nextInt();
		int x2 = scan.nextInt();
		int y2 = scan.nextInt();

		int dx = (x2-x1);
		int dy = (y2-y1);

		int x3 =  x2 - dy;
		int y3 =y2 +dx;
		
		int x4= x3 - dx;
		int y4 = y3 -dy;
		
		System.out.println(x3);
		System.out.println(y3);
		System.out.println(x4);
		System.out.println(y4);


	}






}


Measured memory_bytes: 21844
A , B , C ,D = map(int,input().split())
if C % B == 0:
    t = C // B
else:
    t = C // B + 1
if A % D == 0:
    a = A // D
else:
    a = A // D + 1
if t <= a:
    print("Yes")
else:
    
    print("No")

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

using namespace std;

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

	vector<int> A(N + 2, 0);
	for (int i = 1; i <= N; ++i) {
		cin >> A[i];
	}
	int T = 0;
	for (int i = 0; i <= N; ++i) {
		T += abs(A[i] - A[i + 1]);
	}

	for (int i = 1; i <= N; ++i) {
		int ans = T;
		ans -= abs(A[i] - A[i + 1]);
		ans -= abs(A[i - 1] - A[i]);
		ans += abs(A[i - 1] - A[i + 1]);
		cout << ans << endl;
	}
}


Measured memory_bytes: 1664
//
//  main.cpp
//  ABC
//
//  Created by Amarsanaa Davaasuren on 2019/08/31.
//  Copyright © 2019 Amarsanaa Davaasuren. All rights reserved.
//

#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
using namespace std;



class UnionFind {
public:
    vector<int> Parent;
    UnionFind(int N){
        Parent = vector<int>(N,-1);
    }
    
    int root(int node){
        if (Parent[node] < 0){
            return node;
        }
        else{
            return Parent[node] = root(Parent[node]);
        }
    }
    
    int size(int node){
        return -root(node);
    }
    
    bool connect(int A, int B){
        int Aroot = root(A);
        int Broot = root(B);
        if (Aroot != Broot){
            if (size(Aroot) < size(Broot)) swap(Aroot,Broot);
            Parent[Aroot] += Parent[Broot];
            Parent[Broot] = Aroot;
            return true;
        }
        else{
            return false;
        }
    }
};




#define rep(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
using ll = long long;




int main(){
    string S; cin >> S;
    vector<int> answer(S.size(),0);
    
    int start = 0;
    int end = 0;
    int counter = 0;
    rep(i,0,S.size()-1){
        if (S[i] == 'R' && S[i+1] == 'L'){
            end = i+1;
            counter = 0;
            rep(j,start,end){
                answer[j] = end - start - counter;
                counter++;
            }
        }
        if (S[i] == 'L' && S[i+1] == 'R'){
            start = i + 1;
            counter = 1;
            rep(j,end,start){
                answer[j] = -counter;
                counter ++;
            }
        }
    }
    start = (int) S.size();
    counter = 1;
    rep(j,end,start){
        answer[j] = -counter;
        counter ++;
    }
    vector<int> dist(S.size());
    rep(i,0,S.size()){
        if ((int) answer[i]%2 == 0){
            dist[i+answer[i]]++;
        }
        else{
            if (answer[i]>0){
                dist[i+answer[i]-1]++;
            }
            else{
                dist[i+answer[i]+1]++;
            }
        }
    }
    rep(i,0,S.size()){
        cout << dist[i] << " ";
    }
    
}




Measured memory_bytes: 1408
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto S = readln.chomp.to!(char[]);
    auto front = S[0..2];
    auto rear = S[2..$];

    auto front_ok = front != "00" && front.to!int <= 12;
    auto rear_ok = rear != "00" && rear.to!int <= 12;

    if (front_ok && rear_ok) {
        writeln("AMBIGUOUS");
    } else if (front_ok) {
        writeln("MMYY");
    } else if (rear_ok) {
        writeln("YYMM");
    } else {
        writeln("NA");
    }
}

Measured memory_bytes: 256
k=int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

l=[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]

print(l[k-1])



Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>

typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n;i>s;i--)
#define rep_re(i,s,n)for(ll i = n;i>=s;i--)
using namespace std;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_N = 100001;


int main()
{
	ll n; cin >> n;
	vector<ll> v;
	for (ll i = 1; i * i <= n; i++) {
		if (!(n % i)) {
			v.push_back(i);
			if (i * i != n) v.push_back(n / i);
		}
	}

	sort(v.begin(), v.end());

	ll ans = INF;
	for (auto i : v) {
		for (auto j : v) {
			if(i*j == n){
				ans = min(i + j - 2, ans);
			}
		}
	}
	cout << ans << endl;

}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int N, M;
int A[10];
int dp[100001];

bool Check(int k)
{
  memset(dp, -1, sizeof(dp));
  dp[0] = 0;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j <= M; j++) {
      if(dp[j] >= 0) {
        dp[j] = k;
      } else if(j < A[i] || dp[j - A[i]] <= 0) {
        dp[j] = -1;
      } else {
        dp[j] = dp[j - A[i]] - 1;
      }
    }
  }
  return(dp[M] >= 0);
}


int main()
{
  while(cin >> N >> M, N) {
    for(int i = 0; i < N; i++) {
      cin >> A[i];
    }
    int low = 0, high = M / *min_element(A, A + N);
    while(high - low > 0) {
      int mid = (low + high) >> 1;
      if(Check(mid)) high = mid;
      else low = mid + 1;
    }
    cout << low << endl;
  }
}

Measured memory_bytes: 1556
package main

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

func exec(stdin *Stdin, stdout *Stdout) {
	n := stdin.ReadInt()
	x := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = stdin.ReadInt()
	}

	sum := 0
	for _, v := range x {
		sum += v
	}

	if sum%n == 0 {
		avg := sum / n
		ans := 0
		for _, v := range x {
			ans += (avg - v) * (avg - v)
		}
		stdout.Println(ans)
	} else {
		avg1 := sum / n
		avg2 := sum/n + 1
		ans1 := 0
		ans2 := 0
		for _, v := range x {
			ans1 += (avg1 - v) * (avg1 - v)
			ans2 += (avg2 - v) * (avg2 - v)
		}
		stdout.Println(Min(ans1, ans2))
	}
}

func Min(a ...int) int {
	v := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] < v {
			v = a[i]
		}
	}
	return v
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), int(math.MaxInt32))
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}


Measured memory_bytes: 640
#!/usr/bin/env python3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
INF = float("inf")
import sys,collections,heapq,math

N,K = map(int,sys.stdin.readline().split())
a = list(map(int,sys.stdin.readline().split())) # single line with multi param
a.sort(reverse=True)

ng = 0
ok = a[0]

def isOK(v):
    # within range
    # return key <= a[index]
    k = K
    i = 0
    while k >= 0 and i < N:
        #print("?",v,i,a[i],k,math.ceil(a[i] / v) -1,k - (math.ceil(a[i]/v) - 1))
        k = k - (((a[i]+v-1)//v) - 1)
        #k = k - (math.ceil(a[i]/v) - 1)
        i += 1
    return k >= 0

while abs(ng-ok) > 1:
    mid = (ok+ng)//2
    #print(mid,isOK(mid))
    if isOK(mid):#ok condition?
        ok = mid #move ok
    else:
        ng = mid
#294924427
print(math.ceil(ok))

# a = [[-b,b,1] for b in tuple(map(int,sys.stdin.readline().split()))] # single line with multi param
# heapq.heapify(a)# a == [1,2,3]
# for _ in range(K):
#     _,ori,di = heapq.heappop(a)
#     heapq.heappush(a, [-(ori)/(di+1),ori,di+1])
# print(math.ceil(-a[0][0]))


Measured memory_bytes: 32168
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
	string s;
	cin>>s;
	if((s[0]=='A' && s[1]=='A' && s[2]=='A') || (s[0]=='B' && s[1]=='B' && s[2]=='B')){
		cout<<"No\n";
	}
	else{
		cout<<"Yes\n";
	}
}

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

	int t=1;       
	// cin >> t;
	while(t--){
		solve();
	}
	return 0;
}

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

int main () {
  string I;
  cin >> I;
  int A = I[0] - '0';
  int B = I[1] - '0';
  int C = I[2] - '0';
  int D = I[3] - '0';
  string op[8] = {"+++","++-","+-+","+--","-++","--+","---","-+-"};

  for(int i = 0; i<8; i++) {
    int tmp = 0;
    if(op[i][0] == '+') tmp = A + B;
    else tmp = A - B;

    if(op[i][1] == '+') tmp += C;
    else tmp -= C;

    if(op[i][2] == '+') tmp += D;
    else tmp -= D;
    if(tmp == 7) { 
      printf("%d%c%d%c%d%c%d=7\n" ,A ,op[i][0] ,B ,op[i][1] ,C ,op[i][2], D);
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())

candicate=[]
for y in range(1, H):
    #print(y)
    candicate.append(max(y*W, W * (((H-y)+1)//2)) - min(y*W, W* ((H-y)//2)))
    candicate.append(max(y*W, (H-y)*((W+1)//2)) - min(y*W, (H-y)* (W//2)))

for x in range(1, W):
    candicate.append(max(x*H, H * (((W-x)+1)//2)) - min(x*H, H* ((W-x)//2)))
    candicate.append(max(x*H, (W-x) * ((H+1)//2)) - min(x*H, (W-x)* (H//2)))
#print(candicate)
print(min(candicate))

Measured memory_bytes: 18920
#include<stdio.h>
#include<stdlib.h>
 
void insertionSort(int *, int, int);
void shellSort(int *,int);

int cnt = 0;
main(){
  int i,j,n,*A;


  scanf("%d",&n);
  A=(int *)malloc(sizeof(int)*n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  shellSort(A, n);
  printf("%d\n",cnt);
  for(i=0;i<n;i++){
    printf("%d\n",A[i]);
  }

  free(A);

  return 0;
}
 
void insertionSort(int *A, int n, int g){
   
  int i,j,v;
  for(i=g;i<n;i++){
    v=A[i];
    j=i-g;
    while(j>=0 && A[j]>v){
      A[j+g]=A[j];
      j=j-g;
      cnt++;
    }
    A[j+g]=v;
  }
}
 
 
void shellSort(int *A,int n){
   
  int i,m = 0,*G;
 
  G=(int *)malloc(sizeof(int)*n);
  G[0]=0;
  for(i=0;i<n;i++){
    G[i+1]=3*G[i]+1;
    m++;
    if(G[i+1]>1000000)break;
  }

  while(G[m] > n)m--;

  printf("%d\n",m);

  for(i=m;i>1;i--)printf("%d ",G[i]);

  printf("%d\n", G[1]);

  for(i=m;i>=0;i--)insertionSort(A, n, G[i]);

  free(G);

}

Measured memory_bytes: 4500
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef long long ll;

int main()
{
	ll X;
	scanf("%lld", &X);
	ll a = 100;
	ll i = 0;
	while (a < X)
	{
		a = ((ll)a*1.01);
		i++;
	}
	printf("%lld",i);
	return (0);
}



Measured memory_bytes: 2156
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();

		int tree = 0;
		int number = 0;
		for (int i=1; i<=n; i++) {
			if (i-d < 1) {
				if (i+d >= n) {
					number++;
					break;
				}
			} else if (i-d == 1) {
				tree = i+d;
				number++;
			} else {
				if (i+d == n) {
					number++;
					break;
				}
				if (i-d == tree+1) {
					tree = i+d;
					number++;
				}
				if (tree >= n) {
					break;
				}
			}
		}

		System.out.println(number);
		sc.close();
	}
}


Measured memory_bytes: 21844
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <stack>

typedef long long ll;
typedef std::vector< int > VI;

const double EPS = 1e-10;
const double PI  = acos(-1);
const ll     INF = 1 << 30;

const int MAX_N = 100;
const int MAX_S = 100;

// データ i個まで確認
bool dp[MAX_N+1][MAX_N*MAX_S+1];

int main(int argc, char* argv[])
{
  int n;
  std::cin >> n;

  std::vector< int > vs(n, 0);
  std::vector< int >::iterator it;

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

  dp[0][0] = true;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= MAX_N*MAX_S; j++) {
      dp[i+1][j] |= dp[i][j];
      if (j-vs[i] >= 0) {
	dp[i+1][j] |= dp[i][j-vs[i]];
      }
    }
  }

  int ans = 0;
  for (int i = MAX_N*MAX_S; i >=0; i--) {
    if (dp[n][i] && i % 10 != 0) {
      ans = i;
      break;
    }
  }

  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
typedef long long ll;
int N;
const int MN=100010;
ll L,T;
ll X[MN];
int W[MN];
vector<ll> xs[2];

int main(){
	cin>>N>>L>>T;
	rep(i,N){
		cin>>X[i]>>W[i];
		W[i]--;
	}
	vector<ll> ans;
	ll dif=0;
	rep(i,N){
		ll v;
		if(W[i]==0){
			v = (X[i]+T)%L;
			dif += (X[i]+T)/L;
		}
		else{
			v = ((X[i]-T)%L+L)%L;
			dif -= (T-X[i]+L-1)/L;
		}
		ans.pb(v);
	}
	sort(all(ans));
	dif%=N;
	if(dif<0) dif+=N;
	rotate(ans.begin(),ans.begin()+dif,ans.end());
	rep(i,N) cout<<ans[i]<<endl;
}


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}


int main() {
    int n;
    cin >> n;
    double res = n/2.0;
    cout << ceil(res) << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

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

  ll N,M,K;
  cin >> N >> M >> K;
  vector<ll> A(N), B(M);
  vector<ll> suma(N+1), sumb(M+1);
  repr(i, N, 0) {
    cin >> A[i];
    suma[i+1] = suma[i] + A[i];
  }

  repr(i, M, 0) {
    cin >> B[i];
    sumb[i+1] = sumb[i] + B[i];
  }

  ll ans = 0;
//  cout << sumb.end() - sumb.begin() << endl;
  for (ll i = 0; i <= N; ++i) {
    ll R = K - suma[i];
    if (R < 0) continue;
    auto it = upper_bound(sumb.begin(), sumb.end(), R);

    ll num = it - sumb.begin() - 1;
    chmax(ans, num + i);
  }

  cout << ans << endl;
}

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

int main(){
	ll x,k,d;
	cin >> x >> k >> d;
	x = abs(x);
	if(x / k >= d){
		cout << x - d*k << endl;
		return 0;
	}
	if((x / d) % 2 == k % 2){
		cout << x % d << endl;
	}else{
		cout << d - x % d << endl;
	}
    return 0;
}

Measured memory_bytes: 3600
import java.util.Scanner;

class Main {

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

        String str = sc.next();

        char[] strArr = str.toCharArray();

        String ret = "yes";
        for (int i = 0; i < strArr.length; i++) {
            for (int j = 0; j < strArr.length; j++) {
                if (i != j && strArr[i] == strArr[j]) {
                    ret = "no";
                }
            }
        }

        System.out.println(ret);
    }
}


Measured memory_bytes: 21844
from operator import itemgetter

N, M = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(M)]
ab = sorted(ab, key=itemgetter(1))

# 前回取り除いた橋
removed = -1
ans = 0

for a, b in ab:
    # a が removed より大きい = まだ取り除いていない
    if a > removed:
        removed = b - 1
        ans += 1

print(ans)

Measured memory_bytes: 24732
using System;
using System.Linq;
using System.Collections.Generic;
class P
{
    static void Main()
    {
        long[] nab = Console.ReadLine().Split().Select(long.Parse).Distinct().ToArray();
        long[] a = Console.ReadLine().Split().Select(long.Parse).Distinct().ToArray();
        long res = 0;
        long pos = a[0];
        for (int i = 1; i < a.Length; i++)
        {
            res += Math.Min((a[i] - pos) * nab[1], nab[2]);
            pos = a[i];
        }
        Console.WriteLine(res);
    }
}

Measured memory_bytes: 32608
#include "bits/stdc++.h"
using namespace std;

int main() {

	int n,a,b,c,d;	
	cin >> n;

	d = n % 10;
	c = (n - d) % 100 / 10;
	b = (n - (c * 10 + d)) % 1000 / 100;
	a = (n - (b * 100 + c * 10 + d)) % 10000 / 1000;

	int mode = 0;

	
	if(a + b + c + d == 7) mode = 1; 
	if(a + b + c - d == 7) mode = 2; 
	if(a + b - c + d == 7) mode = 3; 
	if(a + b - c - d == 7) mode = 4; 
	if(a - b + c + d == 7) mode = 5; 
	if(a - b + c - d == 7) mode = 6; 
	if(a - b - c + d == 7) mode = 7; 
	if(a - b - c - d == 7) mode = 8; 

	switch (mode)
	{
		case 1:
			cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
			break;
		case 2:
			cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl;
			break;
		case 3:
			cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
			break;
		case 4:
			cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
			break;
		case 5:
			cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
			break;
		case 6:
			cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
			break;
		case 7:
			cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
			break;
		case 8:
			cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;
			break;	
		default:
			break;
	}

}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
#include<set>
#include<queue>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;

template<class T>
struct Edge {
	int to;
	T cost;
	Edge() {};
	Edge(int to, T cost) : to(to), cost(cost) {};
};

template<class T>
class Graph {
	int n;
	bool directed;
	vector<vector<Edge<T>>> edges;
public:

	Graph(int n, bool directed) :n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)) {};
	Graph() {};

	void add(int to, T cost) {
		emplace_back(to, cost);
	}

	int size() {
		return n;
	}
};


int main() {

	int N;

	cin >> N;

	int a = N % 10;

	if (a == 3) {
		cout << "bon" << endl;
	}
	else if (a == 0 || a == 1 || a == 6 || a == 8) {
		cout << "pon" << endl;
	}
	else {
		cout << "hon" << endl;
	}

	return 0;
}

Measured memory_bytes: 3632
#include <set>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits>
static int imin = std::numeric_limits<int>::min();
static int imax = std::numeric_limits<int>::max();


template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec){
  std::size_t n = vec.size();
  if(n == 0){
    return os;
  }
  for(int i = 0; i<n - 1; ++i){
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  return os;
}

#ifndef BOOST_TEST_MAIN
int main(int const argc, char const** argv){
  int x, y;
  std::cin >>  x >>  y;
  if(x>8 || y > 8){
    std::cout << ":(" << std::endl;
  }else {
      std::cout << "Yay!" << std::endl;
    }
}
#endif


Measured memory_bytes: 256
n = gets.to_i
s = gets.chomp

d = {}
s.chars.each {|c|
  if d[c]
    d[c] += 1
  else
  d[c] = 1
  end
}

M = 1000000007
ans = 1
d.each {|c, i|
  ans = (ans * (i + 1)) % M
}
ans -= 1
p ans


Measured memory_bytes: 8956
n,m,q = map(int, raw_input().split(' ')) #2 3 -10
bis = map(int, raw_input().split(' '))
c = 0
for _ in range(n):
	if sum([u*v for u,v in zip(map(int,raw_input().split(' ')),bis)]) + q > 0:
		c+=1
print c


Measured memory_bytes: 84916
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    ll n;
    cin >> n;
    ll ans=0;
    ll ctr=0;
    Vi a(n);
    rp(i,n) {
        cin >> a.at(i);
        if(a[i]==0) {
            ans+=ctr/2;
            ctr=0;
        }
        else{
            ctr+=a[i];
        }
    }
    ans+=ctr/2;
    print(ans);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

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

struct dans_queue
{
	int pos , v;
	bool operator < (const dans_queue & autre) const
	{
		return v > autre.v || (v == autre.v && pos > autre.pos);
	}
};
const int MAXN = 100 * 1000 + 10;
set<int> nb[MAXN];

int main()
{
	int N , K;
	cin >> N >> K;
	string s;
	cin >> s;
	priority_queue<dans_queue> Q;
	int meilleur[N + 1];
	if (s[N] == '1') 
	{
		cout<<-1<<endl;
		exit(0);
	}
	meilleur[N] = 0;
	Q.push({N , 0});
	for (int i = N -1 ; i >= 0 ; i--)
	{
		if (s[i] == '1')
		{
			meilleur[i] = -1;
			continue;
		}
		while (!Q.empty() && Q.top().pos - i > K)
			{
				Q.pop();
			}
		if (Q.empty())
		{
			meilleur[i] = -1;
			continue;
		}
		else
		{
			meilleur[i] = Q.top().v + 1;
			Q.push({i , meilleur[i]});
		}
	}
	for (int i = 1 ; i <= N ; i++)
	{
		if (meilleur[i] >= 0)
		{
			nb[meilleur[i]].insert(i);
		}
	}
	if (meilleur[0] == -1)
	{
		cout<<-1<<endl;
		exit(0);
	}
	int actu = meilleur[0];

	int posActu = 0;
	while (actu > 0)
	{
		auto it = nb[actu - 1].lower_bound(posActu);
		int tActu = *it;
		cout<<tActu - posActu<<" ";
		posActu = tActu;
		actu--;
	}

}

Measured memory_bytes: 10240
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def S_():
    return input()
def IS():
    return input().split()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[1]*(w+2)
    found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()
 
def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a
 
show_flg=False
show_flg=True
 
ans=0

n,k=LI()
x=LI()
ans=inf
for i in range(n-k+1):
    ans=min(ans,abs(x[i])+abs(x[i]-x[i+k-1]))
    ans=min(ans,abs(x[i+k-1])+abs(x[i]-x[i+k-1]))

print(ans)


Measured memory_bytes: 63084
#include<bits/stdc++.h>
using namespace std;
const int N=998244353;
int main()
{
	int i,flag=0;
	char ch[15];
	char str[15];
	scanf("%s",ch);
	scanf("%s",str);
	int len=strlen(ch);
	int len1=strlen(str);
	if(len+1==len1)
	{
		for(i=0;i<strlen(ch);i++)
	{
		if(ch[i]!=str[i])
		{
			flag=1;
			break;
		}
	 }
	 if(flag!=1)
	 printf("Yes");
	 else
	 printf("No"); 
	}
	else
	printf("No");
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);
    
    int H, N; cin >> H >> N;
    vector<int> A(N), B(N);
    int maxA = 0;
    rep(i, N) {
        cin >> A[i] >> B[i];
        maxA = max(A[i], maxA);
    }
    int inf = 1e8;
    vector<int> dp(H+1+maxA, inf);
    dp[0] = 0;
    repr(i, 1, H+maxA+1) {
        rep(j, N) {
            // j番目の魔法を使う
            int prev_i = i-A[j];
            if (prev_i < 0) continue;
            if (dp[prev_i] == inf) continue;
            dp[i] = min(dp[i], dp[prev_i]+B[j]);
        }
    }

    int ans = inf;
    repr(i, H, H+1+maxA) {
        ans = min(ans, dp[i]);
    }

    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int best = 0;
  for(int i = 1; i < n; i++) best += (s[i] == s[i-1]);
  cout << min(best+2*k, n-1) << '\n';
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 266666;
int n,x;ll res=1e18;
ll zzy,qz[N],val[N];
struct node{
	int b,l,r;
}s[N];
bool cmp(node a,node b){
	return 1LL*a.r*x-1LL*a.r*a.b+1LL*a.l*a.b>1LL*b.r*x-1LL*b.r*b.b+1LL*b.l*b.b;
}
inline ll calc(int p, int c){
	if(c<s[p].b)return 1LL*s[p].l*c;
	return 1LL*s[p].r*(c-s[p].b)+1LL*s[p].b*s[p].l;
}
inline bool ck(ll mid){
	int cnt=mid/x;int Mod=mid%x;
	if(!Mod)return qz[cnt]>=zzy;
	rep(i,1,n)
		if(i-1>=cnt){if(qz[cnt]+calc(i,Mod)>=zzy)return 1;}
		else if(qz[cnt+1]-val[i]+calc(i,Mod)>=zzy)return 1;
	return 0;
}
int main() {
	read(n);read(x);
	rep(i,1,n)read(s[i].b),read(s[i].l),read(s[i].r);
	sort(s+1,s+n+1,cmp);
	rep(i,1,n)zzy+=1LL*s[i].b*s[i].l;
	rep(i,1,n)qz[i]=qz[i-1]+(val[i]=1LL*s[i].r*x-1LL*s[i].r*s[i].b+1LL*s[i].l*s[i].b);
	ll L=0,R=1LL*n*x;
	while(L<R){
		ll mid=(L+R)>>1;
		if(ck(mid))R=mid;else L=mid+1;
	}
	cout<<L;
	return 0;
}


Measured memory_bytes: 5504