akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,N,j) for(int i = (N-1);i >= (j);i--)
#define _rec(i,N,j) for(int i = (N);i >=(j);i--)
#define ALL(x) x.begin(),x.end()
#define MEM(a,n) memset(a,n,sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

int get_int(){int x;scanf("%d",&x);return x;}
LL get_ll(){LL x;scanf("%lld",&x);return x;}
double get_db(){double x;scanf("%lf",&x);return x;}

template<typename T> int chmin(T &a,T b){if(a > b){a = b;return 1;}else return 0;}
template<typename T> int chmax(T &a,T b){if(a < b){a = b;return 1;}else return 0;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {_for(i,0,v.size()) os << v[i] << " ";return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){for(auto a:v) os << a <<" ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){os << v.fst <<" "<<v.scd << " ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& v){for(auto a:v) cout << a << endl;return os;}

static const int dx[8] = { -1,  0, 1, 0,  1, -1,  1, -1};
static const int dy[8] = {0,  1, 0,  -1,  1, -1, -1,  1};
const double pi  = acos(-1.0);
const double eps = 1e-8;
const LL  INF  = 0x3f3f3f3f3f3f3f3f;
const int inf  = 0x3f3f3f3f;

int main()
{
    char a;
    cin >> a;
    a+=1;
    printf("%c\n",a);
    return 0;
}


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

using namespace std;

int main(void) {
	int N, A, B;
	cin >> N >> A >> B;
	if((B - A) % 2 == 0) {
		cout << "Alice\n";
	} else {
		cout << "Borys\n";
	}
	return 0;
}



Measured memory_bytes: 256
/*
 * fudq.cpp
 *
 *  Created on: 2015-10-24
 *      Author: bjfudq
 */
#include <functional>
#include <algorithm>
#include <iostream>
//#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;
//#pragma comment(linker,"/STACK:102400000,102400000")


#define MEM(a) (memset((a),0,sizeof(a)))
#define LEN(a) (int)strlen((a))
#define fr(a) for(int i=0;i<(a);i++)
#define sf(a) scanf("%d",&(a))
#define sf64(a) scanf("%I64d",&(a))
#define sff(a) scanf("%lf",&(a))
#define sfs(a) scanf("%s",(a))
#define sf2(a,b) scanf("%d%d",&(a),&(b))
#define sf3(a,b,c) scanf("%d%d%d",&(a),&(b),&(c))
#define sf2s(a,b) scanf("%s%s",(a),(b))
#define sf2f(a,b) scanf("%lf%lf",&(a),&(b))
#define sf3f(a,b,c) scanf("%lf%lf%lf",&(a),&(b),&(c))
#define sf264(a,b) scanf("%I64d%I64d",&(a),&(b))
#define sf364(a,b,c) scanf("%I64d%I64d%I64d",&(a),&(b),&(c))
#define pf(a) printf("%d\n",(a))
#define pfc(a) printf("%c",(a))
#define pf64(a) printf("%I64d\n",(a))
#define pff(a) printf("%lf\n",(a))
#define pfs(a) printf("%s\n",(a))
#define pf2(a,b) printf("%d %d\n",(a),(b))
#define pf2s(a,b) printf("%s%s\n",(a),(b));
#define pf2f(a,b) printf("%lf %lf\n",(a),(b))
#define pf264(a,b) printf("%I64d %I64d\n",(a),(b))
#define pfn printf("\n")
#define pfk printf(" ")
#define LL long long

const int N=1000010;
const int M=1000010;
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const int dir4[4][2]={{-1,0},{1,0},{0,-1},{0,1}};
const int dir8[8][2]={{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1}};
const double eps=1e-12;
const double PI=acos(-1.0);

inline int sign(double x){return (x>eps)-(x<-eps);}
template<class T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T> inline T Min(T a,T b){return a<b?a:b;}
template<class T> inline T Max(T a,T b){return a>b?a:b;}
/*************************/


int main(){
    LL a,b;
    while(cin>>a>>b){
    	LL g=gcd(a,b);
    	cout<<g<<" "<<a/g*b<<endl;
    }
    return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, W;
    cin >> N >> W;
    const int H = W / 2;
    vector<int> imos(N + 1, 0);
    imos[1] = H;
    for (int j = H + 1; j < N + W; j++) {
        imos[max(1, j - W + 1)]++;
        if (j + 1 <= N) { imos[j + 1]--; }
    }
    for (int j = H + 1; j < W; j++) {
        for (int k = 1; k * j + 2 * j - W + 1 <= N; k++) {
            imos[k * j + 2 * j - W + 1]++;
            if (k * j + j + 1 <= N) { imos[k * j + j + 1]--; }
        }
    }
    for (int i = 1; i <= N - W + 1; i++) { imos[i] += imos[i - 1], cout << (i == 1 ? "" : " ") << imos[i]; }
    cout << endl;
    return 0;
}



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

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

	int n, m;
	cin >> n >> m;
	vector<int> a(m);
	for (int & x : a)
		cin >> x;
	sort(a.begin(), a.end());

	priority_queue<int, vector<int>, greater<int>> pq;

	int x = 0;
	for (int i = 0; i + 1 < m; ++i)
		pq.push(a[i + 1] - a[i]);

	while (pq.size() > n - 1)
		pq.pop();

	int ans = a.back() - a[0] - x;
	while(!pq.empty()) {
		ans -= pq.top();
		pq.pop();
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 1276
#include <stdio.h>
#include<stdlib.h>
#include<string.h>
#include <assert.h>
 
int main(void){
	long long int a,b,c;
    long long int ans;
	scanf("%lld",&a);
    scanf("%lld",&b);
    scanf("%lld",&c);
    long long int x = 0;
 
    if(c<b){
      x = c;
    }
    else{
      x = b-1;
    }
 
 
 
 
    ans = (a*x/b) - a*(x/b);
 
 
    printf("%lld\n",ans);
 
 
		return 0;
}

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


int HP[100], M;
long long dp1[100001], dp2[100001];

int solve(int N)
{
  memset(dp1, 0, sizeof(dp1));
  memset(dp2, 0, sizeof(dp2));
    
  for(int i = 0; i < N; i++) {
    cin >> HP[i];
  }
  cin >> M;

  bool end = false;
  while(M--) {
    string Name, Target;
    int MP, Damage;
    cin >> Name >> MP >> Target >> Damage;
    if(MP == 0) {
      if(Damage > 0) end = true;
      continue;
    }
    for(int i = MP; i <= 100000; i++) {
      dp2[i] = max(dp2[i], dp2[i - MP] + Damage);
    }
    if(Target.size() == 6) MP *= N;
    for(int i = MP; i <= 100000; i++) {
      dp1[i] = max(dp1[i], dp1[i - MP] + Damage);
    }
  }
  if(end) return(0);
  
  int best = 1 << 30;
  for(int i = 0; i <= 100000; i++) {
    int ret = 0;
    for(int j = 0; j < N; j++) {
      ret += lower_bound(dp2, dp2 + 100001, HP[j] - dp1[i]) - dp2;
    }
    best = min(best, i + ret);
  }
  return(best);
}

int main()
{
  int N;
  while(cin >> N, N) {
    cout << solve(N) << endl;
  }
}

Measured memory_bytes: 2784
//Author : Siriuslight
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#define FIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0),cout<<setprecision(10)<<fixed;
#define int long long
#define F first
#define S second

using namespace std;
using namespace __gnu_pbds;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const ll inf = 1e9+100, N = 3e2+5;
const ll INF = 1e18+100, MOD = 1e9+7;

ll powmod(ll a,ll b,ll m=MOD){ll r=1;while(b>0){if(b&1)r=r*a%m;a=a*a%m;b>>=1;}return r;}
ll power(ll a,ll b){ll r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
ll gcd(ll a,ll b){if(!b)return a;return gcd(b,a%b);}
ll inv(ll a, ll m = MOD){return powmod(a,m-2,m);}
ll lcm(ll a,ll b){return(a*b)/gcd(a,b);}

//ordered_set X;
//X.insert(3);
//X.order_of_key(3) no of elements less than 3
//*X.find_by_order(n) nth greatest element(0-indexed)
int n, a[N], h[4];
ld dp[N][N][N];
bool vis[N][N][N];

ld solve(int one, int two, int three){
    if(one < 0 || two < 0 || three < 0) return 0;
    if(one == 0 && two == 0 && three == 0) return 0;
    ld &res = dp[one][two][three];
    if(vis[one][two][three]) return res;
    res = 0;
    vis[one][two][three] = true;
    res += n;
    res += one * solve(one - 1, two, three);
    res += two * solve(one + 1, two - 1, three);
    res += three * solve(one, two + 1, three - 1);
    res /= (ld)(one + two + three);
    return res;
}

int32_t main(){
    FIO;
    cin >> n;
    for(int i = 1; i <= n; ++i){
        cin >> a[i];
        h[a[i]]++;
    }
    cout << solve(h[1], h[2], h[3]);
}


Measured memory_bytes: 467200
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar
#define putchar putchar
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

void rsorta_d32(void *base, const int count, const int size, const int index){
	typedef int32_t rsort_t;
	rsort_t (*a)[size] = (rsort_t(*)[size])base;
	rsort_t (*b)[size] = (rsort_t(*)[size])malloc(count*size*sizeof(rsort_t));
	int c[0x100];
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(0<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(0<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(1<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(1<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(2<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(2<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(3<<3))+0x80]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(3<<3))+0x80]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	free(b);
}

int main(void){
	int n=nextint();
	int m=nextint();
	int d=nextint();
	double ans;
	if(d==0){
		ans=(double)(m-1)/n;
	}else{
		ans=(double)(m-1)*((n-d)*2)/n/n;
	}
	printf("%lf\n", ans);
}


Measured memory_bytes: 1700
#include <stdio.h>

int main(){
  int l, m, n, res, i;
  while(scanf("%d", &l) && l){
    int f = 0;
    for(i = 0; i < 12; ++i){
      scanf("%d%d", &m, &n);
      l -= m - n;
      if(l <= 0){
        printf("%d\n", i + 1);
        l = 9999999;
        f = 1;
      }
      if(i == 11 && f == 0) puts("NA");
    }
  }
  return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int x,y;
    cin>>x>>y;
    bool f=false;
    for(int i=0;i<=x;i++){
        if(2*i+4*(x-i)==y){
            f=true;
            break;
        }
    }
    if(f){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }

return 0;
}


//      *   *  *****  *   *  *   *   ****  ****    ****     **  ***
//     *   *  *      **  *  *   *  *      *   *  *        * *  *  *
//    *****  *****  * * *  *   *  *      ****   *       *  *    *
//   *   *      *  *  **  *   *  *      *  *   *       *****  *
//  *   *  *****  *   *   ***    ****  *   *    ****     *   ****

//     ****  *   *  *   *   ***   *   *  *****  *   *
//    *     *   *  *   *  *   *  *   *  *      *   *
//    ***  *****  *   *  *****  * * *  ****   *   *
//      *   *    *   *  *   *  * * *  *      *   *
//  ****   *     ***   *   *   * *   *****   ***


Measured memory_bytes: 3644
import java.util.*;
class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner (System.in);
        long s = sc.nextLong();
        long h = s / 3600;
        long m = (s % 3600) / 60;
        s = s % 60;
        System.out.println (h + ":" + m + ":" + s);
    }
}


Measured memory_bytes: 26408
#include <bits/stdc++.h>
#define rep(n) for (int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define repeat_from_reverse(i, m, n) for( int i = (n) - 1; (i) >= (m); --(i) )
#define el cout<<endl
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t t=0; t<v.size(); ++t){cout << " " << #v << "[" << t << "]=" << v[t];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n; cin >> n;
    vector<int> a(n);
    repeat (i, n) cin >> a[i];
    sort(a.begin(), a.end());
    cout << a[n-1] << " ";
    
    vector<int> b(n);
    repeat (i, n) b[i] = abs(a[i] * 2 - a[n-1]);
    int mi = 1e9 + 1;
    int ans = 0;
    repeat (i, n) {
        if (mi > b[i]) {
            mi = b[i];
            ans = a[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
using System;

namespace ABC152D {
    class Program {
        static void Main(string[] args) {
            var h = long.Parse(Console.ReadLine());
            var init = h;
            if (h == 1) {
                Console.WriteLine("1");
                return;
            }


            var divides = 0L;
            var i = 0;

            do {
                h /= 2;
                divides += 2L << (i++ - 1);
            } while (h != 1);

            Console.WriteLine(divides + (2L << (i-1)) + 1);
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
     ordered_set s;
     s.insert(1);
     cout<<*s.find_by_order(1); //print kth smallest element
     cout<<s.order_of_key(3);  //print number of strictly smaller element of 3;
*/
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN
#define pi acos(-1)
#define bp __builtin_popcount
#define ll long long int
#define ld long double
#define endl '\n'
#define pii pair<ll , ll>
#define tii tuple<ll,ll,ll>
//aaaccess element of tuple ex. 3rd element(index 2) cout<< get<2>(tuppleName);

#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define minQueue priority_queue<pii,vector<pii>,greater<pii> >
#define minq priority_queue <int, vector<int>, greater<int> >
#define maxQueue priority_queue<ll>
#define pb push_back
#define mx3(a,b,c) max(a,max(b,c))
#define pf push_front
#define ff first
#define ss second
#define FILL(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))
const ll N = 1000005;
const ll M = 1e6 + 10;
const ll mod = 998244353;

ll power(ll x, ll y, ll p)
{
	ll res = 1;
	x = x % p;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}
ll modinv(ll n, ll p)
{
	return power(n, p - 2, p);
}
ll ncr(ll n, ll r, ll p)
{
	if (r == 0)
		return 1;
	int n1 = n;
	ll fac[n1 + 1];
	fac[0] = 1;
	for (int i = 1 ; i <= n; i++)
		fac[i] = fac[i - 1] * i % p;

	return (fac[n] * modinv(fac[r], p) % p *
	        modinv(fac[n - r], p) % p) % p;
}
/*vector<bool> prime(N, true);
void sieve()
{
	for (int i = 2; i <= sqrt(N); ++i) {
		if (prime[i]) {
			for (int j = i * i; j <= N; j += i) {
				prime[j] = false;
			}
		}
	}
}/*

/*int Prime[M];
void MinPrimeFactor()
{
	for (ll i = 1; i < M; i++) Prime[i] = i;
	for (int p = 2; p * p <= M; p++)
	{
		if (Prime[p] == p)
		{
			for (int i = 2 * p; i <= M; i += p)
			{
				Prime[i] = min(p, Prime[i]);
			}
		}
	}
}*/

/*vector<int> getFactorization(int x)
{
	vector<int> ret;
	while (x != 1)
	{
		ret.push_back(Prime[x]);
		x = x / Prime[x];
	}
	return ret;
}


ll find(vector<ll> &parent,ll i)
{
    while(parent[i] != i)
    {
        //parent[i]=parent[parent[i]];
        i=parent[i];
    }
    return parent[i];


}

void Union(vector<ll> &parent,ll i, ll j)
{
    ll x=find(parent,i);
    ll y=find(parent,j);

    parent[x]=y;
}
*/
bool isPowerOfTwo(int x)
{
	return (x && !(x & (x - 1)));
}



int main()
{
	FAST;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	long long int x = 0, a, b, c = 0, k = 1000, n, i;
	cin >> n;
	long long int arr[n];
	for (i = 0; i < n; i++) cin >> arr[i];

	for (i = 0; i < n - 1; i++)
	{
		while (i < n - 1 and arr[i] >= arr[i + 1])
			i++;
		if (i < n - 1)
		{
			c = k / arr[i];
			k = k - c * arr[i];
			c = c * arr[i + 1];
			k += c;
		}

	}
	cout << k;
	return 0;

}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  ll x;
  cin >> x;
  ll yokin = 100;
  ll cnt = 0;

  while(x > yokin){
    yokin = yokin + yokin/100;
    cnt++;
  }
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 3560
#include <cstdio>
using namespace std;
int a[25];
int n;
bool judge (int m,int sum,int pos) {
	if (pos==n+1||sum>m) return false;
	if (sum==m) return true;
	return judge(m,sum,pos+1)||judge(m,sum+a[pos],pos+1);
}
int main () {
	int q;
	scanf ("%d",&n);
	for (int i=0;i<n;i++) {
		scanf ("%d",&a[i]);
	}
	scanf ("%d",&q);
	for (int i=0;i<q;i++) {
		int m;
		scanf ("%d",&m);
		if (judge(m,0,0)) printf ("yes\n");
		else printf ("no\n");
	}
    return 0;
}


Measured memory_bytes: 2600
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <utility>
#ifdef DEBUG
#include <cassert>
#endif
using namespace std;
typedef pair<int,int> pii;
typedef pair<double,int> pdi;
typedef pair<double,pii> pdii;
#define repeat(i,n) for (int i = 0; i < (n); ++i)
#define repeat_from(i,m,n) for (int i = (m); i < (n); ++i)

double sq(double a) { return a * a; }
double hypot(double x, double y) { return sqrt(sq(x)+sq(y)); }
double dist(const pdi & a, const pdi & b) { return hypot(a.first-b.first, a.second-b.second); }

int main() {
    ios_base::sync_with_stdio(false);
    while (true) {
        int N; cin >> N;
        if (N == 0) break;
        vector<int> X(N), Y(N); repeat (i,N) cin >> X[i] >> Y[i];

        // make points
        vector<pdi> p(N);
        repeat (i,N) p[i] = pdi(X[i], Y[i]);
        repeat (i,N-1) {
            const int miny = min(Y[i], Y[i+1]);
            const int maxy = max(Y[i], Y[i+1]);
            if (miny != maxy) {
                const double dx = X[i+1] - X[i];
                const double dy = Y[i+1] - Y[i];
                repeat (j,N) {
                    if (miny <= Y[j] and Y[j] <= maxy) {
                        p.push_back(pdi((Y[j]-Y[i])*dx/dy+X[i], Y[j]));
                    }
                }
            }
        }
        sort(p.begin(), p.end());
        p.erase(unique(p.begin(), p.end()), p.end());

        // dijkstra
        set<pii> used;
        priority_queue<pdii, vector<pdii>, greater<pdii> > pq;
        pq.push(pdii(0, pii(0, p.size()-1)));
        while (true) {
#ifdef DEBUG
            assert(not pq.empty());
#endif
            const double d = pq.top().first;
            const pii    q = pq.top().second;
            pq.pop();
            if (used.find(q) == used.end()) {
                used.insert(q);
                const int a = q.first;
                const int b = q.second;
                if (a == b) {
                    printf("%.12lf\n", d);
                    break;
                } else {
                    repeat_from (da,-1,2) repeat_from (db,-1,2) {
                        if (0 <= a+da and a+da < (int)p.size()
                                and 0 <= b+db and b+db < (int)p.size()
                                and not (da == 0 and db == 0)) {
                            if (p[a+da].second == p[b+db].second) {
                                const pii r = pii(a+da,b+db);
                                if (used.find(r) == used.end()) {
                                    const double dd = dist(p[a+da],p[a]) + dist(p[b+db],p[b]);
                                    pq.push(pdii(d+dd,r));
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 2692
from collections import deque
import sys
input = sys.stdin.readline

def sol():
    n,m=map(int,input().split())
    d={}
    for i in range(m):
        u,v=map(int,input().split())
        if u in d:
            d[u].append(v)
        else:
            d[u]=[v]
    s,t=map(int,input().split())
    ans=chk=0
    w=deque([0,s])
    tmp=[[0,0,0] for i in range(n+1)]
    ans=1
    n+=n//2
    n*=2
    while n:
        x=w.pop()
        if x==0:
            ans+=1
            n-=1
            w.appendleft(0)
        elif x in d:
            for j in d[x]:
                if ans%3==0 and j==t:
                    print(ans//3)
                    exit()
                if tmp[j][ans%3]==0:
                    w.appendleft(j)
                    tmp[j][ans%3]=1
    print(-1)

if __name__=="__main__":
    sol()

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

using namespace std;

int main()
{
    string s;
    cin>>s;
    int x=atoi(s.c_str());
    int sol=0;
    for(char i: s){
        sol+=(int)i-48;
    }
    cout<<(x%sol==0?"Yes":"No");
    return 0;
}


Measured memory_bytes: 256
fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let x = read1::<usize>();
    let time = x / 100;
    let rest = x % 100;
    if time >= 20 {
        println!("1");
    } else {
        for a in 0..time+1 {
            for b in 0..(time+1-a) {
                for c in 0..(time+1-a-b) {
                    for d in 0..(time+1-a-b-c) {
                        for e in 0..(time+1-a-b-c-d) {
                            for f in 0..(time+1-a-b-c-d-e) {
                                if b + 2*c + 3*d + 4*e + 5*f == rest {
                                    println!("1");
                                    return;
                                }
                            }
                        }
                    }
                }
            }
        }

        println!("0");
    }
}

Measured memory_bytes: 4352
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		Comparator<int[]> comparator_0 = new Comparator<int[]>() {
		    @Override
		    public int compare(int[] o1, int[] o2) {
		        return Integer.compare(o1[0], o2[0]);
		    }
		};
		Comparator<int[]> comparator_1 = new Comparator<int[]>() {
		    @Override
		    public int compare(int[] o1, int[] o2) {
		        return Integer.compare(o1[1], o2[1]);
		    }
		};
		Comparator<int[]> comparator_2 = new Comparator<int[]>() {
		    @Override
		    public int compare(int[] o1, int[] o2) {
		        return Integer.compare(o1[2], o2[2]);
		    }
		};
		ArrayList<int[]> list = new ArrayList<int[]>();
		for (int i=0;i<M;i++) {
			int P = Integer.parseInt(sc.next());
			int Y = Integer.parseInt(sc.next());
			int[] tmp = {i, P, Y , 0};
			list.add(tmp);
		}
		Collections.sort(list, comparator_2);
		Collections.sort(list, comparator_1);
		int index=1;
		int former=0;
		for (int i=0;i<M;i++) {
			if (former==list.get(i)[1]) {
				index++;
				list.get(i)[3]=index;
				former=list.get(i)[1];
			} else {
				index=1;
				list.get(i)[3]=index;
				former=list.get(i)[1];
			}
		}

		Collections.sort(list, comparator_0);
		for (int i=0;i<M;i++) {
			String ans = String.format("%06d%06d",list.get(i)[1],list.get(i)[3]);
//			System.out.printf("%06d%06d",list.get(i)[1],list.get(i)[3]);
			System.out.println(ans);
		}
	}
}


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

int main(){
	ll n;
	cin >> n;
	vector<ll> l(n);
	rep(i,n) cin >> l[i];
	sort(l.begin(),l.end());
	ll count = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			for (int k = j + 1; k < n; ++k) {
				if(l[i] != l[j] && l[j] != l[k] && l[i] != l[k] && l[k] < l[i] + l[j]) count++;
			}
		}
	}
	cout << count << endl;
    return 0;
}

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

int main()
{
    int N, M;
    cin >> N >> M;
    bitset<200000> from1, toN;
    for (int i = 0; i < M; i++)
    {
        int ai, bi;
        cin >> ai >> bi;
        if (ai == 1)
        {
            from1.set(bi - 1, 1);
        }
        if (bi == N)
        {
            toN.set(ai - 1, 1);
        }
    }
    auto intersection = from1 & toN;
    if (intersection.any())
        cout << "POSSIBLE" << endl;
    else
        cout << "IMPOSSIBLE" << endl;
}

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

int main(){
	int x,a,b,c;
  	cin >> a >> b >> c >> x;
	int count = 0;
  	for(int i = 0; i<=c;i++) {
    	for(int j = 0; j<=b;j++) {
    		for(int k = 0; i*50 + j * 100 + k * 500  <= x && k<= a;k++) {
				
                if(i*50 + j * 100 + k * 500 == x) {
                    count++;
                }
            }
        }
    }
   	cout << count << endl;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
ll mod=1000000007;
#define vl vector<ll>
#define pl pair<ll,ll>
#define rep(i,b) for(ll i=0;i<b;i++)
#define all(v) (v).begin(),(v).end()
using namespace std;

struct dice{
    ll men[6];
};
ll A[6];
ll B[4];
int main(){
    rep(i,6)cin>>A[i];
    string s;
    cin>>s;
    rep(i,s.length()) {
        if (s[i] == 'S') {
            B[0] = A[0];
            B[1] = A[1];
            B[2] = A[5];
            B[3] = A[4];
            A[1] = B[0];
            A[5] = B[1];
            A[4] = B[2];
            A[0] = B[3];
        }
        if (s[i] == 'E') {
            B[0] = A[3];
            B[1] = A[0];
            B[2] = A[2];
            B[3] = A[5];
            A[0] = B[0];
            A[2] = B[1];
            A[5] = B[2];
            A[3] = B[3];
        }
        if (s[i] == 'N') {
            B[0] = A[1];
            B[1] = A[5];
            B[2] = A[4];
            B[3] = A[0];
            A[0] = B[0];
            A[1] = B[1];
            A[5] = B[2];
            A[4] = B[3];
        }
        if (s[i] == 'W') {
            B[0] = A[0];
            B[1] = A[2];
            B[2] = A[5];
            B[3] = A[3];
            A[3] = B[0];
            A[0] = B[1];
            A[2] = B[2];
            A[5] = B[3];
        }
    }
    cout<<A[0]<<endl;
}


Measured memory_bytes: 3176
#include <iostream>
using namespace std;
int a, b, k, c;;
int main() {
	int i;
	cin>>a>>b>>k;
	for(i=min(a,b); ; i--) {
		if(a%i==0 && b%i==0) {
			c++;
			if(c==k) break;
		}
	}
	cout<<i;
	return 0;
}

Measured memory_bytes: 256
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

#include<bits/stdc++.h>
using namespace std;

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    string s;
    cin>>s;
    ll ans=0;
    int dp[2020]{0};
    rep(i,0,s.size()-1){
        int n=s[i]-'0';
        int tdp[2020]{0};
        tdp[n]=1;
        rep(j,0,2018) if(dp[j]){
            int rem=(j*10+n)%2019;
            tdp[rem]+=dp[j];
        }
        ans+=tdp[0];
        rep(j,0,2018) dp[j]=tdp[j];
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3784
/**   Created by: Marcos Portales
          Codeforces User: marcosportales
          Country: Cuba
                         **/
#include<bits/stdc++.h>
using namespace std;
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define fl '\n'
#define vi vector<int>
#define sz size
typedef pair<int,int> ii;
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 2*1e5+1;
const int mod = 1000000009;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = 10000000000000000ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Template ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if( !e ) return 1;
    if( e & 1 ) return qpow(b,e-1) * b;
    int pwur = qpow(b,e>>1);
    return pwur * pwur;
}
int modinv(int x){
    return qpow(x,mod-2);
}
/// My Code -------------------------------------------------

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));

    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);

    int n,l;
    vector<string>v;
    cin>>n>>l;
    for(int i=0;i<n;i++){
        string s;cin>>s;v.pb(s);
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(v[i]>v[j])swap(v[i],v[j]);
        }
    }
    for(auto it:v)cout<<it;

    return 0;
}


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

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

string s;
int dp[N][10][13];

int f(int pos, int dig, int rem) {
	//printf("pos = %2d, dig = %2d, rem = %2d\n", pos, dig, rem);

	if (pos + 1 == s.size()) {
		// if (rem == 5) {
		// 	printf("this\n");
		// }
		return rem == 5;
	}

	if (dp[pos][dig][rem] != -1) {
		return dp[pos][dig][rem];
	}

	int res = 0;
	if (s[pos + 1] == '?') {
		for (int i = 0; i < 10; i++) {
			int nrem = (rem * 10 + i) % 13;
			res = (res + f(pos + 1, i, nrem)) % MOD;
		}
	} else {
		int nrem = (rem * 10 + (s[pos + 1] - '0')) % 13;
		res = (res + f(pos + 1, s[pos + 1] - '0', nrem)) % MOD;
	}

	return dp[pos][dig][rem] = res;
}

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

	cin >> s;

	int cnt = 0, r = 0;
	for (int i = 0; i < s.size(); i++) {
		r = (r * 10 + (s[i] - '0')) % 13;
		if (s[i] == '?') {
			cnt++;
		}
	}

	if (cnt == 0) {
		cout << (r == 5) << "\n";
		return 0;
	}

	for (int i = 0; i < N; i++) {
		for (int dig = 0; dig < 10; dig++) {
			for (int rem = 0; rem < 13; rem++) {
				dp[i][dig][rem] = -1;
			}
		}
	}

	int ans = 0, rem = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '?') {
			for (int dig = 0; dig < 10; dig++) {
				ans = (ans + f(i, dig, (rem * 10 + dig) % 13)) % MOD;
			}
			break;
		} else {
			rem = rem * 10 + (s[i] - '0');
			rem %= 13;
		}
	}

	cout << ans << "\n";

    return 0;
}

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

#define FILE
#define fr first
#define se second

using namespace std;

const long long N = 2e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int main()
{
    #ifdef FILEs
        freopen("input.txt", "r", stdin);
        /// freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    cout << (n + 1) / 2 << "\n";
}



Measured memory_bytes: 256
using System;
using System.Linq;

class B
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());

		var gl = (n + 1) / 2;
		var gs = Enumerable.Range(0, gl).Select(i => new[] { i + (n + 1) % 2, n - i }).ToArray();

		var r = Enumerable.Range(0, gl == 2 ? 1 : gl).SelectMany(i => gs[i].SelectMany(x => gs[(i + 1) % gl].Where(y => x * y > 0).Select(y => $"{x} {y}"))).ToArray();
		Console.WriteLine(r.Length);
		Console.WriteLine(string.Join("\n", r));
	}
}


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

a, b = zip(
        *sorted(
            (tuple(map(int, input().split())) for i in range(n)), key=lambda x:x[0]))

rank = itertools.accumulate(b)

for i, r in enumerate(rank):
    if  k <= r:
        print(a[i])
        break




Measured memory_bytes: 24436
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var count = 0;
        for (int i = 1; i <= n; i++)
            count += n % i == 0 ? n / i - 1 : n / i;
        Console.WriteLine(count);
    }
}


Measured memory_bytes: 27524
import java.util.Scanner; 
public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String line = in.nextLine();
		String[] Array = line.split(" ");
		int[] numArray = parseInt(Array);
		for(int i = 0; i<numArray.length-1;i++){
			for(int j = numArray.length-1 ; j>i;j--){
				if(numArray[j]<numArray[j-1]){
					int number = numArray[j-1];
					numArray[j-1] = numArray[j];
					numArray[j] = number;

				}
			}
		}
		System.out.println(numArray[0]+" "+numArray[1]+" "+numArray[2]);
		/*for(int i=0; i<numArray.length;i++){
			if(i==0){
			System.out.print(numArray[i]);
		}else{
			System.out.print(" "+numArray[i]);
		}
	}*/
	}
	public static int[] parseInt(String[] Array){
		int[] numArray = new int[Array.length];
		for(int i = 0; i<Array.length ; i++){
			numArray[i] = Integer.parseInt(Array[i]);
		}
		return numArray; 
	} 

}

Measured memory_bytes: 26028
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define f1(i,n) for(int i=1;i<n;i++)
#define rf(i,n) for(int i=n-1;i>=0;i--)
#define PI 3.1415926535897932384626433832795
#define fi first
#define se second
#define mp(x,y) make_pair
#define BIN(n,x) bitset<n>(x)  
using namespace std;

//BITSET
//bitset< ##no of digits required in binary## > x( ##integral string value## )   // bitset< ##no of digits required in binary## > x( ##number## ) 
//stores binary value of the string in x // constructor sets all values to 0 by default // x.set() sets all value to 1 //x.none() checks for 0{gives bool}
//-->x.count() gives no of 1's //--> x.size() gives total bits //--> x.test(i) returns binary value of i'th bit

//SETPRECISION
//cout<<fixed<<setprecision(#n#)<<x;  --> sets the no of digits of x after decimal to n

//SET STL
//insert();*** count() returns 1 if element is present or 0  **** ;find() {returns iterator pointing to element else returns end iterator}; ---> O(log(N))
//begin();end(){next to last};---->O(1)
//See sorting

//VECTOR STL
//begin(); back();-->O(1)
//sort(v.begin(),v.end()); -->{O(Nlog(N))}
//set_union(it1beg,it1end,it2beg,it2end,itcombinedbegin)   {joins two vectors}
//lower_bound(v.begin(),v.end(),val) returns iterator to element just greater than or eq to val--->O(N)
//sort(v.begin(),v.end()) is sorted default by first value of pairs  to sort by second

//MAP STL map<U,V> mp; U=key val  V = mapped val
//count(k) (returns 1 if element with key value k is found}-->O(log(N))
//See sorting


//Binary Exponentiation
long long BERem(long long a, long long b, long long m){
    a%=m;
    long long res =1;
    while(b>0){
        if(b&1){
            res = (res * a)%m;
        }
        a=(a*a)%m;
        b>>=1;
    }
    return res;
}


int main(){
    
    
    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    ll p[a];
    f(i,a){
        cin>>p[i];
    }
    ll q[b];
    f(i,b){
        cin>>q[i];
    }
    ll r[c];
    f(i,c){
        cin>>r[i];
    }
    sort(p,p+a,greater<ll>());
    sort(q,q+b,greater<ll>());
    sort(r,r+c,greater<ll>());
    ll ans[x+y+c];
    f(i,x+y+c){
        if(i<x){
            ans[i]=p[i];
        }
        else if(i<x+y){
            ans[i]=q[i-x];
        }
        else{
            ans[i]=r[i-(x+y)];
        }
    }
    sort(ans,ans+x+y+c,greater<ll>());
    ll fin=0;
    f(i,x+y){
        fin=fin+ans[i];
    }
    cout<<fin<<endl;

    


    return 0;
}



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

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

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

#define PI (2*acos(0.0))
#define eps 1e-9
#define pb push_back
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define show(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi] << " "; cout << endl;
#define showpair(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi].first << " " << v[fi].second << endl;
#define ff first
#define ss second
#define fu cout << "lol" << endl;
#define precision(n) cout << fixed << setprecision(n);
#define lb lower_bound
#define up upper_bound
#define vscan for(i = 0;i<n;i++){cin>>in; v.pb(in);}
#define all(a) a.begin(), a.end()
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define mem(a,val) memset(a,val,sizeof(a))
#define loop(i,n) for(i = 0; i < n; i++)
#define TC() ull T; cin>>T; while(T--)
#define IN(x) {scanf("%d",&x);}
#define LL(x) {scanf("%lld",&x);}
#define CC(x) {scanf("%c",&x);}
#define pfl(x) printf("%d\n",x)
#define pfll(x) printf("%lld\n",x)
#define newl puts("")
#define space printf(" ")
#define MOD 1000000007
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL);


int main()
{
    int i = 0, j = 0, cs = 0, in;
    string s; cin>>s;
    int l = 0, r = s.size()-1;
    bool f = 1;
    while(l <= r){
        if(s[l] != s[r]){
            f = 0;
            break;
        }
        else l++,r--;
    }
    l = 0, r = (s.size()-1)/2 - 1;
    while(l <= r){
        if(s[l] != s[r]){
            f = 0;
            break;
        }
        else l++,r--;
    }
    l = (s.size()+3)/2 - 1, r = s.size()-1;
    while(l <= r){
        if(s[l] != s[r]){
            f = 0;
            break;
        }
        else l++,r--;
    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		// ??\?±???¶???
		int[][][] tenantInfo = new int[4][3][10];

		try {
			// ??\?????¶??°?????\???
			int num = Integer.parseInt(br.readLine());

			// ??\???????????\???
			String str;
			String[] strArr;
			int b,f,r,v;
			for(int i=0;i<num;i++){
				str = br.readLine();
				strArr = str.split(" ");
				b = Integer.parseInt(strArr[0])-1;
				f = Integer.parseInt(strArr[1])-1;
				r = Integer.parseInt(strArr[2])-1;
				v = Integer.parseInt(strArr[3]);

				// ??\?±??????°????¨????
				tenantInfo[b][f][r]+=v;
			}

			// ??????
			StringBuilder output = new StringBuilder();
			for(int i = 0; i<tenantInfo.length; i++){

				for(int j = 0; j<tenantInfo[i].length; j++){

					for(int k = 0; k<tenantInfo[i][j].length; k++){
						output.append(" ");
						output.append(String.valueOf((tenantInfo[i][j][k])));
					}

					// ???????±?????????????
					System.out.println(output.toString());

					// ?????????
					output.setLength(0);
				}
				// ?£???????????????????
				if(i!=(tenantInfo.length-1)){
					System.out.println("####################");
				}
			}

		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			try{
				if(br != null){
					br.close();
				}
			}catch(IOException ioe){
			}

		}
	}
}

Measured memory_bytes: 19228
//Code by ASIM FOIZE AIMON
//CSE'19;CUET
//avoid copy paste//Hit the frined button
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define precise cout.precision(10); cout << fixed;
#define endl "\n"
#define int int64_t
#define ll long long
#define yes printf("Yes\n")
#define no printf("No\n")
#define push_back pb
int32_t main()
{
    /*#ifndef ONLINE_JUDGE
        freopen("/media/AIMON/SSDVol/Progs/CodeForces/input.txt", "r", stdin);
        freopen("/media/AIMON/SSDVol/Progs/CodeForces/output.txt", "w", stdout);
    #endif*/
    int i,t,n,m;
    cin>>n>>m;
    if(n==m)
        yes;
    else
        no;
}


Measured memory_bytes: 3588
s,t = map(str,input().split())
a,b = map(int,input().split())
u = str(input())

s_count = a
t_count = b

if u == s:
    s_count = a - 1
    print(s_count,end=' ')
    print(t_count)
elif u == t:
    t_count = b - 1
    print(s_count , end=' ')
    print(t_count)
else:
    print(s_count,end=' ')
    print(t_count)

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

int main(){
        string str;
        int i,j,sum,ans,n,x,flg;
        int a[40];

        while(1) {
                cin>>n;

                if(n==0) {
                        break;
                }

                for(i=0; i<n; i++) {
                        cin>>str;
                        a[i]=str.length();
                }

                for(i=0; i<n; i++) {
                        sum=0;
                        flg=1;
                        for(j=i; j<n; j++) {
                                sum=sum+a[j];
                                if(sum==5||sum==12||sum==17||sum==24||sum==31) {
                                        flg++;
                                }
                        }
                        if(flg==6) {
                                cout<<i+1<<endl;
                                break;
                        }
                }
        }
}



Measured memory_bytes: 3164
/*
	0241:Quaternion Multiplication
*/
#include	<iostream>

using namespace std;

int main(void) {
	int buf[4][4], n1[4], n2[4], res[4], n;
	
	while(1) {
		cin >> n;
		if(n == 0) { break; }
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 4; j++) {
				cin >> n1[j];
			}
			for(int j = 0; j < 4; j++) {
				cin >> n2[j];
			}
			for(int j = 0; j < 4; j++) {
				for(int k = 0; k < 4; k++) {
					buf[k][j] = n1[j] * n2[k];
				}
			}
			res[0] = buf[0][0] - buf[1][1] - buf[2][2] - buf[3][3];
			res[1] = buf[0][1] + buf[1][0] - buf[2][3] + buf[3][2];
			res[2] = buf[0][2] + buf[1][3] + buf[2][0] - buf[3][1];
			res[3] = buf[0][3] - buf[1][2] + buf[2][1] + buf[3][0];
			cout << res[0] << ' ' << res[1] << ' ' << res[2] << ' ' << res[3] << endl;
		}
	}
}

Measured memory_bytes: 1164
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int  i = 0;
		int  a[]= new int[101];

		while(sc.hasNext()){
			int  p = sc.nextInt();
			a[p]++;
		}
		sc.close();
		int max = 0;
		for(i = 0; i<100; i ++){
			if(max < a[i]){
				max = a[i];
			}
		}
		for(i = 0; i<100;i++){
			if(max == a[i]){
				System.out.println(i);
			}
		}
	}
}

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

int main(){
    string s;
    cin >> s;
    s = "A"+s;
    int ans = 0;
    for(int i=0; i<(int)s.length()-1; i++){
        if(s[i] >= s[i+1]) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

int main(void){
    int N;
    cin >> N;
    for(int i = 0; i <= 25 ;i++){
        for(int j = 0; j < 16 ;j++){
            if(4*i + 7*j == N){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3124
N = gets.to_i
a = gets.split.map(&:to_i)

puts 2 * N - 2
max = a.map(&:abs).each.with_index.max[1]

N.times{|i| puts [max+1, i+1] * " " if i != max}
puts (N-1).times.map{|i| [i+1, i+2] * " "} if a[max] >= 0
puts (N-1).times.map{|i| [i+2, i+1] * " "}.reverse if a[max] < 0


Measured memory_bytes: 1788
#include <stdio.h>
int main(void){
	int a,b,c,sum=0;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	for(int x=a;x<=b;x++){
	if(c%x==0)
	{
		sum++;
	}
		}printf("%d\n",sum);
	return 0;}


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

int main(){
    int n,k;
    cin>>n>>k;
    int ans=0;
    for (int i = 0; i < n; ++i) {
        int t;
        cin>>t;
        if(t>=k)++ans;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
 li n;
 cin>>n;
 string s;
 li i,ac=0,wa=0,tle=0,re=0;
 for(i=0;i<n;i++){
     cin>>s;
     if(s=="AC")
     ac++;
     if(s=="WA")
     wa++;
     if(s=="TLE")
     tle++;
     if(s=="RE")
     re++;
 }
 cout<<"AC x "<<ac<<endl;
 cout<<"WA x "<<wa<<endl;
 cout<<"TLE x "<<tle<<endl;
 cout<<"RE x "<<re<<endl;
}


Measured memory_bytes: 3548
#include "bits/stdc++.h"
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> coin = {500,100,50,10,5,1};
  while(n/*!=0はなくても意味が同じ*/){
    n = 1000 - n;
    int ans = 0;
    for(int i=0;i<6;++i){
      ans += n / coin.at(i);
      n %= coin.at(i);
    }
    cout << ans << endl;
    cin >> n;
  }
}


Measured memory_bytes: 3072
#include <stdio.h>

int main(){
    int N;
    scanf("%d",&N);
    int A[200000];
    int B[200002];
    int i;
    for(i=0;i<N+1;i++){
        scanf("%d",&A[i]);
    }
    for(int j=0;j<N;j++){
        scanf("%d",&B[j]);
    }
    long all=0;
    for(i=0;i<N;i++){
        if(B[i]>=A[i]&&A[i]>=0&&B[i]>=0){
            B[i]=B[i]-A[i];
            all+=A[i];
            A[i] = 0;
        }else if(B[i]>=0&&A[i]>=B[i]&&A[i]>=0){
            all+=B[i];
            A[i]=A[i]-B[i];
            B[i] = 0;
        }
        if(B[i]>0&&A[i+1]>0){
            if(A[i+1]>=B[i]){
                A[i+1]=A[i+1]-B[i];
                all+=B[i];
                B[i] = 0;
            }else if(B[i]>=A[i+1]){
                all+=A[i+1];
                A[i+1] = 0;
                B[i] = 0;
            }
        }
    }
    
    printf("%ld\n",all);
    
    return 0;
}

Measured memory_bytes: 896