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

using namespace std;
typedef long long ll;
typedef long double ld;
using graph = vector<vector<int>>;

#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()
#define size(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000

#define pb push_back
#define mp make_pair
#define f first
#define s second

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

int main(){
	int n,k;cin>>n>>k;
	double ans=0;
	FOR(i,1,n){
		int j=1;
		double c=1.0/n;
		while(i*j<k){
			j*=2;
			c/=2;
		}
		ans+=c;
	}
	printf("%.15lf",ans);
	cout<<endl;
}



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

#define REP(i,n) for (int i=0;i<(n);i++)

using namespace std;

class binary_indexed_tree {
    private:
        int size;
        long long *a;
    public:
        binary_indexed_tree(int n);
        void add(int i, long long x);
        long long sum(int i);
};

binary_indexed_tree::binary_indexed_tree(int n)
{
    size = n;
    a = new long long[n]();
}

void binary_indexed_tree::add(int i, long long x)
{
    for (int j = i; j < size; j |= j + 1) {
        a[j] += x;
    }
}

long long binary_indexed_tree::sum(int i)
{
    long long result = 0;
    for (int j = i; j >= 0; j = (j & (j + 1)) - 1) {
        result += a[j];
    }
    return result;
}

unsigned long long count_inversions_int(int *first, int *last, int max) {
    unsigned long long result = 0;
    binary_indexed_tree bit(max);
    for (int *it = last - 1; it >= first; --it) {
        result += bit.sum(*it-1);
        bit.add(*it, 1);
    }
    return result;
}

template <class Iterator>
unsigned long long count_inversions(Iterator first, Iterator last) {
    int size = distance(first, last);
    typedef typename iterator_traits<Iterator>::value_type T;
    pair<T, int> *a = new pair<T, int>[size];
    for (int i = 0; i < size; ++i) {
        a[i] = pair<T, int>(*(first + i), i);
    }
    sort(a, a + size);
    int *b = new int[size];
    for (int i = 0; i < size; ++i) {
        b[a[i].second] = i;
    }
    return count_inversions_int(b, b + size, size);
}

int main(void)
{
    int n;
    int a[200000];
    cin >> n;
    REP(i, n) cin >> a[i];
    cout << count_inversions(a, a + n) << endl;
    return 0;
}


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

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IEP(i,b,n) for(int i=b;i>=n;i--)
#define iep(i,b) IEP(i,b,0)

const string nesw = "NESWRL";
int n;

void solve() {
  int dice[4][3] = {
    {4,1,3},
    {0,2,0},
    {0,6,0},
    {0,5,0}
  };
  
  int res = 1;
  rep(i,n) {
    string order; cin>>order;
    int o = nesw.find(order[0]);
    switch (o) {
      case 0: {
        int t = dice[0][1];
        rep(j,3) dice[j][1] = dice[j+1][1];
        dice[3][1] = t;
        break;
      }
      case 1: {
        int t = dice[0][2];
        dice[0][2] = dice[0][1];
        dice[0][1] = dice[0][0];
        dice[0][0] = dice[2][1];
        dice[2][1] = t;
        break;
      }
      case 2: {
        int t = dice[3][1];
        IEP(j,3,1) dice[j][1] = dice[j-1][1];
        dice[0][1] = t;
        break;
      }
      case 3: {
        int t = dice[0][0];
        dice[0][0] = dice[0][1];
        dice[0][1] = dice[0][2];
        dice[0][2] = dice[2][1];
        dice[2][1] = t;
        break;
      }
      case 4: {
        int t = dice[0][0];
        dice[0][0] = dice[1][1];
        dice[1][1] = dice[0][2];
        dice[0][2] = dice[3][1];
        dice[3][1] = t;
        break;
      }
      case 5: {
        int t = dice[0][2];
        dice[0][2] = dice[1][1];
        dice[1][1] = dice[0][0];
        dice[0][0] = dice[3][1];
        dice[3][1] = t;
        break;
      }
    }
    /*
    cout<<dice[0][1]<<endl;
    rep(j,3) cout<<dice[0][j];
    cout<<endl;
    REP(j,1,4) cout<<" "<<dice[j][1]<<endl;
    */
    res += dice[0][1];
  }
  cout<<res<<endl;
  //cout<<"+++++"<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>n, n) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
const int mod=1e9+7;
int main()
{
	int n,k;
	scanf("%i %i",&n,&k);
	vector<int> a(n+1);
	int ans=0;
	for(int i=1;i<=n;i++) scanf("%i",&a[i]);
	int inv=0;
	for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++) if(a[i]>a[j]) inv++;
	ans=(ll)inv*k%mod;
	sort(a.begin()+1,a.end());
	for(int i=1,j=1;i<=n;i=j)
	{
		int c=0;
		for(j=i;j<=n && a[i]==a[j];j++) c++;
		int lo=i-1;
		ans+=((ll)k*(k-1)/2)%mod*c%mod*lo%mod;
		if(ans>=mod) ans-=mod;
	}
	printf("%i\n",ans);
	return 0;
}

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

int main()
{
  int N, M;
  cin >> N >> M;
  vector<vector<int>> adj(N);
  for (int i = 0; i < M; i++)
  {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    adj.at(a).push_back(b);
    adj.at(b).push_back(a);
  }
  vector<int> p(N);
  queue<int> que;
  vector<bool> d(N, false);
  p.at(0) = -1;
  que.push(0);
  d.at(0) = true;
  while (!que.empty())
  {
    int u = que.front();
    que.pop();
    for (int i = 0; i < adj.at(u).size(); i++)
    {
      int v = adj.at(u).at(i);
      if (d.at(v))
      {
        continue;
      }
      d.at(v) = true;
      p.at(v) = u;
      que.push(v);
    }
  }
  cout << "Yes" << endl;
  for (int i = 1; i < N; i++)
  {
    cout << p.at(i) + 1 << endl;
  }
}

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

using namespace std;

int main(){
	int n,sum,a,b,c,d;
	string S;
	string T;
	string U;

	cin>>n;
	cin>>S;
	c=S.size();
	sum=0;

	for(int i=0;i<n;i++){
		cin>>T;
		b=T.size();
		for(int j=1;j<b;j++){
			for(int k=0;k<b;k++){
				if(k+j*(c-1)>=b){
					goto Exit1;
				}
				a=0;
				d=0;
				U="";
				for(int l=k;l<k+j*c;l+=j){
					U += T[l];
				}
				if(U==S){
					goto Exit2; 
				}
			}
Exit1:;
		}
		goto Exit3;
Exit2:;
		sum++;
Exit3:;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
struct fastio { fastio () { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } _io;
template<class T, class U> bool chmax(T& a, const U &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> bool chmin(T& a, const U &b) { if (a > b) { a = b; return 1; } return 0; }

constexpr int MAX = 200;

int main() {
    int n;
    cin >> n;
    vector<int> ans(n + 1, 0);
    for (int x = 1; x <= MAX; x++) {
        for (int y = 1; y <= MAX; y++) {
            for (int z = 1; z <= MAX; z++) {
                int val = x * x + y * y + z * z + x * y + y * z + z * x;
                if (val <= n) ans[val]++;
            }
        }
    }

    for (int i = 1; i <= n; i++) {
        cout << ans[i] << '\n';
    }
}

Measured memory_bytes: 3664
using System;
using System.Linq;

namespace ABC176
{
    class Program
    {
        static void Main()
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            Console.WriteLine((int)Math.Ceiling((double)input[0] / input[1]) * input[2]);
        }
    }
}


Measured memory_bytes: 28256
package main

import (
	"fmt"
)

func main() {
	var N, M int
	fmt.Scanf("%d %d", &N, &M)
	sum := 0
	for i := 0; i < M; i++ {
		var n int
		fmt.Scanf("%d", &n)
		sum += n
	}
	if sum > N {
		fmt.Println("-1")
		return
	}
	fmt.Println(N - sum)
}


Measured memory_bytes: 2544
using System;

public class P
{
    public int n { get; set; }
    public int m { get; set; }
    public int[] got { get; set; }
    public int p { get; set; }
}

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        var c = Array.ConvertAll(line, int.Parse);
        var w = new P { n = n, m = m, got = new int[6], p = 0 };
        var ans = goDfs(c, w);
        if (ans) print(w);
        else Console.WriteLine("NA");
    }
    static void print(P w)
    {
        for (int i = 1; i <= w.p; i++)
            Console.Write(w.got[i]);
        Console.WriteLine();
    }
    static bool goDfs(int[] c, P w)
    {
        if (w.n == 0) return true;
        var ok = false;
        for (int i = 0; i <= 9; i++)
            if (c[i] <= w.m && w.n > 0)
            {
                w.n--;
                w.m -= c[i];
                w.p++;
                w.got[w.p] = i;
                if (goDfs(c, w)) { ok = true; break; }
                else
                {
                    w.n++;
                    w.m += c[i];
                    w.p--;
                }
            }
        return ok;
    }
}



Measured memory_bytes: 20008
#include<vector>
#include<queue>
#include<functional>
#include<algorithm>
#include<set>
#include<iostream>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef tuple<int,int,int> t3;

const int MX = 2005;
const int MM = 1000000007;

int D[MX][MX];
int F[MX*MX], FI[MX*MX], I[MX*MX];
int N, K;

ll C(int x, int y){
	if( y < 0 || x < y ) return 0;
	return (ll)F[x] * FI[y] % MM * FI[x-y] % MM;
}

int main()
{
	F[0] = FI[0] = I[1] = 1;
	for(int i = 1; i < MX*MX; i++){
		F[i] = (ll)F[i-1] * i % MM;
		if(i>=2) I[i] = (ll)I[MM%i] * (MM - MM/i) % MM;
		FI[i] = (ll)FI[i-1] * I[i] % MM;
	}
	scanf("%d%d", &N, &K); K--;
	if( K == 0 ) return !printf("1\n");
	D[0][0] = 1;
	for(int i = 0; i <= N; i++){
		for(int j = 0; j <= N; j++){
			if(i) D[i][j] = (D[i][j] + D[i-1][j]) % MM;
			if(j) D[i][j] = (D[i][j] + C(i+j*K-1, K-1) * D[i][j-1]) % MM;
			if( i > j ) D[i][j] = 0;
		}
	}
	printf("%lld\n", D[N][N] * (ll)F[N] % MM);
}


Measured memory_bytes: 62976
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=1e9+7;
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;res%=MOD;
    n*=n;n%=MOD;
    k>>=1;
  }
  return res;
}
std::vector<int> Factorial(5e6),Finverse(5e6);
inline void Cinit(){// limit is 5e6 /// write pw /// this takes 792ms at AtCoder
  Factorial[0]=1;
  for(int i=1;i<5e6;i++)Factorial[i]=Factorial[i-1]*i%MOD;
  for(int i=0;i<5e6;i++)Finverse[i]=pw(Factorial[i],MOD-2);
}
int nCk(int n,int k){
  if(n<k)return 0;if(k<0)return 0;
  if(!Factorial[0])Cinit();
  int res=Factorial[n];
  res*=Finverse[k];res%=MOD;
  res*=Finverse[n-k];res%=MOD;
  return res;
}

signed main(){
  int n;cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  vector<int> w(n+1,0);
  for(int i=0;i<n;i++)w[i+1]=v[i]+w[i];
//  for(int p:w)cout<<p<<" ";cout<<endl;
  int ans=0;
  int L=nCk(1,1);
  for(int j=1;j<n-1;j++){
    int A=w[n]-w[n-j]-(w[j]-w[0]);
    //cout<<"A"<<A<<endl;
    A%=MOD;A+=MOD;A%=MOD;
    A-=v[n-1]-v[n-1-j];A+=MOD;
    A*=Factorial[j-1];A%=MOD;
    A*=Factorial[n-1-(j+1)];A%=MOD;
    A*=nCk(n-1,j+1);A%=MOD;
    ans+=A;ans%=MOD;
    A=v[n-1]-v[n-1-j];A%=MOD;A+=MOD;A%=MOD;
    A*=nCk(n-1,j);A%=MOD;
    A*=Factorial[j-1];A%=MOD;
    A*=Factorial[n-1-j];A%=MOD;
    ans+=A;ans%=MOD;
    //cout<<ans<<endl;
  }
  int j=n-1;
  int A=v[n-1]-v[n-1-j];A%=MOD;A+=MOD;A%=MOD;
  A*=nCk(n-1,j);A%=MOD;
  A*=Factorial[j-1];A%=MOD;
  A*=Factorial[n-1-j];A%=MOD;
  ans+=A;ans%=MOD;
  cout<<ans<<endl;
}


Measured memory_bytes: 80000
#include<iostream>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
#define MaxN 100002
int n;
vector<long long >d;
vector<int>v[MaxN];
map<long long,int>mp;
int sz[MaxN];
bool vis[MaxN];
long long dp[MaxN];
int cnt[MaxN];
inline void dfs(int now,int par=-1){
    cnt[now]++;
    vis[now]=true;
    for(int go:v[now]){
        if(go == par)continue;
        if(vis[go]){
            printf("-1\n");
            exit(0);
        }
        dfs(go,now);
        dp[now] += dp[go] + cnt[go];
        cnt[now] += cnt[go];
    }
} 
long long int ans[MaxN];
inline void dfs2(int now,int par=-1,long long size = 0){
    ans[now] =dp[now]+size;
    size+=dp[now];
    for(int go:v[now]){
        if(go == par)continue;
        long long tmp = size - dp[go]-cnt[go]+(n-cnt[go]) ;
        dfs2(go,now,tmp);
    }
}
vector<pair<int,int>>ed;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    long long x;
    for(int i=0;i<n;i++){
        cin>>x;
        mp[x]=i;
        d.push_back(x);
    }
    for(auto it = mp.rbegin();it!=mp.rend();it++){
        int node = (*it).second;
        long long val = (*it).first;
        sz[node]++;
        long long op = n-sz[node];
        if(op==0)continue;
        long long nex = val + sz[node]- op;
        if(mp.count(nex)){
            int ne = mp[nex];
            sz[ne]+=sz[node];
            v[ne].push_back(node);
            v[node].push_back(ne);
            if(ne > node)swap(ne,node);
            ed.push_back(make_pair(ne+1,node+1));
        }
    }
    dfs(0);
    dfs2(0);
    for(int i=0;i<n;i++){
        if(vis[i]==false){
            puts("-1");
            return 0;
        }
        if(ans[i]!=d[i]){
            puts("-1");
            return 0;
        }
    }
    for(int i = 0; i<ed.size();i++){
        cout<<ed[i].first<<' '<<ed[i].second<<endl;
    }
    return 0;
}

Measured memory_bytes: 20212
#include<bits/stdc++.h>
//#define IORD
#define eps 1e-8
#define inf 0x3f3f3f3f
#define mod (1000000007)

using namespace std;
typedef long long LL;
typedef pair<int,int> pp;

int n,x[110],y[110],h[110],ax,ay,ah;

void Sol(int ind)
{
    int fg=1;
    for(int i=0;i<=100;i++)
    {
        for(int j=0;j<=100;j++)
    {
        ax=i,ay=j;
        fg=1;
        ah=h[ind]+abs(i-x[ind])+abs(j-y[ind]);
        for(int k=0;k<n;k++)
        {
            if(max(ah-abs(i-x[k])-abs(j-y[k]),0)!=h[k])
            {
                fg=0;
                break;
            }
        }
        if(fg) break;
    }
    if(fg) break;
    }
    cout<<ax<<" "<<ay<<" "<<ah<<endl;
}

int main()
{
    #ifdef IORD
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif // IORD
    cin>>n;
    int ind=0;
    for(int i=0;i<n;i++)
    {
        cin>>x[i]>>y[i]>>h[i];
        if(h[i]) ind=i;
    }
    Sol(ind);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int i, j, k, n, m, max = 0, maxn;
  scanf("%d%d", &n, &m);
  int a[n], b[m], cnt[n];
  for(i = 0; i < n; ++i) scanf("%d", &a[i]);
  for(i = 0; i < m; ++i) scanf("%d", &b[i]);
  for(i = 0; i < n; ++i) cnt[i] = 0;
  for(i = 0; i < m; ++i) {
    for(j = 0; j < n; ++j) if(b[i] >= a[j]) {
      cnt[j]++;
      break;
    }
  }
  for(i = 0; i < n; ++i) if(max < cnt[i]) max = cnt[i], maxn = i + 1;
  printf("%d\n", maxn);
  return 0;
}


Measured memory_bytes: 2736
N,M = map(int,input().split())
if M == 0:
    print(0)
else:
    l = [[0 for _ in range(N)] for _ in range(N)]
    for _ in range(M):
        a,b = map(int,input().split())
        l[a-1][b-1] = 1
        l[b-1][a-1] = 1
    g = 0
    def dfs(a,route):
        global g
        if len(route) == N:g += 1
        else:
            for i in range(N):
                if a == i:pass
                else:
                    if l[a][i] == 1 and (not i in route):
                        dfs(i,route+[i])
    dfs(0,[0])
print(g)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int n;
    cin >> n;
    int ot = 0, ox = 0, oy = 0;
    for (int i = 0; i < n; i++) {
        int t, x, y;
        cin >> t >> x >> y;
        int d = abs(x - ox) + abs(y - oy);
        if ((t - ot) < d || (t - ot) % 2 != d % 2) {
            cout << "No" << endl;
            return 0;
        }
        ot = t; ox = x; oy = y;
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 384
#import sys
#input = sys.stdin.readline
#template input
import bisect

def IT(): #整数1個
    return int(input())
def IL(): #整数複数
    return [int(_) for _ in input().split()]
def IS(): #文字列複数
    return [_ for _ in input().split()]
def ILS(n): #整数1つ　縦にズラーってなってるやつ
    return [int(input()) for _ in range(n)]
def SLS(n): #文字列　縦にズラーってなってるやつ
    return [input() for _ in range(n)]
def ILSS(n): #整数複数　縦にズラーってなってるやつ
    return [[int(_) for _ in input().split()] for j in range(n)]

#template technique
def bit_full_search(ss):
    n = len(ss)
    for i in range(1 << n):
        s = ""
        for j in range(n + 1):
            if ((1 & i >> j) == 1):
                s += ss[j]
        print(s)
def bit_full_search2(A):
    #https://blog.rossywhite.com/2018/08/06/bit-search/
    value = []
    for i in range(1 << len(A)):
        output = []

        for j in range(len(A)):
            if ((i >> j) & 1) == 1:
                #output.append(A[j])
                output.append(A[j])
        value.append([format(i, 'b').zfill(16), sum(output)])

    value.sort(key=lambda x:x[1])
    bin = [value[k][0] for k in range(len(value))]
    val = [value[k][1] for k in range(len(value))]
    return bin, val
def matching_bisect(list1_val, list2_val, n):
    #2分探索
    j = 0
    for i in range(len(list1_val)):
        j = bisect.bisect_left(list2_val, n - list1_val[i])
        if j < len(list2_val):
            if list1_val[i] + list2_val[j] == n:
                #ans = list2_bin[j] + list1_bin[i]
                break
    return j

"""ここからメインコード"""
def main():
    t, x = IL()
    print(t/x)



main()


Measured memory_bytes: 3444
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// Nの桁数
ll dig(ll N) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= 10;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

int main() {
	ll A, B, C, D; cin >> A >> B >> C >> D;

	cout << min(A, B) + min(C, D) << endl;
}

Measured memory_bytes: 256
n = int(input())
def f(a,b):
    a = list(str(a))
    b = list(str(b))
    return max(len(a),len(b))

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

l = make_divisors(n)
if len(l)%2 == 0:
    m = float('inf')
    for i in range(len(l)//2):
        m = min(m, f(l[i],n//l[i]))
    print(m)
else:
    m = float('inf')
    for i in range(len(l)//2+1):
        m = min(m, f(l[i],n//l[i]))
    print(m)

Measured memory_bytes: 9192
def main():
    N = int(input())
    F = []
    for i in range(N):
        F.append([int(f) for f in input().split()])
    P = []
    for i in range(N):
        P.append([int(p) for p in input().split()])
    states = [[]]
    for _ in range(10):
        temp = []
        for s in states:
            temp.append(s + [1])
            temp.append(s + [0])
        states = temp

    max_v = float('-inf')
    for s in states:
        if sum(s) != 0:
            v = 0
            for i in range(N):
                c = 0
                for j in range(10):
                    c += s[j] * F[i][j]
                v += P[i][c]
        max_v = max(max_v, v)
    return max_v


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


Measured memory_bytes: 3316
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")
#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;


//最小公倍数、最大公約数
ll gcd(ll a, ll b) {
	return b != 0 ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main() {
	int N;
	cin >> N;
	ll t = 0, a = 0;
	vector<int> T(N), A(N);
	for (int i = 0; i < N; i++) {
		cin >> T[i] >> A[i];
	}
	for (int i = 0; i < N; i++) {
		ll newlcm = lcm(T[i], A[i]);
		ll t_ = newlcm / T[i], a_ = newlcm / A[i];
		if (t_ < t || a_ < a) {
			ll m, n;
			m = (t + t_ - 1) / t_;
			n = (a + a_ - 1) / a_;
			t_ *= max(m, n);
			a_ *= max(m, n);

		}
		a = a_;
		t = t_;
	}
	cout << a + t << endl;
}

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

using namespace std;

bool binarySearch(vector<int> A, int key) {
    int left = 0;
    int right = A.size();
    while (left < right) {
        int mid = (left + right) / 2;
        if (A[mid] == key) {
            return true;
        } else if (key < A[mid]) {
            right = mid;
        } else {
            left = mid + 1;
        }
    }
    return false;
}

int main() {
    int n;
    cin >> n;

    vector<int> S;
    int d;
    for (int i = 0; i < n; i++) {
        scanf("%d", &d);
        S.push_back(d);
    }

    int q;
    cin >> q;

    int C = 0;
    for (int i = 0; i < q; i++) {
        int key;
        scanf("%d", &key);
        if (binarySearch(S, key)) {
            C++;
        }
    }

    cout << C << endl;

    return 0;
}

Measured memory_bytes: 3836
#include <iostream>
using namespace std;
typedef long long ll;
ll gcd(ll m, ll n){
	while(m!=n)m>n?m-=n:n-=m;
	return m;
}
int main(){
	ll a,b;
	while(cin>>a>>b)cout<<gcd(a,b)<<' '<<a/gcd(a,b)*b<<endl;
}

Measured memory_bytes: 1156
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions
bool second_smaller(const pii& left, const pii& right) {
    return left.second < right.second;
}
#endif


int main_C() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N; cin >> N;
    vi X(N); REP(i, N) cin >> X[i];

    vector<pii> v;
    REP(i, N) v.push_back(pii(i, X[i]));
    sort(v.begin(), v.end(), second_smaller);

    map<int, int> mp;
    REP(i, N) mp[v[i].first] = i;
    
    vi y;
    REP(i, N) y.push_back(v[i].second);

    vi ans;
    REP(i, N) {
        int di = mp[i];
        if (di < N / 2) ans.push_back(y[N / 2]);
        else ans.push_back(y[N / 2 - 1]);
    }

    for(int i : ans) cout << i << endl;

    return 0;
}

Measured memory_bytes: 17136
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>

char ch[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
char buf[130];
int len;

int dp[2][128];
int edit_distance(char const*s1, char const*s2) {
  int i, j;
  dp[0][0] = 0;
  for(i = 1; s1[i-1]; ++i) dp[0][i] = i;
  for(j = 1; s2[j-1]; ++j) {
    dp[j%2][0] = j;
    for(i = 1; s1[i-1]; ++i) {
      dp[j%2][i] = std::min(std::min(dp[(j-1)%2][i], dp[j%2][i-1]) + 1,
        dp[(j-1)%2][i-1] + (s1[i-1] == s2[j-1]? 0: 1));
    }
  }
  return dp[(j-1)%2][i-1];
}


int trybuf() {
  std::cout << buf << std::endl;
#if 1
  int a; std::cin >> a; 
#else
  int a = edit_distance("Atcod3rIsGreat", buf+1);
  std::cout << a << "\n\n";
#endif
  if(a == 0) {
    buf[0] = '!';
    std::cout << buf << std::endl;
    exit(0);
  }
  return a;
}

int try_s(std::string const& s) {
  int N = s.size();
  for(int i = 0; i < N; ++i) buf[i+1] = s[i];
  buf[N+1] = 0;
  return trybuf();
}

std::string merge(std::string const& s1, std::string s2) {
  int k = len - s1.size();
  std::string left = "", right = s1;
  int q = 0;
  while(right.size() > 0) {
    left += s2[q];
    int nk;
    while((nk = try_s(left + right)) < k) {
      if(q == s2.size()-1) return left+right;
      left += s2[++q];
      k = nk;
    }
    left.back() = right[0];
    right = right.substr(1);
  }
  return left + s2.substr(q);
}

std::vector<std::string> reduce(std::vector<std::string>const& v) {
  std::vector<std::string> res;
  for(int i = 0; i+1 < v.size(); i += 2) {
    res.push_back(merge(v[i], v[i+1]));
  }
  if(v.size()%2 == 1) res.push_back(v.back());
  return res;
}


int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  std::vector<std::string> v;
  buf[0] = '?';
  buf[129] = 0;
  len = 0;
  for(char c: ch) {
    if(c == 0) break;
    for(int j = 0; j < 128; ++j) buf[j+1] = c;
    int l = 128 - trybuf();
    len += l;
    if(l > 0) {
      std::string s;
      for(int j = 0; j < l; ++j) s += c;
      v.push_back(s);
    }
  }
  while(v.size() > 1) {
    std::vector<std::string> nv = reduce(v);
    v.swap(nv);
  }
  try_s(v[0]);
  
  return 0;
}


Measured memory_bytes: 3768
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cmath>
using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define m_p make_pair
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
#define vecout(v,n) for(int i=0; i<n; i++)cout<<v[i]<<" "; cout<<endl;

const int mod =998244353;
const int INF = 2000000015;
const int MAX = 510000;
const int MOD = 998244353;
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;
}
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}

//x未満の要素数を返す二分探索関数
int b_s(vector<int>&vecxx, int xx) {
	if (xx <= vecxx[0]) { //x以下の要素数を返させる時は"<"に変える
		return 0;
	}
	if (vecxx.back() < xx) { //x以下の要素数を返させる時は"<="に変える
		return vecxx.size();
	}
	int aa1 = 0, aa2 = vecxx.size() - 1, aa3;
	while (aa1 + 1 < aa2) {
		aa3 = (aa1 + aa2) / 2;
		if (vecxx[aa3] >= xx) { //x以下の要素数を返させる時は">"に変える
			aa2 = aa3;
		}
		else {
			aa1 = aa3;
		}
	}
	return aa2;
}


int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
//n個を1個以上のx組のグループに分ける重複組み合わせはcom(n-1,x-1)
//グループが0個でもいいときはnにxを足す

int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}



signed main() {
	int n=700;
	char a,b,c;
	cin>>a>>b>>c;
	if(a=='o'){
		n+=100;
	}
	if(b=='o'){
		n+=100;
	}
	if(c=='o'){
		n+=100;
	}
	cout<<n<<endl;
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

int graph[MAX_N] = {};
bool isVisit[MAX_N] = {};

signed main()
{
    int N;
    cin >> N;
    REP(i, N) {
        int to;
        cin >> to;
        to--;
        graph[i] = to;
    }
    int ans = 0;
    int cur = 0;
    while(cur != 1) {
        if(isVisit[cur]) {
            printf("-1\n");
            return 0;
        }
        isVisit[cur] = true;
        cur = graph[cur];
        ans++;
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 1152
/* Code by pedroslrey *
 *     march 7        *
 *    Starurday       */

#include <bits/stdc++.h>

using namespace std;

using lli = long long int;

const int INF = 1000000007;
const lli LLINF = 9223372036854775800;

#define debug(args...) fprintf(stderr, args)
#define show(x) fprintf(stderr, "[DEBUG] -> %d\n", x)

int main() {
	string s;
	cin >> s;
	int a = 0;
	int b = 0;
	for (char c: s) {
		if (c == 'A') ++a;
		else ++b;
	}
	if (a && b) printf("Yes\n");
	else printf("No\n");
}

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

int main()
{
    long long N, A, B;

    cin >> N >> A >> B;

    long long p = (N / (A + B)) * A;
    long long res = N % (A + B);

    if(res < A)
    {
        p += res;
    }
    else
    {
        p += A;
    }
    
    cout << p << endl;

    return 0;
}

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

int main() {
  
  int d;
  cin >> d;
  
  cout << "Christmas";
  
  if(d<=24) cout << " Eve";
  
  if (d<=23) cout << " Eve";
  
  if(d == 22) cout << " Eve";
  
  cout << endl;
}


Measured memory_bytes: 256
s=input()
a=s.count("R")
be=""
count=0

for i in s:
  if be==i and be=="R":
    count+=1
    
  be=i
  
if s.count("R")>=1 and count==0:
  print(1)
  
else:
  print(count+1 if count>=1 else count)

Measured memory_bytes: 8884
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include<cmath>
#include <functional>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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(){
  int N;
  cin >> N;
  vector<int> A(N);
  map<int,int> mp_A;
  for(int i=0; i<N; i++) cin >> A[i],mp_A[A[i]]++;
  vector<int> B(N);
  map<int,int> mp_B;
  for(int i=0; i<N; i++) cin >> B[i],mp_B[B[i]]++;
  for(auto m: mp_A){
    if(m.second+mp_B[m.first] > N){
      cout << "No\n";
      return 0;
    }
  }
  reverse(B.begin(),B.end());
  int pos = 0;
  for(int i=0; i<N; i++){
    if(A[i] == B[i]){
      while(1){
        if(A[pos] != B[i] && B[pos] != B[i]){
          swap(B[pos],B[i]);
          pos++;
          break;
        }
        pos++;
      }
    }
  }
  cout << "Yes\n";
  for(int i=0; i<N; i++){
    cout << B[i] << " \n"[i+1==N];
  }
  return 0;
}


Measured memory_bytes: 23416
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)

void debug_out() {}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif

int run(istream& in, ostream& out) {
    string S, T;
    in >> S >> T;
    string ans {T};
    ans.append(S);

    // solution here

    out << ans << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    const double PI = acos(-1);
    int R; scanf("%d", &R);
    printf("%.12f\n", 2*R*PI);
    return 0;
}


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


int main() 
{ 
   int n,k,i;cin>>n>>k;
   int a[n];
   for(i=0;i<n;i++){
       cin>>a[i];
   }
   sort(a,a+n);
   int sum=0;
   for(i=0;i<k;i++){
       sum+=a[i];
   }
   cout<<sum;
    return 0; 
}

Measured memory_bytes: 3188
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


s = S()
t = S()
ans = 0
for a, b in zip(s, t):
    if (a != b):
        ans += 1
print(ans)


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

int main() {
   string o,e;
   cin >> o >> e;
   int n=o.size()+e.size();
   string ans="";
   rep(i,n){
      if(i%2==0)
      ans+=o[i/2];
      else
      ans+=e[i/2];
   }
   cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>  // scanfとprintfを使うおまじない
#include <string.h>

int main(int argc, char *argv[]){
    int i, n;
    char S[11];

    // 標準入力から読み込む(空白や改行で勝手に区切ってくれる)
    // 逆に空白込みの文字列を読み込む場合は別の方法で読む必要がある。
    scanf("%s", S);
    n=strlen(S);
    if(n%2!=0) printf("No\n");
    else{
      for(i=0;i<n;i+=2){
        if(S[i]=='h' && S[i+1]=='i'){
          if (i+2<n) continue;
          else printf("Yes\n"); 
        }
        else{ printf("No\n"); break;}
      }
    }
    return 0;
}
  

Measured memory_bytes: 128
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
  int N; scanf("%d", &N);
  int now = 1;
  while (now * 2 <= N) now *= 2;
  printf("%d\n", now);

  return 0;
}


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

	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int a[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,	67,71, 73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009};
		int b[]=new int[1000];
		int y=0,max=0;
		long z=2,x=2;
		while(z<=N){
			x=z;
			while(x>=a[y]){
				if(max<a[y])
					max=a[y];
				if(x%a[y]==0){
					b[a[y]]++;
					x/=a[y];
				}
				if(x%a[y]!=0)
					y++;
			}y=0;
			z++;
		}z=1;y=1;x=1;
		while(max>=y){
			x*=(b[y]+1);
			if(x>1000000007)
				x%=1000000007;
			y++;
		}
		System.out.println(x);
	}

}


Measured memory_bytes: 21460
import sys
from collections import deque
sys.setrecursionlimit(20000000)


def main():

    n = int(input())
    dic = {}
    for _ in range(n):
        t = ''.join(sorted(list(input())))
        if t in dic:
            dic[t] += 1
        else:
            dic[t] = 0

    def pattern(num):
        tmp = 0

        for i in range(1, num+1):
            tmp += i
        return tmp

    ans = 0
    for d in dic:
        if dic[d]:
            ans += pattern(dic[d])

    print(ans)


if __name__ == '__main__':
    main()



Measured memory_bytes: 18192
import sys
bbn=1000000007
	
#+++++
		
def main():
	s ,t = input().split()
	print(t+s)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s,t;
	int ans=0;
	cin >>s>>t;
	rep(i,s.size()){
		if(s[i]!=t[i])ans++;
	}
	cout<<ans<<endl;
}

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

int main() {
    int R, G, B, N;
    cin >> R >> G >> B >> N;

    int ans = 0;

    for (int r=0; r<=N/R; r++) {
        for (int g=0; g<=(N-R*r)/G; g++) {
            if ((N-R*r-G*g) % B == 0) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
//const int MAX=;



int main(){
	int N,K;
	cin>>N>>K;
	if(K==1)cout<<0<<endl;
	else cout<<N-K<<endl;
}


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


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

ll dp[MAXn];

ll w[MAXn], c[MAXn];

int main()
{
    IOS();
    ll n,W;
    cin>>n>>W;
    REP(i,n)cin>>w[i]>>c[i];
    REP(i,n)
    {
        for(int j = W;j >= w[i];j --)dp[j] = max(dp[j], dp[j-w[i]] + c[i]);
    }
    cout<<dp[W]<<endl;

}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000009
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }
ll mod = 1000000007;
ll modsize = 2000010;

ll modinv(ll a) {
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a%mod;
		a = a * a%mod;
		b >>= 1;
	}
	return ans;
}

vector<ll> fac(modsize);
vector<ll> inv(modsize);
vector<ll> facinv(modsize);

void modcalc() {
	fac[0] = fac[1] = 1; inv[1] = 1;
	facinv[0] = facinv[1] = 1;
	for (int i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0) return 0;
	if (n == 0 && k == 0) return 1;
	return modcomb(n + k - 1, k);
}

template<class T>
class segtree {
	int n;
	vector<T> data;
	T def;
	function<T(T, T)> operation;
	function<T(T, T)> update;
	T _query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l) return def;
		if (a <= l && r <= b) return data[k];
		T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2);
		T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r);
		return operation(c1, c2);
	}
public:
	segtree(size_t _n, T _def, function<T(T, T)> _operation, function<T(T, T)> _update)
		:def(_def), operation(_operation), update(_update) {
		n = 1;
		while (n < _n) {
			n *= 2;
		}
		data = vector<T>(2 * n - 1, def);
	}
	void change(int i, T x) {
		i += n - 1;
		data[i] = update(data[i], x);
		while (i > 0) {
			i = (i - 1) / 2;
			data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
		}
	}
	T query(int a, int b) {
		return _query(a, b, 0, 0, n);
	}
	T operator[](int i) {
		return data[i + n - 1];
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	modcalc();

	ll r1, c1, r2, c2;
	cin >> r1 >> c1 >> r2 >> c2;
	ll ans = 0;
	for (ll i = r1; i <= r2; i++) {
		ans += modcomb(c2 + i + 1, i + 1);
		ans -= modcomb(c1 + i, i + 1);
		if (ans < 0) ans += mod;
		if (ans >= mod) ans -= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 47104
package main

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

func solve() {
	r := scanInt()

	fmt.Println(2.0 * math.Pi * float64(r))
	return
}

var sc = bufio.NewScanner(os.Stdin)

func scanString() string {
	sc.Scan()
	return sc.Text()
}
func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}
func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanString(), 64)
	return f
}
func Permute(nums []int) [][]int {
	n := factorial(len(nums))
	ret := make([][]int, 0, n)
	permute(nums, &ret)
	return ret
}

func permute(nums []int, ret *[][]int) {
	*ret = append(*ret, makeCopy(nums))

	n := len(nums)
	p := make([]int, n+1)
	for i := 0; i < n+1; i++ {
		p[i] = i
	}
	for i := 1; i < n; {
		p[i]--
		j := 0
		if i%2 == 1 {
			j = p[i]
		}

		nums[i], nums[j] = nums[j], nums[i]
		*ret = append(*ret, makeCopy(nums))
		for i = 1; p[i] == 0; i++ {
			p[i] = i
		}
	}
}

func factorial(n int) int {
	ret := 1
	for i := 2; i <= n; i++ {
		ret *= i
	}
	return ret
}
func makeCopy(nums []int) []int {
	return append([]int{}, nums...)
}
func gcd(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}
func main() {
	sc.Split(bufio.ScanWords)
	solve()
}


Measured memory_bytes: 1756
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  s <- getLine
  n <- getl toInt
  solve s <$> replicateM n getLine >>= print

solve :: String -> [String] -> Int
solve s = sum . map f
  where
    f x
      | s `isInfixOf` (x ++ x) = 1
      | otherwise = 0

toInt :: String -> Int
toInt = read

getl :: (String -> a) -> IO a
getl f = f <$> getLine

Measured memory_bytes: 3896