akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


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

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<int, int> P;
ll ma = 1000000000 + 7;
ll h, w, n,k; string s;
char maze[60][60];
int dis[101][101];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll dp[100010][2]; int x[509][509]; int c[509][509];
int gcd(int x, int y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
int main() {
	cin >> s;
	map<char, int> mp;
	for (char i = 'a'; i <= 'z'; i++) {
		mp[i] = 0;
	}
	rep(i, s.size()) {
		for (char j = 'a'; j <= 'z'; j++) {
			if (s[i] == j) {
				if (mp[j]) {
					cout << "no" << endl;
					return 0;
				}
				mp[j]++;
			}
		}
	}
	cout<<"yes"<<endl;
}




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


int main(){
  long long s;
  cin >> s;
  vector<long long>x(3,0),y(3,0);
  x[0]=0;
  y[0]=0;
  x[1]=1000000000;
  y[1]=1;
  x[2]=0;
  y[2]=1;
  while(x[1]*y[2]<s){
    y[2]++;
  }
  x[2]=x[1]*y[2]-s;
  cout << x[0] << ' ' << y[0] << ' ' << x[1] << ' ' << y[1] << ' ' << x[2] << ' ' << y[2] << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int n=0,m,ans;
    char s[200];
    bool flag = false;

    cin >> s;

    for(int i=0;s[i]!='\0';i++) n++;

    if(n==3){
        if(s[0] != s[2]) flag = true;
    }else{
        for(int i=0;i<(n-1)/2;i++){
            if((s[i] != s[(n-1)/2-1-i]) || (s[(n+3)/2-1+i] != s[n-1-i]) || (s[i] != s[(n+3)/2-1+i])){
                flag = true;
                break;
            }
        }
    }
    

    //cout << n << endl;
    cout << ((!flag)?"Yes":"No")<< endl;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    A, B, C, D = map(int, input().split())
    while True:
        C -= B
        if C <= 0:
            print('Yes')
            exit()
        A -= D
        if A <= 0:
            print('No')
            exit()

if __name__ == '__main__':
    main()


Measured memory_bytes: 9196
n = gets.to_i
c = Array.new(5) { gets.to_i }

m = Array.new(5, 0)
m[0] = c[0]
1.step(4) do |i|
  m[i] = [m[i - 1], c[i]].min
end

puts (n + m[4] - 1) / m[4] + 4

Measured memory_bytes: 14276
def main():
  n,q,*x=map(int,open(0).read().split())
  a=x[:n]
  queries=[[]for _ in[0]*n]
  for i in range(q):
    l,r=x[n+i*2],x[n+i*2+1]
    l-=1
    r-=1
    queries[r].append((l,i))
  lastAppeared=[0]*n
  bit=[0]*(n+1)
  ans=[0]*q
  for i in range(n):
    x=lastAppeared[a[i]-1]+1
    while x<=n+1:
      bit[x-1]-=1
      x+=x&-x
    x=i+2
    while x<=n+1:
      bit[x-1]+=1
      x+=x&-x
    lastAppeared[a[i]-1]=i+1
    for l,ind in queries[i]:
      x=i+2
      while x:
        ans[ind]+=bit[x-1]
        x-=x&-x
      x=l+1
      while x:
        ans[ind]-=bit[x-1]
        x-=x&-x
  print(*ans)

if __name__ == "__main__":
  main()

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

int main() {
    int n;
    cin >> n;
    bool ans = true;
    if (n/100*5 < n % 100) ans = false;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  vector<ll> X(N);
  rep(i, N) cin >> X[i];

  ll ans = 0;
  rep(i, N - 1) {
    ll dist = X[i + 1] - X[i];
    ans += min(dist * A, B);
  }

  cout << ans << endl;
}

Measured memory_bytes: 1024
N, K = map(int, input().split())


def Base_10_to_n(X, n):
    if int(X / n):
        return Base_10_to_n(int(X / n), n) + str(X % n)
    return str(X % n)


ans = Base_10_to_n(N, K)
print(len(ans))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int, int>
#define f first
#define s second 
using namespace std;

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

	vector<LL> pw(35);
	pw[0] = 1;
	for (int i = 1; i < 35; i++) {
		pw[i] = pw[i - 1] * 3;
	}

	int tc;
	cin >> tc;
	while (tc--) {
		LL x1, y1, x2, y2, ok = 1, ans;
		cin >> x1 >> y1 >> x2 >> y2;
		x1--, y1--, x2--, y2--;
		
		for (int k = 30; k >= 0; k--) {
			LL sx = x1 / pw[k], sy = y1 / pw[k];
			LL tx = x2 / pw[k], ty = y2 / pw[k];
			if (sx != tx && sy != ty) {
				break;
			}
			if (sx == tx && sx % 3 == 1 && abs(sy - ty) > 1) {
				LL xl = x1 / pw[k] * pw[k] - 1, xr = xl + pw[k] + 1;
				LL dy = abs(y2 - y1), dx = min(abs(xl - x1) + abs(x2 - xl), abs(xr - x1) + abs(x2 - xr));
				ans = dx + dy;
				ok = 0;
				break;
//				cout << "Atx " << k << ' ' << pw[k] << ' ' << xl << ' ' << xr << ' ' << dx << ' ' << y1 << ' ' << y2 << ' ' << dy << '\n';
			}
			if (sy == ty && sy % 3 == 1 && abs(sx - tx) > 1) {
				LL yl = y1 / pw[k] * pw[k] - 1, yr = yl + pw[k] + 1;
				LL dx = abs(x2 - x1), dy = min(abs(yl - y1) + abs(y2 - yl), abs(yr - y1) + abs(y2 - yr));
				ans = dx + dy;
				ok = 0;
				break;
			}
		}
		
		if (ok) {
			cout << abs(x2 - x1) + abs(y2 - y1) << '\n';
		}
		else {
			cout << ans << '\n';
		}
	}

	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n;
ll m, a[100010];

template<typename T>
T gcd(T x, T y) {
    if (y==0) return x;
    return gcd(y, x % y);
}

template<typename T>
T lcm(T x, T y) {
    T g = gcd(x, y);
    return x / g * y;
}

int main() {
    cin >> n >> m;
    rep(i, n) cin >> a[i];
    rep(i, n) a[i] /= 2;

    ll x = 1;
    rep(i, n) {
        x = lcm(x, a[i]);
        if (x > 2 * m) {
            cout << 0 << endl;
            return 0;
        }
    }
    rep(i, n) {
        if ((x / a[i]) % 2 == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    cout << (m / x + 1) / 2 << endl;
}


Measured memory_bytes: 1024
using System;

public class Test
{
	public static void Main( )
	{
		int n = int.Parse( Console.ReadLine() );
		int profit = 1-1000000000;
		int Ri = int.Parse( Console.ReadLine() );
		for( var i=1; i<n; i++ ) {
			int Rt = int.Parse( Console.ReadLine() );
			if( profit < Rt - Ri ) {
				profit = Rt - Ri;
			}
			Ri = Math.Min( Rt, Ri );
		}
		
		Console.WriteLine( profit );
	}
}

Measured memory_bytes: 9080
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

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

ans = 0
for a in A:
    while a%2==0:
        a = a//2
        ans += 1

print(ans)

Measured memory_bytes: 13220
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;

using ll = long long;
using ld = long double;
using lli = long long int;

#define PI 3.14159265358979323846264338327950L

int main(){
  int i, temp;

  for(i=0; i<5; i++){
    cin >> temp;
    if(temp == 0){
      cout << i+1 << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 998244353
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main() {
	int n;
	cin >> n;
	vector <int> A(n + 1);
	for (int i = 1; i <= n; i++) {
		cin >> A[i];
	}
	ll mx = -INF;
	int pos = -1;
	vector <int> nxt(n + 1);
	vector <ll> dp(n + 1);
	for (int i = n; i >= 1; i--) {
		dp[i] = A[i];
		nxt[i] = i;
		for (int j = i + 2; j <= n; j += 2) {
			if(dp[i] < A[i] + dp[j]) {
				dp[i] = A[i] + dp[j];
				nxt[i] = j;
			}
		}
		if(mx < dp[i]) {
			mx = dp[i];
			pos = i;
		}
	}
	cout << mx << "\n";
	int sz = n;
	vector <int> mv;
	for (int i = 1; i < pos; i++) {
		mv.push_back(1);
		sz--;
	}
	while(nxt[pos] != pos) {
		int cnt = (nxt[pos] - pos) / 2 - 1;
		while(cnt--) {
			mv.push_back(3);
			sz -= 2;
		}
		mv.push_back(2);
		sz -= 2;
		pos = nxt[pos];
	}
	for (int i = n; i > pos; i--) {
		mv.push_back(sz);
		sz--;
	}
	cout << (int) mv.size() << "\n";
	for (auto g : mv) {
		cout << g << "\n";
	}
}


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

int main() {
	int A, B;
	cin >> A >> B;
	
	if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) cout << "Possible" << endl;
	else cout << "Impossible" << endl;

	return 0;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n,k=LI()
  
  l=LI()

  a=0
  while True:
    a+=1
    if a>=n:
      f=True
      for x in list(str(a)):
        if int(x) in l:
          f=False
          break
      if f:
        return a

print(main())


Measured memory_bytes: 6432
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];


vector<edge> te[100010];
vector<edge> fe[100010];

void Solve() {
	ll x, y;
	cin >> x >> y;
	if (x % y == 0) {
		cout << -1 << endl;
		return;
	}

	for (size_t i = 2; i <= 1000; i++)
	{
		if (y % i != 0) {
			cout << (x * i) << endl;
			return;
		}
	}
}


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



Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
bool Isprime(int n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    for (int i = 3; i * i <= n; i += 2)
    {
        if (n % i == 0)
        {
            return false;
        }
    }
    return true;
}
int main()
{
    int a, d, n;
    while (cin >> a >> d >> n)
    {
        if (a == 0 && d == 0 && n == 0)
            break;
        int cnt = 0;
        while (1)
        {
            if (Isprime(a))
            {
                cnt++;
            }
            a += d;
            if (cnt == n)
            {
                cout << a - d << endl;
                break;
            }
        }
    }
}



Measured memory_bytes: 3108
n = int(input())

y = False
for cake in range(50):
    for donut in range(15):
        price = cake * 4 + donut * 7
        if price == n:
            print('Yes')
            y = True
            break
        elif price > 100:
            continue
    else:
        continue
    break
if not y:
    print('No')


Measured memory_bytes: 2940
#include<stdio.h>
int main(){
  int A,B,X,max;

  scanf("%d %d",&A,&B);
  max = A+A-1;
  if(max < A+B)max=A+B;
  if(max < B + B-1)max=B+B-1;
  printf("%d\n",max);


  return 0;
}


Measured memory_bytes: 128
x=input().split()
n=int(x[0])
k=int(x[1])
def fact_inverse(n,p):
    fact=[1]*(n+1)
    inv=[1]*(n+1)
    inv_fact=[1]*(n+1)
    inv[0]=0
    inv_fact[0]=0
    for i in range(2,n+1):
        fact[i]=(fact[i-1]*i)%p
        #compute the inverse of i mod p
        inv[i]=(-inv[p%i]*(p//i))%p
        inv_fact[i]=(inv_fact[i-1]*inv[i])%p
    return fact,inv_fact    
    

def combi2(n,p):
    f,inv=fact_inverse(n,p)
    combis=[1]*(n+1)
    for k in range(1,n+1):
        if k >=n//2+1:
            combis[k]=combis[n-k]
        else:
            combis[k]=(((f[n]*inv[n-k])%p)*inv[k])%p
    return combis    
      
    
p=10**9+7
combis1=combi2(n,p)
combis2=combi2(n-1,p)
s=0
L=min(n,k+1)
for i in range(L):
  s=(s+(combis1[i]*combis2[i])%p)%p
print(s)  


Measured memory_bytes: 31484
// dile a la jardinera que traigo flores
// corner cases // int vs ll // cin vs scanf
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define sz(x) int(x.size())
#define fill(x,v) memset(x,v,sizeof(x))
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define N 3050
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int n;
ll a[N],dp[N][N][2];

ll go(int i, int j, int t){
	ll &ans = dp[i][j][t];
	if(ans != -1) return ans;
	ans = -go(i+1,j,1-t) + a[i];
	ans = max(ans,-go(i,j-1,1-t)+a[j]);
	return ans;
}

int main(){

	fastio;
	cin >> n;
	fill(dp,-1);
	FER(i,0,n) cin >> a[i];
	FER(i,0,n) dp[i][i][0] = dp[i][i][1] = a[i];
	cout << go(0,n-1,0) << endl;

	return 0;
}


Measured memory_bytes: 145920
#include <bits/stdc++.h>
using namespace std;
#define LL long long 
#define LLU long long unsigned
#define rarr(arr, n) for(int aab = 0; aab < n; aab++){cin >> arr[aab];}
#define parr(arr, n) for(int aab = 0; aab < n; aab++){cout << arr[aab] << " ";}
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << " = " << x << "\n";
#define freopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);ios_base::sync_with_stdio(0);cin.tie(0);

int main(){
	long long int n, k, a, b, counter = 0;
	cin >> n >> k;
	bool arr[n] = {false};
	for(int i = 0; i < k; i++){
		cin >> a;
		for(int j = 0; j < a; j++){
			cin >> b;
			if(!arr[b - 1]){
				counter++;
				arr[b - 1] = true;
			}
		}
	}
	cout << n - counter;
} 

Measured memory_bytes: 3644
#include <stdio.h>
#include <stdlib.h>
 
int main(void)
{
 int n, m, i, t1, t2;
 scanf("%d %d", &n, &m);
 int* r = (int*)malloc(n * sizeof(int));
 
 for (i = 0; i < m; i++) {
  scanf("%d %d", &t1, &t2);
  r[t1 - 1]++;
  r[t2 - 1]++;
 }
 
 for (i = 0; i < n; i++) {
  printf("%d\n", r[i]);
 }
 
 free(r);
 return 0;
}

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

int main(){ 
    string in,buf; 
    int f=0,b;

    cin >> in;
    b = in.size()-1;

    while(b-f >= 1){
        buf = in[f];
        in[f] = in[b];
        in[b] = buf[0]; 
        f++;    
        b--;    
    }

    cout << in << endl;
    return 0;
}

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

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (ll i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

void solve()
{
	int n; cin >> n;
	vector<int> a(n), ac(n), b(n), bc(n);
	forn(i, n) 
	{
		cin >> a[i];
		ac[i] = a[i];
	}
	forn(i, n) 
	{
		cin >> b[i];
		bc[i] = b[i];
	}
	sort(all(a));
	sort(all(b));
	ll cnt = 0;
	bool ok = false;
	do {
		ok = true;
		for (int i = 0; i < n; ++i)
		{
			if (a[i] == ac[i]) continue;
			else 
			{
				ok = false;
			}
		}
		cnt++;
	} while (next_permutation(all(a)) && !ok);
	ll cnt2 = 0;
	ok = true;
	do
	{
		ok = true;
		for (int i = 0; i < n; ++i)
		{
			if (b[i] == bc[i])
				continue;
			else
			{
				ok = false;
				break;
			}
		}
		cnt2++;
	} while (next_permutation(all(b)) && !ok);
	cout << abs(cnt - cnt2) << endl;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}


Measured memory_bytes: 3624
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int):
    ps = []
    i = 2
    ret = 0
    def _is_p(n):
        if n < 2:
            return False
        i = 2
        while i * i <= n:
            if n % i == 0:
                return False
            i += 1
        return True

    ret = 0
    while i * i <= N:
        #if not _is_p(i):
        #    continue
        t = 0
        while N % i == 0:
            t += 1
            N //= i
        if t > 0:
            #print(i, t, N)
            j = 1
            s = 0
            while s + j <= t:
                s += j
                ret += 1
                j += 1
        i += 1

    if _is_p(N):
        ret += 1
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 63500
//union find
//DSU Disjoint Set Union
#include <iostream>
#include <vector>
#include <unordered_set>
using namespace std;

class DSU {
public:
	DSU(int _size) : size(_size) {
		rank = vector<int>(size + 1, 1);
		parent = vector<int>(size + 1, 0);
		for(int i = 0; i < size; i++)
		{
			parent[i] = i;
		}
	}

	int find(int i) {
		if(parent[i] != i)
		{
			parent[i] = find(parent[i]);
		}
		return parent[i];
	}

	bool Union(int i, int j) {
		int ri = find(i), rj = find(j);
		if(ri == rj) return false;
		if(rank[ri] > rank[rj])
		{
			parent[rj] = ri;
		}
		else if (rank[ri] < rank[rj])
		{
			parent[ri] = rj;
		}
		else
		{
			parent[rj] = ri;
			rank[ri] += 1;
		}
		return true;
	}

private:
	int size;
	vector<int> rank;
	vector<int> parent;
};

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> X(M), Y(M), Z(M);
	for(int i = 0; i < M; i++)
	{
		cin >> X[i] >> Y[i] >> Z[i];
	}

	DSU dsu(N);
	int ans = N;
	for(int i = 0; i < M; i++)
	{
		ans -= dsu.Union(X[i], Y[i]);
	}

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


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define inf LLONG_MAX/10000000
#define INF LLONG_MAX/3
#define P pair<int,int>
using namespace std;
int n,m;
signed main(){
	cin>>n>>m;
	int ans=0;
	for(int i=1;i<=sqrt(m);i++){
		if(m%i==0){
			if(i>=n)ans=max(ans,m/i);
			if(m/i>=n)ans=max(ans,i);
		}
	}
	cout<<ans<<endl;
	return 0;	
}

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

int main(int argc, char **argv)
{
	ll N; cin >> N;
	vector<ll> H(N); for (ll i = 0; i < N; ++i) cin >> H[i];

	ll res{H[0]};
	for (ll i = 0; i < N-1; ++i)
	{
		if (H[i] < H[i+1])
			res += H[i+1] - H[i];
	}
	std::cout << res << std::endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static int n, math, English, Japanese;
	static int[][] info;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO ツ篠ゥツ督ョツ青カツ青ャツつウツづェツつスツδソツッツドツ・ツスツタツブ
		while(read()){
			slove();
		}
	}
	static boolean read(){
		n = sc.nextInt();
		if(n == 0)
			return false;
		
		info = new int[n][3];
		for(int i = 0; i<n; i++){
			for(int j = 0; j<3; j++){
				info[i][j] = sc.nextInt();
			}
		}
		return true;
	}
	static void slove(){
		for(int i = 0; i < n; i++){
			math = info[i][0];
			English = info[i][1];
			Japanese = info[i][2];
			if(math == 100 || English == 100 ||
					Japanese == 100){
				System.out.println("A");
			}else if((math+English)/2 >= 90){
				System.out.println("A");
			}else if((math+English+Japanese)/3 >= 80){
				System.out.println("A");
			}else if((math+English+Japanese)/3 >= 70){
				System.out.println("B");
			}else if((math+English+Japanese)/3 >= 50 
					&& (math >= 80 || English >= 80)){
				System.out.println("B");
			}else{
				System.out.println("C");
			}
			
		}
	}

}

Measured memory_bytes: 12000
H,W=[int(s) for s in input().split()]
maze=[input() for _ in range(H)]

point=[set() for _ in range(H*W)]
n=0
numcount=0
for h in range(H):
  for w in range(W):
    if maze[h][w]=='#':
      numcount+=1
      n+=1
      continue
    if h>0 and maze[h-1][w]=='.':
      point[n].add(n-W)
    if h<H-1 and maze[h+1][w]=='.':
      point[n].add(n+W)
    if w>0 and maze[h][w-1]=='.':
      point[n].add(n-1)
    if w<W-1 and maze[h][w+1]=='.':
      point[n].add(n+1)
    n+=1

def dfs(num):
  reach=[num]
  check=[-1 for _ in range(H*W)]
  check[num]=0
  while reach:
    v=reach.pop(0)
    for e in point[v]:
      if not(e in reach) and check[e]==-1:
        reach.append(e)
        check[e]=check[v]+1
  return(max(check))

n=0
ans=set()
for h in range(H):
  for w in range(W):
    if maze[h][w]=='.':
      ans.add(dfs(n))
    n+=1
print(max(ans))


Measured memory_bytes: 3064
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
int n;
int t[500];
int M=256;

int r[500],o[500];
double entro(int s,int a,int c){
	rep(i,500)r[i]=o[i]=0;
	r[0]=s;
	for(int i=1;i<=n;i++)r[i]=(a*r[i-1]+c)%M;
	for(int i=1;i<=n;i++)o[(t[i-1]+r[i])%M]++;
	double h=0;
	for(int i=0;i<M;i++){
		if(o[i]==0)continue;
		double sa=(double)o[i]/(double)n;

		h-=sa*(log(sa));
	}
	return h;
}
int main(){
while(cin>>n,n){
double ma=1000000;
int as=0,aa=0,ac=0;
rep(i,500)t[i]=0;

rep(i,n)cin>>t[i];

rep(s,16){
	rep(a,16){
		rep(c,16){
			if(entro(s,a,c)+0.00000001<ma){
				ma=entro(s,a,c);
				//cout<<s<<" "<<a<<" "<<c<<entro(s,a,c)<<endl;
				as=s;
				aa=a;
				ac=c;
			}
		}
	}
}
//cout<<entro(8,7,14)<<" "<<entro(1,7,12)<<endl;
cout<<as<<" "<<aa<<" "<<ac<<endl;
}

	return 0;
}


Measured memory_bytes: 3208
M=10**9+7;F=lambda X:pow(X,M-2,M);H,W,A,B=map(int,input().split());Z=C=1
for I in range(H-1):Z=C=C*(W+H-B-2-I)*F(I+1)%M
for I in range(1,H-A):C=C*(B-1+I)*F(I)*(H-I)*F(W+H-B-1-I)%M;Z=(Z+C)%M
print(Z)

Measured memory_bytes: 46060
import math

D, G = [int(x) for x in input().split()]
P = [[int(x) for x in input().split()] for i in range(D)]

min_ = 1e+8
for bit in range(2**D):
  score = 0
  n_solved = 0
  rest = -1
  for i in range(D):
    if bit >> i & 1: 
      score += (i + 1) * 100 * P[i][0] + P[i][1]
      n_solved += P[i][0]
    else:
      rest = i
  if G > score:
    s1 = 100 * (rest + 1)
    need = (G - score + s1 - 1) // s1
    if need >= P[rest][0]:
      continue
    n_solved += need
  min_ = min(min_, n_solved)
print(min_)
  

Measured memory_bytes: 3064
n = int(input())
p = list(map(int,input().split()))
count = 0
i = 0

while(i!=n):
    if p[i]!=i+1:
        i+=1
        continue
    else:
        if i==n:
            p[i],p[i-1]=p[i-1],p[i]
        else:
            for j in range(i+1,n):
                if p[j]==j:
                    continue
                p[i],p[j]=p[j],p[i]
                break
        count +=1
        i+=1

print(count)


Measured memory_bytes: 14008
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String b = sc.next();
		
		if (b.equals("A")) {
			System.out.println("T");
		} else if (b.equals("T")) {
			System.out.println("A");
		} else if (b.equals("C")) {
			System.out.println("G"); 
		} else {
			System.out.println("C");
		}


	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <vector>
using namespace std;
int max(int a, int b){
	return a > b ? a : b;
}
int main(){
	int n;
	cin >> n;
	vector<int>a(n), b(n), c(n);
	for (int i = 0; i < n; i++) 
		cin >> a[i] >> b[i] >> c[i];
	vector<vector<int>> dp(2, vector<int>(3, 0));
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	for (int i = 1; i < n; i++){
		dp[1][0] = max(dp[0][1] + a[i], dp[0][2] + a[i]);
		dp[1][1] = max(dp[0][0] + b[i], dp[0][2] + b[i]);
		dp[1][2] = max(dp[0][1] + c[i], dp[0][0] + c[i]);
		dp[0][0] = dp[1][0];
		dp[0][1] = dp[1][1];
		dp[0][2] = dp[1][2];
	}
	cout << max(dp[0][0], max(dp[0][1], dp[0][2]));
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>

using namespace std;

struct Node {
	int key;
	Node *right, *left, *parent;
};

Node *root, *NIL;

Node * find(Node *u, int k) {
	while(u != NIL && k != u->key) {
		if(k < u->key) u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;
	
	z = (Node *)malloc(sizeof(Node));
	z->key   = k;
	z->left  = NIL;
	z->right = NIL;
	
	while(x != NIL) {
		y = x;
		if(z->key < x->key) {
			x = x->left;
		} else {
			x = x->right;
		}
	}
	
	z->parent = y;
	if(y == NIL) {
		root = z;
	} else {
		if( z->key < y->key) {
			y->left = z;
		} else {
			y->right = z;
		}
	}
}

void inorder(Node *u) {
	if(u == NIL) return;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}
void preorder(Node *u) {
	if(u == NIL) return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}
	
int main(void) {
	int n, i, x;
	string com;
	scanf("%d",&n);
	
	for(i=0;i<n;i++) {
		cin >> com;
		if(com[0] == 'f') {
			scanf("%d",&x);
			Node *t = find(root,x);
			if(t != NIL) printf("yes\n");
			else printf("no\n");
		} else if(com == "insert") {
			scanf("%d",&x);
			insert(x);
		} else if(com == "print") {
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}

	return 0;
}


Measured memory_bytes: 21948
N, A, B= list(map(int, input().split()))
ans = 0
digsum = 0
for i in range(1,N+1):
  if i<10:
    digsum = i
  elif i <100:
    dig1 = i%10
    dig2 = ((i%100)-dig1)/10
    digsum = dig1 + dig2
  elif i < 1000:
    dig1 = (i%10)
    dig2 = ((i%100)-dig1)/10
    dig3 = i//100
    digsum = dig1 + dig2 + dig3
  elif i < 10000:
    dig1 = (i%10)
    dig2 = ((i%100)-dig1)/10
    dig3 = ((i%1000) - dig2*10 - dig1)/100
    dig4 = i//1000
    digsum = dig1 + dig2 + dig3 + dig4
  else:
    digsum = 1
  if (digsum>=A) and (digsum<=B):
    ans += i
print(ans)

Measured memory_bytes: 68996
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

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

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail {
template <typename T, std::size_t NDIMS>
struct vector_builder {
  using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
    if (!dims.empty()) dims.pop_back();
    return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
  }
};

template <typename T>
struct vector_builder<T, 1> {
  using type = std::vector<T>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    return type(dims.empty() ? 0 : dims.back(), v);
  }
};
}  // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T& v, SIZE_T... dims) {
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T& data, vector<int>& iter) {
  cout << data << " ";
}
template <typename T>
void dump(const vector<T>& data, vector<int>& iter) {
  for (auto elem : data) dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>>& data, vector<int>& iter) {
  for (auto elem : iter) {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++) {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T>& data, int dummy) {
  for (int i = 0; i < data.size(); i++) {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T& data) {  // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

void solve(long long T, long long X) { printf("%.10lf\n", (double)T / X); }

int main() {
  long long T;
  scanf("%lld", &T);
  long long X;
  scanf("%lld", &X);
  solve(T, X);
  return 0;
}


Measured memory_bytes: 256
from collections import Counter

N = int(input())
S = input()
res = 1

cc = Counter(S)
if len(cc) < 3:
    res = 0
else:
    for i in cc.values():
        res *= i

k = 1
while k <= N/2:
    for i in range(N-2*k):
        if S[i] != S[i+k] and S[i+k] != S[i+2*k] and S[i] != S[i+2*k]:
            res -= 1
    k+=1

print(res)

Measured memory_bytes: 9468
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto ny = readln.chomp.split.to!(int[]);
  auto n = ny[0];
  auto y = ny[1];

  auto f = true;
  a:foreach (i; 0..n+1) {
    foreach (j; 0..n-i+1) {
      auto k = n - i - j;
      if (i * 10000 + j * 5000 + k * 1000 == y) {
        writefln("%d %d %d", i, j, k);
        f = false;
        break a;
      }
    }
  }

  if (f) {
    writeln("-1 -1 -1");
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    int n,m,li,ri;
    
    cin>>n>>m;
    int mn=n+1,mx=0;
    rep(i,m){
        cin>>li>>ri;
        mx=max(li,mx);
        mn=min(ri,mn);
    }
    cout<<max(0,mn-mx+1)<<endl;
    return 0;
}


Measured memory_bytes: 256
import math
n = int(input())
list_prime = [2]
for i in range(3, n + 1):
  for one_prime in list_prime:
    if i % one_prime == 0:
      break
  else:
    list_prime.append(i)

result = 1
for one_prime in list_prime:
  temp = 0
  for i in range(1, int(math.log(n, one_prime)) + 1):
    temp += n // (one_prime ** i)
  result = result * (temp + 1) % (7 + 10 ** 9)
print(result)

Measured memory_bytes: 3064
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)     (x).begin(),(x).end()
# define UNIQ(c)    (c).erase(unique(ALL((c))), end((c)))
# define mp         make_pair
# define eb         emplace_back
# define FOR(i,a,b) for(int i=(a);i<(b);++i)
# define REP(i,n)   FOR(i,0,n)
# define INIT       std::ios::sync_with_stdio(false);std::cin.tie(0);

int dp[2][2][5001], a[9999];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < 2; i++)for (int j = 0; j < 2; j++)for (int k = 0; k <= 5000; k++)dp[i][j][k] = INF;
	dp[0][0][0] = 0;
	for (int i = 1; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= min(n / 2, i); j++) {
			dp[(i + 1) & 1][0][j + 1] = min(dp[i & 1][0][j], dp[i & 1][1][j] + a[i]);
			dp[(i + 1) & 1][1][j] = min(dp[i & 1][1][j], dp[i & 1][0][j] + a[i]);
		}
		dp[(i + 1) & 1][0][0] = INF;
	}
	cout << min(dp[(n / 2) % 2][0][n / 2], dp[(n / 2) % 2][1][n / 2]) << endl;
}

Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;

int main(){
    int n;
    cin >> n;
    n %= 10;
    if(n==2||n==4||n==5||n==7||n==9){
        cout << "hon" << endl;
    }else if(n==0||n==1||n==6||n==8){
        cout << "pon" << endl;
    }else{
        cout << "bon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>

int main(void)
{
 
    long int n,t,x,i,a,ans=0,sum;
    
    scanf("%ld %ld",&n,&t);
    
    for(i=0;i<n;i++){
        scanf("%ld ",&a);
        if(a<=t)x=a;
        else{
            
            sum=a-ans;
            if(sum>=t)x=x+t;
            else{x=x+sum;}
            ans=a;
        }
    }
    x=x+t;
    printf("%ld\n",x);
    
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){int a,b;scanf("%d%d",&a,&b);double ret=0;for(int i=1;i<=a;i++){double tmp=1.0/a;int now=i;while(now<b){now*=2;tmp/=2;}ret+=tmp;}printf("%.12f\n",ret);}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    string s; cin >> s;
    string ans;
    
    if(s=="Sunny"){
        ans = "Cloudy";
    }else if(s=="Cloudy"){
        ans = "Rainy";
    }else{
        ans = "Sunny";
    }
    cout << ans << ln;
    return 0;
}

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

int main() {
  string n; cin >> n;
  int digit_sum;
  if (n.size() == 1) digit_sum = n[0] - '0';
  else {
    string tmp = "";
    for (int i = 0; i < n.size() - 1; ++i) tmp.append("9");
    if (n.substr(1, n.size() - 1) == tmp) digit_sum = n[0] - '0' + 9 * (n.size() - 1);
    else digit_sum = n[0] - '1' + 9 * (n.size() - 1);
  }
  cout << digit_sum << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <cstring>
using namespace std;
int c, n, m, s, d;

int field[101][101];
int visited[11][101];

int main () {
	while (cin >> c >> n >> m >> s >> d, c || n || m || s || d) {
		memset(field, 0x3, sizeof(field));
		memset(visited, 0x3, sizeof(visited));
		for (int i = 0; i < m; i++) {
			int a, b, f;
			cin >> a >> b >> f;
			field[a][b] = field[b][a] = f / 10;
		}
		priority_queue<pair<int, pair<int, int> >, vector<pair<int, pair<int, int> > >, greater<pair<int, pair<int, int> > > > q;
		q.push(make_pair(0, make_pair(c, s)));
		while (!q.empty()) {
			pair<int, pair<int, int> > current = q.top();
			q.pop();
			if (current.second.second == d) {
				cout << current.first * 10 << endl;
				break;
			}
			for (int i = 1; i <= n; i++) {
				if (current.first + field[current.second.second][i] < visited[current.second.first][i]) {
					int next = current.first + field[current.second.second][i];
					q.push(make_pair(next, make_pair(current.second.first, i)));
					visited[current.second.first][i] = next;
				}
				if (current.second.first > 0 && current.first + field[current.second.second][i] / 2 < visited[current.second.first - 1][i]) {
					int next = current.first + field[current.second.second][i] / 2;
					q.push(make_pair(next, make_pair(current.second.first - 1, i)));
					visited[current.second.first - 1][i] = next;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1292
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

R = INT()
print(2*R*pi)

Measured memory_bytes: 9980
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
int main() {
	int N;
	cin >> N;
	vector<ll> A(N);
	rep(i, 0, N)cin >> A[i];
	sort(all(A));
	int i;
	for (i = 0; i < N - 1; i += 2) {
		if (A[i + 1] > 0)break;
		A[i] *= -1;
		A[i + 1] *= -1;
	}
	ll s = 0;
	rep(i2, 0, N)s += A[i2];
	if (i + 1 < N)s = max(s, s - (A[i] + A[i + 1]) * 2);
	printf("%lld\n", s);
	return 0;
}


Measured memory_bytes: 1024
from sys import stdin
h, w = [int(x) for x in stdin.readline().rstrip().split()]
matrix = [stdin.readline().rstrip() for _ in range(h)]
for i in range(h):
    matrix[i] = [matrix[i][x:x+1] for x in range(len(matrix[i]))]
    #matrix[i] = [0 if x == '.' else x for x in matrix[i]]
#print(matrix)
for i in range(h):
    for j in range(w):
        if matrix[i][j] == '#':
            flag = 0
            for n in list([-1, 1]):
                i_n = i + n
                j_n = j + n
                if i_n >= 0 and i_n < h:
                    if matrix[i_n][j] == '#':
                        flag = 1
                        break
                if j_n >= 0 and j_n < w:
                    if matrix[i][j_n] == '#':
                        flag = 1
                        break
            if flag == 0:
                print('No')
                exit()
print('Yes')
#print(*matrix, sep = '\n')



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define PI 3.1415926535
const long long int MOD = 1000000007;
#define pb push_back
#define mp make_pair
#define fill(a)  memset(a, 0, sizeof (a))
#define SORT(v)  sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define MAX(v) *max_element(v.begin(), v.end())
#define MIN(v) *min_element(v.begin(), v.end())
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define watch(x) cout << (#x) << " is " << (x) << endl;
const long long int MAXX = 2e6 + 5;
const long long int MINN = 2e5 + 5;
const long long int inf = 1e6;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef pair<int,ii> iii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector< iii > viii;

ll lcm(ll a, ll b) {
   return a / __gcd(a, b) * b;
}
int XOR(int x, int y){
  return (x | y) & (~x | ~y);
}
bool cmp(const pair<int,int> &a,const pair<int,int> &b) {
    return (a.second < b.second);
}
// bool isl = binary_search(x.begin(), x.end(), 5);
// __builtin_popcount(x)  - Returns the number of set bits in x
const long long int N = 10050;
const int MAXN = 105;
int binsearch(int lo, int hi){
	while(lo<hi){
		int mid=(lo+hi)/2;
		if((mid))   // check(mid)
			hi=mid;
		else
			lo=mid+1;
	}
	return lo;
}
ll power(ll x,ll y){
    ll res=1;
    while(y>0){
      if(y&1) res=((res*x));

      y/=2;
      x=((x*x));
    }
    return res;
}
map<int,int> m;
int main(){
    FAST
    int n;
    string s;
    cin>>n>>s;
    vi r,g,b;
    m[0]=0;
    for(int i=0;i<n;i++){
        m[i+1]=0;
        m[2*(i+1)] = 0;
        if(s[i]=='R') r.pb(i+1);
        else if(s[i]=='G') g.pb(i+1);
        else {b.pb(i+1); m[i+1] = 1;}
    }
    int sz = b.size();
    ll ans = 0;
    for(int i=0;i<r.size();i++){
        for(int j=0;j<g.size();j++){
            int mn = min(g[j],r[i]);
            int mx = max(g[j],r[i]);
            vector<int>::iterator lower,upper;
            lower = lower_bound(b.begin(),b.end(),mx);
            upper = upper_bound(b.begin(),b.end(),mn);
            int cnt1 = 0;
            if(lower - b.begin() == sz){
                cnt1 = 0;
            }
            else {
                cnt1 = sz - (lower - b.begin());
                if(m.count(2*mx - mn) && m[2*mx-mn]) ans += cnt1-1;
                else ans+= cnt1;
            }
            int cnt2= 0;
            if(upper - b.begin() == 0){
                cnt2 = 0;
            }
            else{
                cnt2  = (upper - b.begin());
                if(m.count(2*mn - mx) && m[2*mn -mx]) ans+=cnt2 -1;
                else ans+= cnt2;
            }
            int cnt3= 0;
            cnt3 = sz-cnt1-cnt2;
            if((mn+mx)%2 ==0 && m.count((mn+mx)/2) && m[(mn+mx)/2]) ans+=cnt3-1;
            else ans+=cnt3;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3840
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll a, b, c; cin >> a >> b >> c;
    ll d = c-a-b;

    if(d > 0 && 4*a*b < d*d)cout << "Yes" << ln;
    else cout << "No" << ln;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 				acos(-1)
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define MOD				1000000007
#define MOD1			998244353
#define EPS				1e-9
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)

using namespace std;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
const int tam = 10000010;

int main()
{
	//ios::sync_with_stdio(false); cin.tie(0);
	//freopen("asd1.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	ll a, b;
	cin>>a>>b;
	ll res = 0;
	fore(i, 1, 50)
	{
		ll po = 1ll << i;
		ll ca = a / po * po / 2 + max((a % po) - po / 2 , 0ll);
		ll cb = b / po * po / 2 + max((b % po) + 1 - po / 2, 0ll);
		/*if(i < 5)
			cout<<i<<' '<<ca<<' '<<cb<<'\n';*/
		res |= ((cb - ca) & 1ll) << (i - 1);
	}	
	cout<<res<<'\n';
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2

Measured memory_bytes: 256
fun main(args : Array<String>) {
    val (h, w) = readLine()!!.split(' ').map(String::toInt)
    val s = Array(h) { readLine()!! }
    for (i in 0 .. h - 1) {
        val sb = StringBuilder("")
        for (j in 0 .. w - 1) {
            sb.append(if (s[i][j] == '#' || isBlue(i, j, h, w)) '#' else '.')
        }
        println(sb)
    }
    println()
    for (i in 0 .. h - 1) {
        val sb = StringBuilder("")
        for (j in 0 .. w - 1) {
            sb.append(if (s[i][j] == '#' || !isBlue(i, j, h, w)) '#' else '.')
        }
        println(sb)
    }
}

fun isBlue(i : Int, j : Int, h : Int, w : Int) : Boolean {
    return j == 0 || j != w - 1 && i % 2 == 0
}

Measured memory_bytes: 27012
#include "bits/stdc++.h"
using namespace std;
const int maxn = 2e5 + 10;
int n;
pair<int, int> a[maxn], b[maxn];
int main()
{
	cin>>n;
	for(int i = 1; i <= n; i++)
	{
		cin>>a[i].first>>a[i].second;
		b[i] = make_pair(a[i].second, a[i].first);
	}
	sort(a + 1, a + 1 + n);
	sort(b + 1, b + 1 + n);
	if(n & 1)
	{
		int ans1 = b[(n + 1) / 2].first, ans2 = a[(n + 1) / 2].first;
		cout<<ans1 - ans2 + 1<<endl;
	}
	else
	{
		int ans1 = b[n / 2 + 1].first + b[n / 2].first, ans2 = a[n / 2 + 1].first + a[n / 2].first;
		cout<<ans1 - ans2 + 1<<endl;
	}
	return 0;
}
/*
3
3 7
2 4
1 6
output:5
*/

Measured memory_bytes: 6716