akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define lli long long int
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(lli i=0, i##_len=(lli)(n); i<i##_len; i++)
#define repf(i, n) for(lli i=1, i##_len=(lli)(n+1); i<i##_len; i++)
#define per(i, n) for(lli i=((lli)(n))-1; i>=0; i--)
#define perf(i, n) for(lli i=((lli)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<lli>
#define vvi vector<vector<lli>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
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; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    
    lli a, b, x; cin >> a >> b >> x;
    double ans = 0.0;
    if(x >= (a*a*b/2.0)){
        // 水が半分以上の場合
        ans = atan(2.0*(a*a*b-x)/(a*a*a));
    }
    else{
        // 水が半分未満の場合
        ans = atan((a*b*b)/(2.0*x));
    }
    cout << ans * 180.0 / M_PI << endl;
}

Measured memory_bytes: 384
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd

mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
n=ii()
if n%2==0:
    print(n//2)
else:
    print((n+1)//2)




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

int main() {
  int n, m;
  cin >> n >> m;
  int low = -1, high = n + 10;
  for (int i = 0; i < m; ++i) {
    int l, r;
    cin >> l >> r;
    low = max(low, l);
    high = min(high, r);
  }
  cout << max(0, high - low + 1) << "\n";
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <typeinfo>
#include <climits>
#include <algorithm>
#include <cctype>
#include <cstring>
#include <stdio.h>
#include <cstdlib>
using namespace std;

int main(){
    char a, b;
    cin >> a >> b;
    if(a=='H'&&b=='H' || a=='D'&&b=='D'){
        cout << "H";
    }else{
        cout << "D";
    }
}


Measured memory_bytes: 256
import itertools

ft=24*60*60
while True:
    n=int(input())
    if n==0:
        break
    c=[0]*(ft+1)
    for i in range(n):
        t1,t2=input().split()
        tt1=(int(t1[0:2])*60+int(t1[3:5]))*60+int(t1[6:8])
        tt2=(int(t2[0:2])*60+int(t2[3:5]))*60+int(t2[6:8])
        c[tt1]+=1
        c[tt2]-=1
    cc = itertools.accumulate(c)
    cc=list(cc)
    print(max(cc[:ft+1]))


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

int main()
{
  int n,m;
  cin>>n>>m;
  int s=0;
  int arr[1000];
  for(int i=0;i<n;i++)
    cin>>arr[i];
  
  for(int i=0;i<n;i++)
    s+=arr[i];
  int k=0;
  for(int i=0;i<n;i++)
  {
    if(arr[i]>= ((.25*s)/m))k++;

  }
  if(k>=m)cout<<"Yes\n";
  else cout<<"No\n";
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define oo (int)1e9
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 1e3 + 5, M = 2 * N + 5;

int main(){
    int a, b;
    cin >> a >> b;
    cout << max(0, a - 2 * b) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//#define ordered_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i, a, b, d) for (int i = a; i <= b; i += d)
#define brep(i, a, b, d) for (int i = a; i >= b; i -= d)
#define pb push_back
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define endl '\n'
const int MAX = 1e5 + 5;
const int MOD = 1e9 + 7;
////////////////////////////////

int dp[MAX][3];
int a[MAX][3];

int32_t main(){
    fastio
    int n; cin >> n;
    rep(j,0,2,1) cin >> a[1][j], dp[1][j] = a[1][j];

    rep(i,2,n,1){
        rep(j,0,2,1) cin >> a[i][j];
        rep(j,0,2,1){
            rep(k,0,2,1){
                if(j == k) continue;
                dp[i][j] = max(dp[i][j], dp[i-1][k] + a[i][j]);
            }
        }
    }
    cout << max(dp[n][0], max(dp[n][1], dp[n][2]));
    return 0;
}

Measured memory_bytes: 4992
#coding:utf-8
import math
N, M = map(int, input().split())
yakusu = []
for i in range(1, min(int(M / N) + 1, int(math.sqrt(M)) + 1)):
    if M % i == 0:
        yakusu.append(i)
        if int(M / i) * N <= M:
            yakusu.append(int(M / i))
print(max(yakusu))

Measured memory_bytes: 3060
def main():
	X,Y,Z,k=map(int,input().split())
	a=list(map(int,input().split()))
	b=list(map(int,input().split()))
	c=list(map(int,input().split()))
	ab=[]
	for x in a:
		for y in b:
			ab.append(x+y)
	ab.sort(reverse=True)
	if len(ab)>k:
		ab=ab[:k+1]
	c.sort()
	l=0
	r=max(ab)+max(c)+1
	import bisect
	while r-l>1:
		cnt=0
		mid=(l+r)//2
		for x in ab:
			cnt+=Z-bisect.bisect_left(c,mid-x)
		if cnt>=k:
			l=mid
		else:
			r=mid
	ans=[]
	for i in range(len(ab)):
		for j in range(bisect.bisect_left(c,l-ab[i]),Z):
			ans.append(ab[i]+c[j])
	ans.sort(reverse=True)
	for i in range(min(k,len(ans))):
		print(ans[i])
main()

Measured memory_bytes: 142868
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long a,b,c;
	cin>>a>>b>>c;
	if(a>=c){
		cout<<a-c<<" "<<b<<endl;
		return 0;
	}
	else{
		cout<<0<<" "<<max(0ll,b-(c-a))<<endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int fact(int x){int m;
if(x==1){m=1;}
else{m=fact(x-1)*x;}
return m;}

int main(){
int n;
cin>>n;
double a[n],b[n],x=0;
for (int i = 0; i < n; ++i)
{cin>>a[i]>>b[i];
}
for (int i = 0; i < n; ++i)
{for (int j = 0; j < i; ++j)
{x+=sqrt((a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j]));

}
}
cout<<fixed<<setprecision(6);
cout<<2*x/n;



return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <utility>
#include <unordered_set>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
//_sc(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
//_vo(string &s){for(char c:s)pcu(c);}
//_vo(string s){for(char c:s)pcu(c);}
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
//_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	unordered_set<int> A;
	for (int i = in(); i; i--)
		switch(in()) {
		case 0:
			A.insert(in());
			outl(A.size());
			break;
		case 1:
			outl(A.count(in()));
			break;
		default:
			A.erase(in());
		}
}


Measured memory_bytes: 10444
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
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 pair<int,int> P;

int main(){
  int n;
  cin >> n;
  int x[n];
  rep(i,n)cin >> x[i];
  ll ans=1e10;
  rep(i,105){
    ll t =0;
    rep(j,n){
      t += (i-x[j])*(i-x[j]);
    }
    chmin(ans,t);
  }
  cout << ans << endl;
}


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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define DCIN(...)                                                              \
    double __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const double PI = atan(1.0) * 4.0;
// const int MOD = 998244353;
const ll LINF = 9e18;
const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};

vector<vector<double>> x;

signed main() {
    LCIN(L, R);
    if(R - L >= 4038) {
        cout << 0 << "\n";
    } else {
        ll ans = 2019;
        FOR(i, L, R + 1) FOR(j, i + 1, R + 1) {
            ans = min(ans, (i * j) % 2019);
        }
        cout << ans << "\n";
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <limits.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    std::vector<int> r;
    for(int i=0; i<n; i++){
        int tmp;
        cin >> tmp;
        r.push_back(tmp);
    }

    long long int max = INT_MIN; // 最大の価格差
    int min = INT_MAX; // 途中までの最小価格
    std::vector<int>::iterator itr = r.begin();
    
    // 初期値設定
    min = *itr;
    itr++;
    while(itr != r.end()){
        int val = *itr;
        long long int diff = val - min;
        if(diff > max) max = diff;

        if(val < min) min = val;
        //cout << val << "," << max << "," << min << endl;
        ++itr;
    }
    cout << max << endl;

   
}


Measured memory_bytes: 3932
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main {
    public static void main(String[] args)throws Exception{
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(input.readLine());
        HashMap<String, Integer> blue = new HashMap<>();
        HashMap<String, Integer> red = new HashMap<>();
        String word;
        for (int i = 0; i < n; i++) {
            word = input.readLine();
            blue.put(word, blue.getOrDefault(word, 0) + 1);
        }
        int m = Integer.parseInt(input.readLine());
        for (int i = 0; i < m; i++) {
            word = input.readLine();
            red.put(word, red.getOrDefault(word, 0) + 1);
        }

        int max = 0;
        for (Map.Entry<String, Integer> blueEntry : blue.entrySet()) {
            max = Math.max(max, blueEntry.getValue() - red.getOrDefault(blueEntry.getKey() ,0));
        }

        System.out.println(max);
    }
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);++i)
#define fi first
#define se second
#define INF 1000000009
#define lINF 1000000000000000009
typedef long long ll;

int main(){
  int m,k;
  cin>>m>>k;
  if(m==1){
    if(k==0)cout<<0<<' '<<0<<' '<<1<<' '<<1<<endl;
    else cout<<-1<<endl;
    return(0);
  }
  if(k>=(1<<m)){
    cout<<-1<<endl;
    return(0);
  }

  vector<int>ans;
  ans.push_back(k);
  rep(i,1<<m){
    if(i==k)continue;
    ans.push_back(i);
  }
  ans.push_back(k);
  for(int i=(1<<m)-1;i>=0;i--){
    if(i==k)continue;
    ans.push_back(i);
  }

  rep(i,ans.size()){
    cout<<ans[i];
    if(i+1==ans.size())cout<<endl;
    else cout<<' ';
  }

  return(0);
}




Measured memory_bytes: 2932
N = int(input())
s = input()
t = input()

c = None
# i文字一致している
for i in range(N+1):
    sp = s[i:]
    tp = t[:N-i]
    # print(sp, tp)
    if sp == tp:
        c = i
        break

match = N - c
ans = 2 * N - match
# print(c, match, ans)
print(ans)

Measured memory_bytes: 3060
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 200005
#define inf 1e9
#define eps 1e-10
using namespace std;
 
inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}
 
ll n,a[maxn],b[maxn],ans,a1,a2;
 
inline int w(int x){if(x==0) return n; if(x==n+1) return 1; return x;}
 
int main()
{
	n=read();
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=n;i++) b[i]=read();
	int f=0;
	while(1)
	{
		f=0;
		for(int i=1;i<=n;i++)
		{
			if(b[i]>b[w(i+1)]+b[w(i-1)])
			{
				a1+=(b[i]/(b[w(i+1)]+b[w(i-1)]));
				b[i]%=(b[w(i+1)]+b[w(i-1)]); f=1;
				if(b[i]==0) b[i]+=b[w(i+1)]+b[w(i-1)],a1--;
			}
		}
		//for(int i=1;i<=n;i++) cout<<b[i]<<" "; cout<<endl;
		if(f==0) break;
	}
	//cout<<endl<<endl;
	
	while(1)
	{
		f=0;
		for(int i=1;i<=n;i++)
		{
			if(a[i]>a[w(i+1)]+a[w(i-1)])
			{
				a2+=(a[i]/(a[w(i+1)]+a[w(i-1)]));
				a[i]%=(a[w(i+1)]+a[w(i-1)]); f=1;
				if(a[i]==0) a[i]+=a[w(i+1)]+a[w(i-1)],a2--;
			}
		}
		//for(int i=1;i<=n;i++) cout<<a[i]<<" "; cout<<endl;
		if(f==0) break;
	}
	
	for(int i=1;i<=n;i++) if(a[i]!=b[i]) {puts("-1"); return 0;}
	if(a1<a2) puts("-1"); else cout<<a1-a2<<endl;
	
	return 0;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    double ans = 0;
    cin >> n;
    double x[10];
    string u[10];
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> u[i];
    }
    for (int i = 0; i < n; i++) {
        if (u[i] == "JPY") {
            ans += x[i];
        } else {
            ans += x[i] * 380000.0;
        }
    }
    printf("%lf\n", ans);
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>
#include<unordered_map>
#include<deque>
#include<cmath>





using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;

#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const ll INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
const ll mod = 1000 * 1000 * 1000 + 7;


void solve() {
    int n;
    cin >> n;
    vector<pii> a(n);
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        a[i] = {x + y, x - y};
    }
    sort(a.begin(), a.end());
    int res = 0;
    int x = a[0].second;
    for (int i = 0; i < n; ++i) {
        if (a[i].second >= x) {
            ++res;
            x = a[i].first;

        }

    }
    cout << res << endl;

}


//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    solve();



#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
typedef long long ll;
#define rep(i,l,r) for(int i=l; i<(int)(r); i++)

int k[12], s[12][12], p[12];

int main(){
    int n,m; scanf("%d%d", &n, &m);
    rep(i,0,m){
        scanf("%d", k+i);
        rep(j,0,k[i]){
            scanf("%d", &s[i][j]);
        }
    }
    rep(i,0,m) scanf("%d", p+i);

    int ans = 0;
    //ビット全探索　初期値は0 (ans=0あり)
    rep(bit, 0, (1 << n)) {
        int t_lmp = 0;
        rep(i, 0, m) {
            int tmp_sum = 0;
            rep(j, 0, k[i]){
                if(bit&(1<<(s[i][j]-1))) tmp_sum++;
            }
            if(tmp_sum%2 == p[i]) t_lmp++;
            else break;
        }
        if(t_lmp == m) ans++;
    }

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

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


int main() {
  int n,k,q,a;
  cin >> n >> k >> q;
  vector<int> p(n, 0);

  for(int i=0; i<q; i++){
    cin >> a;
    p.at(a-1) += 1;
  }

  for(int i=0; i<n; i++){
    if(k + p.at(i) - q <= 0){
      cout << "No" << endl;
    }else{
      cout << "Yes" << endl;
    }
  }


}


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

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

    int sum = 0, i = 0;
    while(str[i] != '\0'){
        if(str[i] == '+'){
            sum++;
        }
        else{
            sum--;
        }
        i++;
    }

    cout << sum << endl;

    return 0;
}

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

int main(){

char s[100];
scanf("%s",s);
int sl=strlen(s);
char c=1;

int slh=sl/2;
for(int i=0;i<slh;i++){
if(s[i]!=s[sl-i-1]){
c=0;
break;
}
}

if(c){
int shlh=slh/2;
for(int i=0;i<shlh;i++){
if(s[i]!=s[slh-i-1]){
c=0;
break;
}
}
}

if(c){
printf("Yes");
}else{
printf("No");
}
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long 
#define endl "\n"
using namespace std;

void solve()
{
	//Enter code here Tanmay::
	int n;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++)
	cin>>arr[i];
	
	int dp[n];
	dp[0]=0;
	dp[1]=abs(arr[1]-arr[0]);
	for(int i=2;i<n;i++)
	{
		dp[i]=min(abs(arr[i]-arr[i-1])+dp[i-1],abs(arr[i]-arr[i-2])+dp[i-2]);
	}
	cout<<dp[n-1];
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}
void fastscan(int &number) 
{ 
    //variable to indicate sign of input number 
    bool negative = false; 
    register int c; 
  
    number = 0; 
  
    // extract current character from buffer 
    c = getchar(); 
    if (c=='-') 
    { 
        // number is negative 
        negative = true; 
  
        // extract the next character from the buffer 
        c = getchar(); 
    } 
  
    // Keep on extracting characters if they are integers 
    // i.e ASCII Value lies from '0'(48) to '9' (57) 
    for (; (c>47 && c<58); c=getchar()) 
        number = number *10 + c - 48; 
  
    // if scanned input has a negative sign, negate the 
    // value of the input number 
    if (negative) 
        number *= -1; 
} 

Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define N 3
#define N2 9

struct Puzzle {
  int f[N2];
  int space;
  string path;

  bool operator < ( const Puzzle &p ) const {
    for ( int i = 0; i < N2; i++ ) {
      if ( f[i] == p.f[i] ) continue;
      return f[i] > p.f[i];
    }
    return false;
  }
};

static const int dx[4] = {-1, 0, 1, 0};
static const int dy[4] = {0, -1, 0, 1};
static const char dir[4] = {'u', 'l', 'd', 'r'};

bool isTarget(Puzzle p) {
  for ( int i = 0; i < N2; i++ )
    if ( p.f[i] != (i + 1) ) return false;
  return true;
}

string bfs(Puzzle s) {
  queue<Puzzle> Q;
  map<Puzzle, bool> V;
  Puzzle u, v;
  s.path = "";
  Q.push(s);
  V[s] = true;

  while ( !Q.empty() ) {
    u = Q.front(); Q.pop();
    if ( isTarget(u) ) return u.path;
    int sx = u.space / N;
    int sy = u.space % N;
    for ( int r = 0; r < 4; r++ ) {
      int tx = sx + dx[r];
      int ty = sy + dy[r];
      if ( tx < 0 || ty < 0 || tx >= N || ty >= N ) continue;
      v = u;
      swap(v.f[u.space], v.f[tx * N + ty]);
      v.space = tx * N + ty;
      if ( !V[v] ) {
        V[v] = true;
        v.path += dir[r];
        Q.push(v);
      }
    }
  }

  return "unsolvable";
}

int main() {
  Puzzle in;

  for ( int i = 0; i < N2; i++ ) {
    cin >> in.f[i];
    if ( in.f[i] == 0 ) {
      in.f[i] = N2;  // set space
      in.space = i;
    }
  }
  string ans = bfs(in);
  cout << ans.size() << endl;

  return 0;
}


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

int main()
{
	double a,b,c,d,e,f,x,y;

	while(cin>>a>>b>>c>>d>>e>>f){
		x=(c*e-b*f)/(a*e-b*d);
		y=(c*d-a*f)/(b*d-a*e);
		if(abs(x)<0.001) x=0.000;
		if(abs(y)<0.001) y=0.000;
		cout<<fixed<<setprecision(3)
		    <<x<<" "<<y<<endl;
	}
}

Measured memory_bytes: 1280
#include<iostream>
#include<stdio.h>
using namespace std;

int main()
{
	int A[100], B[100], n, i, j=0;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%d", &A[i]);
		if (A[i] % 2 == 0) {
			B[j] = A[i];
			j++;
		}
	}

	for (i = 0; i < j; i++) {
		if (B[i] % 3 != 0 && B[i] % 5 != 0)n = 0;
	}
	if (n == 0) {
		cout << "DENIED" << endl;
		return 0;
	}
	cout << "APPROVED" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>

using namespace std;

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


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

int main() {
  int64_t n;
  std::cin >> n;

  std::vector<int64_t> a(3 * n);

  for (auto &i : a) {
    std::cin >> i;
  }

  std::multiset<int64_t> r, g;
  std::multiset<int64_t, std::greater<int64_t>> l;

  for (int64_t i = 0; i < 3 * n; i++) {
    if (i < n) {
      r.insert(a[i]);
    } else {
      l.insert(a[i]);
    }
  }

  for (int64_t i = 0; i < n; i++) {
    g.insert(*l.cbegin());
    l.erase(l.cbegin());
  }

  int64_t r_val = std::accumulate(r.cbegin(), r.cend(), 0ll),
    l_val = std::accumulate(l.cbegin(), l.cend(), 0ll),
    ans = r_val - l_val;

  for (int64_t i = 0; i < n; i++) {
    const auto v = a[i + n];

    if (*r.cbegin() < v) {
      r_val += v - *r.cbegin();
      r.erase(r.cbegin());
      r.insert(v);
    }

    auto itr = l.find(v);
    if (itr != l.cend()) {
      l_val += *g.cbegin() - v;
      l.erase(itr);
      l.insert(*g.cbegin());
      g.erase(g.cbegin());
    } else {
      auto itr = g.find(v);
      if (itr != g.cend()) {
        g.erase(itr);
      }
    }
    ans = std::max(ans, r_val - l_val);
  }

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


Measured memory_bytes: 16640
import java.util.*;

public class Main {
	
   public static void main(String args[]){
		
	 Scanner sc= new Scanner(System.in);
	 
	 int n =sc.nextInt();
	 
	 String ans = "second";
	 
	 for(long i=0;i<n;i++){
		 if(sc.nextLong()%2!=0)ans="first";
	 }
	 
	 
	 System.out.println(ans);
   }
}


Measured memory_bytes: 51028
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e5;
int aa[N+2],dp[N+2];
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  int n;cin>>n;
  for(int i=1;i<=n;i++)
    cin>>aa[i];
  dp[2]=abs(aa[2]-aa[1]);
  for(int i=3;i<=n;i++)
  {
    dp[i]=dp[i-1]+abs(aa[i]-aa[i-1]);
    dp[i]=min(dp[i],dp[i-2]+abs(aa[i]-aa[i-2]));
  }
  cout<<dp[n]<<endl;
  return 0;
}

Measured memory_bytes: 1024
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if a * 500 + b * 100 + c * 50 == X:
                ans += 1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <map>
#include <cfenv>
#include <cmath>
#include <vector>
#include<cstdio>
#include <iterator>
#include <sstream>
#include <algorithm>
#include <numeric>
using namespace std;
typedef long long ll;
int main() {
	string s;
	cin >> s;
	vector<int> c(26,0);
	for (int a = 0; a < s.size(); a++) {
		c[s[a] - 97]++;
	}
	bool f = true;
	for (int a = 0; a < c.size(); a++) {
		if (c[a] % 2 == 1)f = false;
	}
	cout <<(f?"Yes":"No")<< endl;
}
	

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int long long
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
int n,w;
char c[405][405];
int nb=0,nw=0;
bool vis[405][405];
int ans=0;

void dfs(int x,int y,char f)
{
    if(x<=0 || y<=0 || x>n || y>w || c[x][y]!=f)
        return;
    if(f=='.')
    { 
        f='#';
        nw++;
    }
    else
    {
        f='.';
        nb++;
    }
    vis[x][y]=true;
    for(int i=0;i<4;i++)
    {
        if(vis[x+dx[i]][y+dy[i]]==false)
            dfs(x+dx[i],y+dy[i],f);       
    }
}

int32_t main()
{
    
    cin>>n>>w;
    for(int i=1;i<=n;i++)
    {
        string s;
        cin>>s;
        for(int j=1;j<=w;j++)
            c[i][j]=s[j-1];
    }
    
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(vis[i][j]==false && c[i][j]=='#')
            {
                nb=0,nw=0;
                char f='#';
                dfs(i,j,f);
                ans+=nb*nw;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 8064
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define eps 1e-10
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

char s[maxn],ch[maxn];

int main()
{
	cin>>(ch+1);
    int len=strlen(ch+1);
    for(int i=2e5;i<=2e5+len-1;i++) s[i]=ch[i-200000+1];
    int h=2e5,t=2e5+len-1,f=0;
    int T=read();
    while(T--)
    {
        int opt=read();
        if(opt==1) f^=1;
        else
        {
            int F=read(); char q; scanf("%c",&q);
            if(F==1&&f==0||F==2&&f==1) s[--h]=q;
            else s[++t]=q;
        }
    }
    if(f==0) for(int i=h;i<=t;i++) printf("%c",s[i]);
    else for(int i=t;i>=h;i--) printf("%c",s[i]);
	return 0;
}

Measured memory_bytes: 896
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_number(A, B) :-
    get_number(A),
    get_number(B).

get_number(A, B, C) :-
    get_number(A, B),
    get_number(C).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)
    sub_string

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==
*/

f(0, []).
f(X, ['1'|Cs]) :- f(X2, Cs), X is X2 + 1.
f(X, ['0'|Cs]) :- f(X2, Cs), X is X2.

main :-
    get_string(S),
    string_chars(S, S2),
    f(X, S2),
    writeln(X).


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

using ll = long long;
#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 INF 1e9

int cost[] = {2, 5, 5, 4, 5, 6, 3, 7, 6};

string comp(string a, string b){
  string ans = a;
  if(a.size() < b.size()){
    ans =b;
  }
  else if(a.size() == b.size()){
    if(a < b){
      ans = b;
    }
  }
  return ans;
}
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  REP(i, M){
    cin >> A[i];
  }
  vector<string> dp(10020, "*");
  dp[0] = "";
  REP(i, N){
    if(dp[i] == "*") continue;
    REP(j, A.size()){
      dp[i+cost[A[j]-1]] = comp(dp[i+cost[A[j]-1]], dp[i]+char(A[j]+'0'));
    }
  }
  cout << dp[N] << endl;
  return 0;
}


Measured memory_bytes: 43648
let () = Scanf.scanf "%d %d %d %d" @@ fun h w a b ->
  for i = 0 to h - 1 do
    for j = 0 to w - 1 do
      print_char @@
      if (i < b) = (j < a)
      then '0'
      else '1'
    done;
    print_newline ()
  done


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

int main() {
    int n;
    cin >> n;
    vector<long> d(n);
    rep(i, n) {
        cin >> d[i];
    }
    sort(d.begin(), d.end());
    long k = d[n/2] - d[n/2-1];
    cout << k << endl;
}

Measured memory_bytes: 4020
//============================================================================
// Name        : SoundHoundProgrammingContest2018.cpp
// Author      : sep
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cmath>
#include <ctime>
#include <functional>
#include <algorithm>
#include <vector>

using namespace std;

inline void mainA() {

	long int a, b;

	cin >> a >> b;

	if (a + b == 15) {
		cout << "+";
	} else if (a * b == 15) {
		cout << "*";
	} else {
		cout << "x";
	}

}

int main() {

#ifdef TEST
	struct timespec startTime, endTime;
	while (1) {
		clock_gettime(CLOCK_REALTIME, &startTime);
#endif

		mainA();

#ifdef TEST
		cout << flush;
		cerr << flush;
		cerr << endl << "Elapsed Time:";
		clock_gettime(CLOCK_REALTIME, &endTime);
		if (endTime.tv_nsec < startTime.tv_nsec) {
			cerr << endTime.tv_sec - startTime.tv_sec - 1 << "."
					<< endTime.tv_nsec + 1000000000 - startTime.tv_nsec << "s"
					<< endl;
		} else {
			cerr << endTime.tv_sec - startTime.tv_sec << "."
					<< endTime.tv_nsec - startTime.tv_nsec << "s" << endl;
		}

		cerr << endl;
	}
#endif

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int res=n%10;
  if(res==2 || res==4 || res==5 || res==7 || res==9) cout << "hon" << endl;
  if(res==0 || res==1 || res==6 || res==8) cout << "pon" << endl;
  if(res==3) cout << "bon" << endl;
  return 0;
}

Measured memory_bytes: 3652
L=input().split()
A,B,C=int(L[0]),int(L[1]),int(L[2])
X=[5,7]
ans = []
for i in range(len(X)):
    ans.append([A,B,C].count(X[i]))
if ans == [2,1]:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 9132
#include <iostream>
#include<cstdio>
using namespace std;
int main(void){
    int a,b;
    cin >> a;
    cin >> b;
    
    if(a < b){
    cout << "a < b";
    }
    else if (a > b){
    cout << "a > b";
    }
    else{
    cout << "a == b";
    }
    cout << endl;
    
}


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

#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 999999999999

using namespace std;

#define int long long

int n;
vector<int> a, b, c;

int32_t main(){
	int n;
	string a, b;
	cin >> n >> a >> b;
	
	int ans=2*n;
	REP(i, n){
		bool flag=true;
		int k=0;
		for(int j=i; j<n; j++){
			if(a[j]!=b[k]){
				flag=false;
			}
			k++;
		}
		
		if(flag){
			ans=min(ans, n+i);
		}
	}
	
	cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define LL long long
typedef unsigned long long ull;
const int maxn = 3e5 + 10;
const int mod = 998244353;
 
LL Jc[maxn];
int n;
LL a, b, c, k;
LL na, nb, nc;
LL ans;
 
void calJc()    //求maxn以内的数的阶乘
{
  Jc[0] = Jc[1] = 1;
  for (LL i = 2; i < maxn; i++)
    Jc[i] = Jc[i - 1] * i % mod;
}
 
LL pow(LL a, LL n, LL p)    //快速幂 a^n % p
{
  LL ans = 1;
  while (n)
  {
    if (n & 1) ans = ans * a % p;
    a = a * a % p;
    n >>= 1;
  }
  return ans;
}
 
LL niYuan(LL a, LL b)   //费马小定理求逆元
{
  return pow(a, b - 2, b);
}
 
LL C(LL a, LL b)    //计算C(a, b)
{
  return Jc[a] * niYuan(Jc[b], mod) % mod
    * niYuan(Jc[a - b], mod) % mod;
}
 
 
int main()
{
  cin >> n >> a >> b >> k;
  if (k == 0)
  {
    puts("1");
    exit(0);
  }
  c = a + b;
  LL left = 0;
  calJc();
  for (LL i = 0; i <= n; i++)
  {
    left = k - a*i;
    if (left < 0)break;
    if (left%b == 0)
    {
      LL num = left / b;
      if (num <= n)
      {
        ans += C(n, i)* C(n, num) % mod;
        ans%=mod;
      }
    }
  }
  cout << ans;
  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int a, b;
  cin >> a >> b;
  cout << (a + b) / 2 << endl;
}



Measured memory_bytes: 3160
#include <stdio.h>
int main(){
	int A;
	int B;
	int C;
	//A,B,Cの入力を受ける
  	scanf("%d %d %d",&A,&B,&C);
  	if(A+B+C==17){
      if((A==7&&B==C)||(B==7&&A==C)||(C==7&&A==B)){
      	printf("YES");
      }
    }else{
    	printf("NO");
    }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <utility>
typedef long long ll;
using namespace std;

int main(){
  ll i,j,k;
  cin >> i >> j >> k;
  ll x,y;
  if(max(max(i,j),k)==k)cout << i*j/2 << endl;
  else if(max(max(i,j),k)==j)cout << i*k/2 << endl;
  else if(max(max(i,j),k)==i)cout << j*k/2 << endl;
  string s;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<limits>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>


using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define big ((ll)(1e9)+7)


// double c(double x)
// {
//   double X = x;
//   X = int(X) % 10;
//   return X;
// }

int main()
{
  int n;
  cin >> n;
  vector<ll> a(n);
  for(int i = 0;i < n;i++)
  {
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  for(int i = 0;i < n-1;i++)
  {
    if(a[i] == a[i+1])
    {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int N,sum=0,x=1,P,a;
long long ans=0;
string S;
int main(){
    cin>>N>>P>>S;
    unordered_map<int,long long> mp;
    for(int i=0;i<N;i++){
        if(P==2 && (S.at(N-i-1)-'0')%2==0){ans+=N-i;}
        if(P==5 && (S.at(N-i-1)-'0')%5==0){ans+=N-i;}
        a=(S.at(N-1-i)-'0');
        sum+=a*x;
        sum%=P;
        mp[sum]++;
        x*=10;
        x%=P;
    }
    if(10%P==0){
        cout<<ans<<endl;
        return 0;
    }
    ans=mp[0];
    for(int i=0;i<P;i++){
        ans+=mp[i]*(mp[i]-1)/2;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3992
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N, K;
  cin>>N>>K;
  ll A[N];
  for(int i=0;i<N;++i) cin>>A[i];
  ll l=1, r=inf, m;
  int num;
  while(l<r) {
    m = (l+r)/2;
    num = 0;
    for(int i=0;i<N;++i) {
      if(A[i]%m==0) num += A[i]/m-1;
      else num += A[i]/m;
    }
    if(num>K) l = m+1;
    else r = m;
  }
  cout<<l<<endl;
}



Measured memory_bytes: 5076
import java.util.*;

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

	int S = sc.nextInt();
	int h,m,s;

	m = S/60;
	s = S%60;

	h = m/60;
	m = m%60;

	System.out.println(h+":"+m+":"+s);
  }
}

Measured memory_bytes: 26096
using System;

class Program
{
    static void Main(string[] args)
    {
        int t = int.Parse(Console.ReadLine());
        int ac = 0;
        int wa = 0;
        int tle = 0;
        int re = 0;
        for (int cnt = 0; cnt < t; cnt++)
        {
            string result = Console.ReadLine();
            switch (result)
            {
                case "AC":
                    ac++;
                    break;
                case "WA":
                    wa++;
                    break;
                case "TLE":
                    tle++;
                    break;
                case "RE":
                    re++;
                    break;
            }
        }
        Console.WriteLine("AC x " + ac);
        Console.WriteLine("WA x " + wa);
        Console.WriteLine("TLE x " + tle);
        Console.WriteLine("RE x " + re);
        return;
    }
}


Measured memory_bytes: 30624
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	d := n % 10
	var ans string
	if d == 3 {
		ans = "bon"
	} else if d == 0 || d == 1 || d == 6 || d == 8 {
		ans = "pon"
	} else {
		ans = "hon"
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1752
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	final int _intMax = Integer.MAX_VALUE; // =2147483647>10^9
	final int _intMin = Integer.MIN_VALUE;
	final long _longMax = Long.MAX_VALUE; // =9223372036854775807L>10^18
	final long _longMin = Long.MIN_VALUE;
	static boolean bElapsed = false;

	void solve() {
		int n = readNum();
		int[] ia = readNums();
		int ans = 0;
		while (true) {
			boolean bBreak = false;
			for (int i = 0; i < n; i++) {
				if (ia[i] % 2 > 0) {
					bBreak = true;
					break;
				}
				ia[i] /= 2;
			}
			if (bBreak)
				break;
			ans++;
		}
		pln(ans);
	}

	int pint(String s) {
		return Integer.parseInt(s);
	}

	long plong(String s) {
		return Long.parseLong(s);
	}

	String readLine() {
		try {
			return _in.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int readNum() {
		String line = readLine();
		return pint(line);
	}

	String[] readFlds() {
		String line = readLine();
		return line.split(" ");
	}

	int[] readNums() {
		String[] flds = readFlds();
		int[] nums = new int[flds.length];
		for (int i = 0; i < flds.length; i++) {
			nums[i] = pint(flds[i]);
		}
		return nums;
	}

	void p(char c) {
		_out.print(c);
	}

	void pln(char c) {
		_out.println(c);
	}

	void p(double d) {
		_out.print(d);
	}

	void pln(double d) {
		_out.println(d);
	}

	void p(long l) {
		_out.print(l);
	}

	void pln(long l) {
		_out.println(l);
	}

	void p(String s) {
		_out.print(s);
	}

	void pln(String s) {
		_out.println(s);
	}

	static BufferedReader _in;
	static PrintWriter _out;

	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		_in = new BufferedReader(new InputStreamReader(System.in));
		_out = new PrintWriter(System.out);
		new Main().solve();
		_out.flush();
		long end = System.currentTimeMillis();
		if (bElapsed) {
			System.err.println((end - start) + "ms");
		}
	}
}


Measured memory_bytes: 23252
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int m[10];
	for(int j=0 ; j<10 ; j++){
		cin >> m[j];
	}

	sort(m,m+10);
	
	for(int i=9 ; i>=7 ; i--){
		cout << m[i] << endl;
	}

	return 0;
}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int x = (c + b - 1) / b;
  int y = (a + d - 1) / d;
  if (x <= y) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


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

using namespace std;

int main() {
  int i, j;
  int N; cin >> N;
  int D; cin >> D;

  //vector<int> a(N);
  //vector<int> b(N);

  int ans;

  if(N%(2*D + 1) == 0) {
    ans = N/(2*D + 1);
  } else {
    ans = N/(2*D + 1) + 1;
  }

  cout << ans << endl;

  return 0;
}


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

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

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

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

    long long K[N+1];
    K[0] = 1;
    for (int i = 1; i <= N; i++){
        K[i] = K[i-1] * i;
    }

    long long count_P, count_Q;
    count_P = 1;
    count_Q = 1;

    for (int i = 0; i < N - 1; i++){
        int count = 0;
        for (int j = i + 1; j < N; j++){
            if (P[i] > P[j]){
                count++;
            }
        }
        count_P += count * K[N-1-i];
    }

    for (int i = 0; i < N - 1; i++){
        int count = 0;
        for (int j = i + 1; j < N; j++){
            if (Q[i] > Q[j]){
                count++;
            }
        }
        count_Q += count * K[N-1-i];
    }

    cout << abs(count_P - count_Q) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <map>
#include <utility>
#include <set>
#include <climits>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

int main() {
    int n;
    scanf ("%d", &n);
    int max_height = 0, total = 0;
    for (int i = 0; i < n; ++i) {
        int h;
        scanf ("%d", &h);
        if (h >= max_height) {
            ++total;
            max_height = max(max_height, h);
        }
    }
    printf("%d\n", total);
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
    int n;
    char s[55];
    int count=0;
    
    scanf("%d", &n);
    scanf("%s", s);
    
    for(int i=0; i<n-2; i++){
        if(s[i]=='A'){
            if(s[i+1]=='B' && s[i+2]=='C') count++;
        }
    }
    
    printf("%d", count);
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int[] l = new int[n];
		int[] d = new int[n + 1];
		d[0] = 0;
		int count = 1;

		for (int i = 0; i < n; i++) {
			l[i] = sc.nextInt();
		}

		for (int i = 1; i <= n; i++) {

			if (d[i - 1] + l[i - 1] <= x) {
				d[i] = d[i - 1] + l[i - 1];
				count++;
			} else {
				break;
			}

		}

		System.out.println(count);
	}
}

Measured memory_bytes: 23376
from sys import stdin
input = stdin.readline

n, q = map(int, input().split())
prosess = [input().split() for _ in range(n)]


class Queue():
    def __init__(self):
        self.head = 0
        self.tail = 0
        self.q = [0] * 10 ** 6
        self.max = 10 ** 6

    def isfull(self):
        return self.head == (self.tail + 1) % self.max

    def isempty(self):
        return self.head == self.tail

    def enqueue(self, x):
        if self.isfull():
            return "Full"
        else:
            self.q[self.tail] = x
            self.tail += 1

        if self.tail == self.max:
            self.tail = 0

    def dequeue(self):
        if self.isempty():
            return "Empty"
        else:
            self.x = self.q[self.head]
            self.head += 1

        if self.head == self.max:
            self.head = 0

        return self.x


queue = Queue()

for p in prosess:
    queue.enqueue([p[0], int(p[1])])

now_time = 0

while not queue.isempty():
    name, time = queue.dequeue()

    if time <= q:
        now_time += time
        print(name, now_time)
    else:
        time -= q
        now_time += q
        queue.enqueue([name, time])



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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	char s[4];
  rep(i, 4) cin >> s[i];
  ll a = s[0] - '0';
  ll b = s[1] - '0';
  ll c = s[2] - '0';
  ll d = s[3] - '0';
  if (a - b - c - d == 7) cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;
  else if (a + b - c - d == 7) cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
  else if (a + b + c - d == 7) cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl;
  else if (a + b + c + d == 7) cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
  else if (a + b - c + d == 7) cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
  else if (a - b + c + d == 7) cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
  else if (a - b - c + d == 7) cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
  else if (a - b + c - d == 7) cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
#define rep(i,s,n)for(int i=s;i<n;i++)
typedef long long ll;

int main() {
	ll n; cin >> n;
	string s;
	ll p;
	map<string, vector<pair<ll, ll>>> m;
	rep(i, 0, n) {
		cin >> s;
		cin >> p;
		pair<ll, ll> pair = make_pair(p, i + 1);
		m[s].push_back(pair);
	}
	for (map<string, vector<pair<ll, ll>>>::iterator it = m.begin(); it != m.end(); it++) {
		sort(it->second.begin(), it->second.end());
		reverse(it->second.begin(), it->second.end());
		for (vector<pair<ll, ll>>::iterator it_v = it->second.begin(); it_v != it->second.end(); it_v++) {
			cout << it_v->second << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256