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

int Digits_sum(int a, int b){
    int sum = 0;
    while(a>0){
        sum += a % 10;
        a /= 10;
    }
    while(b>0){
        sum += b % 10;
        b /= 10;
    }
    return sum;
}

int main(){
    int i,j;
    int min = 100001;
    int digits_sum;
    int n;
    cin >> n;
    for(i=1;i<=n;i++){
        j = n-i;
        if(j > 0){
            digits_sum = Digits_sum(i,j);
            if(digits_sum < min) min = digits_sum;
        }
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int acs(const void *a,const void *b){
  return *(int *)a-*(int *)b;
}
int main(void){
  int n;
  scanf("%d",&n);
  int s[n],sum=0;
  for(int loop=0;loop<n;loop++){
    scanf("%d",&s[loop]);
    sum+=s[loop];
  }
  qsort(s,n,sizeof(int),acs);
  if(sum%10){
    printf("%d\n",sum);
    return 0;
  }
  for(int loop=0;loop<n;loop++){
    if((sum-s[loop])%10){
      printf("%d\n",sum-s[loop]);
      return 0;
    }
  }
  putchar('0');
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=998244353;
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 
ll mul(ll a, ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a, ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll sub(ll a, ll b)
{
	return ((a%mod)-(b%mod)+mod)%mod;
}
ll po(ll a, ll b)
{
	if(b==0)
	{
		return 1;
	}
	ll t=po(a,b/2);
	if(b%2)
	{
		return mul(t,mul(t,a));
	}
	else
	{
		return mul(t,t);
	}
	
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll x,y;
	cin>>x>>y;
	ll o=0;
	ll tr=0;
	while(y-o>=0)
	{
		if(o/2 +(y-o)/4 == x && (y-o)%4==0)
		{
			tr++;
		}
		o+=2;
	}
	if(tr)
	{
		cout<<"Yes\n";
	}
	else 
	{
		cout<<"No\n";
	}
}


Measured memory_bytes: 3636
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

vector<ii> dt;
ii d[MAXn];

set<ii> st;

int main()
{
    IOS();
    ll n;
    cin>>n;
    REP1(i,n)cin>>d[i].X>>d[i].Y, st.insert(d[i]);
    REP1(i, n)REP1(j, i - 1)dt.pb(ii(d[i].X - d[j].X, d[i].Y - d[j].Y));
    ll mn = n;
    for(ii p:dt)
    {
        ll tt = 0;
        REP1(i,n)if(!st.count(ii(d[i].X - p.X, d[i].Y - p.Y)))tt++;
        mn = min(mn, tt);
    }
    cout<<mn<<endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<fstream>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
string s;
char fz,fz1;
int sum;
int main()
{
	cin>>s;
	 fz=s[0];
	 int len=s.size();
	 fz1=s[len-1];
	
	for(int i=2;i<s.size();i++) sum++;
	
	cout<<fz<<sum<<fz1;
	
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define maxn 100010
int n,k; //n 座岛  k个请求
struct bridge{
    int left;
    int right;
}b[maxn];

bool cmp(bridge a,bridge b){
    if(a.right==b.right)  return a.left<b.left;
        return a.right<b.right;
}

int main()      //排序之后从西向东找交集 有交集就断桥
{
    cin>>n>>k;
    for(int i=1;i<=k;i++){
        cin>>b[i].left>>b[i].right;
            if(b[i].left>b[i].right)   swap(b[i].left,b[i].right);
    }
    int minr=b[1].right;
    for(int i=2;i<=k;i++)
        minr=min(minr,b[i].right);
    sort(b+1,b+k+1,cmp);
     /*cout<<endl;
      for(int i=1;i<=k;i++)
        cout<<b[i].left<<" "<<b[i].right<<endl;
            //cout<<endl;*/

     int ans=1;
     for(int i=1;i<=k;i++){
        if(b[i].left>=minr){
            minr=b[i].right;
            ans++;
        }
     }
     cout<<ans<<endl;

    return 0;
}




Measured memory_bytes: 1024
def main():

    S = input()
    ref = S[0]
    i = 1
    ans = 1
    while i < len(S):
        if S[i] == ref:
            if i < len(S)-1:
                ref = S[i:i+2]
                ans += 1
                i += 2
            else:
                i += 1
        else:
            ref = S[i]
            ans += 1
            i += 1
    return ans


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 3500
// author: hjy
// Problem:
#include<bits/stdc++.h>
//#pragma GCC optimize(2)
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define rep(i,n) for(register int i=0; i<(int)(n); ++i)
#define per(i,n) for(register int i=(int)(n)-1; i>=0; --i)
#define rep1(i,n) for(register int i=1; i<=(int)(n); ++i)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<"="<<x<<'\n'
template<typename T1, typename T2>
inline bool umin(T1 &a, const T2 &b) { return a > b ? a = b, true : false; }
template<typename T1, typename T2>
inline bool umax(T1 &a, const T2 &b) { return a < b ? a = b, true : false; }
inline int read() {
	int x=0,ng=0;
	char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-') ng=1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return ng?-x:x;
}
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const int seed=20040305;

int n;
int a[200100];
ll sum[200100];
ll l2[200100],r2[200100];
ll l12[200100];

int main()
{
	scanf("%d",&n);
	rep(i,n) scanf("%d",&a[i]);
	sum[0]=a[0];
	for(int i=1;i<n;i++)
		sum[i]=sum[i-1]+a[i];		
	l2[n]=0;
	for(int i=n-1;i>=0;i--)
	{
		ll s=sum[n-1];
		if(i!=0) s-=sum[i-1];
		ll fuck=l2[i+1]+(a[i]&1);
		if(a[i]==0) fuck+=2;
		l2[i]=min(fuck,s);
	}
	r2[0]=0;
	for(int i=1;i<=n;i++)
	{
		ll s=sum[i-1];
		ll fuck=r2[i-1]+(a[i-1]&1);
		if(a[i-1]==0) fuck+=2;
		r2[i]=min(fuck,s);
	}
	l12[n]=0;
	for(int i=n-1;i>=0;i--)
	{
		l12[i]=min(l12[i+1]+((a[i]&1)^1),l2[i]);
	}
	ll res=inf;
	for(int i=0;i<n;i++)
	{
		umin(res,r2[i]+l12[i]);
	}
	printf("%d",res);
	return 0;
}
/*
7
11
11
10
10
11
10
0
*/


Measured memory_bytes: 7296
#include <iostream>
#include <string>
//#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    if (a*b%2 == 1) {
        cout << "Odd" << endl;
    }else{
        cout << "Even" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize(3,"Ofast","inline")
using namespace std;
int n,dp[2003][2003],a[6003],ans,tg,MX[2003],cur;
int A[100004],B[100004],C[100004],t;
void add(int x,int y,int z){if(dp[x][y]<z)A[t]=x,B[t]=y,C[t++]=z;}
int main(){
	cin>>n;
	for(int i=1;i<=3*n;i++)scanf("%d",&a[i]);
	memset(dp,-1,sizeof(dp));
	memset(MX,-1,sizeof(MX));
	dp[a[1]][a[2]]=dp[a[2]][a[1]]=MX[a[1]]=MX[a[2]]=cur=0;
	for(int i=3;i<3*n;i+=3){
		if(a[i]==a[i+1]&&a[i]==a[i+2]){tg++;continue;}
		t=0;
		if(a[i]>a[i+1])swap(a[i],a[i+1]);
		if(a[i+1]>a[i+2])swap(a[i+1],a[i+2]);
		if(a[i]>a[i+1])swap(a[i],a[i+1]);
		if(a[i]==a[i+1]||a[i+1]==a[i+2])for(int j=1;j<=n;j++){
			if(a[i]==a[i+1]){
				if(dp[j][a[i]]>=0)add(j,a[i+2],dp[j][a[i]]+1);
			}else if(dp[j][a[i+1]]>=0)add(j,a[i],dp[j][a[i+1]]+1);
		}
		if(dp[a[i]][a[i]]>=0)add(a[i+1],a[i+2],dp[a[i]][a[i]]+1);
		if(dp[a[i+1]][a[i+1]]>=0)add(a[i],a[i+2],dp[a[i+1]][a[i+1]]+1);
		if(dp[a[i+2]][a[i+2]]>=0)add(a[i],a[i+1],dp[a[i+2]][a[i+2]]+1);
		add(a[i],a[i+1],cur),add(a[i+1],a[i+2],cur),add(a[i],a[i+2],cur);
		for(int k=1;k<=n;k++)if(MX[k]>=0)add(a[i],k,MX[k]),add(a[i+1],k,MX[k]),add(a[i+2],k,MX[k]);
		for(int j=0;j<t;j++)if(dp[A[j]][B[j]]<C[j]){
			dp[A[j]][B[j]]=dp[B[j]][A[j]]=C[j];
			if(MX[A[j]]<C[j])MX[A[j]]=C[j];
			if(MX[B[j]]<C[j])MX[B[j]]=C[j];
			if(cur<C[j])cur=C[j];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++)ans=max(ans,dp[i][j]);
		if(dp[i][i]>=0)if(i==a[3*n])ans=max(ans,dp[i][i]+1);
	}
	printf("%d",ans+tg);
}

Measured memory_bytes: 19568
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
#define PI 3.1415926535897932384626433832795
int MOD=1e9+7;
int powmod(int a,int l, int md){int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
typedef long long ll; typedef vector<ll> vi; typedef pair<ll, ll> ii; typedef vector<ii> vii;
#define pb push_back
int __set(int b, int i) {return b|(1<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return ((a%md)*(b%md))%md;}
int addmod(int a, int b, int md) {return (a+b)%md;}
int submod(int a, int b, int md) {return (((a-b)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

signed main(void)
{
	IOS;
	int n;
	cin>>n;
	if(n%2==1) {
		cout<<0<<endl;
	} else {
		if(n==0) {
			cout<<0<<endl;
		} else {
			int f=0, tt=n;
			int n1=1, n2=1;
			int num=n/2;
			while(num/n1 > 2ll) {
				tt += num/(n1*2);
				n1 *= 2;
			}
			while(num/n2 > 0) {
				f += num/(n2*5);
				n2 *= 5;
			}
			cout<<min(f,tt)<<endl;
		}
	}
	// time();
	return 0;
}

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

int main() {
  int i, N;
  int64_t lucas[87];
  lucas[0] = 2;
  lucas[1] = 1;
  cin >> N;
  
  for (i = 2; i < N+1; i++) {
    lucas[i] = lucas[i-1] + lucas[i-2];
  }
  
  cout << lucas[N] << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  int A,B,C;
  cin>>A>>B>>C;
  cout << C << " " << A << " " << B << endl;
  return 0;
}

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

int a, b, c;

int diff(int a, int b, int c) {
	return abs(b-a)+abs(c-b);
}

int main() {
	scanf("%d%d%d", &a, &b, &c);
	printf("%d\n", min(diff(a, b, c), min(diff(b, a, c), min(diff(a, c, b), min(diff(b, c, a), min(diff(c, a, b), diff(c, b, a)))))));

	return 0;
}

Measured memory_bytes: 256
#include<string>
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<math.h>
#include<unordered_set>
#include<string.h>
#include<unordered_map>
#include<numeric>
#include<string.h>
using namespace std;

typedef unsigned long long ll;
typedef long double ld;

#define FOR(i,N) for(int i=0;i<N;i++)

ll mod=1e9+7;



int main() {
    ll Q,H,S,D;
    ld Qp,Hp,Sp,Dp;
    ll N;
    cin>>Q>>H>>S>>D>>N;
    Qp = Q*4;
    Hp = H*2;
    Sp = S;
    Dp = D/2;
    deque<pair<ld,pair<ld,ll>> >v;
    v.push_back(make_pair(Qp, make_pair(0.25,Q)));
    v.push_back(make_pair(Hp, make_pair(0.5,H)));
    v.push_back(make_pair(Sp, make_pair(1,S)));
    v.push_back(make_pair(Dp, make_pair(2,D)));
    sort(v.begin(),v.end());
    ll tot=0;
    while(v.size()){
        ll num = N/v.begin()->second.first;
        tot += num * v.begin()->second.second;
        N -= num*v.begin()->second.first;
       // cout<<v.begin()->first<<" "<<v.begin()->second.first<<" "<<v.begin()->second.second<<"  N:"<<N<<"  tot: "<<tot<<endl;
        v.pop_front();
    }
    if(N!=0)return 1;
    cout<<(ll)tot<<endl;
    return 0;
}


Measured memory_bytes: 256
/*

                                  In the name of Allah, Most Gracious, Most Merciful


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

//*** constant value ***
const long double PI = 3.141592653589793238;
const double EPS = 1e-6 ;
//*** constant value ***

//****** define ********
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define dd double
#define vll vector<ll>
#define vs vector<string>
#define fn(i,n) for(ll i = 0; i<n; i++)
#define f(i,a,b) for(i=a;i<b;i++)
#define f1(i,a,b) for(i=b-1;i>=a;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pls pair<ll,string>
#define vpl vector<pll>
#define pb push_back
#define mk make_pair
#define x first
#define y second
#define tt cout<<"Came here"<<endl;
//****** define ********

int main()
{
    IOS;
    ll tc,ans = 0;
    cin>>tc;

    if(tc==0)
        ans = 1;

    cout<<ans<<endl;

return 0;
}



Measured memory_bytes: 3644
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)
ll powMod(ll k, ll n, ll mod) {
    ll x = 1;
    while (n > 0) {
        if (n & 1) {
            x = x * k % mod;
        }
        k = k * k % mod;
        n >>= 1;
    }
    return x;
}

int main() {
  ll n, m, k, x, y = 0, z = 0, h, ans=0, w, sum = 0, Max = -1, Min = 1e9+1;
  string s, t, u;
  bool ok=true;
  cin >> k >> n;
  rep(i,k+1){
    rep(j,k+1){
      int p = n - i - j;
      if(p>=0 && p<=k){
        ans++;
      }
    }
  }
  pri(ans);
  return 0;
}


Measured memory_bytes: 256
import math

def isPrime(n):
  if n == 2:
    return True
  if n % 2 == 0:
    return False

  m = math.floor(math.sqrt(n)) + 1
  for p in range(3, m, 2):
      if n % p == 0:
        return False
  return True
  
count = 0
n = int(input())
for i in range(n):
    x = int(input())
    if isPrime(x):
        count +=1

print(count)


Measured memory_bytes: 5676
N,M=map(int,input().split())
li=[]

for i in range(M):
  P,Y=map(int,input().split())
  li.append([P,Y,i])
li.sort(key=lambda x:x[1])
li.sort(key=lambda x:x[0])
pre=li[0][0]
cnt=1
ans=[]

for p,y,i in li:
  if p==pre:
    ans.append([str(p).zfill(6)+str(cnt).zfill(6),i])
    cnt+=1
  else:
    pre=p
    ans.append([str(p).zfill(6)+str(1).zfill(6),i])
    cnt=2
ans.sort(key=lambda x:x[1])

for a,i in ans:
  print(a)

Measured memory_bytes: 41392
#include "bits/stdc++.h"
//#include <ext/numeric>
using namespace std;
//using namespace __gnu_cxx;
#define ll  long long int
#define bug cout <<"----------------------\n"




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

    string s ;
    cin >> s ;

    string t ;

    cin >> t ;
    int ans = 0 ;
    for(int i = 0 ;i<3 ;i++)
    {
        if(s[i]==t[i])ans++;
    }
   cout << ans <<endl;
    return 0 ;
}


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1


#ifndef ONLINE_JUDGE
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
						 stringstream _ss(_s); \
						 istream_iterator<string> _it(_ss); \
						 err(_it, args); }
#else
#define error(args...)		42
#endif


void err(istream_iterator<string> it) { cerr << endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "; ";
	err(++it, args...);
}


void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("debug.txt", "w", stderr);
#endif
}

int ceil2(int a, int b){
    int c = a / b;
    if (c * b < a) c++;
    return c;
}


int32_t main()
{
	c_p_c();

	int n,K; cin>>n>>K;

	int a[n][n];

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			cin>>a[i][j];
			// error(a[i][j]);
		}
	}

	// matrix exponentiation
	int res[n][n];

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			if(i==j)
				res[i][j] = 1;
			else
				res[i][j] = 0;

			// error(res[i][j]);
		}
	}

	int c[n][n];

	while(K != 0)
	{
		// error(K);
		if(K&1)
		{
			// matrix multiply code
			for (int i = 0; i < n; ++i)
			{
				for (int j = 0; j < n; ++j)
				{
					c[i][j] = 0;
					for (int k = 0; k < n; ++k)
					{
						// error(i, j, k, res[i][k], a[k][j]);
						c[i][j] += ((res[i][k]%mod)*(a[k][j]%mod));
						c[i][j] %= mod;
					}
				}
			}

			for (int i = 0; i < n; ++i)
			{
				for (int j = 0; j < n; ++j)
				{
					res[i][j] = c[i][j];
				}
			}
		}

		K = K >> 1;

		for (int i = 0; i < n; ++i)
		{
			for (int j = 0; j < n; ++j)
			{
				c[i][j] = 0;
				for (int k = 0; k < n; ++k)
				{
					c[i][j] += ((a[i][k]%mod)*(a[k][j]%mod));
					c[i][j] %= mod;
				}

			}
		}

		for (int i = 0; i < n; ++i)
		{
			for (int j = 0; j < n; ++j)
			{
				a[i][j] = c[i][j];
			}
		}
	}


	int ans = 0;

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			ans += res[i][j];
			ans %= mod;
			// cout << res[i][j] << " ";
		}
		// cout << "\n";
	}

	cout << ans;
	
	return 0;
}

Measured memory_bytes: 3704
package main

import "fmt"

func main() {
	// Code for B - Sumo
	var S string
	fmt.Scanf("%s", &S)

	ans := make(map[string]int, 2)
	for i := 0; i < len(S); i++ {
		ans[S[i:i+1]]++
	}

	if ans["o"]+(15-len(S)) >= 8 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 1836
#include <bits/stdc++.h>
using namespace std;
bool ipm(int x) {
	if(x==1) return false;
	for(int i=2;i*i<=x;i++) {
		if(x%i==0) return false;
	}
	return true;
}
int main() {
	int x;
	scanf("%d",&x);
	for(int i=x;;i++) {
		if(ipm(i)) {
			printf("%d\n",i);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var A = cin.ReadLong;
            var strB = cin.Read;
            var pointB = strB.Length - strB.IndexOf(".") -1;
            var longB = long.Parse(strB.Replace(".", ""));

            long surport = 1;
            for (int i = 0; i < pointB; i++)
            {
                surport *= 10;
            }
            long ans = (A * longB) / surport;

            WriteLine(ans);
        }

        public void Display(int[] array)
        {
            var txt = "";
            foreach (var item in array)
            {
                txt += " " + item.ToString();
            }
            WriteLine("{0}", txt);
        }

        public void Display(int index,int[] array)
        {
            var txt = "";
            foreach (var item in array)
            {
                txt += " " + item.ToString();
            }
            WriteLine("{0} : {1}", index,txt);
        }

        public void Display(List<int>[] list) 
        {
            for (int i = 0; i < list.Length; i++)
            {
                Display(i, list[i].ToArray());
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }

        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 28100
//#include<iostream>
//#include<algorithm>
//#include<string>
//#include <cmath>
//#include <vector>
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define REP(x,n) for(int x=0;x<n;x++)

// vector 操作  vector<int> data(10,5) 5が10個　data(10) 要素数10
// v.size(), v.empty(), v.insert(itr,値), v.erase(itr) (first,last),
// sort(itr), find(all(x),値),reverse(itr),accumulate(itr,0) 積算,
//v.swap
// stringも同じ itrがただの数字になる
// s.substr(n,m)n番目以降m文字取り出す　erase(n,m)も  s.find
#define vei vector<int> 
#define velli vector<long long int> 
#define pb(x) push_back(x) // 末尾にxを加える
#define pb2 pop_back() // 末尾削除
#define all(x) (x).begin(),(x).end() //イテレーター
#define be(x) (x).begin()
//auto  auto begin = v.begin()とか

// map 操作  map<string,int> mp キー=string 値=int型  pair< , >型
// 代入:mp["abc"]=123  mp.erase(キー)
// itr = mp.begin()のとき　itr->first = key, itr->second = val
// mp.find(key) itrを返す
typedef pair<int,int> P;  //q(p.first,p.second)で定義できる？

// lcm( , ) gcd( , ) 最大公約数　最小公倍数
//if(cin.eof()) break; 入力数が決まってないとき
//ifstream  whilwee(ifs>>data)

// 浮動小数点
// cout << fixed; 以下と組fみ合わせで小数点以下n桁
// cout << setprecision(n) << 値; n桁表記
// defaultfloat
int main (){
    ll int n,k;
    cin >> n >> k;

    ll int s;
    s = n/k;

    ll int min = n - s*k;
    if(-n + (s+1)*k < min){
        min = -n + (s+1)*k;
    }
    cout << min;
}

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

int main() {
  ll n,m;cin>>n>>m;
  ll d = m / n;
  while (d > 1 && m % d != 0) d--;
  cout<<d;
}


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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	vector<int> deg(n+1,0),tree[n+1],c(n),A(n-1),B(n-1);
	for(int i=0;i<n-1;i++){
		int a,b;
		cin >> a >> b;
		a--,b--;
		A[i] = a;
		B[i] = b;
		tree[a].push_back(b);
		tree[b].push_back(a);
		deg[a]++;
		deg[b]++;
	}

	for(int i=0;i<n;i++) cin >> c[i];
	sort(c.begin(), c.end());
	reverse(c.begin(), c.end());

	int max_deg=-1,ind=-1;
	for(int i=0;i<n;i++){
		if(max_deg < deg[i]){
			max_deg = deg[i];
			ind = i;
		}
	}

	queue<int> vq;
	vq.push(ind);
	ind = 0;
	vector<int> ans(n,0);

	while(not vq.empty()){
		int now = vq.front();
		vq.pop();
		ans[now] = c[ind];
		ind++;
		for(auto to:tree[now]){
			if(ans[to]==0){
				vq.push(to);
			}
		}
	}
	
	int msum = 0;
	for(int i=0;i<n-1;i++){
		msum += min(ans[A[i]],ans[B[i]]);
	}
	cout << msum << endl;
	cout << ans[0];
	for(int i=1;i<n;i++){
		cout << " " << ans[i];
	}
	cout << endl;
}


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

using namespace std;

int main(){
    int n = 0;
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        if(s[i] == '1'){
            n++;
        }
        
    }
cout << n << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;
char s[510],a[2][510][510];
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j,k,l,u;
	scanf("%d%d",&n,&m);
	for(i=1,k=0;i<=n;i++,k^=1,u=l)
	  {
	   scanf("%s",&s);
	   for(j=0,l=0;j<m;j++)
		 if(s[j]=='#')
		   l=1;
	   if(!l && !u)
	     k^=1;
	   for(j=0;j<m;j++)
	     {
	      a[k][i][j]='#';
		  a[k^1][i][j]=s[j];
		 }
	   if(!l)
	     {
	      a[k][i][0]='.';
	      a[k^1][i][0]='#';
		 }
	  }
	for(i=1;i<=n;i++)
	  printf("%s\n",a[0][i]);
	printf("\n");
	for(i=1;i<=n;i++)
	  printf("%s\n",a[1][i]);
	printf("\n");
	return 0;
}


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

int main() {
    char a;
    cin >> a;
    
    string s="abcdefghijklmnopqrstuvwxyz";
    
    for(int i=0;i<26;i++){
        if(a==s.at(i)){
            cout << s.at(i+1);
        }
    }
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
cin>>n;
double temp=n*1.0/1.08;
 int t1=temp+1,t2=temp;
 int t3=t1*1.08,t4=t2*1.08;
 //cout<<t1*1.08<<endl;
 if(t3==n){
 	printf("%d",t1);
 }
 else if(t4==n){
 	printf("%d",t2);
 }
else printf(":(");


return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int max = sc.nextInt();
		boolean ans = true;
		for(int i = 1; i < N; i++) {
			int ne = sc.nextInt();
			if(max - ne > 1) {
				ans = false;
				break;
			}else if(max < ne) {
				max = ne;
			}
		}
		if(ans) System.out.println("Yes");
		else System.out.println("No");
	}
}

Measured memory_bytes: 48600
n,m=map(int,input().split())
h=[0]+list(map(int, input().split()))
roads=[[] for _ in range(n+1)]
cnt=0
for i in range(m):
    a,b=map(int,input().split())
    roads[a].append(b)
    roads[b].append(a)

for i in range(1,n+1):
    for j in roads[i]:
        if h[i]<=h[j]:
            break
    else:
         cnt+=1
    
print(cnt)

Measured memory_bytes: 29404
#include<iostream>
#include<vector>

int main(){

	std::uint32_t N;

	std::cin >> N;

	std::vector<std::int64_t> An( N, std::int64_t{} );

	for( auto&ai : An )
		std::cin >> ai;

	std::int64_t required_{ An[0] }, sum_{};

	for( std::uint32_t i{ 1 }; i < N; ++i )
		if( required_ > An[i] )
			sum_ += required_ - An[i];		
		else
			required_ = An[i];
	
	std::cout << sum_ << "\n";

	return 0;

}

Measured memory_bytes: 4396
def gcd_(a, b):
    if a < b:  a, b = b, a
    if b == 0:  return a
    return gcd_(b, a % b)

def gcd_bl(A):

    left = [0 for _ in range(N + 1)]
    right = [0 for _ in range(N + 1)]
    ans = [0 for _ in range(N)]

    left[1] = A[0]
    for i in range(1, N):
        left[i + 1] = gcd_(left[i], A[i])
    right[-1 - 1] = A[-1]
    for i in range(1, N):
        right[-1 - i - 1] = gcd_(right[-1 - i], A[-1 - i])
    for i in range(N):
        ans[i] = gcd_(left[i], right[i + 1])
        
    return ans

def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

N = cin()
A = cin()
ans = 0
g = gcd_bl(A)
print(max(g))

Measured memory_bytes: 103268
#include <iostream>
#include <iomanip>

int main()
{
    int n;
    double a[3000];
    double dp[3005][3005] = { 0 };

    std::cin >> n;
    for (int i = 1; i <= n; ++i)
        std::cin >> a[i];

    dp[0][0] = 1;
    for (int i = 1; i <= n; ++i)
        dp[i][0] = dp[i - 1][0] * (1 - a[i]);

    for (int i = 1; i <= n; ++i)
    {
        for (int j = 1; j <= i; ++j)
        {
            dp[i][j] = dp[i - 1][j - 1] * a[i] + dp[i - 1][j] * (1.0 - a[i]);
        }
    }

    double ans = 0;
    for (int i = n/2 + 1; i <= n; ++i)
        ans += dp[n][i];

    std::cout << std::setprecision(10) << ans;
}


Measured memory_bytes: 70784
a,b=map(int,input().split())
a-=1

def allx(n):
    ans=0
    for i in range(40):
        if i==0:
            if n%4==2 or n%4==1:
                ans+=1
                continue
        c= pow(2,i+1)
        k=n% c
        
        if k>=c//2 and k%2==0:
          ans+=pow(2,i)
    return ans

print(allx(b)^allx(a))

Measured memory_bytes: 9124
#include<iostream>
#include<cstdio>
#include<vector>
#include<functional>
#include<algorithm>
using namespace std;

int main() {
	int N,K,C,G,dp[11][2000],cost;
	vector<int> latte[10];
	cin>>N>>K;
	for(int i=0;i<N;i++){
		cin>>C>>G;
		latte[--G].push_back(C);
	}

	for(int i=0;i<11;i++)for(int j=0;j<=K;j++) dp[i][j]=-1;
	dp[0][0]=0;
	for(int i=0;i<10;i++){
		sort(latte[i].begin(),latte[i].end(),greater<int>());
		//for(int j=0;j<latte[i].size();j++) printf("%d ",latte[i][j]); puts("");
		cost=0;
		for(int j=0;j<=latte[i].size();j++){
			if(j>0) cost+=latte[i][j-1];
			
			for(int k=0;k<=K;k++){
				/*if(j==0){
					if(dp[i][k]==-1) printf("- ");
					else printf("%d ",dp[i][k]);
				}*/
				if(k+j>K) break;
				if(dp[i][k]==-1) continue;
				dp[i+1][k+j] = max(dp[i+1][k+j],dp[i][k]+cost+(j-1)*j);
			}//puts("");
		}
	}
	printf("%d\n",dp[10][K]);
	return 0;
}

Measured memory_bytes: 1304
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
typedef vector<int>vi;
typedef pair<int,int>pi;
typedef vector<pi>vpi;
typedef vector<vi>vvi;
#define double long double
#define pow powl
#define sqrt sqrtl
#define cbrt cbrtl
#define floor floorl
#define ceil ceill
#define pb push_back
#define ep emplace_back
#define PB pop_back
#define pf push_front
#define ef emplace_front
#define PF pop_front
#define mp make_pair
#define ub(a,b) upper_bound(all(a),b)-a.begin()
#define lb(a,b) lower_bound(all(a),b)-a.begin()
#define bs(a,b) binary_search(all(a),b)
#define mem(a,b) memset(a,b,sizeof(a))
#define in(a,n) FOR(i,0,n-1) cin>>a[i]
#define in1(a,n) FOR(i,1,n) cin>>a[i]
#define ff first
#define ss second
#define out(a,n) FOR(i,0,n-1) cout<<a[i]<<" ";cout<<endl;
#define out1(a,n) FOR(i,1,n) cout<<a[i]<<" ";cout<<endl;
#define clr(a) a.clear()
#define pow2(a) (1LL<<a)
#define all(a) a.begin(),a.end()
#define all1(a) a.begin()+1,a.end()
#define rall(a) a.rbegin(),a.rend()
#define rall1(a) a.rbegin(),a.rend()
#define sz(a) ((int)a.size())
#define FOR(i,a,b) for(auto i=a;i<=b;i++)
#define NFOR(i,a,b) for(auto i=a;i>=b;i--)
const int mod=1e9+7;

inline int add(int a,int b){return (a%mod + b%mod)%mod;}
inline int sub(int a ,int b){return (a%mod - b%mod + mod)%mod;}
inline int mul(int a,int b){return (a%mod * b%mod)%mod;}
inline int power(int a,int b,int MOD){int res=1;while(b){if(b&1){res*=a;res%=MOD;}a=a*a;a%=MOD;b>>=1;}return res;}

#define trace(x) cout<<#x<<" :: "<<x<<endl;
#define trace2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define trace3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define trace4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
clock_t time_p = clock();
void time()
{
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (double)(time_p)/CLOCKS_PER_SEC <<endl;
}
signed main()
{
     SPEED;
     int a,b,h;
     cin>>a>>b>>h;
     cout<<(h/2)*(a+b)<<endl;
     time();
     return 0;
}

Measured memory_bytes: 256
import Data.Array.IO
import Data.Char
import System.IO
import Control.Monad
import Control.Applicative

{-
 - list から 1, 2 個選んで残りも一緒に返す
 - 2個選ぶときは順序付きのペアだとする (x,y) と (y,x) を一般に区別する
 - > one [1..6]
 - [(1,[2,3,4,5,6]),(2,[3,4,5,6,1]),(3,[4,5,6,2,1]),(4,[5,6,3,2,1]),(5,[6,4,3,2,1]),(6,[5,4,3,2,1])]
 - > two [1..6]
 - [(1,2,[3,4,5,6]),(1,3,[4,5,6,2]),(1,4,[5,6,3,2]),(1,5,[6,4,3,2]),(1,6,[5,4,3,2]),(2,3,[4,5,6,1]),(2,4,[5,6,1,3]),(2,5,[6,1,4,3]),(2,6,[1,5,4,3]),(2,1,[6,5,4,3]),(3,4,[5,6,2,1]),(3,5,[6,2,1,4]),(3,6,[2,1,5,4]),(3,2,[1,6,5,4]),(3,1,[2,6,5,4]),(4,5,[6,3,2,1]),(4,6,[3,2,1,5]),(4,3,[2,1,6,5]),(4,2,[1,3,6,5]),(4,1,[2,3,6,5]),(5,6,[4,3,2,1]),(5,4,[3,2,1,6]),(5,3,[2,1,4,6]),(5,2,[1,3,4,6]),(5,1,[2,3,4,6]),(6,5,[4,3,2,1]),(6,4,[3,2,1,5]),(6,3,[2,1,4,5]),(6,2,[1,3,4,5]),(6,1,[2,3,4,5])]
-}

one :: [a] -> [(a, [a])]
one xs = sub xs []
  where
    sub [] _ = []
    sub (x:xs) ac = (x, xs++ac) : (sub xs (x:ac))

two :: [a] -> [(a, a, [a])]
two [] = []
two [a] = []
two xs = do
  (x, rest) <- one xs
  do
    (y, rest) <- one rest
    return (x, y, rest)

data Expr = Val Int | Add Expr Expr | Sub Expr Expr | Mul Expr Expr
type Number = (Expr, Int)

eval :: Number -> Int
eval = snd

{-
 - n 個の Number に一回演算を適用して出来る (n-1) 個の Number を返す
 -}
apply :: [Number] -> [[Number]]
apply xs = concat $ do
  ((e, x), (f, y), rest) <- two xs
  return [
    (Add e f, x + y) : rest,
    (Sub e f, x - y) : rest,
    (Mul e f, x * y) : rest
    ]

{-
 - (bfs n xs) は xs に何度か apply を適用して
 - 評価結果が n になる Number を返す
 -}
bfs :: Int -> [[Number]] -> [Number]
bfs n [] = []
bfs n ([x] : rest) =
  (if (eval x) == n then [x] else []) ++ (bfs n rest)
bfs n (xs : rest) = bfs n (rest ++ (apply xs))

instance Show Expr where
  show (Val n) = show n
  show (Add e f) = "(" ++ show e ++ " + " ++ show f ++ ")"
  show (Sub e f) = "(" ++ show e ++ " - " ++ show f ++ ")"
  show (Mul e f) = "(" ++ show e ++ " * " ++ show f ++ ")"

toVal :: Int -> Number
toVal n = (Val n, n)

solve a b c d = do
  let anss = bfs 10 [[toVal a, toVal b, toVal c, toVal d]]
  if null anss
    then print 0
    else print $ fst $ head $ anss

main = do
  [a,b,c,d] <- (map read . words)<$>getLine :: IO [Int]
  if (minimum [a,b,c,d]) == 0
    then return ()
    else solve a b c d >> main

Measured memory_bytes: 5684
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    ll A, B, Q;
    cin >> A >> B >> Q;
    vector<ll> s(A);
    rep(i, A) cin >> s.at(i);
    s.push_back(-1 * INF);
    s.push_back(INF);
    vector<ll> t(B);
    rep(i, B) cin >> t.at(i);
    t.push_back(-1 * INF);
    t.push_back(INF);
    sort(all(s));
    sort(all(t));
    rep(i, Q){
        ll x;
        cin >> x;
        ll l = 0;
        ll r = A+1;
        // s.at(l) <= x < s.at(r);
        while(r-l > 1){
            ll c = (l+r) / 2;
            if(s.at(c) <= x){
                l = c;
            }
            else{
                r = c;
            }
        }
        ll ljinja = s.at(l);
        ll rjinja = s.at(r);
        l = 0;
        r = B+1;
        // t.at(l) <= x < t.at(r);
        while(r-l > 1){
            ll c = (l+r) / 2;
            if(t.at(c) <= x){
                l = c;
            }
            else{
                r = c;
            }
        }
        ll ltera = t.at(l);
        ll rtera = t.at(r);
        ll ans = INF;
        //WW
        ll m = min(ljinja, ltera);
        chmin(ans, x-m);
        //WE
        if(x-ljinja < rtera-x){
            chmin(ans, 2*(x-ljinja)+rtera-x);
        }
        else{
            chmin(ans, 2*(rtera-x)+x-ljinja);
        }
        //EW
        if(x-ltera < rjinja-x){
            chmin(ans, 2*(x-ltera)+rjinja-x);
        }
        else{
            chmin(ans, 2*(rjinja-x)+x-ltera);
        }
        //EE
        m = max(rjinja, rtera);
        chmin(ans, m-x);
        cout << ans << endl;
    }
}

Measured memory_bytes: 5404
#include<bits/stdc++.h> 
#define N 100005
int n,x,t[N],cnt,ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&x),
		cnt+=(!t[x]),t[x]=1;
	if(cnt&1)ans=cnt;
	else ans=cnt-1;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
/*  Author: Simanta Deb Turja 
    Website: https://simantaturja.github.io
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    string s;
    cin >> s;
    for ( int i = 0; i < 3; ++i ) {
        if ( s[i] == '7' ) {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
    return 0;
}

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

long long x, y;
int ans;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> x >> y;
	while(x <= y){
		x <<= 1;
		++ans;
	}
	cout << ans << "\n";
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    ll m = 0;
    ll tmp = 0;
    REP(i, 0, 3) {
        if (S[i] == 'R') {
            tmp++;
            m = max(m, tmp);
        } else {
            tmp = 0;
        }
    }
    cout << m << endl;
}


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

int gcd ( int x, int y ){

  return y ? gcd(y, x%y) : x;
}


main(){

  int x,y;
  
  cin >> x>> y;

  cout << x+y - (gcd(x, y) - 1 ) << endl; 

  return 0;

}

  
















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

ll gcd(ll x, ll y){
    if(x < y) swap(x, y);
    while(y){
        ll r = x % y;
        x = y;
        y = r;
    }
    return x;
}

ll lcm(ll x, ll y){
    ll g = gcd(x, y);
    return (x / g) * (y / g) * g;
}

int main(){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    auto divs = [&](ll x){
        return b / x - (a + x-1) / x + 1;
    };
    cout << b - a + 1 - divs(c) - divs(d) + divs(lcm(c, d)) << endl;
    return 0;
}

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

const int maxInput = 1000000000;

int main(void)
{
    int timeLength;
    cin >> timeLength;

    int currentDollar, minDollar;
    cin >> minDollar;
    int maxProfit = maxInput * -1;
    for (int i = 1; i < timeLength; i++) {
        cin >> currentDollar;
        maxProfit = max(maxProfit, currentDollar - minDollar);
        minDollar = min(minDollar, currentDollar);
    }

    cout << maxProfit << endl;

    return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <tuple>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repd(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repdm(i, a, b) for (ll i = (ll)(a); i > (ll)(b); i--)

int main()
{

  ll N, K;
  cin >> N >> K;

  ll ans = 0;

  if (K % 2 == 1)
  {
    ll num = floor(N / K);
    ans += pow(num, 3);
  }
  else if (K % 2 == 0)
  {
    ll num = floor(N / (K / 2));
    ll numK = floor(N / K);
    ans += pow(numK, 3);
    ans += pow(num - numK, 3);
  }

  cout << ans;
}

Measured memory_bytes: 512
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main() {
	long long a, b, h;
	cin >> a >> b >> h;
	cout << (a + b) * h / 2 << endl;
	return 0;
}


Measured memory_bytes: 504
//#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
// using namespace __gnu_pbds;
// template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ld long double


#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}

typedef long long int ll;
#define int ll
#define endl '\n'
const ll mod =1e9+7;
const ll MAX_NODES =200001;
const ll MAX_LOG =50;
const ll inf = 1e18+123;
const int maxn = 200001;
int vis[101];
int32_t main()
{

   IOS
    int n;
    cin>>n;
    int a[n+1];
    for(int i = 1;i<=n;i++){
      cin>>a[i];
    }
    map<int,int> m;
    int ans = 0;
    for(int i = 1;i<=n;i++){
      ans+=(m[i-a[i]]);
      m[i+a[i]]++;
    }
    cout<<ans<<endl;
} 


Measured memory_bytes: 27952
#include "bits/stdc++.h"

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

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

	const double pi = acos(-1.0);

	cout << 2 * pi * r << endl;
}


Measured memory_bytes: 3808
#include <stdio.h>
long long int min(long long int a, long long int b) {
  if (a > b) {
    return b;
  } else {
    return a;
  }
}
int main(){
  long long int n, a, b;
  scanf("%lld%lld%lld", &n, &a, &b);
  long long int ans = (n / (a + b)) * a + min(a, n % (a + b));
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

typedef unsigned long long ull;

ull gcd(ull a,ull b){
    ull max,min,r;
    min = MIN(a,b);
    max = MAX(a,b);
    while (min){
        r = max;
        r %= min;
        max = min;
        min = r;
    }
    return max;
}

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

int main(void){
    int n;
    long m;
    scanf("%d %ld",&n,&m);
    long ar[n];
    for(int i = 0;i < n;i++)scanf("%ld",&ar[i]);
    for(int i = 0;i < n;i++){
        ar[i] /= 2;
        if(ar[i] != 16384 && ar[i] != 278528)fprintf(stderr,"number of %ld\n",ar[i]);
    }
    ull lcmnum = 1;
    for(int i = 0;i < n;i++)lcmnum = lcm(lcmnum,ar[i]);
    fprintf(stderr,"lcmnum = %llu",lcmnum);
    ull ans = ((m/lcmnum)+1llu)/2llu;
    for(int i = 0;i < n;i++)if(!(lcmnum / ar[i] % 2))ans = 0ull;
    printf("%llu",ans);
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <numeric>
#include <functional>
#include <iomanip>
#include <math.h>
using namespace std;
using LL = long long;

int main(void) {

	int A1, A2, A3;

	cin >> A1 >> A2 >> A3;

	if (A1 + A2 + A3 >= 22) {
		cout << "bust" << endl;
	}
	else {
		cout << "win" << endl;
	}

	return 0;
}

Measured memory_bytes: 256