akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);



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

	int N;
	cin >> N;
	vector<vector<int>>t(N,vector<int>());
	rep(i, N - 1) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		t[a].push_back(b);
		t[b].push_back(a);
	}

	vector<int>distF(N, -1);
	queue<pair<int,int>> bfs;
	bfs.push(make_pair(0, 0));
	while (!bfs.empty()) {
		auto x = bfs.front(); bfs.pop();
		int pos = x.first;
		if (distF[pos] != -1)continue;
		distF[pos] = x.second;
		for (int y : t[pos]) {
			bfs.push(make_pair(y, x.second + 1));
		}
	}

	vector<int>distS(N, -1);
	bfs.push(make_pair(N-1, 0));
	while (!bfs.empty()) {
		auto x = bfs.front(); bfs.pop();
		int pos = x.first;
		if (distS[pos] != -1)continue;
		distS[pos] = x.second;
		for (int y : t[pos]) {
			bfs.push(make_pair(y, x.second + 1));
		}
	}

	int Fpos = 0;
	rep(i, N)if (distF[i] <= distS[i])Fpos++;
	if (Fpos > (N - Fpos))cout << "Fennec" << endl;
	else cout << "Snuke" << endl;





	return 0;
}





Measured memory_bytes: 8576
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Split(bufio.ScanWords)
	n, m := scanInt(), scanInt()
	digit := make([]int, m)
	val := make([]string, m)
	for i := 0; i < m; i++ {
		digit[i] = scanInt() - 1
		val[i] = scanText()
	}

	for i := 0; i <= 999; i++ {
		ans := strconv.Itoa(i)
		if n != len(ans) {
			continue
		}

		ok := true
		for j := 0; j < m; j++ {
			d := digit[j]
			if string(ans[d]) != val[j] {
				ok = false
				break
			}
		}

		if ok {
			fmt.Print(ans)
			return
		}
	}

	fmt.Print(-1)
}

func scanInt() int {
	i, _ := strconv.Atoi(scanText())
	return i
}

func scanInts(size int) []int {
	ints := make([]int, size)
	for i := 0; i < size; i++ {
		ints[0] = scanInt()
	}
	return ints
}

func scanText() string {
	scanner.Scan()
	return scanner.Text()
}

func abs(n int) int {
	return int(math.Abs(float64(n)))
}


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

int main() {
int A, B; 
cin >> A >> B;
int ans = 0;
int outlet = 1;
while (outlet < B) {
  --outlet;
  outlet += A;
  ++ans;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    int d[n];
    for (int i = 0; i < n; i++) cin >> d[i];
    set<int> num;
    for (int i = 0; i < n; i++) {
        num.insert(d[i]);
    }
    cout << num.size() << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pi M_PI
#define inf 1<<30
#define eps (1e-11)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;

class Point{
public:
  double x,y;
  Point(double x=0,double y=0):x(x),y(y){}

  Point operator+(Point p){ return Point(x+p.x,y+p.y);}
  Point operator-(Point p){ return Point(x-p.x,y-p.y);}
  Point operator*(double k){ return Point(x*k,y*k);}
  Point operator/(double k){ return Point(x/k,y/k);}
  bool operator<(Point p)const{ return (x!=p.x ? x<p.x : y<p.y);}
  bool operator==(Point p)const{ return fabs(x-p.x)<eps && fabs(y-p.y)<eps;}

  double abs(){ return sqrt(norm());}
  double norm(){ return (x*x+y*y);}
};
typedef Point Vector;
typedef vector<Point> Polygon;

class Segment{
public:
  Point p1,p2;
  Segment(Point p1=Point(),Point p2=Point()):p1(p1),p2(p2){}
};
typedef Segment Line;

class Circle{
public:
  Point c;
  double r;
  Circle(Point c=Point(),double r=0.0):c(c),r(r){}
};

double norm(Vector a){ return (a.x*a.x+a.y*a.y);}
double abs(Vector a){ return sqrt(norm(a));}
double dot(Vector a,Vector b){ return (a.x*b.x+a.y*b.y);}
double cross(Vector a,Vector b){ return (a.x*b.y-a.y*b.x);}

Point rotate(Point base,Point a,double r){
  Point b=a-base;
  a.x=b.x*cos((r/180)*M_PI)-b.y*sin((r/180)*M_PI);
  a.y=b.x*sin((r/180)*M_PI)+b.y*cos((r/180)*M_PI);
  a=a+base;
  return a;
}

pair<Point,Point> getTangent(Circle c,Point p){
  Vector v=p-c.c;
  double r=acos(c.r/abs(v))*360/(2*pi);
  v=v*c.r/abs(v);
  Point p1=rotate(c.c,c.c+v,r);
  Point p2=rotate(c.c,c.c+v,360-r);
  return mp(p1,p2);
}

int main()
{
  int x,y,r;

  cin>>x>>y;
  Point p(x,y);
  cin>>x>>y>>r;
  Circle c(Point(x,y),r);

  pair<Point,Point> pp=getTangent(c,p);
  if(pp.s<pp.f)swap(pp.f,pp.s);
  printf("%.10f %.10f\n",pp.f.x,pp.f.y);
  printf("%.10f %.10f\n",pp.s.x,pp.s.y);
  return 0;
}

Measured memory_bytes: 1228
import numpy as np

n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))

a  = np.sort(np.array(a))
f = np.sort(np.array(f))[::-1]

l ,r = 0, 10 ** 12
while l <= r:
 x = (l + r) // 2
 if np.clip(a - x // f, 0, None).sum() <= k:
  r = x - 1
 else:
  l = x + 1
print(l)

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

int main(void){
  int x,y;
  cin>>x>>y;
  if(x==1||x==3||x==5||x==7||x==8||x==10||x==12){
    cout<<(y==1||y==3||y==5||y==7||y==8||y==10||y==12?"Yes":"No");

  }
  else if(x==4||x==6||x==9||x==11){
    cout<<(y==4||y==6||y==9||y==11?"Yes":"No");

  }
  else cout<<(y==2?"Yes":"No");
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, a[100008], b[100008];
string str;

int main(){
	cin >> n;
	for(ll i = 1; i <= n+1; i++){cin >> a[i];}
	for(ll i = 1; i <= n; i++){cin >> b[i];}

	ll ans = 0;
	for(ll i = 1; i <= n; i++){
		if(b[i] <= a[i]){
			ans += b[i];
		}
		else{
			ans += a[i];
			b[i] -= a[i];
			ans += min(b[i], a[i+1]);
			a[i+1] -= min(b[i], a[i+1]);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] sumA = new long[N+1];
		long[] sumB = new long[N+1];
		long countA = 0,countB = 0;
		for( int i=1; i<=N; i++ ){
			long a = sc.nextLong();
			sumA[i] = a + sumA[i-1];
			sumB[i] = a + sumB[i-1];
			if( sumA[i]<=0 && i%2!=0 ){
				countA += 1 - sumA[i];
				sumA[i] += 1 - sumA[i];
			}
			if( sumA[i]>=0 && i%2==0 ){
				countA += sumA[i] + 1;
				sumA[i] += (-1) - sumA[i];
			}
			if( sumB[i]<=0 && i%2==0 ){
				countB += 1 - sumB[i];
				sumB[i] += 1 - sumB[i];
			}
			if( sumB[i]>=0 && i%2!=0 ){
				countB += sumB[i] + 1;
				sumB[i] += (-1) - sumB[i];
			}
		}
		System.out.println(Math.min(countA,countB));
	}
}


Measured memory_bytes: 59376
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define lowbit(i) i&-i
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	ull ans=0; For(i,0,5)ans=ans<<15^rand(); return ans;
}
const int N=405;
int a[N][4],ycl[4];
ll yc[N];
unordered_map<ll,int> to;
map<ll,int> t;
ll chu(int a[4]){
	ll ans=0; 
	vector<int> v;
	For(i,0,3)v.pb(a[i]);
	For(i,1,3){
		vector<int> b;
		For(j,0,3)b.pb(a[(i+j)%4]);
		if(b<v)v=b;
	}
	//For(i,0,3)cout<<a[i]<<" "; puts(""); for(auto i:v)wri(i); puts("fjz");
	For(i,0,3)ans+=(ll)v[i]*ycl[i];
	return ans;
}
ll c(int a,int b){
	ll ans=1; 
	for(int i=a;i>a-b;i--)ans*=i;
	//For(i,2,b)ans/=i;
	return ans;
}
int get(ll x){
	auto it=to.find(x);
	if(it!=to.end())return it->second; else return 0;
}
void add(int i,int y){
	to[yc[i]]+=y;
}
int main(){
	int n=read();
	For(i,ycl[0]=1,3)ycl[i]=ycl[i-1]*1000;
	For(i,1,n){
		For(j,0,3){a[i][j]=read();} yc[i]=chu(a[i]); add(i,1);
	}
	ll ans=0;
	For(i,1,n){
		add(i,-1);
		For(j,i+1,n){
			add(j,-1);
			For(k,0,3){
				int q[4],B[4];
				For(l,0,3)B[l]=a[j][3^((l+k)%4)];
				t.clear();
				ll sum=1;
				For(l,0,3){
					q[3]=a[i][l]; q[2]=a[i][(l+1)%4];
					q[0]=B[l]; q[1]=B[(l+1)%4];
					/*if(i==1&&j==5&&k==2){
						For(o,0,3)wri(q[o]); puts("");
					}*/
					if(q[0]==q[2]&&q[1]==q[3]){sum*=2;
					if(q[0]==q[1])sum*=2;}
					//cerr<<sum<<endl;
					t[chu(q)]++;
				}
				for(auto i:t){
					sum=sum*c(get(i.fi),i.se);
				}
				//if(i==1&&j==8&&k==0)cout<<sum<<" "<<t.size()<<endl;
				ans+=sum;
			}
			add(j,1);
		}
		add(i,1);
	}
	cout<<ans/3<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int x[101],ans[101][101];

int main(void){

  int n,i,j,a,b,c,d,res=0;

  scanf("%d",&n);

  while(~scanf("%d %d %d %d",&a,&b,&c,&d)){
    if(c>d)x[a]+=3;
    else if(c==d){x[a]+=1;x[b]+=1;}
    else x[b]+=3;
  }

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      if(res<=x[j]){a=j;res=x[j];}
    }

    for(j=1;j<=n;j++){
      if(res==x[j])ans[i][j]=1;
    }
    x[a]=-1;
    res=0;
  }

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      if(ans[j][i]==1){
	printf("%d\n",j);
	break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int N, K;
vector<int> D(10);

bool check(int x){
    while(x != 0){
        for(int i = 0; i < K; i++){
            if(x % 10 == D[i])
                return false;
        }
        x /= 10;
    }
    return true;
}

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

    int i;
    for(i = 0; i < K; i++)
        cin >> D.at(i);

    int ans = N;

    while(!check(ans)){
        ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll N = 103000;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;
ll n;
ll fact[N];
ll arr[N];
ll ifact[N];
ll po(ll x,ll y)
{
	ll res=1;
	while(y)
	{
		if(y%2)
		res=res*x%mod;
		y/=2;
		x=x*x%mod;
	}
	return res;
}

int main()
{  fast
int z;
  fact[0]=1;
  for(int i=1;i<N;i++)
  fact[i]=fact[i-1]*i%mod;
  ifact[N-1]=po(fact[N-1],mod-2);
  for(int i=N-2;i>=0;i--)
  	ifact[i]=ifact[i+1]*(i+1)%mod;
  	   cin>>n;
  	vector<int> v(n+1);
   for(int i=1;i<=n+1;i++)
   {
	int x;
	cin>>x;
	v[i-1]=x;
   if(arr[x])
   {
arr[x]++;
   z=i;}
   arr[x]++;
   }
   int r;
   for(int i=0;i<=n;i++)
   {
   	if(v[i]==v[z-1])
   	{
		r=i;
		break;
	   }
   	
   }
   	z=n+1-(z-r);
	r=z;
  //0 cout<<r<<endl;
ll ans=0;
cout<<n<<endl;
if(n==1)
{cout<<1<<endl;
return 0;
}

for(int i=2;i<=n+1;i++)
{ans=0;
	ans+=(((fact[n+1]*ifact[i])%mod)*ifact[n+1-i])%mod;


	if(r>=i-1)
	ans-=(((fact[r]*ifact[i-1])%mod)*ifact[r-i+1])%mod;
 ans=(ans+mod)%mod;
	cout<<ans<<endl;
}
}


Measured memory_bytes: 3968
#include<stdio.h>
#include<memory.h>
#include<algorithm>
using namespace std;
int A[3001];
long dp[3001][3001];
long solve(int l, int r)
{
    if(l == r)return A[l];
    if(dp[l][r] != -1)return dp[l][r];
    long max_score = 0x8000000000000000;
    max_score = max(max_score, A[l]-solve(l+1, r));
    max_score = max(max_score, A[r]-solve(l, r-1));
    return dp[l][r] = max_score;
}
int main()
{
    int N;
    //freopen("input.txt", "r", stdin);
    scanf("%d", &N);
    memset(dp, -1, sizeof(dp));
    for(int i=0; i<N; i++)
    {
        scanf("%d", &A[i]);
    }
    printf("%ld\n", solve(0, N-1));
    return 0;
}

Measured memory_bytes: 70656
/********************************
*MAHBUBCSEJU                    *
*CSE 22                         *
*JAHANGIRNAGAR UNIVERSITY       *
*TIMUS:164273FU                 *
*UVA>>LIGHTOJ>>HUST:mahbubcseju */
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d\n",a)
#define PL(a) printf("%lld\n",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())
//#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M) {
    ll ret = 1;
    for(; e > 0; e >>= 1) {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b) {
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M) {
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e) {
    ll ret = 1;
    for(; e > 0; e >>= 1) {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
template <class T>string NTS ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template <class T>T stringtonumber ( const string &Text ) {
    istringstream ss(Text);
    T result;
    return ss >> result ? result : 0;
}
template <class T>bool ISLEFT ( T a,T b,T c) {
    if(((a.xx-b.xx)*(b.yy-c.yy)-(b.xx-c.xx)*(a.yy-b.yy))<0.0)return 1;//Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
#define mx 10000
#define md 1000000007
#define maxp 2050180000

typedef pair<int ,int > P;

////////define value/////

    int main()
    {
        int n,l;
        I2(n,l);
        string s[n+2];
for(int i=0;i<n;i++)cin>>s[i];
sort(s,s+n);
for(int i=0;i<n;i++)cout<<s[i];
NL;
        return 0;
    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long int X, Y, Z, C;
  cin >> X;
  cin >> Y;
  Z = (4 * X);
  
  if (Z < Y || (2 * X) > Y){
    cout << "No" << endl;
    return 0;
  }
  else{
    C = (Z - Y) % 2;
  }
    
  if (C == 0){
    cout << "Yes" << endl;
  }
  else if (C == 1){
    cout << "No" << endl;
  }
}

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

int main(void){
    
    ll x;
    ll b=100;
    
    cin >> x;
    
    for(ll i=1; i<=100000000; i++){
        
        b *= 1.01;
        
        if(b>=x){
            
            cout << i << endl;
            return 0;
            
        }
        
    }
    
    return 0;
    
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<long long> > vvll;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define INF 1000000000
#define MOD 1000000007
#define EPSILON 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define p_q priority_queue
 
#define FOR(i, a, b) for (ll i=(a); i<=(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 500005
#define MX 1048600
int n;
ll a[MN];
ll ps[MN];

ll lst[MX]; //last time we saw 0
ll cnt[MX];
pll dp[MX]; //cnt for k, cnt for 0

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n;
    FOR(i, 1, n){
        cin >> a[i];
        ps[i] = ps[i-1] ^ a[i];
    }
    ll ov = ps[n];
    //cout << ov << "\n";

    if(ov != 0){
        ll isn = 0;
        ll isz = 1;

        FOR(i, 1, n-1){
            if(ps[i] == 0){
                isz = (isn+isz)%MOD;
            } else if(ps[i] == ov){
                isn = (isn+isz)%MOD;
            }
        }

        cout << isz << "\n";
    } else{
        int tm = 0;

        dp[0].f = 1;
        FOR(i, 1, MX-1){
            dp[i].s = 1;
        }

        FOR(i, 1, n-1){
            //cout << ps[i] << " ";
            if(ps[i] == 0){
                tm++;
                dp[0].f = (dp[0].f*2)%MOD;
            } else{
                int j = ps[i];
                int dif = tm-lst[j];
                dp[j].s = (dp[j].s + dp[j].f*dif) % MOD;
                dp[j].f = (dp[j].f + dp[j].s) % MOD;
                lst[j] = tm;
            }
        }
        //cout << "\n";
        ll sm = 0;
        F0R(i, MX){
            /*if(dp[i].f != 0){
                cout << i << " adds " << dp[i].f << "\n";
            }*/
            sm += dp[i].f;
            sm %= MOD;
        }

        //cout << "\n";
        cout << sm << "\n";
    }

    return 0;
}


Measured memory_bytes: 34688
n = int(input())
divisors = []
for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
        divisors.append(i)
        if i != n // i:
            divisors.append(n // i)
divisors.sort()
if len(divisors) % 2 == 1:
    print(2 * divisors[len(divisors) // 2] -2)
else:
    print(divisors[len(divisors) // 2] + divisors[len(divisors) // 2 - 1] - 2)

Measured memory_bytes: 3264
#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
#include <queue>
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long LINF = 1e18;
#define dump(x) cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    vector<ll> a(3*n);
    for (int i = 0; i < 3*n; ++i) cin >> a[i];
    sort(a.begin(), a.end());
    ll ans = 0;
    int x = 3*n-2;
    for (int i = 0; i < n; ++i) {
        ans += a[x];
        x -= 2;
    }
    cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 2560
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static int MOD = 1000000007;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int r = parseInt(sc.next());
		sc.close();
		out.println(r*r);
	}
}


Measured memory_bytes: 22612
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
public class Main {
	public static void main(final String[] args){
        Scanner sc = new Scanner(System.in);
        List<Integer> list = new ArrayList<>();
        String s = sc.next();
        String t = sc.next();

        String sum = t.concat(s);
        System.out.println(sum);
    
	}
}

Measured memory_bytes: 22484
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;
template <typename T>
void vecin(vector<T> &v, int n = 0)
{
    if (n == 0)
        n = v.size();
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
    }
}
template <typename T>
void vecout(vector<T> &v, int n = 0)
{
    if (n == 0)
        n = v.size();
    for (int i = 0; i < n - 1; ++i)
    {
        cout << v[i] << " ";
    }
    cout << v[n - 1] << endl;
}

int main()
{
    ll n, k, q;
    cin >> n >> k >> q;
    vector<ll> a(q), seikai(n, 0), tensuu(n,1);
    vecin(a);
    REP(i,q){
        seikai[a[i] - 1]++;
    }
    ll ans = 0;
    REP(i, n)
    {
        ans += seikai[i];
    }
    REP(i,n){
        ans -= seikai[i];
        if (ans >= k){
            tensuu[i] = 0;
        }
        ans += seikai[i];
    }
    REP(i,n){
        if (tensuu[i] == 0){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }
}

Measured memory_bytes: 2944
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
char str[700][700];
pair<double,int> ev[500000];
double eps=1e-9;
int main(){
	int a,b;scanf("%d%d",&a,&b);
	
	for(int i=0;i<a;i++)scanf("%s",str[i]);
	for(int i=0;i<=a;i++)str[i][b]='.';
	for(int i=0;i<=b;i++)str[a][i]='.';
	a++;b++;
	int sz=0;
	for(int i=0;i<a-1;i++){
		for(int j=0;j<b-1;j++){
			if(str[i][j]==str[i][j+1]&&str[i][j]==str[i+1][j]&&str[i][j]!=str[i+1][j+1]){
				ev[sz++]=make_pair(atan2(a-i-2,j+1),-1);
			}
			if(str[i][j]!=str[i][j+1]&&str[i][j]!=str[i+1][j]&&str[i][j]!=str[i+1][j+1]){
				ev[sz++]=make_pair(atan2(a-i-2,j+1),1);
			}
		}
	}
	for(int i=1;i<b;i++){
		if(str[0][i]=='#'&&str[0][i-1]=='.'){
			ev[sz++]=make_pair(atan2(a-1,i),-1);
		}
	}
	for(int i=1;i<a;i++){
		if(str[i][0]=='#'&&str[i-1][0]=='.'){
			ev[sz++]=make_pair(atan2(1,0),-1);
		}
	}
	std::sort(ev,ev+sz);
	//for(int i=0;i<sz;i++)printf("%f %d\n",ev[i].first,ev[i].second);
	int ret=1;
	int now=1;
	for(int i=0;i<sz;i++){
		now+=ev[i].second;
		if(i<sz-1&&ev[i+1].first-ev[i].first<eps)continue;
		ret=max(ret,now);
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 9336
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define dump(x)  cout << #x << " = " << (x) << endl;

#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
//             0123456789 - digits. check the limits, int vs long
const int MX = 100001;
const double PI = 3.14159265359;
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(6);
    cout << std::fixed;
    // freopen("ex.in","r",stdin);
    // freopen("ex.out","w",stdout);
    double a, b, x;
    cin >> a >> b >> x;
    double rad;
    if (a*a*b <= 2*x){
    rad = atan(2*b / a - 2*x/(a*a*a));
    } else {
        rad = atan(b*b*a / (2*x));
    }
    cout << rad * 180 / PI;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
    using namespace std;
    int main()
    {
      int f;
      cin>>f;
      int n;
      n=f%10;
      if(n==2 || n==4 || n==5 || n==7 || n==9)
      {
        cout<<"hon";
      }
        if(n==0 || n==1 || n==6 || n==8)
      {
        cout<<"pon";
      }
      if(n==3 )
      {
        cout<<"bon";
      }
     
    }

Measured memory_bytes: 3576
/*
ID: thanhvq1
LANG: C++14
PROB: namenum
*/

#pragma GCC optimize ("O2")
#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;
#define int long long
#define double long double
#define vec vector
#define vi vector<int>
#define FZ(n) memset((n),0,sizeof(n))
#define FMO(n) memset((n),-1,sizeof(n))
#define unset unordered_set
#define ii pair<int, int>
#define vii vector<ii>
#define F first
#define S second
#define PB push_back
#define ALL(x) begin(x),end(x)
#define SZ(x) ((int)(x).size())
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first, l.second+r.second};
}
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;

void FILEIO() {  freopen("in.txt", "r", stdin);  freopen("out.txt", "w", stdout); }
//void FILEIO() {  freopen("namenum.in", "r", stdin);  freopen("namenum.out", "w", stdout); }

int n, x;
vi l;

void solve() {
	cin >> n >> x;
	l.resize(n+1); FORE(i, 1, n) cin >> l[i];
	vi d(n+1); d[0]=0;
	int ans=1;
	FORE(i, 1, n) { d[i] = d[i-1] + l[i];
		if(d[i]<=x) ans++;
		else break;
	}
	cout << ans << endl;
}

//#undef int
signed main() {
//#define int long long
  ios_base::sync_with_stdio(false); cin.tie();
//  FILEIO();
//auto beginProgram = chrono::steady_clock::now();

// int t; cin >> t;
//  while (t--)
  {
		solve();
  }

  //auto endProgram = chrono::steady_clock::now();

  return 0;
}


Measured memory_bytes: 256
import sys

while True :
	h,w = map(int,raw_input().split())
	if h==0 and w==0 :
		break
	else :
		for i in range(h):
			if i%2:
				for j in range(w):
					if j%2:
						if j==w-1:
							sys.stdout.write('#\n')
						else :
							sys.stdout.write('#')
					else :
						if j==w-1:
							sys.stdout.write('.\n')
						else :
							sys.stdout.write('.')
			else :
				for j in range(w):
					if j%2 :
						if j==w-1:
							sys.stdout.write('.\n')
						else :
							sys.stdout.write('.')
					else :
						if j==w-1:
							sys.stdout.write('#\n')
						else :
							sys.stdout.write('#')
		print''

Measured memory_bytes: 6348
#include <iostream>
#include <stdio.h>

#define MAX_N 200'000

typedef long long ll;

using namespace std;

int A[MAX_N]{};
int C[MAX_N]{};

ll comb(int n) {
  if (n <= 1) {
    return 0;
  } else {
    return (ll)n * (n - 1) / 2;
  }
}

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    A[i] = a - 1;
    ++C[a - 1];
  }

  ll t = 0;
  for (int i = 0; i < N; ++i) {
    t += comb(C[i]);
  }

  for (int i = 0; i < N; ++i) {
    printf("%lld\n", t - comb(C[A[i]]) + comb(C[A[i]] - 1));
  }
}

Measured memory_bytes: 4720
from collections import Counter

N , K , Q = map(int, input().split())
pn = [None  for _ in range(Q) ]

for i in range(Q):
    pn[i] = input()

c =  Counter(pn)
# print(c)
for j in range(1, N + 1):
    if Q - c[str(j)] < K:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)



Measured memory_bytes: 14240
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;

long long P = 1000000007;

class C {
public:
  int n;
  vector<long long> fac, inv, facInv;
  long long power(long long e, long long x) {
    if (x == 0)
      return 1;
    if (x == 1)
      return e;
    if (x % 2 == 0)
      return power((e * e) % P, x / 2);
    return (e * power(e, x - 1)) % P;
  }
  C(int n_) {
    n = n_;
    fac.resize(n + 1);
    inv.resize(n + 1);
    facInv.resize(n + 1);
    fac[1] = 1;
    for (int i = 2; i <= n; i++)
      fac[i] = (i * fac[i - 1]) % P;
    inv[1] = 1;
    for (int i = 2; i <= n; i++)
      inv[i] = power(i, P - 2);
    facInv[1] = 1;
    for (int i = 2; i <= n; i++)
      facInv[i] = (inv[i] * facInv[i - 1]) % P;
  }
  long long comb(int N, int K) {
    if (N == 0 || K == 0 || K == N)
      return 1;
    if (N < K || K < 0 || N < 0)
      return 0;
    return ((fac[N] * facInv[K]) % P * facInv[N - K]) % P;
  }
  long long pair(int N, int K) { return (comb(N, K) * fac[K]) % P; }
};

C comb(10000);

long long add(long long a, long long b) { return (a + b) % P; }

long long mul(long long a, long long b) { return (a * b) % P; }

int main() {
  long long n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  // dp[i人以下のグループ][j人]: 通り数
  long long dp[1001][1001] = {0};
  dp[0][0] = 1;
  for (int i = 1; i <= b; i++) {
    for (int j = 0; j <= n; j++) {
      dp[i][j] = dp[i - 1][j];
      if (i < a)
        continue;
      for (int k = c; k <= d && j - i * k >= 0; k++) {
        dp[i][j] =
            add(dp[i][j],
                mul(dp[i - 1][j - i * k],
                    mul(comb.pair(n - j + i * k, i * k),
                        mul(comb.power(comb.facInv[i], k), comb.facInv[k]))));
      }
    }
  }
  cout << dp[b][n] << endl;
  return 0;
}


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

ll N, W;

int main(){
  cin >> N >> W;
  vector<pair<ll, ll> > wv(N);
  vector<ll> kaz(4, 0LL);
  
  for(ll i = 0; i < N; i++){
    ll w, v; cin >> w >> v;
    wv[i] = make_pair(w, -v);
  }
  ll wmi = wv[0].first;
  
  sort(wv.begin(), wv.end());
  for(ll i = 0; i < N; i++){
    kaz[wv[i].first-wmi]++;
    //cout << "w = " << wv[i].first << ",v = " << -wv[i].second << endl;
  }
  ll s2 = kaz[0];
  ll s3 = s2 + kaz[1];
  ll s4 = s3 + kaz[2];
  
  ll ans = 0LL;
  ll w1 = 0LL, v1 = 0LL;
  ll w2 = 0LL, v2 = 0LL;
  ll w3 = 0LL, v3 = 0LL;
  ll w4 = 0LL, v4 = 0LL;
  for(ll i = 0; i <= kaz[0]; i++){
    if(i) {w1 += wv[i-1].first; v1 -= wv[i-1].second;}
    for(ll j = 0; j <= kaz[1]; j++){
      if(j) {w2 += wv[s2 + j-1].first; v2 -= wv[s2 + j-1].second;}
      else {w2 = 0; v2 = 0;}
      for(ll k = 0; k <= kaz[2]; k++){
        if(k) {w3 += wv[s3 + k-1].first; v3 -= wv[s3 + k-1].second;}
        else {w3 = 0; v3 = 0;}
        for(ll l = 0; l <= kaz[3]; l++){
          if(l) {w4 += wv[s4 + l-1].first; v4 -= wv[s4 + l-1].second;}
          else {w4 = 0; v4 = 0;}
          if(w1 + w2 + w3 + w4 <= W) ans = max(ans, v1 + v2 + v3 + v4);
        }
      }
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>
#include <sstream>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

ll gcd(ll a, ll b) {
    if (a < b) return gcd(b, a);
    return b ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

ll count(ll n, ll c, ll d) {
    return n - (n/c) - (n/d) + (n/(lcm(c, d)));
}

 
int main() {
    ll ans = 0;

    ll a, b, c, d;

    cin >> a >> b >> c >> d;

    cout << count(b, c, d) - count(a-1, c, d) << endl;


    
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

inline ll read(){
    ll Hashimoto=0;
	bool Kanna=1;
    char I_Love=getchar();
    while(I_Love<'0'||I_Love>'9'){
        if(I_Love=='-')Kanna=0;
        I_Love=getchar();
    }
    while(I_Love>='0'&&I_Love<='9'){
        Hashimoto=Hashimoto*10+I_Love-'0';
        I_Love=getchar();
    }
    return (Kanna?Hashimoto:-Hashimoto);
}
template<typename T1,typename T2> inline void Umax(T1 &a,T2 b){
	if(a<b)a=b;
}
template<typename T1,typename T2> inline void Umin(T1 &a,T2 b){
	if(a>b)a=b;
}

#define I_Love_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<(Kanna);++I_Love)cout<<Hashimoto[I_Love]<<(I_Love==(Kanna)-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<(Kanna);++I_Love)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define inf (int)1e9
#define linf (ll)1e18
#define mod (inf+7)

int n,k;

int I_Love_Hashimoto_Kanna() {
	fastio;
	cin>>n>>k;
	ll cnt=0;
	ll cnt2=0;
	for(int i=1;i<=n;i++){
		if(2*i%k==0){
			if((2*i/k)%2)cnt++;
			else cnt2++;
		}
	}
	
	Tone(cnt*cnt*cnt+cnt2*cnt2*cnt2)
	
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a)
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;

inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=100005;
//i_am_noob
int n,a[maxn],ans=1,k=1e18;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	rep(n) cin >> a[i];
	sort(a,a+n);
	if(a[0]==0){
        print1(0);
        return 0;
	}
	rep(n){
	    if(a[i]>k/ans){
            print1(-1);
            return 0;
	    }
	    ans*=a[i];
	    if(ans>k){
            print1(-1);
            return 0;
	    }
	}
	print1(ans);
	return 0;
}


Measured memory_bytes: 4436
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

using Graph = std::vector<std::vector<int>>;
using WGraph = std::vector<std::vector<std::pair<int, long long>>>;
using ll = long long;
using namespace std;

int main() {
    int n = 0, m = 0;
    cin >> n >> m;
    Graph G(n);
    int a = 0, b = 0;
    for (int i=0; i<m; i++) {
        cin >> a >> b;
        a--;
        b--;
        G.at(a).push_back(b);
    }
    int shortest = n+1;
    vector<int> res;
    for (int i=0; i<n; i++) { 
        vector<int> prev(n, -1);
        vector<int> dis(n, -1);
        dis.at(i) = 1;
        queue<int> que;
        que.push(i);
        while (!que.empty()) {
            int t = que.front();
            que.pop();
            for (auto v : G.at(t)) {
                if (dis.at(v) == -1) {
                    prev.at(v) = t;
                    dis.at(v) = dis.at(t) + 1;
                    que.push(v);
                }
            }
        }
        for (int j=0; j<n; j++) {
            if (j == i || dis.at(j) == -1) {
                continue;
            }
            for (auto v : G.at(j)) {
                if (v == i) {
                    if (dis.at(j) < shortest) {
                        shortest = dis.at(j);
                        vector<int> tmp;
                        int cur = j;
                        while (cur != -1) {
                            tmp.push_back(cur);
                            cur = prev.at(cur);
                        }
                        res = tmp;
                    }
                }
            }
        }
    }
    if (shortest == n+1) {
        cout << -1 << endl;
    }
    else {
        cout << shortest << endl;
        for (auto v : res) {
            cout << v+1 << endl;
        }
    }
    return 0;
}
 

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
 int $(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
signed main(){
  int a,b,e=10000000000,d,f,g=0;
  cin>>a>>b;
  vector<int> c(a);
  fo(i,a)
  c.at(i)=i+b;
  for(int i=0;i<a;i++){
    d=abs(c.at(i));
    if(e>d){
      e=d;
      f=i;
    }
  }
  fo(i,a)
  g+=c.at(i);
  cout<<g-c.at(f)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define MOD 1000000007

int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  ll sum=0;
  for(int i=0;i<n;i++){
    int b;
    cin>>b;
    a[i]-=b;
    if(a[i]<0) a[i]/=2;
    sum+=a[i];
  }
  if(sum<=0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    const int INF = 1000000000;
    string s;
    cin >> s;
    int n = s.size();
    int ans = INF;
    rep(i, s.size() - 2){
        int num = 100 * (s[i] - '0') + 10 * (s[i+1] - '0') + (s[i+2] - '0');
        ans = min(abs(num - 753), ans);
    }
    cout << ans << endl;
}



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

using namespace std;

const int N = 200000, A = 1000000;

int aa[N], kk[A + 1];

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++)
		cin >> aa[i];
	for (int i = 0; i < n; i++)
		kk[aa[i]]++;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (kk[aa[i]] > 1)
			continue;
		int k = 0;
		for (int a = 1; a <= aa[i] / a; a++)
			if (aa[i] % a == 0) {
				if (kk[a])
					k++;
				if (a < aa[i] / a && kk[aa[i] / a])
					k++;
			}
		if (k == 1)
			ans++;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 8332
#include <iostream>
using namespace std;
#define MAX_N 30000

int main() {
    int N;
    char S[MAX_N + 1];
    cin >> N >> S;
    int flag[1000];
    for (int i = 0; i < 1000; i++) {
        flag[i] = 0;
    }
    for (int i = 0; i < 1000; i++) {
        int pin[4];
        int x = i;
        pin[0] = x / 100;
        x %= 100;
        pin[1] = x / 10;
        x %= 10;
        pin[2] = x;
        pin[3] = -1;

        int j = 0;
        for (int k = 0; k < N; k++) {
            if (S[k] == pin[j] + '0') {
                j++;
            }
        }

        if (j == 3) {
            flag[i] = 1;
        }
    }

    int count = 0;
    for (int i = 0; i < 1000; i++) {
        if (flag[i]) {
            count++;
        }
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string S;
    cin >> S;
    long long N = S.size();
    vector<long long> V(N+1);
    V[0] = 0;
    long long ten = 1;
    map<long long,long long> mp;
    mp[0]++;
    for(int i = 1; i <= N; i++){
        V[i] = ((S[N-i] - '0')*ten + V[i-1])%2019;
        ten *= 10;
        ten %= 2019;
        mp[V[i]]++;
    }
    long long ans = 0;
    for(auto p : mp){
        long long k = p.second;
        ans += k*(k-1)/2;
    }
    cout << ans << endl;
}

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

using ll = long long;
using pll = pair<ll, ll>;

ll const INF = ll(1e18);

struct Seq {
    int l;
    int r;
    ll c;
};

bool operator<(Seq const& lhs, Seq const& rhs) {
    if (lhs.l == rhs.l) {
        if (lhs.r == rhs.r) {
            return lhs.c < rhs.c;
        }
        return lhs.r < rhs.r;
    }
    return lhs.l < rhs.l;
}

struct RNGT {
    int nd;
    vector<ll> d;

    RNGT(int n) {
        nd = n;
        d.resize(nd * 4, INF);
    }

    void update(int qp, ll val) { return __update(1, 0, nd - 1, qp, val); }
    void __update(int p, int l, int r, int qp, ll val) {
        if (qp < l || r < qp) return;
        if (l == r) {
            d[p] = min(d[p], val);
            return;
        }

        int mid = l + (r - l) / 2;
        if (qp <= mid) {
            __update(p * 2, l, mid, qp, val);
        } else {
            __update(p * 2 + 1, mid + 1, r, qp, val);
        }
        d[p] = min(d[p * 2], d[p * 2 + 1]);
    }

    ll query(int ql, int qr) { return __query(1, 0, nd - 1, ql, qr); }
    ll __query(int p, int l, int r, int ql, int qr) {
        if (l>r || r < ql || qr < l) return INF;
        if (ql <= l && r <= qr) return d[p];

        int mid = l + (r - l) / 2;
        return min(__query(p * 2, l, mid, ql, qr), __query(p * 2 + 1, mid + 1, r, ql, qr));
    }
};

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

    vector<Seq> vs;
    int l, r, c;
    for (int i = 0; i < m; ++i) {
        cin >> l >> r >> c;
        --l, --r;
        vs.push_back({l, r, c});
    }
    sort(vs.begin(), vs.end());

    RNGT segt(n);
    segt.update(0, 0);
    for (int i = 0; i < m; ++i) {
        segt.update(vs[i].r, segt.query(vs[i].l, vs[i].r - 1) + vs[i].c);
    }

    ll ans = segt.query(n - 1, n - 1);
    cout << (ans == INF ? -1 : ans) << endl;
}

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

typedef long long ll;
ll memo[1000002];
ll n;
map<ll,bool> s;
vector<ll>W;

ll dp(ll x){
    if (x>n)
    {
        memo[x] = 0;
        return 0;
    }

    if (s[x]){
        memo[x] = 0;
        return 0;
    }
    ll to_add = 0;
    if (x==n)
    {
        return 1;
    }
    if (memo[x] != -1)
        return memo[x];
    else
    {
        if(!s[x+1])
        to_add += dp(x+1);
        if (!s[x+2]&&x+2<=n)
            to_add += dp(x+2);
        memo[x] = to_add%1000000007;
        return memo[x];
    }

}

int main()
{
    ll n, w,sumr=0,suml;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>w;
        if(i>0)sumr+=w;
        else suml=w;
        W.push_back(w);
    }
    ll mini=abs(suml-sumr);
    for(int i=1;i<n-1;i++)
    {
        suml+=W[i];
        sumr-=W[i];
        if(mini>abs(sumr-suml))mini=abs(sumr-suml);
    }
    cout<<mini<<endl;



    return 0;

}

Measured memory_bytes: 256
#include <stdio.h>

int main (void){

    int swp=0;
    int num1=0;
    int num2=0;
    int num3=0;

    scanf("%d %d %d",&num1,&num2,&num3);

    if(num3<num1){
    		swp =num3;
    		num3=num1;
    		num1=swp;
    	}
    if(num3<num2){
     	swp =num2;
     	num2=num3;
     	num3=swp;
     }

    if(num2<num1){
		swp =num1;
		num1=num2;
		num2=swp;
    }




    printf("%d %d %d\n",num1,num2,num3);

    return 0;
}




Measured memory_bytes: 2056
#include<bits/stdc++.h>
using namespace std;
int main(){ 
    int N;
    cin >> N;
    bool f = false;
    for(int i = 0; i < N; i++){
        char a; cin >> a;
        if(a == 'Y') f = true;
    }
    if(f) cout << "Four" << endl;
    else cout << "Three" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793238462
typedef long long ll;
typedef double db;
ll a[10005];
int main(){
    ll n,k,sum=0;
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+1+n);
    for(int i=1;i<=k;i++){
        sum+=a[i];
    }
    cout<<sum<<endl;
}   

Measured memory_bytes: 3636
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <cmath>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
const ll MOD = 998244353;

int main() {
    ll n, m;
    cin >> n >> m;
    ll left = -1;
    ll right = 1e9;
    for (ll i = 0; i < m; ++i) {
        ll l, r;
        cin >> l >> r;
        left = max(left, l);
        right = min(right, r);
    }
    ll res = right - left;
    if (res >= 0) {
        cout << ++res << endl;
    } else {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;
 
signed main(){
    string s;
    cin >> s;
    int ans = 0;
    int cs = 0;
    rep(i, 0, s.size()){
        if(s[i] == 'S') cs++;
        else if(s[i] == 'T' && cs != 0) cs--;
        else if(s[i] == 'T' && cs == 0) ans++;
    }
    cout << ans * 2 << endl;
}

Measured memory_bytes: 640
//#define TEST
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
    static void Main(){
        string s = Console.ReadLine();
        int n = s.Length - 7;
        for (int i = 0;i <= s.Length - 2;i++){
#if TEST
        Console.Write("i = {0} ",i);
#endif
            List<char> l = new List<char>();
            for (int j = 0;j < i;j++)
                l.Add(s[j]);
            for (int j = i + n;j < s.Length;j++)
                l.Add(s[j]);
#if TEST
            foreach (var c in l)
                Console.Write(c);
            Console.WriteLine();
#endif
            bool f = true;
            string s2 = "keyence";
            for (int j = 0;j < 7;j++)
                f = f && s2[j] == l[j];
            if (f){
                Console.WriteLine("YES");
                return;
            } 
        }
        Console.WriteLine("NO");
    }
}

Measured memory_bytes: 11220