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

using namespace std;

int main()
{
  int n;
  string s;
  cin>>n;
  cin>>s;
  
  if(s.length()%2==1)
    cout<<"No";
  else
  {
    int half=s.length()/2,i;
    string s1,s2;
    
    for(i=0;i<half;i++)
    {
      s1=s1+s[i];
    }

     for(i=half;i<s.length();i++)
    {
      s2=s2+s[i];
    }
    
    if(s1==s2)
      cout<<"Yes";
    else
      cout<<"No";
  }
  return 0;
}


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

int main() {
  long long int x=100,z,count=0;
  cin>>z;
  int i=1;
while(i)
{   x+=x/100;
  count++;
    if(x>=z)
    i=0;
  }
  cout<<count;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int d, t, s;
    cin>>d>>t>>s;
    int r=t*s;
    if(r>=d)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

int main() {
	int N;
	cin >> N;
	map<int,int> A;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		A[a - 1]++;
		A[a]++;
		A[a + 1]++;
	}
	int ans = INT_MIN;
	for (auto it = A.begin(); it != A.end(); it++) {
		ans = max(ans, (*it).second);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4736
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long
#define ull unsigned long long
#define EPS 1e-8
using namespace std;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
const double pi = acos(-1.0);
int read()
{
	int ret=0;char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	for(;ch>='0'&&ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret;
}
const int MAX_N=55;
char G[MAX_N][MAX_N];
char ans[MAX_N][MAX_N]; 
int n,m;
int dir[8][2]={-1,-1, -1,0, -1,1, 0,-1, 0,1, 1,-1, 1,0, 1,1};
int main()
{
 	#ifdef TEST
	 	freopen("input.txt","r",stdin);
	#endif
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)
	{
		scanf("%s",G[i]);
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(G[i][j]=='#')
			{
				ans[i][j]='#';
				continue;
			}
			int temp=0;
			for(int k=0;k<9;k++)
			{
				int x=i+dir[k][0],y=j+dir[k][1];
				if(x>=0&&x<n&&y>=0&&y<m)
				{
					if(G[x][y]=='#')
					{
						temp++;
					}
				}
			}
			ans[i][j]=temp+'0';
		}
	}
	for(int i=0;i<n;i++)
	{
		printf("%s\n",ans[i]);
	}
	return 0;
}



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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int a,b; cin >> a >> b;
  int n = 1000;
  vector<int> sum(n);
  sum[0] = 0;
  for(int i = 1;i<n;i++) sum[i]=sum[i-1]+i;

  int res;
  for(int i = 1;i<n;i++){
    if(sum[i]-a>0){
      if(sum[i]-a!=sum[i+1]-b) continue;
      res = sum[i]-a;
    }
  }

  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 3640
import sys

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")


a,p = MI()

x = 3*a + p
print(x//2)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>

using namespace std;

typedef long long ll;
typedef long double ld;

//#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define no {cout << "No"; return;}

void solve() {
    int n, k, q;
    cin >> n >> k >> q;
    vector <int> a(n);
    loop(i, q) {
        int x; cin >> x;
        ++a[x - 1];
    }
    loop(i, n)
        cout << (k > q - a[i] ? "Yes" : "No") << "\n";
}

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

Measured memory_bytes: 3732
def main():
    k, a, b = (int(i) for i in input().split())
    ans = 0
    cur = 1
    if cur < a:
        if a - cur <= k:
            k -= a - cur
            cur = a
        else:
            cur += k
            k = 0
    if 0 < k:
        if b - a > 2:
            cur += (b - a)*(k//2)
            k %= 2
        else:
            cur += k
            k = 0
    if 0 < k:
        cur += k
    print(cur)


if __name__ == '__main__':
    main()


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

//方針：K回の修行でかかる時間X以下にできるかの判定を考える
//ある時間を境にできるとできないが決まるので2分探索行う
int main(void){
  //入力
  int N;
  ll K;
  cin >> N >> K;
  vector<ll> A(N);
  vector<ll> F(N);
  for(int i = 0; i < N; ++i) cin >> A[i];
  for(int i = 0; i < N; ++i) cin >> F[i];

  //貪欲に割り当てるため
  //Aは降順，Fは昇順にソートする
  sort(A.begin(),A.end(),greater<ll>());
  sort(F.begin(),F.end());

  //X以下でできるかの判定
  auto f = [&](ll X){
    ll k = K;
    for(int i = 0; i<N; ++i){
      //A[i]*F[i]がX以下であるためにA[i]をQ以下にする必要がある
      ll Q = X/F[i];
      //Qになるまで修行．既にQ以下なら必要なし
      k -= max(0ll, A[i]-Q);
    }
    //修行回数がK以下ならtrue
    return k>=0;
  };

  // lは必ずできない，rは必ずできる状態にする
  ll l = -1, r = 1e12;
  //lとrが隣り合うまで続ける
  while(r-l>1){
    ll X = (l+r)/2;
    if(f(X)) r = X;
    else l = X;
  }

  //出力
  cout << r << endl;
}


Measured memory_bytes: 3328
// DP
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MAX_N 1001
#define MAX_W 1001
using namespace std;

int main(){
	int caseNum = 1;
	int ans;
	int W, n;
	int v[MAX_N];
	int w[MAX_N];
	int dp[MAX_N][MAX_W];
	while(cin >> W){
		if(W == 0){
			break;
		}
		cin >> n;
		for (int i = 0; i < n; i++) {
			scanf("%d,%d", &v[i], &w[i]);
		}
		
		memset(dp, 0, sizeof(dp));
		for (int i = 0; i < n; i++){
			for (int j = 0; j <= W; j++){
				if(j < w[i]){
					dp[i+1][j] = dp[i][j];
				} else{
					dp[i+1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
				}
			}
		}
		// answer
		cout << "Case " << caseNum++ << ":" << endl;
		for (int i = W; i >= 0; i--) {
			if(dp[n][W] != dp[n][i]) {
				ans = i+1;
				break;
			}
		}
		cout << dp[n][W] << endl;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long N = sc.nextLong();
		long M = sc.nextLong();
		String S = sc.next();
		String T = sc.next();
		
		long lcm = N * M / gcd(N,M);
		
		Map<Long,Character> map = new HashMap<>();
		for (int i = 0; i < N; i++) {
			if (i == 0) {
				map.put(1L, S.charAt(0));
			} else {
				map.put(i*lcm/N+1, S.charAt(i));
			}
		}
		
		for (int i = 0; i < M; i++) {
			if (i == 0) {
				if (map.get(1L) != T.charAt(0)) {
					System.out.println(-1);
					return;
				}
			} else {
				if (map.containsKey(i*lcm/M+1)) {
					if (map.get(i*lcm/M+1) != T.charAt(i)) {
						System.out.println(-1);
						return;
					}
				}
			}
		}
		
		System.out.println(lcm);
	}
	
	static long gcd(long a, long b) {
		long tmp = 0;
		while((tmp = a%b) != 0) {
			a = b;
			b = tmp;
		}
		return b;
	}
}


Measured memory_bytes: 33308
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
ll gcd(ll x,ll y)
{
    return y?gcd(y,x%y):x;
}

int main()
{
    ll a,b;
    cin >> a >> b;
    ll com=gcd(a,b);
    ll tot=0;
    for(ll i=2; i<=(ll)sqrt(com+0.5); i++)
    {
        if(com%i==0)
        {
            tot++;
            while(com%i==0)
                com/=i;
        }
    }
    if(com!=1)
        tot++;
        tot++;
    cout << tot;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>

using namespace std;

int main(int argc, char const *argv[])
{
    long long N;
    cin >> N;
    int F;
    int minF = INT_MAX;
    int cntA, cntB;
    long long j;
    for (long long i = 1; i * i <= N; i++)
    {
        if (N % i == 0)
        {
            j = N / i;
            cntA = log(i) / log(10) + 1;
            cntB = log(N / i) / log(10) + 1;
            F = max(cntA, cntB);
            if (F < minF) minF = F;

        }
        
    }

    cout << minF << endl;
    
    return 0;
}

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

using namespace std;

int main(){
  int64_t l,r,res = (1 << 29);
  cin >> l >> r;
  if(r - l + 1 >= 2019){
    cout << 0;
    return 0;
  }
  l %= 2019;
  r %= 2019;
  if(l >= r){
    cout << 0;
    return 0;
  }
  for(int64_t i = l;i <= r;i++){
    for(int64_t j = i+1;j <= r;j++){
      res = min(res,i*j%2019);
    }
  }
  cout << res;
  return 0;
}

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

int n;
vector< vector<int> > G;
vector<int> color, d, p;

void Dijsktra() {
  color.resize(n), d.resize(n, 1000000000), p.resize(n, -1);
  d[0] = 0;

  while (true) {
    int min_cost = 1000000000, u;
    for (int i = 0; i < n; i++) if (color[i] != 2 && d[i] < min_cost) min_cost = d[i], u = i;
    if (min_cost == 1000000000) break;
    color[u] = 2;
    for (int v = 0; v < n; v++) {
      if (color[v] != 2 && G[u][v] != -1)
        if (d[u] + G[u][v] < d[v]) d[v] = d[u] + G[u][v], p[v] = u, color[v] = 1;
    }
  }
}

int main() {
  cin >> n;
  G.resize(n, vector<int>(n, -1));
  for (int i = 0; i < n; i++) {
    int u, k;
    cin >> u >> k;
    for (int i = 0; i < k; i++) {
      int v, c;
      cin >> v >> c;
      G[u][v] = c;
    }
  }

  Dijsktra();

  for (int i = 0; i < n; i++) cout << i << " " << d[i] << endl;
}


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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

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

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

  string s;
  cin >> s;
  for(int i = 0; i < 4; i++){
    cout << s[i];
  }
  cout << " ";
  for(int i = 4; i < 12; i++){
    cout << s[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

class Mint:
    
    MOD = 10**9+7
    
    def __init__(self, x=0):
        self.x = (x%self.MOD + self.MOD) % self.MOD
    
    def __iadd__(self, other):
        self.x += other.x
        if self.x >= self.MOD:
            self.x -= self.MOD
        return self
    
    def __isub__(self, other):
        self.x += self.MOD - other.x
        if (self.x >= self.MOD):
            self.x -= self.MOD
        return self
    
    def __imul__(self, other):
        self.x *= other.x
        self.x %= self.MOD;
        return self;
    
    def __add__(self, other):
        ans = Mint(self.x)
        ans += other
        return ans
        
    def __sub__(self, other):
        ans = Mint(self.x)
        ans -= other
        return ans
    
    def __mul__(self, other):
        ans = Mint(self.x)
        ans *= other
        return ans
    
    def __pow__(self, n):
        if n == 0:
            return Mint(1)
        a = self.__pow__(n >> 1)
        a *= a
        if n&1:
            a *= self
        return a
    
    def inv(self):
        return self**(self.MOD-2)
    
    def __ifloordiv__(self, other):
        self *= other.inv()
        return self
    
    def __floordiv__(self, other):
        ans = Mint(self.x)
        ans //= other
        return ans
        

N = int(input())
from collections import Counter

def Main(N):
    if N == 1:
        return 1
    ans = []
    for i in range(2, N+1):
        ans += prime_factorize(i)
    counter = Counter(ans)
    val = [v+1 for v in counter.values()]
    a = Mint(1)
    for v in val:
        a *= Mint(v)
    return a.x
          
                    
print(Main(N))

Measured memory_bytes: 3316
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <stack>

using namespace std;


int main(){
	int n;
	while(1){
		cin >> n;
		if(n==0) break;

		int S[2*n+1][2*n+1];
		for(int i=0 ; i<2*n+1 ; i++){
			for(int j=0 ; j<2*n+1 ; j++){
				S[i][j] = 999;
			}
		}

		int num , code;
		S[n][n] = 0;
		for(int i=1 ; i<n ; i++){
			cin >> num;
			cin >> code;

			int y, x;
			//???????????£?????¢?????¢?´¢
			for(int j=0 ; j<2*n+1 ; j++){
				for(int k=0 ; k<2*n+1 ; k++){
					if(S[j][k] == num){
						x = k;
						y = j;
					}
				}
			}

			if(code == 0) S[y][x-1] = i;
			if(code == 1) S[y+1][x] = i;
			if(code == 2) S[y][x+1] = i;
			if(code == 3) S[y-1][x] = i; 
		}

		
		/*
		for(int i=0 ; i<2*n+1 ; i++){
			for(int j=0 ; j<2*n+1 ; j++){
				cout << S[i][j];
			}
			cout << endl;
		}
		*/
		

		int ws, we;
		int hs, he;

		int flag=0;
		for(int i=0 ; i<2*n+1 ; i++){
			for(int j=0 ; j<2*n+1 ; j++){
				if(S[j][i] != 999){
					ws = i;
					flag = 1;
					break;
				}
				if(flag==1) break;
			}
		}

		flag=0;
		for(int i=2*n ; i>0 ; i--){
			for(int j=0 ; j<2*n+1 ; j++){
				if(S[j][i] != 999){
					we = i;
					flag = 1;
					break;
				}
				if(flag==1) break;
			}
		}
		cout << we-ws+1 << ' ';
		

		flag = 0;
		for(int i=0 ; i<2*n+1 ; i++){
			for(int j=0 ; j<2*n+1 ; j++){
				if(S[i][j] != 999){
					hs = i;
					flag = 1;
					break;
				}
			}
			if(flag == 1) break;
		}

		flag = 0;
		for(int i=2*n ; i>0 ; i--){
			for(int j=0 ; j<2*n+1 ; j++){
				if(S[i][j] != 999){
					he = i;
					flag = 1;
					break;
				}
			}
			if(flag == 1) break;
		}

		cout << he-hs+1 << endl;


	}
	return 0;
}

Measured memory_bytes: 1776
#include <stdio.h>
#include <cmath>
#include <vector>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
using namespace std;

int main(void) {
	vector<int> r;
	while (true)
	{
		int n=0;
		scanf("%d",&n);
		if (n==0){
			break;
		}
		for (int i=0; i<9; i++)
		{
			int m=0;
			scanf("%d",&m);
			n-=m;
		}
		r.push_back(n);
	}
	for(int i=0; i<r.size(); i++)
	{
		cout << r[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=1e18+7;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}




int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,b;
    cin>>n>>b;
    ll dig = (ll)(floor( log(n) / log(b)) + 1);
    cout<<dig<<endl;
    return 0;
    }


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fi first
#define sc second
#define ALL(x) x.begin(), x.end()
#define RALL(X) x.begin(), x.end()
#define FOR(i, n, k) for(i=0; i<n; i+=k)
#define FO(i, n, k) for(i=1; i<=n; i+=k)
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define N 100005
#define mid ((l+r)/2)
#define dbg(x) (cerr << #x << " : " << x << endl)
#define endl "\n"
#define MOD 100000009

using namespace std;

typedef long long int lli;
int n;
int c[50];
int v[50];
int res;

void perform(int i, int cost, int sum){
	if(i == n+1){
		res = max(res, sum-cost);
		return;
	}

	perform(i+1, cost, sum);
	perform(i+1, cost + c[i], sum + v[i]);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin >> n;
	res = -INT_MAX;
	for(int i=0; i<n; i++) cin >> v[i];
	for(int i=0; i<n; i++) cin >> c[i];
	perform(0, 0, 0);
	cout << res;
	return 0;
}

Measured memory_bytes: 256
//μ's forever
#include <bits/stdc++.h>
#define N 100005
#define getchar nc
using namespace std;
inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
inline int read()
{
    register int x=0,f=1;register char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
    return x*f;
}
inline void write(register int x)
{
    if(!x)putchar('0');if(x<0)x=-x,putchar('-');
    static int sta[20];register int tot=0;
    while(x)sta[tot++]=x%10,x/=10;
    while(tot)putchar(sta[--tot]+48);
}
int n,s;
struct edge{
    int to,nxt,w;
}e[N*10];
int head[N],cnt;
inline void add(register int u,register int v,register int w)
{
    e[++cnt]=(edge){v,head[u],w};
    head[u]=cnt;
}
struct node{
    int dis,pos;
    bool operator <(const node &x)const
    {
        return x.dis<dis;
    }
};
std::priority_queue<node>q;
int dis[N],vis[N];
int main()
{
    n=read(),s=n;
    for(register int i=1;i<10;++i)
        add(s,i,i);
    for(register int i=1;i<n;++i)
        for(register int j=0;j<10;++j)
            add(i,(i*10+j)%n,j);
    memset(dis,0x3f,sizeof(dis));
    dis[s]=0;
    q.push((node){dis[s],s});
    while(!q.empty())
    {
        node tmp=q.top();
        q.pop();
        int x=tmp.pos;
        if(vis[x])
            continue;
        vis[x]=1;
        for(register int i=head[x];i;i=e[i].nxt)
        {
            int v=e[i].to;
            if(dis[v]>dis[x]+e[i].w)
            {
                dis[v]=dis[x]+e[i].w;
                q.push((node){dis[v],v});
            }
        }
    }
    write(dis[0]);
	return 0;
}


Measured memory_bytes: 15348
#include<iostream>
using namespace std;
#define ll long long
int main()
{
  string s;
  cin>>s;
  for(ll i=0;i<s.length();i++)
  {
    if(s[i]=='7')
    {
      cout<<"Yes"<<"\n";
      return 0;
    }
  }
  cout<<"No"<<"\n";
  return 0;
}


Measured memory_bytes: 3040
#include<bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main() {
    string s;
    cin >> s;
    cout << s.front() << s.length() - 2 << s.back();
    return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	var n, x int
	s := wordScanner(100)
	scanInts(s, &n, &x)
	l := scanIntSlice(s, n)

	sort.Ints(l)
	d := make([]int, n)
	for i, xi := range l {
		d[i] = abs(x - xi)
	}

	ans := d[0]
	for _, di := range d {
		ans = gcd(ans, di)
	}

	fmt.Println(ans)
}

func gcd(x, y int) int {
	for x%y != 0 {
		x, y = y, x%y
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func wordScanner(n int) *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	b := make([]byte, n)
	s.Buffer(b, n)
	return s
}

func scanInts(s *bufio.Scanner, vals ...*int) {
	for i := range vals {
		s.Scan()
		n, _ := strconv.Atoi(s.Text())
		*vals[i] = n
	}
}

func scanIntSlice(s *bufio.Scanner, n int) []int {
	vals := make([]int, n)
	for i := range vals {
		s.Scan()
		m, _ := strconv.Atoi(s.Text())
		vals[i] = m
	}
	return vals
}


Measured memory_bytes: 3840
def counting_sort(A, k):
    B, C = [], [0]*(k+1)
    for j in range(0, len(A)):
        C[A[j]] += 1
    for i in range(0, len(C)):
        while True:
            if C[i] != 0:
                B.append(i)
                C[i] -= 1
            else:
                break
    return B

input()
num = list(map(int, input().split()))
result = counting_sort(num, max(num))
print(*result)

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int N, M, R; scanf("%d %d %d", &N, &M, &R);
  vector<int> cities(R);
  for (int i = 0; i < R; ++i) {
    scanf("%d", &cities[i]);
  }
  vector<vector<int> > d(N + 5, vector<int>(N + 5, INF));
  for (int i = 0; i < N + 5; ++i) { d[i][i] = 0; }
  for (int i = 0; i < M; ++i) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    d[a][b] = d[b][a] = c;
  }
  for (int k = 1; k <= N; ++k) {
    for (int i = 1; i <= N; ++i) {
      for (int j = 1; j <= N; ++j) {
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }

  int ans = INF;
  sort(cities.begin(), cities.end());
  do {
    int cost = 0;
    for (int i = 1; i < R; ++i) {
      cost += d[cities[i - 1]][cities[i]];
    }
    ans = min(ans, cost);
  } while (next_permutation(cities.begin(), cities.end()));

  printf("%d\n", ans);
  return 0;
}


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

int main()
{
    map<long long int,bool>mp;
    int n;
    cin>>n;
    int c=1;
    for(int i=1;i<=n;i++)
    {
        int a;
        cin>>a;
        if(mp.find(a)!=mp.end())
            c=0;
        mp[a]=true;
    }
    if(c)
        cout<<"YES";
    else 
        cout<<"NO";
}


Measured memory_bytes: 12800
#include <stdio.h>
#include <sysexits.h>
#include <math.h>
int main(void){
  int x[6],t,i,j;
  if(scanf("%d",&x[0])!=1){
exit(1);
}
  if(scanf("%d",&x[1])!=1){
exit(1);
}
  if(scanf("%d",&x[2])!=1){
exit(1);
}
  if(scanf("%d",&x[3])!=1){
exit(1);
}
  if(scanf("%d",&x[4])!=1){
exit(1);
}
  if(scanf("%d",&x[5])!=1){
exit(1);
}
  /*
  for(i=0;i<4;i++){
    for(j=i+1;j<4;j++){
      if(t>fabs(x[i]-x[j])){
        t=x[i]-x[j];
        }
  }
  }
  */
  if(x[5]>=x[4]-x[0]){
    printf("Yay!");
  }
  else{
    printf(":(");
  }
  return 0;
}



Measured memory_bytes: 128
from math import log, floor
from itertools import islice

k = int(input())

def s(n):
    return n / sum(map(int, str(n)))

def f(n):
    ds = range(int(log(n+1, 10))+2)
    xs = [(10**(d+1))*floor(n/(10**(d+1)) + 1) - 1 for d in ds]
    return min(xs, key=s)

def g():
    for n in range(1, 10):
        yield n
    while True:
        n = f(n+1)
        yield n

for x in islice(g(), k):
    print(x)

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

int main() {
  string n;

  cin >> n;
  for (int i = 0; i < n.size(); ++i) {
    if (n[i] == '9') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

int main()
{
  int i,j,k,l,r;
  long long int ll,rr,N,A[200010],res=10E15,O[100010],P,Q,R,S;
  
  cin >> N;
  REP(i,N)cin >> A[i];
  O[0] = A[0];
  for(i=1;i<N;i++)O[i] = O[i-1] + A[i];
  l = 1;
  r = 3;
  for(i=2;i<=N-2;i++){
    P = O[l-1];
    Q = O[i-1] - O[l-1];
    while(l < i){
      P = O[l-1];
      Q = O[i-1] - O[l-1];
      if((abs(2*O[l]-O[i-1]) <= abs(Q-P)) && (l+1 < i))
        l++;
      else
        break;
    }
    if(r == i)
      r++;
    R = O[r-1] - O[i-1];
    S = O[N-1] - O[r-1];
    while(r <= N-1){
      R = O[r-1] - O[i-1];
      S = O[N-1] - O[r-1];
      if((abs(2*O[r]-O[i-1]-O[N-1]) < abs(R-S)) && (r < N-1))
        r++;
      else
        break;
    }
    res = min(abs(max(P,max(Q,max(R,S)))-min(P,min(Q,min(R,S)))),res);
    
  }
  
  cout << res << endl;
  
  return 0;
  
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second

void solve(){
    ll n; cin>>n;
    string ans="";
    while(n){
        int rem = n%26;
        if(rem==0){
            ans += rem + 'z';
            n = (n/26) - 1;
        }else{
            ans += (rem-1) + 'a';
            n /= 26;
        }
    }
    reverse(ans.begin(),ans.end());
    cout<<ans;
}
int main() {
    // int t; cin>>t;
    // while(t--){
        solve();
        // cout<<endl;
    // }
}

Measured memory_bytes: 3608
<?php
$n = (int)trim(fgets(STDIN));

$edge_cnt = [];
$visited  = [];
$nexts = [];
$colors = [];
$parent_color = [];
$edge_color = [];
for ($i=1; $i <= $n; $i++) { 
	$edge_cnt[$i] = 0;
	$nexts[$i]  = [];
	$colors[$i] = [];
	$visited[$i] = false;
	$parent_color[$i] = null;
}

$edges = [];
for ($i=0; $i < $n-1; $i++) { 
	$input = explode(' ', trim(fgets(STDIN)));
	$a = (int)$input[0];
	$b = (int)$input[1];

	$edge_cnt[$a] += 1;
	$nexts[$a][] = $b;
	$edge_cnt[$b] += 1;
	$nexts[$b][] = $a;
	$edges[] = [$a, $b];
	$edge_color[$a][$b] = '';
}

$max = 0;
$s = 0;
foreach ($edge_cnt as $k => $v) {
	if ($max < $v) {
		$max = $v;
		$s = $k;
	}
}

//wfs
$q = new SimpleQueue();
$q->enq($s);
$parent_color[$s] = 0;
$e_num = 0;
while (!$q->isEmpty()) {
	$cur = $q->deq();
	$visited[$cur] = true;
	$children = $nexts[$cur];
	foreach ($children as $child) {
		if ($visited[$child]) {
			continue;
		}
		//coloring
		if ($e_num == $parent_color[$cur]) {
			$e_num = $e_num % $max + 1;
		}
		$parent_color[$child]   = $e_num;
		$from = min($cur, $child);
		$to   = max($cur, $child);
		$edge_color[$from][$to] = $e_num;
		//enq
		$q->enq($child);
		$e_num = $e_num % $max + 1;

	}
}
$results = [];
foreach ($edges as $p) {
	$results[] = $edge_color[$p[0]][$p[1]];
}
echo $max . PHP_EOL;
echo implode(PHP_EOL, $results);


class SimpleQueue
{
	private $data = [];
	private $idx = 0;

	function enq($d){
		$this->data[] = $d;
	}

	function deq(){
		$this->idx += 1;
		return $this->data[$this->idx-1];
	}

	function isEmpty(){
		return (count($this->data) === $this->idx);
	}
}

Measured memory_bytes: 137192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int main() {
	int n, f = 0, b = 0;
	cin >> n;
	string s;
	vector<bool> sb(n, false);
	vector<string> ss,sa,sz;
	rep(i, n) {
		cin >> s;
		ss.push_back(s);
	}
	rep(i, n) {
		string a, z;
		rep(j, ss[i].size()) {
			if (ss[i][j] == '?') {
				a.push_back('a');
				z.push_back('z');
			}
			else {
				a.push_back(ss[i][j]);
				z.push_back(ss[i][j]);
			}
		}
		sa.push_back(a);
		sz.push_back(z);
	}
	cin >> s;
	rep(i, n) {
		//cout << sa[i] << " " << sz[i] << endl;
		if (sa[i] > s) {
			b++;
		}
		else if (sz[i] < s) {
			f++;
		}
	}
	vi v;
	range(i,1 + f, n + 2 - b) {
		v.push_back(i);
	}
	cout << v << endl;
}


Measured memory_bytes: 2176
char W[9],V[9];Z[2*4],S,N,T,P,M;main(){
	int i,j,k,l,r,d;
	for(;scanf("%d%d%d%s%s%d%d",&S,&N,&T,W,V,&P,&M),S;printf("%.10f\n",1-pow(1-1.0/P,N*r))){
		memset(Z,0,sizeof(Z));
		l=*W=='A'?2:1;
		d=24*60*(*W=='A'?1:7);
		if(*V=='A')for(i=0;i<l;i++)for(j=0;j<4;j++)Z[i*4+j]=1;
		if(*V=='D')for(i=0;i<l;i++)for(j=0;j<2;j++)Z[(i*4+1)+j]=1;
		if(*V=='N')for(i=0;i<l;i++)for(j=0;j<1;j++)Z[i*4+j]=Z[(i*4+3)+j]=1;
		for(r=j=0;j<24*60;r=r>l?r:l,j++)for(k=j,l=i=0;i<M;i++){
			if(k<24*60)l+=Z[(k+S)%(2*24*60)/60/6]&Z[k/60/6];
			k=(k+T)%d;
		}
}exit(0);}

Measured memory_bytes: 692
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll= long long;
using ld= long double;
using P =pair<ll,ll>;


//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<=(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define sort(a) sort(ALL(a))//sortの省略
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define in(T, x) T x;cin >> x;//Tは型,xが入力値
#define vec(T,a,n,x) vector<T> a(n,x);
#define vec2(T,a,n,m) vector<vector<T>> a(n,vector<T>(m));
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define out(x) cout << x << endl//出力
#define bout(b) if(b){out("Yes");}else{out("No");}//真偽問題に対する出力
#define ain(T, a, n) vector<T> a(n);REP(i, n){cin >> a[i];}//配列の宣言と入力
#define a2in(T1, a, T2, b, n) vector<T1> a(n);vector<T2> b(n);REP(i, n){cin >> a[i] >> b[i];}//2つの配列を同時宣言、入力

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }//dp表とかで最大値更新するやつ
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }//最小値更新


signed main(){
  in(ll,N);
  vec(ll,x,N+1,0);
  vec(ll,y,N+1,0);
  vec(ll,t,N+1,0);
  bool can=true;
  FOR(i,1,N){
    cin>>t[i]>>x[i]>>y[i];
    if((abs(t[i]-t[i-1]) < abs(x[i]-x[i-1])+abs(y[i]-y[i-1])) || ((abs(t[i]-t[i-1])%2 != (abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))%2))){
        can=false;
        break;
    } 
  }
  bout(can);
  

}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define inchar			getchar
#define outchar(x)		putchar(x)
#define ll long long int
#define all(v) v.begin(), v.end()
#define SP outchar(' ')
#define LN outchar('\n')
using namespace std;

template<typename T> void inpos(T &x){x=0;register T c=inchar();while(((c<48)||(c>57))&&(c!='-'))c=inchar();bool neg=0; if(c=='-')neg=1;for(;c<48||c>57;c=inchar());for(;c>47&&c<58;c=inchar())x=(x<<3)+(x<<1)+(c&15);if(neg)x=-x;}
template<typename T> void outpos(T n){if(n<0){outchar('-');n*=-1;}char snum[65];int i=0;do{snum[i++]=n%10+'0';n/=10;}while(n);i=i-1;while(i>=0)outchar(snum[i--]);}
inline void instr(char *str){register char c=0;register int i=0;while(c<33)c=inchar();while(c!='\n'&&c!=' '&&c!=EOF){str[i]=c;c=inchar();++i;}str[i]='\0';}


vector <ll > sum;
ll retSum ( int l , int r) { //[l, r]
	return sum[r+1] - sum [l];
}

ll dp[405][405] ; 

ll slime(ll * arr , ll left , ll right) {
	if (dp[left][right] != -1 ) {
		return  dp[left][right];
	} 
	if (left == right) {
		dp[left][right] = 0;
		return 0;
	}
	ll maxi = LLONG_MAX; 
	for (int j = left ; j<right;j++) {
		maxi = min(slime( arr, left , j) + slime(arr, j+1, right) , maxi);
	}
	
	dp[left][right] = maxi + retSum(left , right); 
	return maxi + retSum(left , right);

}


int main () {
	int n;
	cin >> n;
	ll arr[n];
	sum.resize(n+1); sum[0] = 0;
	for (int i = 0; i<n;i++) {
		cin >> arr[i];
		sum[i+1] = sum [i] + arr[i]; 
	}
	for (int i = 0 ; i< 405 ; i++) {
		for (int j = 0 ; j< 405 ; j++) {
			dp[i][j] = -1;
		}
	}
	cout << slime( arr, 0,n-1) <<endl;

		
}

Measured memory_bytes: 1536
{-# LANGUAGE BangPatterns #-}

import Control.Monad
import Data.Array.Unboxed
import Data.Bits
import Data.Char
import Data.Coerce
import Data.Function
import Data.Int 
import Data.IORef
import Data.List
import Data.Maybe
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as MV
import qualified Data.ByteString.Char8 as BS

main :: IO ()
main = do
  n <- getInt
  print $ solve n

solve :: Int -> Integer
solve n = foldr ((+) . fromIntegral) 0 [ i * j * (j + 1) `div`2 | i <- [1..n], let j = n `div` i]

-- input

getInt :: IO Int
getInt = readLn

second :: (b -> c) -> (a, b) -> (a, c)
second f (a, b) = (a, f b)

readInt :: BS.ByteString -> Maybe (Int, BS.ByteString)
readInt = fmap (second BS.tail) . BS.readInt

getIntVec :: Int -> IO (V.Vector Int)
getIntVec n = V.unfoldrN n readInt <$> BS.getLine

getIntList :: IO [Int]
getIntList = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

getIntPair :: IO (Int, Int)
getIntPair = do
  v <- getIntVec 2
  return (v V.! 0, v V.! 1)

-- search

bisearch :: (Int -> Bool) -> (Int, Int) -> (Int, Int)
bisearch check = bis
  where
    bis (l, r)
      | l + 1 == r = (l, r)
      | check mid  = bis (mid, r)
      | otherwise  = bis (l, mid)
      where
        mid = l + (r - l) `div` 2

Measured memory_bytes: 252180
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main{
	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		int R = sc.nextInt();
		if(R < 1200){
			System.out.println("ABC");
		}else if (R < 2800){
			System.out.println("ARC");
		}else{
			System.out.println("AGC");
		}
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 21076
n,p=map(int,input().split())
a=[i%2 for i in map(int,input().split())]

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

oishii = a.count(1)

c = sum([cmb(oishii,i) for i in range(p,oishii+1,2)])

print(c*2**(n-oishii))


Measured memory_bytes: 9108
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")
#define io_init cin.tie(0);ios::sync_with_stdio(0);cout<<setprecision(10)
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int N;
vector<ll> A,sum;
vector<vector<ll>> memo;
ll dp(int l, int r) {
	if (memo[l][r] != -1)return memo[l][r];
	if (r == l + 1) return A[l] + A[r];
	if (r == l)return 0;
	ll ret = INF_LL;
	for (int i = l; i < r; i++) {
		ret = min(ret, dp(l, i) + dp(i + 1, r) + sum[r + 1] - sum[l]);
	}
	memo[l][r] = ret;
	return ret;
}
int main() {
	io_init;
	cin >> N;
	A = vector<ll>(N);
	sum = vector<ll>(N + 1, 0);
	memo = vector<vector<ll>>(N + 1, vector <ll>(N + 1, -1));
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		sum[i + 1] = sum[i] + A[i];
	}
	cout << dp(0,N-1) << endl;
}


Measured memory_bytes: 1536
#coding: utf-8
# n,k = int(input())
# list = list(map(int,input().split()))
# strings = list(map(str, [input() for i in range(amount)]))

s = input()
hug = 0

for i in range(len(s)//2):
    # print(i)
    if s[i] != s[len(s)-i-1]:
        hug += 1

print(hug)


Measured memory_bytes: 2940
#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 <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

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();}

int main(){
    std::ios::sync_with_stdio(false);
    string s;
    cin >> s;
    bool easy = true;
    int n = s.length();
    for(int i=0;i<n;++i)
    {
        if(((i+1)%2) == 0)
        {
            if(s[i] == 'R')
            {
                easy = false;
            }
        }
        else
        {
            if(s[i] == 'L')
            {
                easy = false;
            }
        }
    }
    
    cout << (easy ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
//#define i_7 (long long)(1e9+7)
#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  long long n, x, m;
  cin>>n>>x>>m;
  long long now = x;
  long long l = -1, r = -1;
  vector<long long> dp(m, -1);
  vector<long long> vals(100'010, 0);
  dp[x] = 0;
  vals[0] = x;
  for(int i = 0; i <= 100'010; i++){
    if(i == 0) continue;
    now = now * now;
    now %= m;
    vals[i] = now;
    if(dp[now] >= 0){
      l = dp[now];
      r = i;
      break;
    }
    dp[now] = i;
  }
  
  long long cnt = r - l;
  long long s = 0;
  for(int i = l; i < r; i++) s += vals[i];
  long long ans = 0;
  if(n <= l){
    for(int i = 0; i < n; i++) ans += vals[i];
    cout << ans << endl;
    return 0;
  }
  for(int i = 0; i < l; i++) ans += vals[i];
  long long q = (n - l) / cnt;
  long long rem = (n - l) % cnt;
  ans += q * s;
  for(int i = 0; i < rem; i++) ans += vals[l + i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4872
import collections
mod = 998244353

N = int(input())
D = list(map(int,input().split()))

if D[0] != 0 or 0 in D[1:]:
    print(0)
    exit()

Dep = collections.Counter(D)
values, counts = zip(*Dep.most_common())
#print(values)
#print(counts)
#print(Dep)
ans = 1
for i in range(1,len(values)):
    if Dep[i-1] == 0:
        ans = 0
    ans *= pow(Dep[i-1],Dep[i], mod)
    #print(i,Dep[i])
    ans %= mod
print(ans)


Measured memory_bytes: 80948
#include<stdio.h>
int main(void)
{
	int w,h,x,y,r;
	scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
	if(x+r<=w&&y+r<=h&&x-r>=0&&y-r>=0)
	printf("Yes\n");
	else 
	printf("No\n");
	return 0;
}


Measured memory_bytes: 2052
# coding: utf-8

# In[1]:

import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))


# In[2]:

#import copy
#import numpy as np
try:
    from fractions import gcd
except:
    from math import gcd


# In[ ]:

# 左からn個の最大公約数を求める O(n)
# 右からn個の最大公約数を求める O(n)
# n個目を抜いた最大公約数は n-1個目までの公約数とn+1個目からの公約数との公約数


# In[3]:

lg = [1]*(N)
rg = [1]*(N)
#ans = 0


# In[4]:

#print(lg)
#print(rg)
#print(A)


# In[ ]:

lg[0] = A[1]
rg[0] = A[N-2]
lg[1] = A[0]
rg[1] = A[N-1]

for i in range(1, N-1):
    #print(i)
    lg[i+1] = gcd(lg[i], A[i])
    #print(lg[i], A[i])
    rg[i+1] = gcd(rg[i], A[N-1-i])
    #print(rg[N-1-i], A[N-1-i])
#print(lg, rg)

#ans = [0]*N
ans = [gcd(lg[i], rg[N-1-i]) for i in range(N)]
#for i in range(N):
    #print(i, lg[i], rg[N-i-1])
    #ans = gcd(lg[i], rg[N-i-1])
print(max(ans))


# In[6]:

#print(ans)



Measured memory_bytes: 84576
#ifndef Local
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/STACK:1024000000,1024000000")
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define popCnt(x) (__builtin_popcountll(x))
typedef long long Long;

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
  freopen("test.in", "r", stdin);
#else
#define endl '\n'
#endif

  int n, k;
  cin >> n >> k;

  cout << n - k + 1;

}


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

int main() {
  string S;
  cin >> S;

  int N = S.size();
  int count = 0;
  for(int i=0; i<N/2; i++){
    if(S.at(i)!=S.at(N-1-i)) count++;
  }
  cout << count << endl;
}



Measured memory_bytes: 256
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(declaim (ftype (function * (values fixnum &optional)) read-fixnum))
(defun read-fixnum (&optional (in *standard-input*))
  (macrolet ((%read-byte ()
               `(the (unsigned-byte 8)
                     #+swank (char-code (read-char in nil #\Nul))
                     #-swank (sb-impl::ansi-stream-read-byte in nil #.(char-code #\Nul) nil))))
    (let* ((minus nil)
           (result (loop (let ((byte (%read-byte)))
                           (cond ((<= 48 byte 57)
                                  (return (- byte 48)))
                                 ((zerop byte) ; #\Nul
                                  ;; (return-from read-fixnum 0)
                                  (error "Read EOF or #\Nul."))
                                 ((= byte #.(char-code #\-))
                                  (setf minus t)))))))
      (declare ((integer 0 #.most-positive-fixnum) result))
      (loop
        (let* ((byte (%read-byte)))
          (if (<= 48 byte 57)
              (setq result (+ (- byte 48) (* 10 (the (integer 0 #.(floor most-positive-fixnum 10)) result))))
              (return (if minus (- result) result))))))))

(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (let* ((n (read))
         (c (read))
         (timelines (make-array (list 30 100002) :element-type 'bit :initial-element 0)))
    (declare (uint32 n) (ignore c))
    (dotimes (i n)
      (let ((begin (read-fixnum))
            (end (read-fixnum))
            (channel (- (read-fixnum) 1)))
        (loop for time from begin to end
              do (setf (aref timelines channel time) 1))))
    (println (loop for time below 100002
                   maximize (loop for channel below 30
                                  sum (aref timelines channel time) of-type uint32)))))

#-swank(main)


Measured memory_bytes: 24420
package main

import(
	"fmt"
	"os"
	"bufio"
)

func main(){
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)


	defer out.Flush()

	var s string

	fmt.Fscanf(in, "%s\n", &s)

	n := len(s)
	ok := true

	for i := 0 ; i < n / 2 ; i ++ {
		if s[i] != s[n - i - 1] {
			ok = false
			break
		}
	}

	for i := 0 ; i < (n - 1) / 2 ; i ++ {
		if s[i] != s[(n - 1)/2 - i -1] {
			ok = false
			break
		}
	}

	for i := ( n + 3 ) / 2 ; i < (3 * n + 3) / 4 ; i ++ {
		if s[i] != s[n - i - 1] {
			ok = false
			break
		}
	}

	if ok == true {
		fmt.Fprintf(out, "Yes\n")
	} else {
		fmt.Fprintf(out, "No\n")
	}

}



Measured memory_bytes: 640
N, M, X, Y = map(int, raw_input().split())
x = map(int, raw_input().split())
y = map(int, raw_input().split())

# if max(x) < min(y) and X < min(y) and max(x) < Y:
#     print("No War")
# else:
#     print("War")

for z in range(-100, 101):
    if X < z and z <= Y and max(x) < z and z <= min(y):
        print("No War")
        exit(0)
print("War")


Measured memory_bytes: 2568