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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int N;
  cin >> N;
  
  vector<vector<int>> F(N);
  int tmp;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < 10; j++){
      cin >> tmp;
      F[i].push_back(tmp);
    }
  }

  vector<vector<int>> P(N);
  for(int i = 0; i < N; i++){
    for(int j = 0; j < 11; j++){
      cin >> tmp;
      P[i].push_back(tmp);
    }
  }

  ll ans = -INF;
  for(int i = 1; i < 1024; i++){
    ll tmp_ans = 0;
    for(int n = 0; n < N; n++){
      ll cnt = 0;
      for(int j = 0; j < 10; j++){
        if(i & (1 << j) && F[n][j] == 1){
          cnt++;          
        }
      }
      tmp_ans += P[n][cnt];
    }
    chmax(ans, tmp_ans);
  }

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


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

int main(void) {
  int n;
  scanf("%d", &n);

  int t = 0;
  int x = 0;
  int y = 0;

  int t_i, x_i, y_i;
  int tmp;

  for (int i = 1; i <= n; ++i) {
    scanf("%d %d %d", &t_i, &x_i, &y_i);
    tmp = abs(x_i - x) + abs(y_i - y) - abs(t_i - t);

    if (tmp <= 0 && tmp % 2 == 0) {
      continue;
    } else {
      printf("No");
      exit(0);
    }
  }

  printf("Yes");
}


Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-10;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long long fib[100];
vector<pair<long long,long long > > v[100];
void dfs(int a,long long b,long long c,int d){
	if(b&&c/b==1){
		v[a].push_back(make_pair(b,c));
		v[a].push_back(make_pair(c,b));
	}
	if(d==0){
		long long tb=c;
		long long tc=b+c*2;
		if(tb<=fib[a+3]&&tc<=fib[a+3])dfs(a+1,tb,tc,1);
	}
	long long tb=c;
	long long tc=b+c;
	if(tb<=fib[a+3]&&tc<=fib[a+3])dfs(a+1,tb,tc,d);
}
int main(){
	int a;scanf("%d",&a);
	fib[1]=1;
	fib[2]=2;
	for(int i=3;i<100;i++){
		fib[i]=min(inf,fib[i-2]+fib[i-1]);
	}
	dfs(0,1,1,0);
	for(int i=1;i<=4;i++){
//		for(int j=0;j<v[i].size();j++)printf("%d: %lld %lld\n",i,v[i][j].first,v[i][j].second);
	}
	while(a--){
		long long x,y;scanf("%lld%lld",&x,&y);
		if(x>y)swap(x,y);
		int K=1;
		for(int i=98;i>=1;i--){
			if(fib[i]<=x&&fib[i+1]<=y){
				K=i;
				break;
			}
		}
		printf("%d ",K);
		if(K==1){
			printf("%lld\n",(x%mod)*(y%mod)%mod);
			continue;
		}else{
			long long ret=0;
			for(int i=0;i<v[K].size();i++){
				if(v[K][i].first>x||v[K][i].second>y)continue;
				ret=(ret+(y-v[K][i].second)/v[K][i].first+1)%mod;
			}
			printf("%lld\n",ret);
		}
	}
}

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

#define For(i,a,b) for(int (i) = (a);(i) < (b);i++)
#define Rep(i,n) For((i),0,(n))
#define All(a) (a).begin(),(a).end()
#define sp " "
#define INF 1e18
#define INT_INF 1e9

typedef long long ll;
const ll MOD = 1000000007;
const ll MOD_9 = 998244353;

vector<char> boin = {'a','i','u','e','o'};
vector<char> alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

int main(){
    int N;
    cin >> N;
    for(int i = 1;i <= N;i++){
        int x = i;
        x *= 27;
        x /= 25;
        if(x == N){
            cout << i << endl;
            //cin >> x;
            return 0;
        }
    }
    cout << ":(" << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
int main(void){
    int N;
    cin >> N;
    int A[N+2];
    rep(i,N) cin >> A[i+1];
    A[0]=0,A[N+1]=0;
    int dis[N+1];
    rep(i,N+1) dis[i]=abs(A[i+1]-A[i]);
    int dis2[N];
    rep(i,N) dis2[i]=abs(A[i+2]-A[i]);
    int sum=0;
    rep(i,N+1) sum+=dis[i];
    rep(i,N) cout << sum-dis[i]-dis[i+1]+dis2[i] << endl;
}

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

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

int common_factor(int a, int b) {
  int r = a%b;
  while (r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}

int main() {
  int N,X;
  scanf("%d %d",&N,&X);
  int x[N+1];
  for (int i = 0; i < N; i++) {
    scanf("%d",&x[i]);
  }
  x[N] = X;
  qsort(x,N+1,sizeof(int),compare_int);
  int dif_x[N];
  for (int i = 0; i < N; i++) {
    dif_x[i] = x[i+1] - x[i];
  }
  if (N == 1) {
    printf("%d\n",dif_x[0]);
    return 0;
  }
  qsort(dif_x,N,sizeof(int),compare_int);
  int ans = common_factor(dif_x[0],dif_x[1]);
  if (N >= 3) {
    for (int i = 2; i < N; i++) {
      ans = common_factor(ans,dif_x[i]);
    }
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 1396
L,R=map(int,input().split())
if R-L>2018:
    print(0)
else:
    r=2018
    for i in range(L,min(R,L+2019)):
        for j in range(i+1,min(R+1,L+2020)):
            r=min(r,(i*j)%2019)
    print(r)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <stddef.h>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <math.h>
#define ll long long;

using namespace std;

class dice {
public:
	int a[7];
	int state[7];
	void move(char s);
	void rotate(int a, int b);
};

void dice::move(char s) {
	int t[7];//??????????????´???
	for (int i = 1; i <= 6; i++) {
		t[i] = state[i];
	}
	if (s == 'N') {
		state[1] = t[2];
		state[2] = t[6];
		state[6] = t[5];
		state[5] = t[1];
	}
	else if (s == 'S') {
		state[1] = t[5];
		state[5] = t[6];
		state[6] = t[2];
		state[2] = t[1];
	}
	else if (s == 'W') {
		state[1] = t[3];
		state[3] = t[6];
		state[6] = t[4];
		state[4] = t[1];
	}
	else {
		state[1] = t[4];
		state[4] = t[6];
		state[6] = t[3];
		state[3] = t[1];
	}
}

void dice::rotate(int a, int b) {
	while (state[2] != b) {
		move('N');
		if (state[2] == b) break;
		move('N');
		if (state[2] == b) break;
		move('N');
		if (state[2] == b) break;
		move('W');
		move('S');
		if (state[2] == b) break;
		move('S');
		move('S');
	}
	while (state[1] != a){
		move('E');
	}
}


int main() {
	
	dice dice{
	};
	string s;

	for (int i = 1; i <= 6; i++) {
		cin >> dice.a[i];
		dice.state[i] = dice.a[i];
	}

	int q;
	int a[24], b[24];
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> a[i] >> b[i];
	}

	for (int i = 0; i < q; i++) {
		dice.rotate(a[i], b[i]);
		cout << dice.state[3] << endl;
	}
}

Measured memory_bytes: 3104
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
const int maxn = (1 << 12), maxn1 = 1e3 + 10;
#define inf 0x3f3f3f3f

int Dp[maxn] = {0}, n, m;

int main(){
    cin >> n >> m;
    for(int i = 1; i < (1 << n); i++){
        Dp[i] = inf;
    }
    for(int i = 0; i < m; i++){
        int a, b, c, temp = 0;
        cin >> a >> b;
        while(b--){
            cin >> c;
            temp |= (1 << (c - 1));
        }
        for(int j = 0; j < (1 << n); j++){
            if(Dp[j] != inf){
                Dp[j | temp] = min(Dp[j | temp], Dp[j] + a);
            }
        }
    }
    int s = (1 << n) - 1;
    if(Dp[s] == inf){
        cout << -1; return 0;
    }
    cout << Dp[s];
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define VerticesNum 100
typedef unsigned int uint;

struct output
{
    uint uDiscoverTime;
    uint uFinTime;
}Output;

struct output gstOutput[VerticesNum];
uint uTotalTime = 1;

void DepthFirstSearch(uint pGraph[][VerticesNum], uint uSize, uint uRoot)
{
    if(gstOutput[uRoot].uDiscoverTime == 0)
    {
        gstOutput[uRoot].uDiscoverTime = uTotalTime++;
    }
    else
    {
        return;
    }
    
    for(uint i = 0; i < uSize; i++)
    {
        if((pGraph[uRoot][i] == 1) && (gstOutput[i].uDiscoverTime == 0 ))
        {
            DepthFirstSearch(pGraph, uSize, i);
        }
    }
    gstOutput[uRoot].uFinTime = uTotalTime++;
    
    return;
}

int main(void){
    uint arGraph[VerticesNum][VerticesNum] = {};
    
    uint uVertices;
    scanf("%u", &uVertices);
    
    for(uint i = 0; i < uVertices; i++)
    {
        uint uVertexIdx;
        uint OutDegree;
        scanf("%u", &uVertexIdx);
        scanf("%u", &OutDegree);
        for(uint j = 0; j < OutDegree; j++)
        {
            uint AdjacentVertex;
            scanf("%u", &AdjacentVertex);
            arGraph[uVertexIdx - 1][AdjacentVertex - 1] = 1; 
        }
    }
    /*
    for(uint i = 0; i < uVertices; i++)
    {
        for(uint j = 0; j < uVertices; j++)
        {
            printf("%u", stGraph[i][j]);
            (j < (uVertices - 1))
                ? printf(" ")
                : printf("\n");
        }
    }
    */
    for(uint uRoot = 0; uRoot < uVertices; uRoot++)
    {
        DepthFirstSearch(arGraph, uVertices, uRoot);
    }
    
    for(uint i = 0; i < uVertices; i++)
    {
        printf("%d %d %d\n", i + 1, gstOutput[i].uDiscoverTime, gstOutput[i].uFinTime);
    }
    
    return 0;
}


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

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  
  vector<int> a = {A,B,C};
  
  int five = 0;
  int seven = 0;
  for(int i = 0; i < 3; i++){
    if(a.at(i) == 5){
      five++;
    }
    else if(a.at(i) == 7){
      seven++;
    }
  }
  
  if(five == 2 && seven == 1){
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
    return 0;
}

Measured memory_bytes: 3516
#include <iostream>
#include <string>

using namespace std;

void solve()
{
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); ++i)
	{
		if (s[i] == 'C')
		{
			for (int j = i + 1; j < s.size(); ++j)
			{
				if (s[j] == 'F')
				{
					cout << "Yes" << endl;
					return;
				}
			}
		}
	}
	cout << "No" << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

class segtree{
public:
	static const int N=1<<19;
	int dp[1<<20];
	segtree(){
		memset(dp,0,sizeof(dp));
	}
	void update(int k,int v){
		k+=N-1;
		dp[k]+=v;
		while(k>0){
			k=(k-1)/2;
			dp[k]=dp[k*2+1]+dp[k*2+2];
		}
	}

	int query(int a,int b,int k=0,int l=0,int r=N){
		if(b<=l || r<=a)return 0;
		if(a<=l && r<=b)return dp[k];
		int mid=(l+r)/2;
		int vl=query(a,b,k*2+1,l,mid);
		int vr=query(a,b,k*2+2,mid,r);
		return vl+vr;
	}
};

int n,q;
string s;
segtree seg[28];

int main(void){
	scanf("%d",&n);
	cin >> s;
	for(int i=0;i<s.size();i++){
		seg[(s[i]-'a')].update(i,1);
	}
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		int type;
		scanf(" %d",&type);
		if(type==1){
			int pos;
			char c;
			scanf(" %d %c",&pos,&c);
			pos--;
			seg[(s[pos]-'a')].update(pos,-1);
			s[pos]=c;
			seg[(s[pos]-'a')].update(pos,1);
		}else{
			int pos,pos2;
			scanf("%d%d",&pos,&pos2);
			pos--;
			int cnt=0;
			for(int j=0;j<26;j++){
				if(seg[j].query(pos,pos2)>0){
					cnt++;
				}
			}
			printf("%d\n",cnt);
		}
	}
	return 0;
}


Measured memory_bytes: 115588
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;

int main() {
  int a, b, k;
  cin >> a >> b >> k;
  vector <int> ans;
  for(int i=1; i<=a; ++i) {
    if(a % i == 0 && b % i == 0) {
      ans.push_back(i);
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ans[k-1] << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define LL long long
using namespace std;
int n;
int num[510][510], tot;
int main() {
	int i, j, k;
	scanf("%d", &n);
	for(i = 2; i*(i-1)/2 <= n; i++){
		if(i*(i-1)/2 == n) break;
	}
	if(i*(i-1)/2 != n){ printf("No\n"); return 0; }
	printf("Yes\n%d\n", i);
	int x = i;
	for(i = 1; i <= x; i++){
		for(j = i+1; j <= x; j++) num[i][j] = num[j][i] = ++tot;
	}
	for(i = 1; i <= x; i++){
		printf("%d", x-1);
		for(j = 1; j <= x; j++) if(i != j) printf(" %d", num[i][j]);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 2176
#include<iostream>
#include <algorithm>
#include<string>
#include <numeric>
#include<math.h>
#include <bits/stdc++.h>
using namespace std;

int main(void) {
    string s;
    cin>>s;
    if(s=="111")s="999";
    else if(s=="119")s="991";
    else if(s=="191")s="919";
    else if(s=="199")s="911";
    else if(s=="911")s="199";
    else if(s=="919")s="191";
    else if(s=="991")s="119";
    else if(s=="999")s="111";
    cout<<s<<endl;

    return 0;
}


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

using namespace std;

int main() {
	int n, k, L[50], i, j, tmp, sum = 0;

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

	for (i = 0;i < n - 1;i++) {
		for (j = i + 1;j < n;j++) {
			if (L[i] < L[j]) {
				tmp = L[j];
				L[j] = L[i];
				L[i] = tmp;
			}
		}
	}

	for (i = 0;i < k;i++) {
		sum += L[i];
	}
	printf("%d\n", sum);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[200010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int g(int x){
	x=modpow(x,MOD-2);
	return x;
}
string s;
int L[100010],R[100010],cnt[100010];
signed main(){
	cin>>s;
	int nowL=s.size()-1;
	for(int i=s.size()-1;i>=0;i--){
		if(s[i]=='L')nowL=i;
		L[i]=nowL;
	}
	int nowR=0;
	rep(i,s.size()){
		if(s[i]=='R')nowR=i;
		R[i]=nowR;
	}
	rep(i,s.size()){
		if(s[i]=='R'){
			if((L[i]-i)%2==0)cnt[L[i]]++;
			else cnt[L[i]-1]++;
		}
		else{
			if((i-R[i])%2==0)cnt[R[i]]++;
			else cnt[R[i]+1]++;
		}
	}
	rep(i,s.size()){
		cout<<cnt[i]<<(i==s.size()-1?"\n":" ");
	}
	return 0;
}


Measured memory_bytes: 2972
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,K;
    cin >> N >> K;
    vector<int> data(N);
    for (int i=0;i<N;i++) {
        cin >> data.at(i);
    }
    
    sort(data.begin(),data.end());
    int sum=0;
    for (int i=0;i<K;i++) {
        sum+=data.at(i);
    }
    
    cout << sum << endl;

}

Measured memory_bytes: 3652
#include<iostream>
#include<cmath>

using namespace std;
int main(){
    int h,w;

    while(1){
        cin >> h >> w;
        if(h == 0 && w == 0){
            break;
        }else{
            for(int i = 0; i < h; i++){
                for(int j = 0; j < w; j++){
                    if(i == 0 || i == h - 1 || j == 0 || j == w - 1){
                        cout << "#" << flush;
                    }else{
                        cout << "." << flush;
                    }
                }
                cout << endl;
            }
            cout << endl;
        }
    }
}


Measured memory_bytes: 3104
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
#include <iomanip>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
//template< typename T >
//T mod_pow(T x, T n, const T &p) {
//  T ret = 1;
//  while(n > 0) {
//    if(n & 1) (ret *= x) %= p;
//    (x *= x) %= p;
//    n >>= 1;
//  }
//  return ret;
//}
/////////////////// 
//

#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
#define mp make_pair
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
//
//
//

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  string s;
  cin >> s ;
  cout << s[0] << s[1] << s[2] << s[3] << " " << s[4]<< s[5]<< s[6]<< s[7]<< s[8]<< s[9]<< s[10]<< s[11] << endl;
  return 0;
}







Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int x,a,b;
	cin>>x>>a>>b;
	if(a>=b)cout<<"delicious"<<endl;
	else if(x+a<b)cout<<"dangerous"<<endl;
	else cout<<"safe"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

const int mod = 2019;

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

  int l,r;
  while(cin >> l >> r){
    int ans = 2019;

    FORE(i,l,min(l+2019,r)){
      FORE(j,i+1,min(l+2019,r)){
        chmin(ans, (i%mod*j%mod)%mod);
      }
    }
    
    cout << ans << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    int a[3];
    rep(i, 3) { cin >> a[i]; }
    sort(a, a + 3);
    if(a[0] + a[1] == a[2]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    s: chars,
  }
  let mut dp = vec![vec![0; n + 1]; n + 1];
  for i in (0 .. n).rev() {
    for j in (0 .. n).rev() {
      dp[i][j] = if s[i] == s[j] {
        dp[i+1][j+1] + 1
      } else {
        0
      };
    }
  }
  let mut ans = 0;
  for i in 0 .. n {
    for j in i + 1 .. n {
      ans = cmp::max(ans, cmp::min(dp[i][j], j - i));
    }
  }

  puts!("{}\n", ans);
}


Measured memory_bytes: 231676
#include<iostream>
#include<vector>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<string> v[26];
    char tmp;
    for (int i = 0; i < n; ++i) {
        string w;
        cin >> w;
        if (i && w[0] != tmp) {
            cout << "No" << endl;
            return 0;
        }
        tmp = w[w.length()- 1];
        for (vector<string>::iterator it = v[w[0] - 'a'].begin(); it != v[w[0] - 'a'].end(); ++it) {
            if (w == *it) {
                cout << "No" << endl;
                return 0;
            }
        }
        v[w[0] - 'a'].push_back(w);
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
n, m, l = (int(x) for x in input().split())

matrixA = []
matrixB = []
matrixANS =[]

for i in range(n):
    matrixA.append([int(x) for x in input().split()])

for j in range(m):
    matrixB.append([int(x) for x in input().split()])

for row_A in matrixA:
    numlist = []
    for j in range(l):
        sum = 0
        for k in range(m):
            sum += row_A[k] * matrixB[k][j]
        numlist.append(sum)
    matrixANS.append(numlist)

for ans in matrixANS:
    print(" ".join(map(str,ans)))


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

int main(){
    int N; int K; int V[51]; cin >> N >> K;
    for(int i=0; i<N; i++){
        cin >> V[i];
    }
    ll ans=0;
    for(int j=0; j<=N/2; j++){
        for(int i=j; i<=K-j; i++){
            if(i>N) break;
            for(int s=0; s<=i; s++){
                vector<int> vec(0);
                for(int t=0; t<=s-1; t++){
                    vec.push_back(V[t]);
                }
                for(int t=N-1; t>=N-i+s; t--){
                    vec.push_back(V[t]);
                }
                sort(vec.begin(), vec.end());
                ll res=0;
                for(int l=j; l<i; l++){
                    res +=vec[l];
                }
                ans = max(ans, res);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll  long long
#define PI  acos(-1)
#define pb  push_back
#define ins insert
#define INF 5000000000000000007 //1e18+7
#define mk  make_pair
#define lb(v,x) lower_bound(all(v),x)
#define ub(v,x)  upper_bound(all(v),x)
#define ff  first
#define ss  second
#define rev reverse
#define endl "\n"
#define max3(x,y,z)  max(x,max(y,z))
#define min3(x,y,z)  min(x,min(y,z))
#define sz(a) (ll)a.size()
#define double long double
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define mset(x,y)  memset(x,y,sizeof(x))
#define all(x)   (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define bp(n)  __builtin_popcountll(n)
#define mxt(a)  *(max_element(a.begin(),a.end()))
#define mnt(a)  *(min_element(a.begin(),a.end()))
#define unique_sort(c) (sort(all(c)), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define rep(i,a,b) for(ll i=(a);i<=(b);++i)
#define trav(a, x)    for(auto &a : x)
#define re(i,n)       for(ll i=0;i<n;++i) 
#define int2Bin(x,y)  bitset <y> z=x; cout<<z.to_string()<<endl;
const double eps=1e-7;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
// int dx[8]={+1, +1, +1, 0, 0, -1, -1, -1};
// int dy[8]={+1, 0, -1, +1, -1, +1, 0, -1};
int dx[4]={ 1, 0, 0, -1 };
int dy[4]={ 0, -1, 1, 0 };
ll power(ll x,ll y){ll ans=1;x=x;while(y>0){if(y&1)ans=(ans*x);y=y>>1;x=(x*x);}return ans;}
ll sqr(ll x) { return x * x;}
template <typename T> T gcd(T a,T b){ if(a==0) return b; return gcd(b%a,a); }
template <class T> inline void chmax(T &x,T y){ x = max((x), (y));}
template <class T> inline void chmin(T &x,T y){ x = min((x), (y));}
template <class T> T abs(T x) { return x>0 ? x : -x;}
template <typename T> T powm(T a,T b, ll m){T cnt=1; while(b>0){ if(b%2==1) cnt=(cnt*a)%m; b/=2; a=(a*a)%m; }return cnt%m;}
typedef pair<int,int>  pii;
typedef pair<ll,ll>  pll;
typedef vector<pll>  vpll;
typedef vector<pii>  vpii;
typedef vector<ll>   vll;
typedef vector<int>  vii;
#define minpq priority_queue<T,vector<T>,greater<T> >;
//#define T pll
//#define ordered_set tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
//*X.find_by_order(k) returns the kth largest element (0-based).
//X.order_of_key(val) returns the no. of values less than val.
ll ncr(ll n,ll r){ll ans=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){ans*=(n-i);ans/=(i+1);}return ans;}
const int MOD=124561253;   
const int N=400005;
struct compare{
    bool operator() (const int &a,const int &b) const{
        return a>b;
    }
};
void prec(){

}
void run(){
   ll n,k;cin>>n>>k;
   vll a(n+1);
   rep(i,1,n) cin>>a[i];
   rep(i,k+1,n){
        if(a[i]>a[i-k]) cout<<"Yes\n";
        else cout<<"No\n";
   }
}   
int32_t main(){
    cin.sync_with_stdio(0);cin.tie(0);
    cin.exceptions(cin.failbit);
    int tc=1;
    //cin>>tc;
    prec();
    re(i,tc)
        run();
    return 0; 
}
/* 
    stuff you should look for
    * int overflow,array bounds.
    * special cases (n=1?).
    * N,MOD value.
*/


Measured memory_bytes: 4784
#include<cstdio>
#include<algorithm>
using namespace std;
int n,h;
struct node{
int x;
bool f1;
}a[2000098];
bool cmp(node a,node b)
{
 	return a.x>b.x;
}
int main()
{
	scanf("%d",&n);
	scanf("%d",&h);
	for(int i=1;i<=n;i++)
		{
		scanf("%d%d",&a[i].x,&a[i+n].x);
		
		a[i+n].f1=true;		
	}
	sort(a+1,a+1+n*2,cmp);int ans=0;
	for(int i=1;i<=n+n;i++)
		{
		if(a[i].f1)
			{
			h-=a[i].x;
			ans++;
		}
		else
			{
			ans+=h/a[i].x;
			if(h%a[i].x) ans++;
			h=-1;
		}
		if(h<=0)
			{
			printf("%d",ans);
			return 0;
		}
		
	}

}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define ALL(v) (v).begin(), (v).end()
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main(){
    ll n;
    ll suma=0;
    ll sumb=0;
    ll husoku=0; 
    cin>>n;
    VL a(n,0), b(n,0), yoyu;
    ll cnt=0;
    rep(i,0,n){
        cin >> a[i];
        suma += a[i];
    }
    rep(i,0,n){
        cin >> b[i]; 
        sumb += b[i];
        if(a[i]<b[i]){
            husoku += b[i]-a[i];
            cnt++;
        }
        else yoyu.push_back(a[i]-b[i]);
    }
    sort(ALL(yoyu)); 
    reverse(ALL(yoyu));
    if(suma < sumb){
        cout << -1 << endl;
        return 0;
    }
    ll id=0;
    while(husoku>0){
        husoku-=yoyu[id]; id++;
    }
    cout << cnt+id << endl;
}

Measured memory_bytes: 2936
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n=0;
		String str1 = in.next();
		String str2 = in.next();
		for(int i=0;i<str1.length();i++)
		{
			if(str1.charAt(i) != str2.charAt(i))
				n++;
		}
		System.out.print(n);
	}

}


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


int main(){
    
    int n,ans=-1,d=1;
    cin >> n ;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a.at(i);
    }
    for(int i=0;i<n;i++){
      if(a.at(i)==d){
            d++;
        }  
    }
    ans=n-d+1;
    if(ans==n){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n,m,a[105][105],b[105][105];
int main()
{
    memset(a,0x3f,sizeof a);
    cin>>n>>m;
    for(int i=0,u,v,w; i<m; i++)
        cin>>u>>v>>w,a[u][v]=a[v][u]=b[u][v]=b[v][u]=w;
    for(int k=1; k<=n; k++)
        for(int i=1; i<=n; i++)
            for(int j=1; j<=n; j++)
                a[i][j]=min(a[i][j],a[i][k]+a[k][j]);
    int ans=0;
    for(int i=1; i<=n; i++)
        for(int j=i+1; j<=n; j++)
            ans+=a[i][j]<b[i][j];
    cout<<ans;
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

#define MIN(a,b) ((a)<(b)?(a):(b))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  i32 *x = ALLOC (n, i32);
  i32 *y = ALLOC (n, i32);
  for (i32 i = 0; i < n; ++i) {
    scanf ("%" SCNi32 "%" SCNi32, x + i, y + i);
  }
  i32 ans = n;
  for (i32 i = 0; i < n; ++i) {
    for (i32 j = 0; j < n; ++j) {
      if (i == j) continue;
      i32 dx = x[i] - x[j];
      i32 dy = y[i] - y[j];
      i32 cnt = 0;
      for (i32 k = 0; k < n; ++k) {
        for (i32 l = 0; l < n; ++l) {
          if (k == l) continue;
          if (x[k] - x[l] == dx && y[k] - y[l] == dy) {
            cnt++;
          }
        }
      }
      ans = MIN (ans, n - cnt);
    }
  }
  printf ("%" PRIi32 "\n", ans);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 128
import sys
input = sys.stdin.buffer.readline
import heapq
from collections import defaultdict
from operator import itemgetter

def main():
    N,K = map(int,input().split())
    sushi = []
    for _ in range(N):
        t,d = map(int,input().split())
        sushi.append((-d,t))
    sushi.sort(key=itemgetter(0))
    use,only,unuse = [],[],sushi[K:]
    neta = defaultdict(int)
    x = 0
    for i in range(K):
        d,t = sushi[i]
        if neta[t] == 0:
            only.append((-d,t))
        else:
            use.append((-d,t))
        neta[t] += 1
        x -= d
    
    l = len(neta)
    heapq.heapify(use)
    heapq.heapify(only)
    heapq.heapify(unuse)
    
    ans = x + l**2
    while (len(use) != 0 and len(unuse) != 0 and l < K):
        cd,ct = heapq.heappop(unuse)
        cd *= -1
        if neta[ct] != 0:
            continue
        heapq.heappush(only,(cd,ct))
        rd,rt = heapq.heappop(use)
        x += cd-rd
        l += 1
        neta[ct] += 1
        neta[rt] -= 1
        ans = max(ans,x+l**2)
        
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 30464
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, k, q;
	cin >> n >> k >> q;
	map<int, int> m;
	for (int i = 0; i < q; i++) {
		int t;
		cin >> t;
		m[t - 1]++;
	}
	for (int i = 0; i < n; i++) {
		if (k - (q - m[i]) > 0)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
#define     ll              long long
#define     MAX             100000
#define     FI              freopen("input.txt","r",stdin)
#define     FO              freopen("output.txt","w",stdout)
#define     fast            ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define     sc(a)           scanf("%d",&a)
#define     sc2(a,b)        scanf("%d %d",&a,&b)


int main()
{
    int test;
    cin>>test;
    set<int>s;
    while(test--)
    {
        int cs,num;
        cin>>cs>>num;
        switch(cs)
        {
        case 0:
        {
            s.insert(num);
            cout<<s.size()<<"\n";
        }
        break;
        case 1:
        {

            cout<<s.count(num)<<"\n";
        }
        break;
        default:
            s.erase(num);
            break;

        }
    }
    return 0;
}




Measured memory_bytes: 12356
import java.util.Scanner;
public class Main {

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

        while (sc.hasNext()){
            int a = sc.nextInt();
            int b = sc.nextInt();
            int sum = 0;

            for (int i = 0; i < 2; i++) {
                if (a > b){
                    sum += a;
                    a--;
                }else{
                    sum += b;
                    b--;
                }
            }
            System.out.println(sum);
        }
    }
}

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

int main(){
  int n;
  cin >> n;
  int Univ[10][10][100];
  for(int i = 0; i < n; i++){
    int b, f, r, v;
    cin >> b >> f >> r >> v;
    Univ[b][f][r] += v;
  }
  for(int b = 1; b <= 4; b++){
    for(int f = 1; f <= 3; f++){
      for(int r = 1; r <= 10; r++){
        if(r != 10) cout << " " << Univ[b][f][r];
        else cout << " " << Univ[b][f][r] << endl;
      }
    }
    if(b == 4) break;
    else cout << "####################" << endl;
  }
}


Measured memory_bytes: 3116
import bisect
n,m = map(int,input().split())

g = [[ ] for i in range(n+1)]

for i in range(m):
    a,b = map(int,input().split())
    if a == 1 or a == n or b == 1 or b == n:
        g[a].append(b)
        g[b].append(a)

    #print(bisect.bisect_left(g[a],b))
    #g[a][] = b
    #g[a].append(b)
    #g[b].append(a)

#g[4].sort()

#print(g[4])

if len(g[n]) == 0:
    print('IMPOSSIBLE')
    exit()

for i in g[n]:
    g[i].sort()
    if g[i][0] == 1:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')

Measured memory_bytes: 37820
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <string>

using namespace std;
int main()
{
    int n;
    cin >> n;
    stack<bool> st;
    int cnt = 0;
    bool flag = true;
    for (int i = 0; i < n; i++) {
        string str;
        cin >> str;
        if (str == "A") {
            st.push(true);
        } else {
            if (not st.empty()) {
                st.pop();
                cnt++;
            } else {
                flag = false;
            }
        }
    }
    if (st.empty() and flag) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 3168
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
n = inp()
res = []
for i in range(1,55556):
    if is_prime(i) and i%5 == 1:
        res.append(i)
print(*res[:n])

Measured memory_bytes: 79124
#include <iostream>
using namespace std;
int main(){
	string a;
	int f=0;
	cin >> a;
	if(a=="a")f=1;
	if(a=="e")f=1;
	if(a=="i")f=1;
	if(a=="o")f=1;
	if(a=="u")f=1;
	if(f==1){
		cout << "vowel" << endl;
	}else{
		cout << "consonant" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
	int n;
	scanf("%d", &n);
	int k;
	scanf("%d", &k);
	int at;
	for (int i = 0; i < n; ++i) {
		int x;
		scanf("%d", &x);
		if (x == 1)
			at = i;
	}
	--k;
	int ans = 1e9;
	for (int i = max(0, at - k); i < n && i <= at + k; ++i) {
		int a = i;
		int b = max(0, n - (i + k) - 1);
		ans = min(ans, (a + k - 1) / k + (b + k - 1) / k + 1);
	}
	cout << ans << endl;
	return 0;
}

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

//Base class for Segment Trees
template <class T>
class segtree_base
{
protected:
	size_t width;
	vector<T> vec;
	T def;
	virtual T query_raw(int l_, int r_, int a_, int b_, int k_) = 0;
public:
	segtree_base(size_t size_, const T& def_ = T()) : def(def_)
	{
		width = 1;
		while (width < size_)width *= 2;
		vec.resize(width * 2 - 1, def);
	}
	T query(int left, int right)
	{
		return query_raw(left, right, 0, width, 0);
	}
	virtual ~segtree_base() {}
};

#include <algorithm>
//Range Minimum Tree
template <class T>
class rmq_tree : public segtree_base<T>
{
public:
	rmq_tree(size_t size_, const T& def) : segtree_base<T>(size_, def)
	{}
	void update(int index, int val)
	{
		auto &vec = this->vec;
		index += (this->width - 1);
		vec[index] = val;
		while (index > 0)
		{
			index = (index - 1) / 2;
			vec[index] = min(vec[index * 2 + 1], vec[index * 2 + 2]);
		}
	}
private:
	T query_raw(int l_, int r_, int a_, int b_, int k_)override
	{
		const auto &vec = this->vec;
		if (l_ <= a_ && b_ <= r_)
		{
			return vec[k_];
		}
		if (b_ <= l_ || r_ <= a_)
		{
			return this->def;
		}
		int m = (a_ + b_) / 2;
		return min(
			query_raw(l_, r_, a_, m, k_ + k_ + 1),
			query_raw(l_, r_, m, b_, k_ + k_ + 2));
	}
};

#include <iostream>
#include <climits>

int main()
{
	int n, q;
	cin >> n >> q;
	rmq_tree<int>rmq(n, INT_MAX);
	for (int i = 0; i < q; ++i)
	{
		int com, x, y;
		cin >> com >> x >> y;
		if (com)
		{
			cout << rmq.query(x, y + 1) << endl;
		}
		else
		{
			rmq.update(x, y);
		}
	}
	return 0;
}

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

#define N	3000
#define MD	1000000007

int max(int a, int b) { return a > b ? a : b; }

int main() {
	static char cc[N + 1];
	static int dp[N + 1];
	int n, m, k, k0, l_, r_;

	scanf("%d%d%s", &n, &m, cc);
	l_ = 0, r_ = -1, k0 = 0;
	dp[0] = 1;
	while (m--) {
		int l, r;

		scanf("%d%d", &l, &r), l--, r--;
		if (r_ < r) {
			while (l_ <= r_ && l_ < l) {
				for (k = k0; k > 0; k--)
					dp[k] = (dp[k] + dp[k - 1]) % MD;
				if (k0 >= r_ - l_ + 1)
					dp[k0 - (r_ - l_ + 1)] = 0;
				l_++;
			}
			if (r_ < l)
				l_ = l, r_ = l - 1;
			while (r_ < r)
				if (cc[++r_] == '0')
					k0++;
		}
	}
	while (l_ <= r_) {
		for (k = k0; k > 0; k--)
			dp[k] = (dp[k] + dp[k - 1]) % MD;
		if (k0 >= r_ - l_ + 1)
			dp[k0 - (r_ - l_ + 1)] = 0;
		l_++;
	}
	printf("%d\n", dp[k0]);
	return 0;
}


Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FastIO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define forn(i, n) for (int i = 0; i < n; ++i)
#define forn1(i, n) for (int i = 1; i <= n; ++i)
#define pb push_back
#define fr first
#define sc second
const int MAXN = 65535 + 5;
const double INF = 2e9;
const ll MOD = 1e9 + 7;

//#define DEBUG

int main(){
  FastIO;
  #ifdef DEBUG
    freopen("input.txt", "r", stdin);
  #endif
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b + c >= 22)
  {
    cout << "bust\n";
  }
  else
  {
    cout << "win\n";
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int a,b,c,d;

int main(){
    cin >> a;
    for(int i = 0; i < a ;i++){
        cin >> b >> c >> d;
        if (b*b+c*c==d*d || c*c+d*d==b*b || d*d+b*b==c*c) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 2992
using System;
using System.Collections.Generic;
using System.Windows;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    public class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine().Split(' ');
            var a = r[0].ToDecimal();
            var b = r[1].ToDecimal();
            var c = r[2].ToDecimal();
            var d = 4 * a * b;
            var e = c - a - b;
            var f = e * e;
            var ans = "No";
            if (e > 0 && d < f)
            {
                ans = "Yes";
            }
            Console.WriteLine(ans);
            Console.ReadLine();
        }
    }
}

public static class Extentions
{
    public static int ToInt(this object obj)
    {
        return int.Parse(obj.ToString());
    }

    public static decimal ToDecimal(this object obj)
    {
        return decimal.Parse(obj.ToString());
    }

    public static double ToDouble(this object obj)
    {
        return double.Parse(obj.ToString());
    }
}



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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const ll mod=1000000007;

ll fib(int x){
  if(x==-1){return 0;}
  else if(x==0){return 1;}
  else{
    return fib(x-1)+fib(x-2);
  }
}


ll solve(int H, int W, int K){
  vvl dp(H+1, vl(W));
  dp[0][0]=1;

  for (int i=0;i<H;++i){
    for (int j=0;j<W;++j){
      ll C=dp[i][j]*fib(j)*fib(W-j-1)%mod;
      dp[i+1][j]=C;
      
      if(j!=0){
        ll L=dp[i][j-1]*fib(j-1)*fib(W-j-1)%mod;
        (dp[i+1][j]+=L)%=mod;
      }
      
      if (j!=W-1){
        ll R=dp[i][j+1]*fib(j)*fib(W-j-2)%mod;
        (dp[i+1][j]+=R)%=mod;
      }
    }
  }

  return dp[H][K-1];
}

int main(){
  int H, W, K;cin>>H>>W>>K;
  ll ans = solve(H, W,K);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//=  <   >
using namespace std;
typedef long long ll;
int main() 
{
  ll nEnemigos, nSpecialMove, HEnemigos = 0;
  cin >> nEnemigos >> nSpecialMove;

  if ( nSpecialMove >= nEnemigos ) cout << 0;
  else 
  {
    ll Enemigos[nEnemigos];
    for ( int i = 0; i < nEnemigos; ++i )
    {
      ll p; cin >> p;
      HEnemigos += p;
      Enemigos[i] = p;
    } 

    sort( Enemigos, Enemigos + nEnemigos );
    
    for ( int i = ( nEnemigos - 1 ); i > ( nEnemigos - nSpecialMove - 1 ); --i )
    {
      HEnemigos -= Enemigos[i];
    }
    cout << HEnemigos;
  }
  return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
     public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for (int i = 1;; i++) { 
            int x = sc.nextInt();
            if (x != 0) {
            System.out.println("Case " + i + ": " + x);
            } else {
                break;
            }
        }
    }
}



Measured memory_bytes: 40960
#include <bits/stdc++.h>
using namespace std;
int N;
long long a[111],b=1e12;
int main(){
    cin>>N;
    for(int i=0;i<N;i++)
        cin>>a[i];
    for(int i=-100;i<101;i++){
        long long ans=0;
        for(int j=0;j<N;j++){
            ans+=(a[j]-i)*(a[j]-i);
        }
        b=min(b,ans);
    }
    cout<<b<<endl;
    return 0;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
arr = gets.chomp.split(" ").map(&:to_i)

# 0: 灰の人数, 1: 茶の人数, ...
count_arr = Array.new(8, 0)
free = 0

arr.each do |a|
  if a >= 3200
    free += 1
  else
    count_arr[a / 400] += 1
  end
end

pos_count = 0
count_arr.each do |count|
  pos_count += 1 if count > 0
end

min = [pos_count, 1].max
max = pos_count + free
puts "#{min} #{max}"


Measured memory_bytes: 14160
import collections
N = int(input())
A = [int(i) for i in input().split()]

S = [0] * (N+1)
for k in range(1,N+1):
  S[k] = S[k-1] + A[k-1]

count = collections.Counter(S)
ans = 0
for k,v in count.items():
  ans += v * (v-1) // 2
print(ans)

Measured memory_bytes: 41504
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T b,T a){if(a<b){a^=b;b^=a;a^=b;return 1;}return 0;}

ll n;
vector<ll> a;
void input(){
    cin>>n;
    a.resize(n);
    rep(i,n) cin>>a[i];
}
void src(){
    int maxid = (int)std::distance(a.begin(), max_element(a.begin(), a.end()));
    auto t=a[maxid];a[maxid]=0;
    int max2id = (int)std::distance(a.begin(), max_element(a.begin(), a.end()));
    a[maxid]=t;
    rep(i,n){
        cout<< (maxid!=i ? a[maxid]:a[max2id])<<"\n";
    }

}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 3200
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  double x,y,ans;
  cin >> x >> y;
  ans=abs(x+y)/2;
  if(abs(x-y)>180) {
    ans+=180;
    if(ans>360) {
      ans-=360;
    }
  }
  cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 3312