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

using namespace std;

#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)
#define INF 1000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

ll starling[3333][3333];
ll combination[3333][3333];
ll nijou[3333*3333];
ll n,m;

ll m_pow(ll a,ll b,ll mod = m){
	a %= mod;
	b %= mod;
	ll ret = 1;
	REP(i,60LL){
		if(b & (1LL << i)){
			ret = (ret * a) % mod;
		}
		a = (a * a) % mod;
	}
	return ret % mod;
}

int main()
{
	cin >> n >> m;
	REP(i,3333){
		combination[i][0] = combination[i][i] = 1;
		starling[i][0] = starling[i][i] = 1;
	}
	for(ll i = 0;i < 3333;i++){
		for(ll j = 1;j < i;j++){
			combination[i][j] = (combination[i-1][j-1] + combination[i-1][j]) % m;
			starling[i][j] = (starling[i-1][j-1] + starling[i-1][j] * (j+1))% m;
		}

	}
	nijou[0] = 1;
	REP(i,3333*3333-1)nijou[i+1] = (nijou[i] * 2) % m;
	
	ll ans = 0;
	
	//SHOW2d(starling,10,10);
	//SHOW2d(combination,10,10);
	
	for(ll i = 0;i <= n;i++){
		ll tmp = 0;
		for(ll j = 0;j <= i;j++){
		//	cout << "       "  << starling[i][j] << ' ' << m_pow(2,(n-i)*j) << endl;
			ll hoge = (starling[i][j] * nijou[(n-i)*j]) % m;
		//	cout << ' ' << j << ' ' << hoge << endl;
			tmp = (tmp + hoge) % m;
		}
		//cout << i << ' ' << tmp << endl;
		tmp *= m_pow(2,m_pow(2,n-i,m-1));
		tmp %= m;
		tmp *= combination[n][i];
		tmp %= m;
		if(i % 2 == 0){
		//	cout << '+' << endl;
			ans += tmp;
		}
		else{
		//	cout << '-' << endl;
			ans -= tmp;
			while(ans < 0)ans += m;
		}
		ans %= m;
		//cout << i << ' ' << tmp << endl;
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 260608
#include <bits/stdc++.h>
#define drep(i,cc,n) for(int i=(cc);i<=(n);++i)
#define rep(i,n) drep(i,0,(n)-1)
#define drrep(i,cc,n) for(int i=(cc);i>=(n);--i)
#define rrep(i,n) drrep(i,0,(n)-1)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,v.size())if(i==0)cout << v[i];else cout << " " << v[i]; cout << endl;
#define arrprint(v,n) rep(i,n)if(i==0)cout << v[i];else cout << " " << v[i]; cout << endl;
#define matprint(v,n,m) rep(i,n){rep(j,m){cout << v[i][j] << " ";}cout << endl;}
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
using ll = long long;
using P = pair<int,int>;
template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>; //小さいものから取り出す

int main(){
    int n;
    cin >> n;
    vector<int> ans(n);
    drep(x,1,n){
        int k = x*x + 1 + 1 + x + 1 + x;
        if(k > n)break;
        drep(y,1,n){
            int j = x*x + y*y + 1 + x*y + y + x;
            if(j > n)break;
            drep(z,1,n){
            int i = x*x + y*y + z*z + x*y + y*z + z*x;
            if(i > n)break;
            ans[i-1]++;
            }
        }
    }

    rep(i,n)cout << ans[i] << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  for(int i = 0; i < n; i++){
    cin >> s[i];
  }
  int ans = 0;
  for(int k = 0; k < n; k++){
    bool ok = true;
    for(int i = 0; i < n; i++){
      for(int j = 0; j < n; j++){
        if(s[i][j] != s[(j + k) % n][(i - k + n) % n]){
          ok = false;
          break;
        }
      }
      if(!ok)break;
    }
    if(ok){
      ans += n;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
N=int(input())
T,A=map(int,input().split())
h=list(map(int,input().split()))

t = (T-A)/0.006

MIN=10**9
argmin=-1
for i in range(N):
  diff = abs(h[i]-t)
  if diff<MIN:
    MIN=diff
    argmin=i

print(argmin+1)

Measured memory_bytes: 9212
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cmath>

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

int main() {
    long long n, k;
    cin >> n >> k;

    long long min_num = pow(10, 18);
    n = n%k;
    while(n <= min_num) {
        n = abs(n-k);
        if(n < min_num) {
            min_num = n;
        } else {
            break;
        }
    }

    cout << min_num << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define ll long long int
using namespace std;

int main(){
    int n,m,denger_id;
    vector<int> a;
    vector<ll> step;

    cin>>n>>m;
    a.resize(m+1);
    for(int i=0; i<m; i++){
        cin>>a[i];
    }
    step.resize(n+1);
    for(int i=0; i<n+1; i++){
        step[i]=0;
    }

    step[0]=1;
    denger_id=0;
    if(a[denger_id]==1){
        step[1]=0;
        denger_id++;
    }else{
        step[1]=1;
    }
    if(step.size()<2){
        cout<<step[1]<<endl;
        return 0;
    }
    for(int i=2; i<n+1; i++){
        if(i==a[denger_id]){

                denger_id++;
    
        }else{
            step[i]=(step[i-1]+step[i-2])%1000000007;
        }
    }
    cout<<step[n]%1000000007<<endl;
    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int  main()
{
	string s;
	int n;
	cin>>n>>s;
	if(n&1)
	{
		cout<<"No";
		return 0;
	}
	string t=s.substr(0,n/2);
	t=t+t;
	if(t==s)
		cout<<"Yes";
	else
		cout<<"No";
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main()
{
	long long n,a,b,x,y,mx,mn;
	cin>>n>>a>>b;
	if (abs(a-b)%2==0)
	{
		cout<<abs(a-b)/2<<endl;
		return 0;
	}
	else
	{
		//cout<<"yes"<<endl;
		mx=max(a,b);
		mn=min(a,b);
		x=mn;
		x=x+((mx-mn-1)/2);
		y=n-mx+1;
		y=y+(n-mn-y)/2;
		cout<<min(x,y)<<endl;
	}
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define fs first
#define sc second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 1e6+10;
using namespace std;

string s,t;
int main(){
	// debug;
	ios;
	cin>>s>>t;
	int lens = s.length(),lent = t.length();
	if(lens+1 == lent && s == t.substr(0,lent-1))
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return 0;
}


Measured memory_bytes: 3652
#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline
input=sys.stdin.readline

n,m=map(int,input().split())

def DIJKSTRA(point,d):
    cost      = [float("inf")]*(n+1)
    Q         = []
    cost[point]=0
    heappush(Q,(point,cost[point]))
    while Q:
        prefnd,tmpC=heappop(Q)
        if cost[prefnd]<tmpC:
            continue
        for node,c in d[prefnd]:
            altC=c+tmpC
            if cost[node]>altC:
                cost[node]=altC
                heappush(Q,(node,altC))
    return cost

def main():
    
    d=[[]for i in range(n+1)]
    
    for i in range(m):
        a,b,c=map(int,input().split())
        d[a].append((b,c))
    for i in range(1,n+1):
        d[i].append((i-1,0))
#    print(d)
    x=DIJKSTRA(1,d)[n]
    if x!=float("inf"):
        print(x)
    else:
        print(-1)
        
if __name__ == '__main__':
    main()


Measured memory_bytes: 122060
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-5;
const ld pi = acos(-1.0);

struct BIT {
private:
	vector<ll> node; int n;
public:
	BIT(int n_) {
		n = n_; node.resize(n, 0);
	}
	//0-indexed
	void add(int a, ll w) {
		for (int i = a; i < n; i |= i + 1)node[i] += w;
	}
	//[0,a)
	ll sum(int a) {
		ll ret = 0;
		for (int i = a - 1; i >= 0; i = (i&(i + 1)) - 1)ret += node[i];
		return ret;
	}
	//[a,b)
	ll sum(int a, int b) {
		return sum(b) - sum(a);
	}
};

ll mod_pow(ll x, ll n) {
	ll ret = 1;
	while (n > 0) {
		if (n % 2)ret = ret * x%mod;
		x = x * x%mod; n >>= 1;
	}
	return ret;
}
struct perm {
private:
	int sz;
	vector<ll> p, invp;
public:
	perm(int n) {
		sz = n + 1;
		p.resize(sz), invp.resize(sz);
		p[0] = 1;
		rep1(i, sz - 1) {
			p[i] = p[i - 1] * i%mod;
		}
		invp[sz - 1] = 1;
		ll cop = mod - 2, x = p[sz - 1];
		while (cop) {
			if (cop % 2)invp[sz - 1] = invp[sz - 1] * x%mod;
			cop >>= 1; x = x * x % mod;
		}
		per(i, sz - 1) {
			invp[i] = invp[i + 1] * (i + 1) % mod;
		}
	}
	ll comb(ll x, ll y) {
		if (x < y || y < 0)return 0;
		ll ret = p[x];
		(ret *= invp[y]) %= mod;
		(ret *= invp[x - y]) %= mod;
		return ret;
	}
	ll combP(ll x, ll y) {
		if (x < y || y < 0)return 0;
		return p[x] * invp[x - y] % mod;
	}
};
perm p(1 << 18);

void solve() {
	int n, k;ll a; cin >> n >> k >> a;
	ll inv100 = mod_pow(100, mod - 2);
	ll invn = mod_pow(n, mod - 2);
	a = a * inv100%mod;
	BIT b(k + 1);
	for (int x = k - 1; x > 0; x--) {
		int l = x + 1; int r = x + n;
		if (r > k)r = k;
		ll res = 1 - a;
		ll csum = a * (b.sum(l, r + 1)%mod) % mod;
		csum = csum * invn%mod;
		res += csum;
		res = (res%mod + mod) % mod;
		b.add(x, res);
	}
	ll ans = invn*(b.sum(1, min(n + 1, k + 1))%mod)%mod;
	ans = 1 - ans; ans = (ans%mod + mod) % mod;
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
	return 0;
}



Measured memory_bytes: 7848
#include<bits/stdc++.h>
using namespace std;
string Replace(string s,int a,int b,string t){
  for(int i=a;i<=b;i++){
    s[i]=t[i-a];
  }
  return s;
}
string Reverse(string s,int a,int b){
  int i=a,j=b;
  while(i<j){
    swap(s[i],s[j]);
    i++;
    j--;
  }
  return s;
}
void Print(string s,int a,int b){
  for(int i=a;i<=b;i++){
    cout<<s[i];
  }
  cout<<endl;
}
int main(){
  string str,command,t;
  cin>>str;
  int q,a,b;
  cin>>q;
  for(int i=0;i<q;i++){
    cin>>command;
    cin>>a>>b;
    if(command=="replace"){
      cin>>t;
      str=Replace(str,a,b,t);
    }else if(command=="reverse"){
      str=Reverse(str,a,b);
    }else if(command=="print"){
      Print(str,a,b);
    }
  }
  return 0;
}


Measured memory_bytes: 3224
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int n, m; cin >> n >> m;
	vector<vector<int>> d(n, vector<int>(m));

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> d[i][j];
		}
	}

	set<int> s;

	for (int i = 0; i < 10000; i++) {
		s.insert(i*i);
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			int v = 0;

			for (int k = 0; k < m; k++) {
				int diff = abs(d[i][k] - d[j][k]);
				v += diff * diff;
			}
			if (s.count(v))ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    string s, t;
    cin >> s >> t;
    int cnt = 0;
    for (int i=0; i<3; i++) {
        if (s.at(i) == t.at(i)) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
# AOJ 0055 Sequence

while line = gets
  a = [line.to_f]
  9.times do |i|
    # すべての偶数番目の項は一つ前の項に 2 を掛けたものと等しい数である。
    # すべての奇数番目の項は一つ前の項を 3 で割ったものと等しい数である。
    a[i + 1] = i.even? ? (a[i] * 2.0) : (a[i] / 3.0)
  end
  puts a.reduce(0, :+)
end

Measured memory_bytes: 6120
#include<bits/stdc++.h>
using namespace std;
#define MAX 100005

int n,a,b,c;
vector<int> G[MAX];//*
int size[MAX];// *
int par[MAX];// *
int cur[MAX];// *
int dep[MAX];// *
int depth[MAX];
int het[MAX];
int parent[MAX];

void idfs(int pos,int prev){
  int m=-1;
  parent[pos]=prev;
  if(G[pos].size()==1&&prev!=-1)return;  
  for(int i=0;i<(int)G[pos].size();i++){
    int to=G[pos][i];
    if(to==prev)continue;
    depth[to]=depth[pos]+1;
    idfs(to,pos);
    size[pos]+=size[to];
    het[pos]=max(het[pos],het[to]+1);
    if(m==-1||size[m]<size[to]){
      m=to;
    }
  }
  cur[pos]=m;
  par[m]=pos;
  het[pos]=max(het[pos],het[m]);
}

int calc(int x){
  if(par[x]==x){
    return x;
  }else{
    par[x]=calc(par[x]);
    return par[x];
  }
}

void init(){
  for(int i=0;i<MAX;i++){
    G[i].clear();
    size[i]=1;
    par[i]=i;
    cur[i]=-1;
    dep[i]=0;
    depth[i]=0;
    het[i]=0;
    parent[i]=0;
  }
  for(int i=0;i<n;i++){    
    scanf("%d",&a);
    while(a--){
      scanf("%d",&b);
      G[i].push_back(b);
      G[b].push_back(i);
    }
  }
  for(int i=0;i<n;i++)sort(G[i].begin(),G[i].end());
  depth[0]=0;
  idfs(0,-1);
  for(int i=0;i<n;i++){
    int root=calc(i);
    het[i]=het[root];
    int p=par[i];
    while(p>0){
      p= par[ parent[p] ];      
      dep[i]++;
    }

    /*    
    cout<< (char)('A'+i) <<"   -> ";
    cout<< (char)('A'+par[i]) <<endl;    
    cout<<"size = "<< size[i]<<" , ";    
    cout<<"depth = "<< depth[i]<<" , ";
    cout<<"dep = "<< dep[i]<<" , ";
    cout<<"parent = "<< (char)('A'+parent[i]) <<" , ";
    cout<<"cur = "<< (char)('A'+cur[i]) <<" , ";
    cout<<"het = "<< het[i] << endl;
    
    cout<<endl;
    */
  }

  
}

int main(){
  while( scanf("%d",&n)!=EOF){
    init();
    int q;
    scanf("%d",&q);
    while(q--){
      scanf("%d %d",&a,&b);
      if(par[a]==par[b])printf("%d\n",(depth[a]<depth[b]?a:b));      
      else{
        while(par[a]!=par[b]){
          if(dep[a]<dep[b])swap(a,b);
          a=parent[par[a]];
        }
        printf("%d\n",(depth[a]<depth[b]?a:b));      
      }
    }
    break;
  }

  
  return 0;
}

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

int main(){
  int n,k;
  cin >> n>> k;
  vector<int>x(n);
  long long ans =0;
  for(int i=0;i<n;i++){
      cin >> x[i];
      if(x[i] <= k/2){
          ans += x[i]*2;
      }
      else{
          ans += (k-x[i])*2;
      }
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
def ch_min(a, b):
    if (a > b):
        a = b
    return a


if __name__ == "__main__":
    N = int(input())
    h = list(map(int, input().split()))
    INF = 10 ** 10
    dp = [INF] * 100010
    dp[0] = 0
    for i in range(1, N):
        dp[i] = ch_min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
        if (i > 1):
            dp[i] = ch_min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
    print(dp[N - 1])


Measured memory_bytes: 13980
n, w = [int(e) for e in input().split()]
d = [[int(e) for e in input().split()] for i in range(n)]
t = {}
t[w] = 0
for i in range(n):
  keys = list(sorted(t.keys()))
  tw, tv = d[i]
  for j in keys:
    nw = j - tw
    if nw < 0:
      continue
    nv = t[j] + tv
    if nw in t:
      if nv > t[nw]:
        t[nw] = nv
    else:
      t[nw] = nv
print(max(t.values()))

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

using namespace std;


int main() {
  #ifdef LOCAL
  freopen("sol.in", "r", stdin);
  freopen("sol.out", "w+", stdout);
  #endif
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<double> pr(n);
  for (int i = 0; i < n; i++) {
    cin >> pr[i];
  }
  vector<vector<double>> dp(n + 1, vector<double>(n + 1));
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      dp[i][j] = (j - 1 < 0 ? 0 : dp[i - 1][j - 1] * pr[i - 1]) + dp[i - 1][j] * (1 - pr[i - 1]);
    }
  }
  double ans = 0;
  for (int j = 0; j <= n; j++) {
    ans += (j + j > n ? 1 : 0) * dp[n][j];
  }
  cout << fixed << setprecision(10) << ans << '\n';
  return 0;
}

Measured memory_bytes: 70784
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;


int main() {
	ll x;
	cin >> x;
	ll now = 0;
	ll cnt = 1;
	while (now < x)
		now += cnt, ++cnt;
	--cnt;
	cout << cnt << "\n";
	return 0;
}




Measured memory_bytes: 256
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

static constexpr int mod = (int)1e9 + 7;
static constexpr int inf = 100100100;
static constexpr ll linf = 1e18;
static constexpr double eps = 1e-9;
static constexpr double pi = 3.14159265359;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, n) for (ll i = n; i >= 0; --i)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define pb push_back
#define ist insert
#define fst first
#define snd second


int main() {
    // cin.tie(0);
    // ios_base::sync_with_stdio(false);
    ll N;
    cin >> N;
    map<ll, ll> M;
    rep (i, N) {
        ll a;
        cin >> a;
        ++M[a - 1];
        ++M[a];
        ++M[a - 2];
    }
    ll ans = 0;
    for (auto it : M) {
        if (it.snd > ans) {
            ans = it.snd;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 6144
n = int(input())
x = list(map(int,input().split()))

def func(p):
	a=0
	for i in x:
		a += (i-p)**2
	return a

# print(func(2))
xsum = sum(x)
p1 = int(xsum/n)
p2 = p1+1


if func(p1)<func(p2):
	print(func(p1))
else:
	print(func(p2))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
typedef unsigned long long ull;
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define f(i,a,b) for(ll i=a;i<=b;i++)
#define testcases ll t;cin>>t;while(t--)
#define dec(x) greater<x>()

/*** Define Values ***/
#define mx 200005
#define mod 1000000007
#define PI acos(-1.0)
#define eps 1e-7
#define size1 100005

#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))

/*** STLs ***/
typedef vector <ll> vll;
typedef set <ll> sll;
typedef multiset <ll> msll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll , ll> > vpll;

/*** Sorts ***/
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtGreat(v) sort(all(v), greater<ll>())
inline bool cmp(pll a,pll b){ if(a.ff == b.ff)return a.ss < b.ss; return a.ff > b.ff; }

#define en cout << '\n';
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": "

/*** Functions
ll BigMod(ll base, ll pow, ll modvalue){ if (pow == 0) return 1;  ll ans = BigMod(base, pow / 2, modvalue);ll total = ((ans % modvalue) * (ans % modvalue)) % modvalue;  if(pow % 2 == 0) return total; else{ return (total * (base % modvalue) ) % modvalue; } }
ll InverseMod(ll base, ll pow) { if(pow == 0) return 1; ll ans = InverseMod(base, pow / 2); ans = (ans * ans) % mod; if(pow & 1){ return (ans * base) % mod; } else{ return ans; } }
bool checkprime(ll num) { if(num < 2) return false; for(ll i = 2; i * i <= num; i++){ if(num % i == 0) return false; } return true; }
ll EularPHI(ll num) { double ans = num; for(ll i = 2; i * i <= num; i++){ if(num % i == 0){ while (num % i == 0) { num /= i; } ans *= (1.0 - (1.0 / (double)i)); } } if(num > 1) ans *= (1.0 - (1.0 / (double)num)); return (ll)ans; }
ll sumofdigit(long ll n){ll sum=0;while(n){sum=sum+n%10;n=n/10;}return sum;}
ll countDigit(ll n) { if (n == 0) return 0; return 1 + countDigit(n / 10); }
ll countDigit(ll n) { return floor(log10(n) + 1); } //only positive  
 ***/

template <class T> inline T gcd(T a,T b){if(b == 0)return a; return gcd(b, a % b);}
template <class T> inline T lcm(T a,T b){return a * b / gcd<T>(a, b);}
template <class T> inline T power(T b,T p){ll ans = 1;while(p--) ans *= b; return ans;}

int main()
{

	#ifndef ONLINE_JUDGE
	freopen("C:/Users/91731/Documents/input.txt","r",stdin);
	freopen("C:/Users/91731/Documents/output.txt","w",stdout);
	freopen("C:/Users/91731/Documents/error.txt","w",stderr);
    #endif
	
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	ll k;string s;
	cin>>k>>s;
	ll n=s.length();
	if(s.length()<=k)cout<<s;
	else
	{
		for(ll i=0;i<k;i++)cout<<s[i];
			cout<<"...";
	}
}

Measured memory_bytes: 3608
S = str(input())

if S == 'SUN':
    print(7)
elif S == 'MON':
    print(6)
elif S == 'TUE':
    print(5)
elif S == 'WED':
    print(4)
elif S == 'THU':
    print(3)
elif S == 'FRI':
    print(2)
elif S == 'SAT':
    print(1)

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

#define UP 0
#define DOWN 1

long long N;
vector<lli> A;
lli cnt;

lli calc(lli from,lli now,lli dir){
    if(DEBUG)cout<<"from="<<from<<" now = "<<now<<" dir="<<dir<<"cnt="<<cnt<<endl;
    if(now >= N)return now;
    if(dir==UP){
        if(from > A[now])return now;
        else return calc(A[now],now+1,dir);
    }
    else{
        if(from < A[now])return now;
        else return calc(A[now],now+1,dir);
    }
}

void func(){

    bool ok = false;
    REP(i,0,N){
        if(i==N-1){
            ok=true;
        }
        else if(A[i]<A[i+1]){
            lli next = calc(A[i],i+1,UP);
            i = next-1;
            cnt++;
            ok = false;
        }
        else if(A[i]>A[i+1]){
            lli next = calc(A[i],i+1,DOWN);
            i = next-1;
            cnt++;
            ok = false;
        }
        else{
            ok=true;
        }
    }
    if(ok)cnt++;
    cout<<cnt<<endl;
}

int main(){
    // cout << fixed << setprecision(5);

    scanf("%lld",&N);
    A.resize(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    func();
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define rep(a,b,c) for(a=b;a<c;a++)
#define repj(a,b,c) for(a=b;a<c;a++)
#define repr for(i=n-1;i>=0;i--)
#define pii pair<ll,ll>
#define pll pair<ll, ll>
#define inf 100000001
#define mod 1000000007
#define lb lower_bound
#define up upper_bound
#define rep1 for(i=1;i<=n;i++)
#define vr vector
#define ef else if
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll myXOR(ll x, ll y)
{
	return (x|y)&(~x|~y);	
}
ll powerLL(ll x, ll n) 
{ 
    ll result = 1; 
    while (n) { 
        if (n & 1) 
            result = result * x % mod; 
        n = n / 2; 
        x = x * x % mod; 
    }
    return result; 
}
int main()
{
	ll t,n,m,i,j,k,l,x,y,z,a,b,c,d,e,p,nl,np,q,r,s,h;
	string str,str1;
	double nn;
	cin>>nn;
	double aa,bb,cc;
	n = nn;
	if(n%3==0)
	{
		aa = bb = cc = nn/3;
	}
	else
	{
		aa = bb = nn/3;
		cc = nn-(aa+bb);
	}
	double res = aa*bb*cc;
	printf("%.12f", res);
}

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

#define ll long long
#define endl "\n"

const ll MAX = 200;
const ll INF = 1e18;

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

    ll n,m,s;
    cin>>n>>m>>s;
    struct Train{
        ll s, c, d;
        Train(ll s,ll c,ll d):s(s),c(c),d(d){}
        bool operator>(const Train& x) const {return d>x.d;}
    };
    vector <Train> graph[n];
    for (int i=0; i<m; ++i){
        ll u,v,a,b;
        cin>>u>>v>>a>>b;
        graph[u-1].emplace_back(v-1,a,b);
        graph[v-1].emplace_back(u-1,a,b);
    }
    for (int i=0; i<n; ++i){
        int c,d;
        cin>>c>>d;
        graph[i].emplace_back(i, -c, d);
    }
    vector <array<ll, MAX+1>> dp(n);
    for (auto& arr:dp){
        arr.fill(INF);
    }
    dp[0][min(s, MAX)]=0;
    priority_queue<Train, vector <Train>, greater<>> q;
    q.emplace(0,s,0);
    while (!q.empty()){
        auto [s,c,d] = q.top();
        q.pop();
        if (d>dp[s][min(c, MAX)]){
            continue;
        }
        for (auto t: graph[s]){
            if(c-t.c<0){
                continue;
            }
            if(d+t.d>=dp[t.s][min(c-t.c, MAX)]){
                continue;
            }
            dp[t.s][min(c-t.c, MAX)]=d+t.d;
            q.emplace(t.s, c-t.c, d+t.d);
        }
    }
    for (int i=1; i<n; ++i){
        cout<<*min_element(dp[i].begin(), dp[i].end())<<endl;
    }
}

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

namespace TemplateAlgorithm
{
    class Program
    {
        public const long Inf = (long)1e18;
        public const double eps = 1e-6;
        public const string alfa = "abcdefghijklmnopqrstuvwxyz";
        public const string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        public const int MOD = 1000000007;


        static void Main(string[] args)
        {
            int[] data = IO.ReadIntArr();
            int r = data[0], D = data[1], x = data[2];

            for (var i =0; i < 10; i++)
            {
                x = x * r - D;
                WriteLine(x);
            }
        }

        static int ToInt(char c) => c - '0';



        #region MIN,MAX

        /// <summary>
        /// 最大値を返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="vals"></param>
        /// <returns></returns>
        public static T MaxValue<T>(params T[] vals) => vals.Max();

        /// <summary>
        /// 最小値を返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="vals"></param>
        /// <returns></returns>
        public static T MinValue<T>(params T[] vals) => vals.Min();
        #endregion
    }

    #region IO

    /// <summary>
    /// IO
    /// </summary>
    public class IO
    {
        public static string ReadStr(bool isTrim = false) => (isTrim) ? ReadLine().Trim() : ReadLine();
        public static int ReadInt() => int.Parse(ReadStr());

        public static long ReadLong() => long.Parse(ReadStr());

        public static decimal ReadDecimal() => decimal.Parse(ReadStr());
        public static double ReadDouble() => double.Parse(ReadStr());
        public static string[] ReadStrArr(char separator = ' ') => ReadLine().Split(separator);
        public static int[] ReadIntArr() => Array.ConvertAll(ReadStrArr(), int.Parse);
        public static long[] ReadLongArr() => Array.ConvertAll(ReadStrArr(), long.Parse);

        public static decimal[] ReadDecimalArr() => Array.ConvertAll(ReadStrArr(), decimal.Parse);
        public static double[] ReadDoubleArr() => Array.ConvertAll(ReadStrArr(), double.Parse);

        public static void Cout<T>(T value) => WriteLine(value);
        public static void CoutJoin<T>(T[] values, string separator = " ") => Cout(string.Join(separator, values));
    }

    #endregion    
}


Measured memory_bytes: 13140
import math
import fractions

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def bitlist(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

#a = list(map(int, input().split()))
# --------------------------------------------

n = int(input())
a = list(map(int, input().split()))
b = []

for i in range(n):
    b.append(bitlist(a[i],61))

c = [0 for i in range(61)]

for i in range(61):
    for j in range(n):
        c[i] += b[j][i]
ans = 0
for i in range(61):
    ans += c[i]*(n-c[i])*2**i % 1000000007
print(ans % 1000000007)

Measured memory_bytes: 240060
import java.util.*;

class Main {
	public static void main(String[] args){
		Scanner input=new Scanner(System.in);
		
		Stack<Integer> stack=new Stack<Integer>();
		
		String expression=input.nextLine();
		
		String[] arrays=expression.split(" ");
		
		for(int i=0;i<arrays.length;i++){
			if(Character.isDigit(arrays[i].charAt(0)))
				stack.add(Integer.parseInt(arrays[i]));
			else if(!Character.isDigit(arrays[i].charAt(0))){
				int number2=stack.pop();
				int number1=stack.pop();
				
				stack.push(add(number1,number2,arrays[i].charAt(0)));
			}
				
		}
		
		System.out.println(stack.pop());
		
		
	}
	
	public static int add(int number1,int number2,char symbol){
		int result=0;
		if(symbol=='+')
			result=number1+number2;
		else if(symbol=='-')
			result=number1-number2;
		else if(symbol=='*')
			result=number1*number2;
		else if(symbol=='/')
			result=number1/number2;
		
		
		return result;
	}

}

Measured memory_bytes: 26256
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <list>          // list
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main()
{
    stack<int> S1;
    stack<pair<int, int>> S2;
    char ch;
    int sum = 0;
    for (int i = 0; cin >> ch; i++)
    {
        if (ch == '\\')
            S1.push(i);
        else if (ch == '/' && S1.size() > 0)
        {
            int j = S1.top();
            S1.pop();
            sum += i - j;
            int a = i - j;
            while (S2.size() > 0 && S2.top().first > j)
            {
                a += S2.top().second;
                S2.pop();
            }
            S2.push(make_pair(j, a));
        }
    }

    vector<int> ans;
    while (S2.size() > 0)
    {
        ans.push_back(S2.top().second);
        S2.pop();
    }
    reverse(ans.begin(), ans.end());
    cout << sum << endl;
    cout << ans.size();
    for (int i = 0; i < ans.size(); i++)
    {
        cout << " ";
        cout << ans[i];
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 3236
Coordinate=[0]*5
for i in range(5):
    Coordinate[i]=int(input())
k=int(input())
ans=True
for i in range(5):
    for j in range(5):
        if abs(Coordinate[i]-Coordinate[j])>k:
            ans=False
if ans==True:
    print('Yay!')
else:
    print(':(')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x)  (long long)(x).size()
#define sqr(x) (x)*(x)
#define sof sizeof
#define resz resize
#define ins insert
#define lowerB lower_bound
#define upperB upper_bound
#define mkp make_pair
#define mkt make_tuple
#define act(a,v) (get<(long long)a>(v))
#define mod 1000000007
#define mod1 998244353
#define N 400003  //N idhar hai
#define inf 1e10
#define minf -1e18
#define min3(a,b,c) min(a,min(b,c));
#define max3(a,b,c) max(a,max(b,c));
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define sumall(v) accumulate(all(v),(ll)0)
#define suma accumulate
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION(n) std::cout.unsetf ( std::ios::floatfield );std::cout.precision((ll)n)
#define PI M_PI
#define fi first
#define se second
#define here cout<<"RSSB"<<endl
#define showzero cout<<std::showpoint
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) ((a*b)/gcd(a,b))
#define bitcount( x ) __builtin_popcountll( x )
#define br "\n"
#define sp " "
using namespace  std ;
typedef double db;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
typedef vector<bool>vbool ;
void READ(vll &v, ll n){ll a ;for(ll i=0 ; i<n ; i=i+1){cin>>a ;v.pb(a);}}
void PRINT(vll &v , ll a = 0){for(ll i=a ; i<v.size() ; i=i+1){/*v[i] = max((ll)0,v[i]);*/cout<<v[i]<<" " ;}cout<<"\n" ;}
double logy(ll n , ll b){if(b==0){return(-1);}if(n==1){return(0);}return((db)log10(n)/log10(b));}
long long power(long long k , long long n , long long m=mod){long long res = 1;while(n){if(n%2!=0){res = (res*k)%m ;}k = (k*k)%m ;n = n/2 ;}return(res) ;}
double power(double k , long long n ){double res = 1;while(n){if(n%2!=0){res = (res*k) ;}k = (k*k) ;n = n/2 ;}return(res) ;}
double distance(pll a , pll b){return((db)(sqrt( sqr(a.fi-b.fi) + sqr(a.se-b.se))));}
const ll dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const ll dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
vpll dr;
void call(){dr.pb(mkp(1,0));dr.pb(mkp(-1,0));dr.pb(mkp(0,1));dr.pb(mkp(0,-1));}
ll n,m,k,h;
bool ok = false;
int main()
{
    FastIO ;
    PRECISION(10) ;
    ll a,b,c,d,i,j,t,x,y,z;//,x1,y1,z1,e,f;
    db p,q,r,u,w ;
    char ch,chr ;
    string str,st,str1,str2,str3,str4;
    //ll a1=0,a2=0,b1=0,b2=0,c1=0 ;
    //cin>>str>>str1;
    //Stay Motivated!!
    //Never use i for two or more nested loops!!
    //Range Query + Constructive + DSU  +  Graph Theory + Math + DP + Bitmasks + Geometry + Brute Force + Greedy + Implementation + Binary Search
    cin>>n>>a>>b;
    c = n/(a+b);
    d = min(a,n%(a+b));
    cout<<c*a+d;
}

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

int main(){
	string s;
	string longest = "";
	int most = 0;
	string most_str;
	map<string, int> h;
	while(cin >> s){
		if(s.size() > longest.size()){
			longest = s;
		}
		if (h.find(s) == h.end()) {
			h[s] = 0;
		}
		h[s]++;
		if (most < h[s]) {
			most = h[s];
			most_str = s;
		}
	}
	cout << most_str << " " << longest << endl;
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define fi first 
#define se second

#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>

#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>

const ll HMOD = (ll)1e9 + 7;
const ll LMOD = 998244353;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;
const long double EPS = 1e-10;


void YN(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Yn(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void yn(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

int main() {
	string s; cin >> s;
	REP(i, 3) cout << ((s[i] == '1') ? 9 : 1);
	cout << endl;


	return 0;
}



Measured memory_bytes: 256
import numpy as np

S = np.array(list(input()))
S = S.astype('int32')
length = len(S)

if length == 1:
    print(0)
    exit()

check_array1 = np.zeros(length, int)
for i in range(1, length, 2):
    check_array1[i] = 1

check_array2 = np.append(check_array1[1:], check_array1[-2])


checked1_S = S + check_array1
checked2_S = S + check_array2

checked1_total = (checked1_S == 1).sum()
checked2_total = (checked2_S == 1).sum()

answer = min(checked1_total, checked2_total)

print(answer)


Measured memory_bytes: 30336
import sys
import math
import copy
import heapq
import random
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10 ** 9 + 7
divide = lambda x: pow(x, MOD - 2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n - k])) % MOD


def fact_and_inv(SIZE):
    inv = [0] * SIZE  # inv[j] = j^{-1} mod MOD
    fac = [0] * SIZE  # fac[j] = j! mod MOD
    finv = [0] * SIZE  # finv[j] = (j!)^{-1} mod MOD
    inv[1] = 1
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    for i in range(2, SIZE):
        inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD
        fac[i] = fac[i - 1] * i % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

    return fac, finv


def renritsu(A, Y):
    # example 2x + y = 3, x + 3y = 4
    # A = [[2,1], [1,3]])
    # Y = [[3],[4]] または [3,4]
    A = np.matrix(A)
    Y = np.matrix(Y)
    Y = np.reshape(Y, (-1, 1))
    X = np.linalg.solve(A, Y)

    # [1.0, 1.0]
    return X.flatten().tolist()[0]


class TwoDimGrid:
    # 2次元座標 -> 1次元
    def __init__(self, h, w, wall="#"):
        self.h = h
        self.w = w
        self.size = (h + 2) * (w + 2)
        self.wall = wall
        self.get_grid()
        # self.init_cost()

    def get_grid(self):
        grid = [self.wall * (self.w + 2)]
        for i in range(self.h):
            grid.append(self.wall + getS() + self.wall)

        grid.append(self.wall * (self.w + 2))
        self.grid = grid

    def init_cost(self):
        self.cost = [INF] * self.size

    def pos(self, x, y):
        # 壁も含めて0-indexed 元々の座標だけ考えると1-indexed
        return y * (self.w + 2) + x

    def getgrid(self, x, y):
        return self.grid[y][x]

    def get(self, x, y):
        return self.cost[self.pos(x, y)]

    def set(self, x, y, v):
        self.cost[self.pos(x, y)] = v
        return

    def show(self):
        for i in range(self.h + 2):
            print(self.cost[(self.w + 2) * i:(self.w + 2) * (i + 1)])

    def showsome(self, tgt):
        for t in tgt:
            print(t)
        return

    def showsomejoin(self, tgt):
        for t in tgt:
            print("".join(t))
        return

    def search(self):
        grid = self.grid
        move = [(0, 1), (0, -1), (1, 0), (-1, 0)]
        move_eight = [(0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
        # for i in range(1, self.h+1):
        #     for j in range(1, self.w+1):
        #         cx, cy = j, i
        #         for dx, dy in move_eight:
        #             nx, ny = dx + cx, dy + cy


def solve():
   d, t,s  = getList()
   if s * t >= d:
       print("Yes")
   else:
       print("No")

if __name__ == "__main__":
    # main()
    solve()

Measured memory_bytes: 76720
A,B,K = map(int, input().split())

flg = True
for i in range(K):
    if flg:
        if A % 2 > 0:
            A -= 1
        B += A // 2
        A //= 2
        flg = False
    else:
        if B % 2 > 0:
            B -= 1
        A += B // 2
        B //= 2
        flg = True
print(A, B)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		int H = sc.nextInt();
		int W = sc.nextInt();
		sc.nextLine();

		String[] ans = new String[2*H];
		for(int i=0;i<H;i++) {
			String s = sc.nextLine();
			ans[2*i] = s;
			ans[2*i + 1] = s;
		}

		for(int i=0;i<ans.length;i++) {
			System.out.println(ans[i]);
		}
	}
}


Measured memory_bytes: 23764
#include<stdio.h>
#include<math.h>

int judge(double a,double b,double c){
  int j=0;
  if(a*a==b*b+c*c) j=1;
 else if(b*b==a*a+c*c) j=1;
 else if(c*c==a*a+b*b) j=1;
return j;
}



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

  int tri[100000][3];
  
  int i=0;
  for(i;i<n;i++){
      scanf("%d %d %d",&tri[i][0],&tri[i][1],&tri[i][2]);
	}
  i=0;
  for(i;i<n;i++){
    int j=0;
    j=judge(tri[i][0],tri[i][1],tri[i][2]);
    
    if(j==1)
      printf("YES\n");
    else
      printf("NO\n");
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef long long llong;
char moji[26]={'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'};
char moji2[26]={'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'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MAX 105


int main(){
    int n,l;
    cin >> n >> l;
    string A[MAX];
    REP(i,n) cin >> A[i] ;
    sort(A,A+n);
    string ans;
    REP(i,n ) ans += A[i];
    cout << ans << endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextInt();
		long B = sc.nextInt();
		long C = sc.nextInt();
		long K = sc.nextLong();
		if(C == 0)
		sc.close();
		long ans = B - A;
		if(K % 2 == 0) {
			ans *= -1;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21972
// Example program
#include <iostream>
using namespace std;

int main()
{
    int a; int b; int c; int d; int e;
    cin>>a>>b>>c>>d>>e;
   if(a<40){
       a=40;
       }
   if(b<40){
       b=40;
       }
   if(c<40){
       c=40;
       }
   if(d<40){
       d=40;
       }
    if(e<40){
       e=40;
       }
  cout << (a+b+c+d+e)/5 << endl;
}

Measured memory_bytes: 3080
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>

using namespace std;

int main(){
  int N;
  cin>>N;
  int a[N];
  for (int i=0;i<N;i++) cin>>a[i];
  int count=0;
  for (int i=0;i<N;i++){
    while (a[i]%2==0){
      a[i]/=2;
      count++;
    }
  }
  cout<<count<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<map>

using namespace std;
    int x[1000];
int main(){
    int n,k;
    cin >> n >> k;



    for(int i=0;i<k;i++){
        int d;
        cin >> d;
        for(int j=0;j<d;j++){
            int a; cin >> a;
            x[a]++;
        }
    }

    int ans=0;

    for(int i=1;i<=n;i++)if(x[i]==0)ans++;

    cout << ans << endl;
    

    return 0;
}

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

int main() {
    int N;
    cin >> N;
    int flag = 0;
    for (int i = 1;i < 10;i++){
        if (N % i == 0 && N / i < 10) flag = 1;
    }
    if (flag == 0) cout << "No" << endl;
    else cout << "Yes" << endl;
}

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

int main() {
  string s;
  cin >> s;
  
  if(s.size()<4){
    cout << "No" << endl;
  }
  
  else if(s.at(0)=='Y'&&s.at(1)=='A'&&s.at(2)=='K'&&s.at(3)=='I'){
    cout << "Yes" << endl;
  }
  
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import collections

a1,b1=map(int,input().split())
a2,b2=map(int,input().split())
a3,b3=map(int,input().split())
lst=sorted([a1,b1,a2,b2,a3,b3])
ans=[]
l=collections.Counter(lst).values()
for i in l:
    ans.append(i)
print('YES') if ans==[1,2,2,1] else print('NO')

Measured memory_bytes: 3316
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

const int N = 1e5 + 10;

int a[N];

int main()
{
    int n , c , k;
    scanf("%d %d %d",&n , &c , &k);
    for(int i = 1 ; i <= n ; i++ )scanf("%d",&a[i]);
    int ans = 0;
    sort(a + 1 , a + n + 1);
    for(int i = 1 ; i <= n ; i++){
        int sum = 0 , dis = a[i];
        while(i <= n && sum < c){
            if(a[i] - dis > k) break;
            sum++;
            i++;
        }
        i--;
        //printf("i = %d\n",i);
        ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 512