akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
    #include <ext/pb_ds/tree_policy.hpp> 
    #include <functional> // for less 
    using namespace __gnu_pbds; 
    using namespace std;
    //typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;    
    #define ll            long long
    #define pb            push_back
    #define ppb           pop_back
    #define si            set <ll>
    #define endl          '\n'
    #define fr            first
    #define sc            second
    #define mii           map<ll,ll>
    #define msi           map<string,ll>
    #define mis           map<ll,string>
    #define rep(i,a,b)    for(ll  i=a;i<b;i++)
    #define all(v)        v.begin(),v.end()
    #define sort(v)       sort(all(v))
    #define pii           pair<ll ,ll >
    #define vi            vector<ll >
    #define vii           vector<pair<ll,ll>>
    #define vs            vector<string>
    #define sz(x)         (ll)x.size()
    #define M             1000000007
    #define bs            binary_search
    #define rev(a)        reverse(all(a));
    #define sp(n)         setprecision(n)
    #define spl           " "
    #define arr(a,n)      rep(i,0,n) cin>>a[i]
    #define mod           998244353
    #define print_vector(a)  for(auto t:a) cout<<t<<" ";cout<<endl;
    #define print_arr(a,n)   rep(i,0,n) cout<<a[i]<<" "; cout<<endl;        
    #define show(a,n)     for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
    #define debug(x)      cout << #x << " is " << x << endl;
    #define time          cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    #define INF           1ll<<31
    #define hi            cout<<"hi"<<endl;
    const ll maxn=int(3e5)+500;
    const ll maxa=(1<<20)+3;
    ll bpow(ll a, ll b, ll mm = M)
    {
        ll res = 1;
     
        while(b)
        {
            if(b & 1)
                res = (res * a) % mm;
            a = (a * a) % mm;
     
            b >>= 1;
        }
     
        return res;
    }
   
    void solve()
    {
      ll a,b,c,d;
      cin>>a>>b>>c>>d;
      ll g=__gcd(c,d);
      g=(c*d)/g;
      ll x=b/c;
      ll y=(a-1)/c;
      ll z=x-y;
      x=b/d;
      y=(a-1)/d;
      ll zz=(x-y);
      x=b/(g);
      y=(a-1)/(g);
      ll zzz=(x-y);
      //cout<<zzz<<endl;
      ll ans=z+zz-zzz;
      //cout<<ans<<endl;
      cout<<b-a+1-ans<<endl;
    } 
    signed main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        ll t=1;
        //cin>>t;
        while(t--) solve();
    }

  

Measured memory_bytes: 256
N, M = map(int, input().split())

ans = 1
for g in range(1, int(M ** 0.5) + 1):
    if M % g == 0 and M / g >= N:
        ans = max(ans, g)
    
    if M % g == 0:
        g2 = M // g
        if M % g2 == 0 and M / g2 >= N:
            ans = max(ans, g2)
print(ans)


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

int main(){
  int N,x;//N人ｘ個
  cin >> N >> x;
  vector<int> a(N);
  for(int i=0;i<N;i=i+1){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  int sum = 0;
  int count;
  for(int i=0;i<N;i=i+1){
    sum = sum + a.at(i);
    if(sum < x){
      count = i;
      continue;
    }
    else if(sum == x){
      count = i+1;
      continue;
    }
    else if(sum > x){
      count = i;
      break;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define NMAX 110
using namespace std;
int v[NMAX], i, n, x, nr = 0;
int main()
{
    cin >> n >> x;
    for(i = 1; i <= n; i++)
        cin >> v[i];
    sort(v + 1, v + n + 1);
    i = 1;
    while (x > 0 && i <= n) {
        nr++;
        x -= v[i];
        i++;
    }
    if (x == 0)
        cout << nr;
    else
        cout << nr - 1;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace ABC167A
{
    class Program
    {
        static void Main(string[] args)
        {
            var id1 = Console.ReadLine();
            var id2 = Console.ReadLine();

            if(id2.Substring(0,id1.Length)==id1 && id2.Length== id1.Length+1)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


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

int main()
{
    int i, j, n;
    while (1) {
        int ans = 0;
        cin >> n;
        if (n == 0)break;
        int sum = 0;
        i = 0;
        while (n > sum) {
            i++;
            sum += i;
        }
        sum = 1;
        for (j = 2; j <= i; j++) {
            sum = sum + j;
            if ((n - sum) % j == 0)ans++;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 2980
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<ctime>
#include<list>
#include<deque>
#include<bitset>
#include<fstream>
#define ld double
#define ull unsigned long long 
#define ll long long 
#define pii pair<ll,ll >
#define iiii pair<int,pii >
#define mp make_pair 
#define INF 1000000000
#define MOD 1000000007 
#define rep(i,x) for(int (i)=0;(i)<(x);(i)++)

using namespace std;

inline int getint()
{
	int x=0,p=1;char c;
	c=getchar();
	while (c<=32)c=getchar();
	if(c==45)p=-p,c=getchar();
	while (c>32)x=x*10+c-48,c=getchar();
	return x*p;
}

const int maxn=1e5+5;

map<ll,int>h;
set<int>G[maxn];
int n,res;
queue<pii >qu;

void fmerge(int x,int y)
{
	if(G[x].size()<G[y].size())swap(x,y);
	while (!G[y].empty())
	{
		int z=*G[y].begin();
		h[1ll*z*n+x]+=h[1ll*z*n+y];
		h[1ll*x*n+z]+=h[1ll*y*n+z];
		h[1ll*y*n+z]=h[1ll*z*n+y]=0;
		G[x].insert(z);
		G[z].insert(x);
		G[z].erase(y);
		G[y].erase(z);
		if(h[1ll*x*n+z]==2)qu.push(mp(x,z));
	}
}

int main()
{
	n=getint();
	rep(i,2*n-2)
	{
		int x,y;
		x=getint();y=getint();
		G[x].insert(y);G[y].insert(x);
		h[1ll*y*n+x]++;h[1ll*x*n+y]++;
		if(h[1ll*y*n+x]==2)qu.push(mp(x,y));
	}
	
	while (!qu.empty())
	{
		int x=qu.front().first,y=qu.front().second;qu.pop();
		if(h[1ll*x*n+y]==2)
		{
			res++;
			fmerge(x,y);
		}
	}
	
	if(res==n-1)printf("YES\n");
	else printf("NO\n");
	

	return 0;	
} 

Measured memory_bytes: 55552
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
lli mw(vector<pair<lli,lli>>v,lli N,lli W)
{
    lli dp[N+1][W+1];
    for(lli w=0;w<=W;w++)
    {
        dp[1][w] = 0;
        dp[0][w] = 0;
    }
    dp[1][v[1].first] = v[1].second;
    for(lli i=2;i<=N;i++)
    {
        for(lli w = 0;w<=W;w++)
        {
            dp[i][w] = dp[i-1][w];
            if(w-v[i].first>=0)
            dp[i][w] = max(dp[i][w],v[i].second+dp[i-1][(w-v[i].first)]);
        }
    }
    return *max_element(dp[N],dp[N]+W+1);
}
int main() 
{
    lli n,w;
    cin>>n>>w;
    vector<pair<lli,lli>>v(n+1);
    for(lli i=1;i<=n;i++)
    {
        cin>>v[i].first>>v[i].second;
    }
    cout<<mw(v,n,w)<<"\n";
    //cout<<v[1].first<<" "<<v[1].second<<"\n";
}


Measured memory_bytes: 79104
/*
    @uthor: Amit Kumar
    user -->GitHub: drviruses ; CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#define ln mp::cpp_int;
#define ll    long long
#define ld    long double
#define ull   unsigned long long
#define all(vec) vec.begin(),vec.end()
#define endl "\n"
ll google_itr = 1;
#define google(x) cout<<"Case #"<<x<<":"
#define pi 3.14159265358979323846264338327950L

const ll mod = 1e9+7;
const ll inf = 1e18;
const ll mx = 3005;

ll dp[mx][mx];

void virus(){
          string a,b;
          cin>>a>>b;
          ll m = (ll)a.size(), n = (ll)b.size();
          for(auto i=1; i<=m; i++){
              for(auto j=1; j<=n; j++){
                  if(a[i-1] == b[j-1]) dp[i][j] = 1 + dp[i-1][j-1];
                  else dp[i][j] = max(dp[i-1][j], dp[i][j-1]); 
              }
          }
    
          string ans = "";
          ll lr = m, lc = n;
          while(lr and lc){
              if(dp[lr][lc] == dp[lr-1][lc])
                lr--;
             else if(dp[lr][lc] == dp[lr][lc-1])
                lc--;
             else{
                 ans += a[lr-1];
                 lr--, lc--;
             }   
          }
          reverse(all(ans));
          cout<<ans<<endl;
}


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/

    ll t = 1;
    //cin>>t;
    while(t--){
           auto start = high_resolution_clock::now();
           virus();
           auto stop = high_resolution_clock::now();
           auto duration = duration_cast<seconds>(stop - start);
           cerr << "\n Time: "<<duration.count()<<endl;
        //your code goes here
    }
    return 0;
}

Measured memory_bytes: 74048
s=input()
n=len(s)
set=set(s)
m=len(set)
a=s.count('a')
b=s.count('b')
c=s.count('c')
if m==1:
  if n==1:
    print('YES')
  else:
    print('NO')
elif m==2:
  if n==2:
    print('YES')
  else:
    print('NO')
else:
  if n%3==0:
    if a==b==c:
      print('YES')
    else:
      print('NO')
  elif n%3==2:
    if (a==n//3+1 and b==n//3+1) or (c==n//3+1 and b==n//3+1) or (a==n//3+1 and c==n//3+1):
      print('YES')
    else:
      print('NO')
  else:
    if (a==n//3 and b==n//3) or (c==n//3 and b==n//3) or (a==n//3 and c==n//3):
      print('YES')
    else:
      print('NO') 

Measured memory_bytes: 9284
#include<bits/stdc++.h>
using namespace std;
#define int long long 
typedef long long ll;
typedef pair<ll,ll>pi;
const int MAXN=100005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define fst first
#define snd second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int N;
	int ans=0;
	cin>>N;
	FOR(i,1,N){
		if (i%3!=0 && i%5!=0) ans+=i;
	}
	cout<<ans;
}


Measured memory_bytes: 3652
data = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
w = input()


for i in range(26):
        if w.count(data[i]) % 2 != 0:
            print('No')
            exit()
print('Yes')

Measured memory_bytes: 8968
#include<stdio.h>
#define M 40
int n,s;
int a[M],b[M];
void solve(int, int);
int main(){
  int i;
  scanf("%d",&n);
  for(i = 0; i<n; i++){
    scanf("%d", &a[i]);
  }
  for(i = 0; i<n; i++){
    scanf("%d",&b[i]);
  }
  s = 0;
  solve(0,n-1);
  printf("\n");
  return 0;
}

void solve(int l, int r){
  int x,i;
  x = a[s];
  if( l > r){
    return;
  }
  if(l == r){
    if( b[l] == a[0]){
      printf("%d",b[l]);
    }
    else{
      printf("%d ",b[l]);
    }
      s++;
      return;
    }
    
    s++;
    for(i = l ; i<=r ;i ++){
      if(b[i] == x)break;
    }
    solve(l,i - 1);
    solve(i + 1,r);

    if(x == a[0]){
      printf("%d",x);
    }

    else{
      printf("%d ",x);
    }
    }



Measured memory_bytes: 2096
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

  int n500 = x / 500;
  int n5 = (x%500) / 5;
  cout << (n500*1000+n5*5) << endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
typedef long long ll;
typedef double db;
#define mk make_pair
#define pa pair<int,int>
using namespace std;

inline int rd() {
	int x=0,f=1;char ch=getchar();
	for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-1;
	for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}
int N;
int a[10010];
int ans;
//main=============================
int main() {
	N=rd();N*=2;
	for(int i=1;i<=N;++i) a[i]=rd();
	sort(a+1,a+N+1);
	for(int i=1;i<=N;++i) if(i&1) ans+=a[i];
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

void s1(int m[][14], int x, int y){
    x+= 2; y+= 2;
    m[x][y]++;
    m[x+1][y]++;
    m[x-1][y]++;
    m[x][y+1]++;
    m[x][y-1]++;
}
void s2(int m[][14], int x, int y){
    x+= 2; y+= 2;
    m[x][y]++;
    m[x+1][y]++;
    m[x-1][y]++;
    m[x][y+1]++;
    m[x][y-1]++;
    m[x+1][y+1]++;
    m[x+1][y-1]++;
    m[x-1][y+1]++;
    m[x-1][y-1]++;
}
void s3(int m[][14], int x, int y){
    x+= 2; y+= 2;
    m[x][y]++;
    m[x+1][y]++;
    m[x-1][y]++;
    m[x][y+1]++;
    m[x][y-1]++;
    m[x+1][y+1]++;
    m[x+1][y-1]++;
    m[x-1][y+1]++;
    m[x-1][y-1]++;
    m[x+2][y]++;
    m[x-2][y]++;
    m[x][y+2]++;
    m[x][y-2]++;
}

int main(){
    int x,y,s;
    char g;
    int m[14][14] = {{0}};
    int ans[2] = {0};

    while(cin >> x >> g >> y >> g >> s){
        if(s == 1) s1(m,x,y);
        else if(s == 2) s2(m,x,y);
        else if(s == 3) s3(m,x,y);
    }
    range(i,2,12){
        range(j,2,12){
            if(m[i][j] == 0){
                ans[0]++;
            }
            if(ans[1] < m[i][j]){
                ans[1] = m[i][j];
            }
        }
    }
    cout << ans[0] << endl << ans[1] << endl;
}

Measured memory_bytes: 1160
// C++ 14
#include <math.h>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <string>

#define ll long long
#define Int ll
#define loop(x, start, end) for(Int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)
#define span(a,x,y) a.begin()+x,a.begin()+y
#define span_all(a) a.begin(),a.end()
#define len(x) (x.size())
#define last(x) (*(x.end()-1))

using namespace std;

#define EPS 0.00000001
#define fequals(a,b) (fabs((a) - (b)) < EPS)

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (const Vector2 v) const { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (const Vector2 v) const { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (const double k) const { return Vector2(x * k, y * k); }
  Vector2 operator / (const double k) const { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 const v) { return x * v.x + y * v.y; }
  double cross (Vector2 const v) { return x * v.y - y * v.x; }
  
  bool parallel(Vector2 &other) {
    return fequals(fabs(dot(other)), length() * other.length());
  }
  
  bool orthogonal(Vector2 &other) {
    return fequals(0, dot(other));
  }
  
  bool operator < (const Vector2 &v) {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

Int N;
double R;
Vector2 C, p1, p2;


Vector2 project(Vector2 start_, Vector2 end_, Vector2 p) {
    Vector2 v = end_ - start_;
    return start_ + v * (v.dot(p - start_) / v.norm());
}

Vector2 unitVec(Vector2 v) {
  return v / v.length();
}

pair<Vector2, Vector2> crossPoints() {
  Vector2 p = project(p1, p2, C);
  Vector2 e = unitVec(p2 - p1);
  double len = sqrt(R*R - (p - C).norm());
  Vector2 x1 = p + e * len;
  Vector2 x2 = p + e * (-len);
  if (fabs(x1.x) < EPS) x1.x = 0.0;
  if (fabs(x1.y) < EPS) x1.y = 0.0;
  if (fabs(x2.x) < EPS) x2.x = 0.0;
  if (fabs(x2.y) < EPS) x2.y = 0.0;
  if (x1 < x2) return make_pair(x1, x2);
  return make_pair(x2, x1);
}

void solve() {
  auto points = crossPoints();
  cout << points.first.x << ' ' << points.first.y << ' ';
  cout << points.second.x << ' ' << points.second.y << endl;
}

void input() {
  cin >> C >> R >> N;
  while (cin >> p1 >> p2) {
    solve();
  }
}

int main() {
  cout.precision(15);
  input();
}


Measured memory_bytes: 3256
import java.util.Scanner;

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

    char[] s = scanner.next().toCharArray();

    int num = 0;
    for (int i = 0; i < s.length; i++) {
      char c = s[i];
      if (i % 2 == 0) num -= c == 'g' ? 0 : 1;
      else num += c == 'g' ? 1 : 0;
    }
    System.out.println(num);
  }
}


Measured memory_bytes: 26860
using System;
class Program 
   {
      static int Inning;
      static int outs = 0,j;
      static int[] Points;
      static bool[] runner = new bool[3];
      static int Case(string s) {
         switch (s) {
            case "HIT": return 1;
            case "HOMERUN":return 2;
            case "OUT":return 3;
            default:return 0;
         }
      }

      static int RunnerCount() {
         int y = 0;
         foreach (bool b in runner) if (b) y++;
         return y;
      }

      static void MakeEvent(int E) {
         switch (E) {
            case 1:  //Hit
               if (!runner[0]) runner[0]=true;
               else if (!runner[1]) runner[1]=true;
               else if (!runner[2]) runner[2]=true;
               else Points[j]++;
               break;
            case 2:
               Points[j]+=RunnerCount()+1;
               for (int i = 0; i<3; i++) runner[i]=false;
               break;
            case 3:outs++;break;
         }
      }

      static void Main() {
         int E;
         Inning=int.Parse(Console.ReadLine());
         Points=new int[Inning];
         for (j = 0; j<Inning; j++) {
               while (true) {
                  E=Case(Console.ReadLine()) ;
                  MakeEvent(E);
                  if (outs>=3) break;
               }
               outs=0;
            for (int i = 0; i<3; i++) {
               runner[i]=false;
            }
         }
         foreach (int p in Points) Console.WriteLine(p);
      }

      
   }

Measured memory_bytes: 8940
#include<iostream>

int main(){
	long answer[3];
	
	long n;
	std::cin>>n;

	long numer;
	long denom;

	for(int i=1; i<=3500; i++){
		for(int j=1; j<=3500; j++){
			numer= 4*i*j-(n*j + n*i);
			denom= n*i*j;

			if(numer<=0)
				continue;

			if(denom< numer)
				continue;

			if(denom % numer== 0){
				answer[0]= i;
				answer[1]= j;
				answer[2]= denom/numer;
				break;
			}
		}
	}

	for(int i=0; i<3; i++){
		std::cout<< answer[i];
		
		if(i!=2)
			std::cout<<" ";
	}
	std::cout<<std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <iomanip>
using namespace std;

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

  int n,k;
  cin >> n >> k;
  vector<int> l(n);
  for(int i = 0; i < n; i++){
    cin >> l[i];
  }
  sort(l.begin(),l.end());
  int sum = 0;
  for(int i = n - 1; i >= n - k; i--){
    sum += l[i];
  }
  cout << sum << endl;
}

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

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 1e9
using R = long double;
constexpr R EPS = 1E-6;
int sgn(const R &r) { return (r > EPS) - (r < -EPS); }
int sgn(const R &a, const R &b) { return sgn(a - b); }
using namespace std;
template <class T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}

typedef long long ll;
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;
}

#pragma endregion

int main() {
  int n = in();

  bool flag = false;
  for (int i = (n / 1.08); i < n + 1; ++i) {
    if ((int)(i * 1.08) == n) {
      flag = true;
      cout << i << endl;
      break;
    }
  }
  if (!flag) {
    cout << ":(" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
dict = {"a":0,"b":1,"c":2}
revd = {0:"A",1:"B",2:"C"}
strset = [input() for _ in range(3)]
deckpo = [0,0,0]
turn = 0
while True:
    if deckpo[turn] == len(strset[turn]):
        break
    next = dict[strset[turn][deckpo[turn]]]
    deckpo[turn] += 1
    turn = next
print(revd[turn])

Measured memory_bytes: 3064
n = gets.chomp.to_i
ps = gets.chomp.split(' ').map(&:to_i)
ps_sorted = ps.sort

if ps == ps_sorted
    puts 'YES'
    exit
end

n.times do |i|
    if ps[0] != ps.min
        min_i = ps.index(ps.min)
        ps[0], ps[min_i] = ps[min_i], ps[0]
        if ps == ps.sort
            puts 'YES'
        else
            puts 'NO'
            exit
        end
    else
        ps.shift
    end
end
        


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	string s;
	cin >> s;
	vector<int> cnt(3, 0);
	int l=s.length();
	for(int i=0; i<l; i++){
		cnt[s[i]-'a']++;
	}
	sort(cnt.begin(), cnt.end());

	bool bl=false;
	if(l%3==0){
		if(cnt[0]==l/3 && cnt[2]==l/3){
			bl=true;
		}
	}else if(l%3==1){
		if(cnt[0]==l/3 && cnt[1]==l/3 && cnt[2]==(l+2)/3){
			bl=true;
		}
	}else{
		if(cnt[0]==l/3 && cnt[1]==(l+2)/3 && cnt[2]==(l+2)/3){
			bl=true;
		}
	}
	if(bl) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 512
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
from collections import deque, defaultdict
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    A = LI()
    # print(list(accumulate(A)))
    d = defaultdict(int)
    B = [0] + list(accumulate(A))
    ans = 0
    for b in B:
        ans += d[b]
        d[b] += 1

    print(ans)

    
if __name__ == '__main__':
    solve()



Measured memory_bytes: 44880
#include <bits/stdc++.h>
using namespace std;
// types
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
// IO
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define sc(n) scanf("%d", &n) 
#define sca(a, n) fo(i, n) sc(a[i])
#define pd(a) printf("%d ", a)
#define pld(a) printf("%d\n", a)
#define pda(a, n) fo(i, n) pd(a[i])
#define pl printf("\n")
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b) 
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
// math
const ll mod = 1e9+7;
template<typename T> T gcf(T a, T b) {return (b == 0) ? a : gcf(b, a%b);} 
template<typename T> T lcm(T a, T b) {return (a*b)/gcf(a, b);}
template<typename T> T sumTo(T x) {return x * (x+1) / 2;}
template<typename T> T sumSquaresTo(T x) {return x * (x+1) * (2*x+1) / 6;}
template<typename T> T ceilDiv(T n, T d) {return (n+d-1)/d;}

void solve() {
    int a; cin >> a;
    cout << a + a*a + a*a*a;
}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3516
a, b, c, d = map(int, input().split())

if a <= c:
    if d <= b:
        print(d - c)
    elif c <= b:
        print(b - c)
    elif b < c:
        print(0)
elif c < a:
    if b <= d:
        print(b - a)
    elif a <= d:
        print(d - a)
    elif d < a:
        print(0)


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

int N;
int A[200100], B[200100], B2[200100];

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

    std::cin >> N;

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

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

    int res = 0;
    for(int i=0;i<29;++i){
        int x = 1 << i;

        for(int j=0;j<N;++j){
            B2[j] = B[j] % (2 * x);
        }
        sort(B2, B2+N);

        int s = 0;
        
        for(int j=0;j<N;++j){
            int a = A[j] % (2 * x);
            auto l1 = lower_bound(B2, B2+N, x - a);
            auto r1 = lower_bound(B2, B2+N, 2 * x - a);
            auto l2 = lower_bound(B2, B2+N, 3 * x - a);
            auto r2 = lower_bound(B2, B2+N, 4 * x - a);

            s ^= ((r1 - l1) + (r2 - l2)) % 2;
        }

        res |= s << i;
    }

    std::cout << res << std::endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin >> N;
    vi A(N);
    cin >> A;
    int tot = accumulate(all(A), 0LL);
    int s = 0;
    int ans = INF;
    rep(i, 0, N) {
        s += A[i];
        chmin(ans, abs(s - tot + s));
    }
    cout << ans << endl;
    return (0^_^0);
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define F first
#define S second
#define bitcnt(v) __builtin_popcount(v)
#define all(v) v.begin(), v.end()

int dp[100003][2];
vector<int> a;
int n, k; 

bool solve(int stones, bool alice){
	if(dp[stones][alice] != -1) return dp[stones][alice];
	for(int x : a){
		if(stones >= x && !solve(stones-x,!alice)){
			return dp[stones][alice] = 1;
		}
	}
	return dp[stones][alice] = 0;
}

void solution(){
	cin >> n >> k;
	a = vector<int>(n); for(auto& x : a) cin >> x;
	// Game Theory DP - 
	// here state only depends on number of stones left 
	// and whos turn it is to move
	memset(dp,-1,sizeof(dp));
	dp[0][1] = dp[0][0] = 0;
	cout << (solve(k,1) ? "First\n" : "Second\n");
	return;
}	


int main(){ 

	fio; // fast input output
	int t;
	t = 1;
	// cin >> t;
	for(int i = 1; i <= t; i++){
		// GOOGLE //
		// cout << "Case #" << i << ": ";
		solution();
	} 
	return 0;
}


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

int main() {
  long long x; cin >> x;
  long long res = 0;
  long long quotient, remainder;
  quotient  = x / 11;
  remainder = x % 11;
  if( 0 < remainder  && remainder<= 6) res += 1;
  else if ( 7<= remainder && remainder < 11 ) res += 2;
  res = res + quotient * 2;
  cout << res << endl;

  return 0;
}


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

int digit_sum(int a){
    if(a<10) return a;
    return digit_sum(a/10) + a%10;
}

int main(){
    int n;
    cin >>n;
    if(n%digit_sum(n)==0) cout <<"Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
int N;
bool so[55556];
std::vector<int> ans;
int main(){
    std::cin>>N;
    so[1]=true;
    for(int i=2;i<=55555;i++){
        if(!so[i]){
            int e=i+i;
            while(e<=55555){
                so[e]=true;
                e+=i;
            }
        }
    }
    for(int i=23;i<=55555;i+=20){
        if(!so[i])ans.push_back(i);
    }
    for(int i=0;i<N;i++){
        std::cout<<ans[i]<<(i<N-1?" ":"\n");
    }
    return 0;
}

Measured memory_bytes: 256
table= list(map(int,input().split()))
for i in range(2,0,-1):
    k=0
    while k < i :
        if table[k] > table[k+1] :
            table[k],table[k+1]=table[k+1],table[k]
        k+=1
print(table[0],table[1],table[2])


Measured memory_bytes: 5600
#include <algorithm>
#include <climits>
#include <functional>
#include <iterator>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#ifdef _MSC_VER
using ll = __int64;
using ull = unsigned __int64;
#else
using ll = long long int;
using ull = unsigned long long int;
#endif

// 二乗を計算する。
ll sq(ll x) { return x * x; }

// 領域内にいるか。
bool within(ll x, ll min, ll max) {
	return min <= x && x <= max;
}

// container の中から key より小さい値を見つける。
// 見つからない場合は container.end() を返す。
template<typename T>
typename T::iterator less_than(T& container, typename T::key_type& key) {
	typename T::iterator prev = container.lower_bound(key);
	if (prev == container.begin()) prev = container.end();
	else prev--;
	return prev;
}

// container の中から key より大きい値を見つける。
// 見つからない場合は container.end() を返す。
template<typename T>
typename T::iterator greater_than(T& container, typename T::key_type& key) {
	return container.upper_bound(key);
}

// b^e (mod m) を求める
ll modpow(ll b, ll e, ll m) {
	ll result = 1;
	while (e > 0) {
		if ((e & 1) == 1) result = (result * b) % m;
		e >>= 1;
		b = (b * b) % m;
	}
	return result;
}


// ここから解法

const ll MOD = 1000000007;


int main(void) {
	std::ios_base::sync_with_stdio(false);

	int N, M;
	cin >> N >> M;
	vector<bool> b(N + 1, false);
	for (int i = 1; i <= M; ++i) {
		int a;  cin >> a; b[a] = true;
	}
	vector<ll> dp(N + 1, 0);
	dp[0] = 1;
	dp[1] = b[1] ? 0 : 1;
	for (int i = 2; i <= N; ++i) {
		if (b[i]) continue;
		dp[i] = (dp[i - 1] + dp[i - 2]) % MOD;
	}
	cout << dp[N] << endl;

	return 0;
}



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


void trace(int A[], int N){
    for (int i=0; i<N; i++){
        if(i>0){
            printf(" ");
        }
        printf("%d", A[i]);
    }
    printf("\n");
}

int BubbleSort(int A[], int N){
    int iter, j, i, v;
    int cnt = 0;
    for(iter=0; iter<N-1; iter++){
        for(i=N-1; i>iter; i--){
            j = i - 1;
            if(A[j] > A[i]){
                v = A[j];
                A[j] = A[i];
                A[i] = v;
                cnt++;
            }
        }

    }
    return cnt;
}

int main(){
    int N;
    int A[100];
    
    scanf("%d", &N);
    for(int i=0; i<N; i++){
        scanf("%d", &A[i]);
    }
    
    int cnt = BubbleSort(A, N);
    trace(A, N);
    printf("%d", cnt);
    printf("\n");
    return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
int to[4][2]={-1,0,
               1,0,
               0,-1,
               0,1};
int vis[1005][1005];
int news[1005][1005];
string s[1005];
int h,w;
int ans;
int x,y;
struct node
{
    int x,y,step;
};
void bfs()
{
    queue<node> q;
    node b;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if(s[i][j]=='#')
            {
                b.step=0;
                b.x=i;
                b.y=j;
                q.push(b);
            }
        }
    }
    while(!q.empty())
    {
        b=q.front();
        q.pop();
        int flag=0;
        for(int i=0;i<4;i++)
        {
            int xx=b.x+to[i][0];
            int yy=b.y+to[i][1];
            if(0<=xx&&xx<h&&0<=yy&&yy<w)
            {
                if(s[xx][yy]=='.')
                {
                    s[xx][yy]='#';
                    node tmp;
                    tmp.x=xx;
                    tmp.y=yy;
                    tmp.step=b.step+1;
                    ans=max(ans,tmp.step);
                    q.push(tmp);
                }
            }
        }
    }
    cout<<ans<<endl;
}

int main()
{
    cin>>h>>w;
    ans=0;
    memset(vis,0,sizeof(vis));
    for(int i=0;i<h;i++) cin>>s[i];
    bfs();
    /*while(1)
    {
        memset(news,0,sizeof(n));
        sum=0;
        for(int i=0;i<h;i++)
        {
            for(int j=0;j<w;j++)
            {
                if(s[i][j]=='#') sum++;
            }
        }
        if(sum==h*w) break;
        for(int i=0;i<h;i++)
        {
            for(int j=0;j<w;j++)
            {
                if(s[i][j]=='#'&&!vis[i][j]&&!news[i][j])
                {
                    vis[i][j]=1;
                    for(int k=0;k<4;k++)
                    {
                        int xx=i+to[k][0];
                        int yy=j+to[k][1];
                        if(0<=xx&&xx<h&&0<=yy&&yy<w)
                        {
                            if(s[xx][yy]=='.')
                            {
                                s[xx][yy]='#';
                                news[xx][yy]=1;
                            }
                        }
                    }
                }
            }
        }
        ans++;
//        for(int i=0;i<h;i++)
//        {
//            for(int j=0;j<w;j++)
//                cout<<s[i][j]<<" ";
//            cout<<endl;
//        }

    }*/
    /*for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
            cout<<s[i][j]<<" ";
        cout<<endl;
    }
    */
    //cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 19216
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ll long long
#define P pair<int,int>
using namespace std;
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
const int INF = 2002002002;
const ll LLINF = 9009009009009009009;

bool dis(int w, int h, int nx, int ny) {
    if (nx < 0) return false;
    else if (nx >= w) return false;
    else if (ny < 0) return false;
    else if (ny >= h) return false;
    return true;
}

struct Mp {
    int x, y, c;
    Mp(int x_, int y_, int c_) {
        x = x_;
        y = y_;
        c = c_;
    }
};

int main() {
    fast_io
    int h, w;
    cin >> h >> w;
    vector<string> m(h), m_copy;
    rep(i,h) {
        cin >> m[i];
    }
    m_copy = m;

    int nx, ny, nc;
    int total_c = 0;
    int dir[4][2] = {{0,1},{0,-1},{1,0},{-1,0}};
    queue<Mp> q;
    rep(i,w) {
        rep(j,h) {
            m = m_copy;
            vector<vector<int>> dist(h, vector<int>(w, INF));
            int sx = i, sy = j;
            if (m[sy][sx] == '#') continue;
            while (!q.empty()) q.pop();
            q.emplace(sx, sy, 0);
            dist[sy][sx] = 0;
            m[sy][sx] = '#';
            while (!q.empty()) {
                for (auto d: dir) {
                    nx = q.front().x + d[0];
                    ny = q.front().y + d[1];
                    nc = q.front().c + 1;
                    if (dis(w, h, nx, ny)) {
                        if (m[ny][nx] == '.') {
                            q.emplace(nx, ny, nc);
                            dist[ny][nx] = nc;
                            m[ny][nx] = '#';
                        }
                    }
                }
                q.pop();
            }
            rep(i,h) {
                rep(j,w) {
                    if (dist[i][j] == INF) continue;
                    total_c = max(total_c, dist[i][j]);
                }
            }
        }
    }
    cout << total_c << endl;
    return 0;
}

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


int compare(const void *a, const void *b) {
  return *(int*)a - *(int*)b;
}


int main(void) {
  int N;
  int d[100000];

  scanf("%d", &N);
  for (int i=0;i<N;i++) {
    scanf("%d", d+i);
  }

  qsort(d, N, sizeof(int), compare);

  printf("%d\n", d[N/2]-d[N/2-1]);

  return 0;
}

Measured memory_bytes: 892
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		ArrayList<Integer> one = nextIntArray();
		int A = one.get(0);
		int B = one.get(1);
		myout(Math.max(A + B, Math.max(A - B, A * B)));
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 32856
#include<stdio.h>
int main()
{
	int A,B,tambah,kurang,kali;
	scanf("%d %d",&A,&B);
	tambah = A+B;
	kurang = A-B;
	kali = A*B;
	
	if(tambah>=kurang && tambah>=kali)
	{
		printf("%d\n",tambah);
	}
	else if(kurang>=tambah && kurang>=kali)
	{
		printf("%d\n",kurang);
	}
	else if(kali>=tambah&& kali>=kurang)
	{
		printf("%d\n",kali);
	}
}

Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
using namespace std;
int a[1000005],b[1000005];
int main(){
	int n;
	scanf("%d",&n);
	for (int i=1; i<=n; i++){
		scanf("%d",&a[i]);
		b[i]=a[i];
	}
	sort(a+1,a+n+1);
	int mid=a[(n+1)/2];
	for (int i=1; i<=n; i++)
		if (mid>b[i]){
			if (n%2==1) printf("%d\n",mid);
			else printf("%d\n",a[(n+1)/2+1]);
		}
		else if (mid<b[i]){
			if (n%2==1) printf("%d\n",a[(n+1)/2-1]);
			else printf("%d\n",mid);
		}
		else{
			if (n%2==1) printf("%d\n",a[(n+1)/2-1]);
			else printf("%d\n",a[(n+1)/2+1]);
		}
	return 0;
}

Measured memory_bytes: 7040
import sys
sys.setrecursionlimit(100000000)
#input = sys.stdin.readline

def solve():
  m,d = (int(i) for i in input().split())
  ans = 0
  for m in range(1,m+1):
    for d in range(2,d+1):
      d1 = d%10
      d10 = d//10
      if d1 >= 2 and d10 >= 2:
       if d1*d10 == m:
        ans += 1
      
  
  print(ans)

solve()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define i64 long long
using namespace std;
int main() {
	int n,m,X,Y,Z;
	cin>>n>>m>>X>>Y;
	int x[n+1], y[m+1];
	for(int i=0;i<n;i++) cin>>x[i];
	for(int i=0;i<m;i++) cin>>y[i];
	
	bool found = false;
	int i,j;
	for(Z=-100; Z<=100 and !found; Z++){
		if(Z<=X or Z>Y) continue;
		for(i=0;i<n;i++) if(Z<=x[i]) break;
		
		if(i<n) continue;
		else{ // all x satisfies given constraint
			for(i=0;i<m;i++) if(Z>y[i]) break;
			if(i<m) continue;
			else{
				found = true;
				printf("No War\n"); return 0;
			}
		}
	}
	if(!found) printf("War\n");
	return 0;
}

Measured memory_bytes: 256
def solve(n):
    """ f(0, n) """

    n += 1
    res = 0
    for i in range(0, 40):
        t2 = (1 << i)
        # i桁の周期が完全に何回でてくるか
        x = n // (t2 * 2)
        cnt = x * t2
        # あまり分(0 * t2 のあと 1 * t2 の順で出現)
        cnt += max(0, n % (t2 * 2) - t2)

        res += t2 * (cnt % 2)
    return res


a, b = [int(_) for _ in input().split()]
# print(solve(b))
# print(solve(a-1))
print(solve(b) ^ solve(a-1))



Measured memory_bytes: 3060
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	int num ,n[1001] ,p[1001] ,q[1001] ,r[1001];
	//限界タンパク質、脂質、炭水化物
	int lp, lq, lr, lc;

	while(cin >> num)
	{
		if(num == 0)
			break;

		for(int i = 0; i < num ; i++)
		{
			cin >> n[i] >> p[i] >> q[i] >> r[i];
		}

		cin >> lp >> lq >> lr >> lc;
		bool ok = true;

		for(int i = 0; i < num; i++)
		{
			if(p[i] <= lp && q[i] <= lq && r[i] <= lr && (p[i]+r[i])*4+q[i]*9 <= lc)
			{
				cout << n[i] << endl;
				ok = false;
			}
		}
		if(ok == true)
		{
			puts("NA");
		}
	}
}

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

#define N 500000
#define INFTY 1000000005

void mergeSort(int *, int, int);
void Merge(int *,int, int, int);


int cnt, n;

int main () {
  int i, data[N];

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

  mergeSort(data, 0, n);

  for(i = 0 ; i < n ; i++) {
    if(i < n - 1) printf("%d ",data[i]);
    else printf("%d",data[i]);
  }

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

void Merge(int *A, int left, int mid, int right) {
  int n1 = 0, n2 = 0, i = 0, j = 0, k = 0;
  int *L, *R;
 

  n1 = mid - left;
  n2 = right - mid;

  L = (int *)malloc(sizeof(int) * (n1 + 1));
  R = (int *)malloc(sizeof(int) * (n2 + 1)); 
  
  for(i = 0 ; i < n1 ; i++) {
    L[i] = A[left + i];
  }

  for(i = 0 ; i < n2 ; i++) {
    R[i] = A[mid + i];
  }

  L[n1] = INFTY;
  R[n2] = INFTY;

  i = 0;
  j = 0;

  for(k = left ; k < right ; k++) {
    cnt++;
    if(L[i] <= R[j]) {
      A[k] = L[i];
      i++;
    }
    else {
      A[k] = R[j];
      j++;
    }
  }
  free(L);
  free(R);

}


void mergeSort(int *A, int left, int right) {
  
  int mid = 0;

  if((left+1) < right) {
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    Merge(A, left, mid, right);
  }
}



Measured memory_bytes: 5468
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define mreps(i,j,n) for(int i = j; i <= n; i++)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define el cout << endl
#define sp(x) cout << setprecision(x);
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vpii vector<pair<int,int>> 
#define vl vector<ll> 
#define vvl vector<vector<ll>> 
#define vd vector<double> 
#define vvd vector<vector<double>> 
#define vb vector<bool> 
#define vvb vector<vector<bool>>
#define vs vector<string>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
ll inf = 1001001000;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a * b / g; }
bool is_prime(ll x) { for (ll i = 2; i * i <= x; i++) { if (x % i == 0)return false; } return true; }


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll h, n; cin >> h >> n;
	vl a(n), b(n);
	rep(i, n)cin >> a[i] >> b[i];
	vvl dp(n + 1, vl(h+1, inf));
	dp[0][0] = 0;
	rep(i, n)rep(j, h + 1)
	{
		chmin(dp[i + 1][j], dp[i][j]);
		chmin(dp[i + 1][min(h, j + a[i])], dp[i + 1][j] + b[i]);
	}
	ll ans = dp[n][h];
	co(ans);
	return 0;
}


Measured memory_bytes: 78592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

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

  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;

  s[k-1] = (char)(s[k-1]-('A'-'a'));

  cout << s << endl;
}


Measured memory_bytes: 256