akhauriyash/Code-Regression huggingface dataset:
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using INT=mp::cpp_int;
using namespace std;
using ll=long long;
using vec=vector<ll>;
using vect=vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
INT LCM(INT x,INT y){
  INT z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
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 main() {
  cout << fixed << setprecision(30);
  ll k,a,b;
  cin3(k,a,b);
  if(b-a>2){
    ll remain=k-(a-1);
    if(remain<0)putout(k+1);
    else{
      if(remain%2==0){
        ll t=remain/2;
        putout(t*(b-a)+a);
      }
      else{
        ll t=remain/2;
        putout(t*(b-a)+a+1);
      }
    }
  }
  else{
    putout(k+1);
  }
}

Measured memory_bytes: 256
s = int(input())

def f(n):
  if n % 2 == 0:
    return n // 2
  else:
    return 3 * n + 1

a = [0, s]

for i in range(2, 1000001):
  new_a = f(a[i - 1])
  if new_a in a:
    print(i)
    break
  a.append(new_a)

Measured memory_bytes: 2940
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i])
#define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vil vector<pil>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e5 + 5;
const double eps = 1e-9;
ll a[MAXN], ans[MAXN];
pll b[MAXN];

int main() {
	int n; ni(n); nal(a, n);
	for (int i = 0; i < n; i++)
		b[i] = mp(a[i], (ll)i);
	b[n] = mp(0, n);
	sort(b, b+n+1);
	ll cur = b[n].se;
	for (int i = n-1; ~i; i--) {
		ans[cur] += (b[i+1].fi - b[i].fi) * (ll)(n-i);
		cur = min(cur, b[i].se);
	}
	for (int i = 0; i < n; i++)
		prl(ans[i]);
    return 0;
}


Measured memory_bytes: 4224
module Main where

    -- import Debug.Trace
    import Data.List
    import qualified Data.Sequence as S
    import qualified Data.ByteString.Char8 as B
    import Data.Int
    import Data.Char
    import Data.Array
    -- import Data.Array.IO
    import Data.Maybe
    import qualified Data.Map as M
    import Data.Ord
    import Data.Functor
    import Control.Applicative
    import Control.Monad
    import Text.Printf
     
    solve :: Int -> [[Int]] -> Array (Int, Int) Int
    solve n l = accumArray (+) 0 ((1,1), (n,n)) (vertices l) where
        vertices [] = []
        vertices (l:ls) = adjacents l ++ vertices ls
        adjacents (k:n:as) = iter as where
            iter [] = []
            iter (a:as) = ((k, a),1):iter as

    readIntLn:: IO Int
    readIntLn = (fst . fromJust . B.readInt) <$> B.getLine
    
    readIntList:: IO [Int]
    readIntList = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

    print' :: Int -> Array (Int, Int) Int -> IO()
    print' n ar = iterI 1 where
        iterI i 
            | i > n = return ()
            | otherwise = iterJ 1 >> iterI (i+1) where
                iterJ j 
                    | j < n = putStr (s ++ " ") >> iterJ (j+1)
                    | otherwise = putStrLn s where
                        s = show $ ar!(i,j)
     
    main :: IO() 
    main = do
        n <- readIntLn
        l <- replicateM n readIntList
        print' n $ solve n l
    


Measured memory_bytes: 4132
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m;
	cin>>n>>m;
	int a;cin>>a;
	vvi in(n,vi(m));
	int I=0,J=0;
	rep(i,a){
		int t;cin>>t;
		while(t){
			in[I][J]=i+1;
			if(I%2==0){
				J++;
				if(J==m){
					J--;
					I++;
				}
			}else{
				J--;
				if(J==-1){
					J++;
					I++;
				}
			}
			t--;
		}
	}
	rep(i,n){
		rep(j,m){
			if(j)cout<<" ";
			cout<<in[i][j];
		}
		cout<<endl;
	}
}









Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>

#define DEBUG 0
#define NINF -1
#define PINF 1E9+7

int n,q;
char *s;
int l,r;
int *ll,*rr;
int all;

int main()
{
	int i,j;
	int ans;

	scanf("%d %d",&n,&q);
	s = (char *)malloc(sizeof(char) * (n+1));
	scanf("%s",s);

	ll = (int *)malloc(sizeof(int) * n);
	rr = (int *)malloc(sizeof(int) * n);
	if (rr==NULL) {
		perror("malloc");
		exit(1);
	}
	ll[0]=0;

	rr[n-1]=0;
	for (i=1,j=0;i<n;i++) {
		if (s[i-1]=='A' && s[i]=='C') {
			j++;
		}
		ll[i]=j;
		if (DEBUG) printf("%d ",ll[i]);
	}
	if (DEBUG) printf("\n");
	for (i=n-2,j=0;i>=0;i--) {
		if (s[i]=='A' && s[i+1]=='C') {
			j++;
		}
		rr[i]=j;
		if (DEBUG) printf("%d ",rr[i]);
	}
	if (DEBUG) printf("\n");

	all = ll[n-1];

	for (i=0;i<q;i++) {
		scanf("%d %d",&l,&r);

		ans = all;
		ans -= ll[l-1];
		ans -= rr[r-1];

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


	
	free(s);
	free(ll);
	free(rr);
	return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;}


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

int N; cin >> N;
VS S(N); invec(S);

map<string, int> m;
for(string s: S) ++m[s];

cout << m.size() << "\n";

return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 問題文から考える。自分ができることから考える。
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索。逆から考える。
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 25080
#include<iostream>

int main(){
    int R;
    std::cin >> R;
    if(R < 1200) std::cout << "ABC" << std::endl;
    else if(R < 2800) std::cout << "ARC" << std::endl;
    else std::cout << "AGC" << std::endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long ret = N - 1;
		for(long A = 1 ; A * A <= N ; ++A){
			if(N % A == 0){
				long B = N / A;
				long move = (B - 1) + (A - 1);
				ret = Math.min(ret, move);
			}
		}
		System.out.println(ret);
	}
}


Measured memory_bytes: 23252
#include <stdio.h>
#include <stdlib.h>

#define MAX 200

int isEmpty(void);
int isFull(void);
void push(int);
int pop(void);

int top;
int data[MAX];

int main(){
 int a;
 int b;
 char c[MAX];
  
 while(scanf("%s",c)!=EOF){
      if(c[0]=='+'){
         a=pop();
         b=pop();
         push(a + b);
      }
    else if(c[0]=='-'){
         a=pop();
         b=pop();
         push(b - a);
      }
    else if(c[0]=='*'){
         a=pop();
         b=pop();
         push(a * b);
      }
    else { 
         push(atoi(c));
         }
   }
 
 printf("%d\n",data[1]);
 
 return 0;
}
void initialize(void){
 top=0;
}
int isEmpty(void){
 if(top==0) return -1;
 return top;
}
int isFull(void){
    if(top >= MAX - 1) return -1;
    return top;
}
void push(int x){
   if(isFull()==-1){
   fprintf(stderr,"Overflow!\n");
   exit(1);
   }
   else{
   top++;
   data[top] = x;
   }
}
int pop(){
   if(isEmpty()==-1){
   fprintf(stderr,"Underflow!\n");
   exit(2);
   }
   else top--;
   return data[top+1];
   }

Measured memory_bytes: 548
A,B,C,X,Y = map(int,input().split())

if X > Y:
  D = A
else:
  D = B
  
if A+B < 2*C:
  print(A*X + B*Y)
elif D < 2*C:
  print(2*C*min(X,Y) + D*abs(X-Y))
else:
  print(2*C*max(X,Y))

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
int dx[4] = { 1,-1,0,0 };
int dy[4] = { 0,0,1,-1 };
vector<ll>to[200005];
ll ans[200005] = {};
int main() {
	int n, m;
	cin >> n >> m;
	int a, b;
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		a--; b--;
		to[a].push_back(b);
		to[b].push_back(a);
	}

	vector<ll>dist(n, inf);
	vector<ll>pre(n, -1);
	dist[0] = 0;
	queue<ll>que;
	que.push(0);
	while (!que.empty()) {
		int v = que.front();
		que.pop();
		for (int id : to[v]) {
			if (dist[id] != inf)continue;
			dist[id] = dist[v] + 1;
			pre[id] = v;
			que.push(id);
		}
	}
	cout << "Yes" << endl;
	for (int i = 1; i < n; i++) {
		cout << ++pre[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 16012
import math

X = int(input())
absX = abs(X)
X = math.pow(X, 1/5)
#print(X)
X = math.floor(X)
#print(X)

Pow = []
Dif = []

for i in range(64):
    Pow.append(int(math.pow(i, 5)))


for i in range(1, 1000):
    Dif.append(i**5 - (i-1)**5)
    if ((i+1)**5 - i**5) > 1000000000:
        break
#print(len(Dif))

#print(Pow)
#print(Dif)

for n in range(len(Pow)):
    p = Pow[n]
    m = n
    while m < len(Pow):
        q = Pow[m]
        if p + q > absX:
            break
        #print('p: {}, q: {}'.format(p, q))
        if p + q == absX :
            #print(absX)
            if X < 0:
                print(-n, m)
            else:
                print(n, -m)
            exit(0)
        m += 1

for n in range(len(Dif)):
    sam = 0
    m = n
    while m < len(Dif):
        sam += Dif[m]
        if sam > absX:
            break
        #print('sam: {}'.format(sam))
        if sam == absX:
            if X <= 0:
                print(n, m+1)
            else:
                print(-n,-(m+1))
            exit(0)
        m += 1

Measured memory_bytes: 9464
import java.io.InputStreamReader
import java.io.BufferedReader

fun main(args: Array<String>) {
  val br = BufferedReader(InputStreamReader(System.`in`))
  val (A, B, C, D) = br.use { it.readLine().split(" ").map { it.toInt() } }

  fun isPushed(i: Int, a: Int, b: Int) = if((a <= i) && (i < b)) true else false

  val ans = IntArray(101, { i ->
      if((isPushed(i, A, B) && isPushed(i, C, D)) ) 1 else 0
    }).sum()

  println(ans)
}

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

int main(){
  int n; cin >>n;
  map<ll, ll> mp;
  rep(i,n){
    int a; cin >>a;
    mp[a]++;
  }
  vector<ll> rec;
  for(auto x:mp){
    if(x.second>=2) rec.push_back(x.first);
    if(x.second>=4) rec.push_back(x.first);
  }
  if(rec.size()<2) cout << 0 << endl;
  else cout << (ll)rec[rec.size()-1]*rec[rec.size()-2] << endl;
  return 0;
}

Measured memory_bytes: 9836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	string s;cin>>s;
	int n=s.size();
	bool chk=0;

	rep(i,8){
		string t=s.substr(0,i);
		string u=s.substr(n-(7-i),7-i);
		if(t+u=="keyence") chk=1;
	}
	if(chk) cout<<"YES"<<"\n";
	else cout<<"NO"<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxc 10010
struct ss{
    int a,b;
}s[maxc];
int main()
{
    int n,m;
    cin>>n>>m;
    int minx=9999999;
    int f=0;
    for(int i=0;i<n;i++){
        cin>>s[i].a>>s[i].b;
        if(s[i].b<=m&&s[i].a<minx){
            minx=s[i].a;
            f=1;
        }
    }
    if(f==0)
        cout<<"TLE"<<endl;
    else
        cout<<minx<<endl;
    return 0;
}


Measured memory_bytes: 384
package main

import "fmt"

var x int
var ok1, ok2 bool

func main() {
  fmt.Scanf("%d", &x)
  
  if 1 <= x/100 && x/100 <= 12 {
    ok1 = true
  }
  if 1 <= x%100 && x%100 <= 12 {
    ok2 = true
  }
  
  if ok1 && ok2 {
    fmt.Println("AMBIGUOUS")
  } else if ok1 {
    fmt.Println("MMYY")
  } else if ok2 {
    fmt.Println("YYMM")
  } else {
    fmt.Println("NA")
  }
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep1(i, n) for(int i=1; i<=(int)(n); i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> wi;
typedef vector<ll> vl;
const ll INF=1LL << 60;
const ll MOD=1e9+7;

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

  ll n, ans;
  cin >> n;
  ll p=1, q=1, r=1;
  if(n>=2){
    rep(i, n){
      p*=10;
      p%=MOD;
      q*=9;
      q%=MOD;
      r*=8;
      r%=MOD;
    }
    ans=(p-2*q+r+MOD)%MOD;
  }
  else ans=0;

  cout << (ans+MOD)%MOD << endl;

  return 0;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
//using namespace std;
#define rep(i,j,n) for(ll i=(ll)(j);i<(ll)(n);i++)
#define REP(i,j,n) for(ll i=(ll)(j);i<=(ll)(n);i++)
#define per(i,j,n) for(ll i=(ll)(j);(ll)(n)<=i;i--)
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(ll)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(ll)(key)))
#define pb push_back
#define mp std::make_pair
#define endl "\n"
using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::upper_bound;
using std::lower_bound;
using vi=vector<ll>;
using vii=vector<vi>;
using pii=std::pair<ll,ll>;
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll MAX=500000;
const ll INF=(1ll<<62)-1;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
struct Binary_indexed_tree{
    int N;
    vi bit;
    Binary_indexed_tree(int n):N(n){
        bit.resize(N+1,0);
    }
    void add(int x,int a){
        for(x;x<=N;x+=(x&-x)) bit[x]+=a;
    }
    ll sum(int x){
        ll ret=0;
        for(x;x>0;x-=(x&-x)) ret+=bit[x];
        return ret;
    }
};
ll modpow(ll X,ll Y){
    ll sum=X,cnt=1;
    vi A;
    while(cnt<=Y){
        A.pb(sum);
        sum*=sum;
        sum%=MOD;
        cnt*=2;
    }
    int M=A.size();
    ll ret=1;
    REP(i,1,M){
        if(Y>=(1ll<<M-i)){
            Y-=(1ll<<M-i);
            ret*=A[M-i];
            ret%=MOD;
        }
    }
    return ret;
}
ll fac[MAX],finv[MAX],inv[MAX];
void COMinit(){
    fac[0]=fac[1]=finv[1]=finv[0]=inv[0]=inv[1]=1;
    rep(i,2,MAX){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=modpow(i,MOD-2);
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(ll n,ll r){
    if(n<r||n<0||r<0) return 0;
    return fac[n]*finv[r]%MOD*finv[n-r]%MOD;
}
signed main(){
    ll X; cin>>X;
    ll ans=1,sum=100;;
    while(1){
        sum+=sum/100;
        if(sum>=X){
            cout<<ans<<endl;
            break;
        }
        ans++;
    }
}

Measured memory_bytes: 3632
open Printf
open Scanf

let id x = x

let solve n =
  let g x = if x == n then -1 else x in
  let f (ct, i) x = if i = x then (ct, i + 1) else (ct + 1, i) in
  g @@ fst @@ Array.fold_left f (0, 1) @@ Array.init n @@ fun _ -> scanf "%d " id

let () =
  scanf "%d " solve |> printf "%d\n"


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

int X,A,B;

int main()
{
    scanf("%d%d%d",&X,&A,&B);
    if(A >= B)printf("delicious\n");
    else if(B - A <= X)printf("safe\n");
    else printf("dangerous\n");
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include <stdlib.h>
#include <queue>
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>
#include <numeric>
#include <functional>
#include <cassert>
typedef long long int ll;
using namespace std;

int main(){
	ll i,N,count=0;
	queue<ll> A;
	ll b;
	cin>>N;
	for(int i=1;i<=9;i++){
		A.push(i);
	}
	for(int i=0;i<N;i++){
		b=A.front();
		A.pop();
		if(b%10!=0){
			A.push(10*b+b%10-1);
		}
		A.push(10*b+b%10);
		if(b%10!=9){
			A.push(10*b+b%10+1);
		}	
	}
	cout<<b<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <string>
#include "math.h"

using namespace std;

const int max_n = 10000;

bool first_is_bigger(string a, string b) {
    if (a == "-") {
        return false;
    }
    if (a.size() > b.size()) {
        return true;
    } else if (a.size() == b.size() && a >= b) {
        return true;
    } else {
        return false;
    }
}

int main() {
    
    map<int, int> costs;
    
    costs[1] = 2;
    costs[2] = 5;
    costs[3] = 5;
    costs[4] = 4;
    costs[5] = 5;
    costs[6] = 6;
    costs[7] = 3;
    costs[8] = 7;
    costs[9] = 6;
    
    vector<string> dp(max_n, "-");
    dp[0] = "";
    
    int n,m;
    cin >> n >> m;
    
    vector<int> a(m, 0);
    vector<int> cost(m, 0);
    
    for (int j=0; j<m; j++) {
        cin >> a[j];
        cost[j] = costs.at(a[j]);
    }
    cout << endl;
    
    for (int i=0; i<=n; i++) {
        if (dp[i] == "-") continue;
        string max_dp = "";
        for (int j=0; j<m; j++) {
            if (first_is_bigger(dp[i] + to_string(a[j]), dp[i+cost[j]])) {
                dp[i+cost[j]] = dp[i] + to_string(a[j]);
            }
        }
    }
    
    cout << dp[n] << endl;
    
    return 0;
    
}

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

using ll = long long;

constexpr ll INF = 1'010'000'000'000'000'017LL;
constexpr ll MOD = 1'000'000'007LL;
constexpr double EPS = 1e-12;
constexpr double PI = 3.14159265358979323846;

#define FOR(i, start, end) for(ll i = (start); i < end; i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()

template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }

template<class T = ll> using V = vector<T>;
using vi = V<int>; using vl = V<>; using vvi = V< V<int> >;
using pint = pair<int, int>;
using pll = pair<ll, ll>; using vp = V<pll>;

ll mod(ll val, ll m){ ll res = val % m; if(res < 0) res += m; return res;}
ll modinv(ll a, ll m) { ll b = m, u = 1, v = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u;}
ll modpow(ll a, ll n, ll mod) { ll res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }


//---------------------------------------------------------------

void Main()
{
    ll N;
    cin >> N;
    ll A;
    int flg = 1;
    REP(i, N){
        cin >> A;
        if(A%2 == 0){
            if(!(A%3 == 0 || A%5 == 0)){
                flg = 0;
            }
        }
    }
    if(flg == 1){
        cout << "APPROVED" << endl;
    }else{
        cout << "DENIED" << endl;
    }
}

//---------------------------------------------------------------
int main()
{
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
//#include<bits/extc++.h>
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> set_t;
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pdd pair<double,double>
#define pb push_back
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define EPS 1e-6
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
#define pi acos(-1)
#define index Index
#define Line pll
typedef long long LL;
int cnt0[2005],cnt1[2005];
int dp[4005][4005];
int mod=998244353;
int main(){
    char c[2005];
    scanf("%s",c+1);
    for(int i=1;c[i]!=0;i++){
        if(c[i]=='0'){
            cnt0[i]=cnt0[i-1]+2;
            cnt1[i]=cnt1[i-1];
        }
        else if(c[i]=='1'){
            cnt0[i]=cnt0[i-1]+1;
            cnt1[i]=cnt1[i-1]+1;
        }
        else{
            cnt0[i]=cnt0[i-1];
            cnt1[i]=cnt1[i-1]+2;
        }
    }
    int len=strlen(c+1);
    dp[0][0]=1;
    for(int i=0;i<=cnt0[len];i++){
        for(int j=0;j<=cnt1[len];j++){
         //   printf("%d ",dp[i][j]);
            if(i+j>=len){
                dp[i+1][j]+=dp[i][j];
                dp[i][j+1]+=dp[i][j];
            }
            else{
                if(cnt0[i+j+1]-i>0){
                    dp[i+1][j]+=dp[i][j];
                }
                if(cnt1[i+j+1]-j>0){
                    dp[i][j+1]+=dp[i][j];
                }
            }
            dp[i+1][j]%=mod;
            dp[i][j+1]%=mod;
        }
       // printf("\n");
    }
    printf("%lld\n",dp[cnt0[len]][cnt1[len]]);
}

Measured memory_bytes: 60416
#!/usr/bin/python
import sys
if sys.version_info[0]>=3: raw_input=input

def solve(s,t):
	if s==t:
		return 'IDENTICAL'
	s=s.split('"')
	t=t.split('"')
	if len(s)==len(t):
		k0=sum(s[i]!=t[i] for i in range(0,len(s),2))
		k1=sum(s[i]!=t[i] for i in range(1,len(s),2))
		if k0==0 and k1==1:
			return 'CLOSE'
	return 'DIFFERENT'

try:
	while True:
		s=raw_input().strip()
		if s=='.': break
		t=raw_input().strip()
		print(solve(s,t))
except EOFError:
	pass

Measured memory_bytes: 6460
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
/*#include <boost/multiprecision/cpp_int.hpp> 
using boost::multiprecision::cpp_int;*/
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int              long long int
#define pb              push_back
#define mp12            make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pq1             priority_queue<int>
#define pqr1            priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
// mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void fast()
{
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

}
void file(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int modInv(int a,int b,int m)
{
    int res=1;
    a=a%m;
    while(b>0){
        if(b&1){
            res=(res*a)%m;
        }
        a=(a*a)%m;
        b=b>>1;
    }
    return res;
}


int p[1000006];
vi prime;
//int mrp[1000000];
void seive(){
    for(int i=2;i<1000006;i++) {
        if(p[i]){
            prime.pb(i);
            for(int j=i*i;j<=1000006;j=j+i){
                p[j]=0;
            }
        }
    }

}
// int c;
int dp[300001];



int32_t main()
{
    // memset(prime,0,sizeof(prime));
    //memset(p,1,sizeof(p));   
    //seive();
    //file();
    fast();
    //int mo=1000000007;
   int n;
   cin>>n;
   int k;
   cin>>k;
   int a[n];
   for(int i=0;i<n;i++) cin>>a[i];
    memset(dp,0,sizeof(dp));
    dp[0]=0;
    for(int i=1;i<=k;i++){
        for(int j=0;j<n;j++){
            if(i-a[j]>=0){
                if(dp[i-a[j]]==0) {
                    dp[i]=1;
                    break;
                }
            }
        }
    }
    //for(int i=0;i<k;i++) cout<<dp[i]<<" ";
    if(dp[k]) cout<<"First";
    else cout<<"Second";
    




    return 0;
    
    
}



Measured memory_bytes: 5952
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N = in(),M = in();
    vector<int> A(N);
    REP(i,N)A[i] = in();
    vector<pair<int,int>> B(M);
    REP(i,M){
        B[i].second = in();
        B[i].first = in();
    }
    sort(ALL(A));
    sort(ALL(B),greater<>());
    int place = 0;
    REP(i,M){
        REP(l,B[i].second){
            if(A[place] < B[i].first){
                A[place] = B[i].first;
                place++;
            }else{
                break;
            }
        }
    }
    ll answer = 0;
    REP(i,N)answer += A[i];
    cout << answer << "\n";
}

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

typedef long long ll;
const int N = 100005;
const ll MOD = 1e9+7;


int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
	
	ll x,y;
	cin>>x>>y;
	if(x == y || x == y+1 || x == y-1){
		cout<<"Brown";
	}else{
		cout<<"Alice";
	}
	
	return 0;
}



Measured memory_bytes: 3620
#include<stdio.h>

main(){
  int i,j,k,l,n,min,R[100],C,m[100][100];
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d%d",&R[i],&C);
  R[n] = C;
   
  for(i=1;i<=n;i++)m[i][i]=0;
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j = l+i-1;
      m[i][j] = 99999999;
      for(k=i;k<=j-1;k++){
	min = m[i][k] + m[k+1][j] + R[i-1]*R[k]*R[j];
	if(m[i][j] >  min)m[i][j] = min;
      }
    }
  }
      printf("%d\n",m[1][n]);
      return 0;
}

Measured memory_bytes: 636
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<cmath>
#include<queue>
#include<unordered_map>
#include<map>
#include<stack>
#include<bits/stdc++.h>
#include<string.h>
#include <ext/pb_ds/assoc_container.hpp>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
//#define f first
//#define s second
#define respr(fir,sec) for(int i=0;i<=fir;i++){for(int j=0;j<=sec;j++){cout << res[i][j] << " ";}cout << "\n";}
#define pb push_back
//#define INF (1LL<<31)
using namespace std;
using namespace __gnu_pbds;
const int mod = 1e9+7;
const ll MAX = 1000000000000000000;
typedef pair<int,ll> pii;
typedef pair<ll,int> pi;
typedef tuple<long long,int> tp;
typedef tuple<int,int,long long> tu;
typedef multimap<pii , int> mpp;
typedef priority_queue< tp , vector<tp>, greater<tp>>  minheap;
typedef priority_queue<pii , vector<pii>> maxheap;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>  new_data_set;
const int nax=1005;
ll dp[nax][nax];


int main()
{
	FASTIO;
	int H,W;
	cin >> H >> W;
	vector<vector<char>> arr(H,vector<char>(W));
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin >> arr[i][j];
		}
	}
	bool flag=false;
	for(int i=0;i<W;i++){
		if(arr[0][i]=='#' || flag){
			dp[0][i] =0;
			flag=true;
		}
		else
			dp[0][i] =1;
	}
	flag=false;
	for(int j=0;j<H;j++){
		if(arr[j][0]=='#' || flag){
			dp[j][0] = 0;
			flag=true;
		}
		else
			dp[j][0] = 1;
	}
	
	for(int i =1;i<H;i++){
		for(int j=1;j<W;j++){
			if(arr[i][j]=='#')
				dp[i][j]=0;
			else{
				dp[i][j] = (dp[i-1][j]+dp[i][j-1]);	
				dp[i][j] %= mod;
			}	
		}
	}
	
	cout << dp[H-1][W-1] << "\n";
	return 0;
}


Measured memory_bytes: 9088
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

    int N; cin>>N;
    vector<int> a(N);
    for(int i=0;i<N;i++) cin>>a[i];
    sort(a.begin(),a.end());

    int ans=0;
    for(int i=0;i<N;i++) for(int j=i+1;j<N;j++){
        int x=a[i]+a[j];
        int cnt=lower_bound(a.begin(),a.end(),x)-(a.begin()+j+1);
        ans+=cnt;
        // cout<<x<<' '<<cnt<<endl;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
#define ll long long


int main(){
    std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
    string input = "";
    cin >> input;
    if(input=="ABC")
        cout << "ARC" << endl;
    if(input=="ARC")
        cout << "ABC" << endl;

}

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

typedef long long int ll;

int main()
{
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
       string a,b;
       cin>>a>>b;
       string c="";
       for(ll i=0;i<a.size();i++)
       {
           c += a[i];
           c += b[i];
       }
       std::cout << c << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
 
#define li long long int
#define FOR(i, a, b) for (li (i) = (a) ; (i) < (b) ; ++(i))
#define REP(i, n) FOR(i, 0, n)

int main(void) {
    li N;
    cin >> N;

    li C[N + 10];
    li S[N + 10];
    li F[N + 10];

    li ans[N + 10];

    FOR(i, 0, N-1) {
        cin >> C[i] >> S[i] >> F[i];
    }

    FOR(index, 0, N-1) {
        li answer = 0;
        FOR(k, index, N-1) {
            if (answer == 0) {
                // はじめは待ち時間と移動時間のみ追加
                answer = S[k];
                answer += C[k];
                continue;
            }

            if (answer < S[k]) {
                // 列車の運行開始前の場合は開始まで待ち、移動時間を追加
                answer = S[k];
                answer += C[k];
            } else {
                if (answer % F[k] == 0) {
                    answer += C[k];
                } else {
                // 運行開始後の場合は、次の列車を待ち、移動時間を追加
                li multi = answer / F[k];
                li diff = (multi + 1) * F[k] - answer;
                answer += diff + C[k];
                }
            }
        }
        ans[index] = answer;
    }

    FOR(index, 0, N) {
        if (index == N-1) {
            cout << 0 << endl;
        } else {
        cout << ans[index] << endl;
        }
    }

    return 0;
}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  cin >> n;
  int a[n + 1];
  REP1(i, n) cin >> a[i];
  int ans[n + 1];
  int m = 0;
  REP1(i, n) ans[i] = 0;
  for (int i = n; i >= 1; --i) {
    int cnt = 0;
    for (int j = i; j <= n; j += i) {
      cnt ^= ans[j];
    }
    ans[i] = cnt ^ a[i];
    m += ans[i];
  }
  cout << m << endl;
  REP1(i, n) {
    if (ans[i]) {
      cout << i << " ";
    }
  }
  cout << "\n";
  return 0;
}

Measured memory_bytes: 2432
n,m = map(int,raw_input().strip().split(' '))
graph = [[] for i in range(n)]
for i in range(m):
    s,t = map(int,raw_input().strip().split(' '))
    graph[s].append(t)
    graph[t].append(s)
color = {}
c = 0
for i in range(n):
    if not i in color:
        que = [i]
        color[i] = c
        while len(que) > 0:
            u = que[0]
            for v in graph[u]:
                if not v in color:
                    color[v] = c
                    que.append(v)
            del que[0]
        c += 1
q = int(raw_input())
for i in range(q):
    s,t = map(int,raw_input().strip().split(' '))
    if color[s] == color[t]:
        print 'yes'
    else:
        print 'no'

Measured memory_bytes: 32192
using System;
using System.Collections.Generic;

public class Program
{
	 static void Main(string[] args){
	 	int i=1;
	 	while(true){
	 	int x = int.Parse(Console.ReadLine());
	   if (x == 0)break;
	   	Console.WriteLine("Case {0}: {1}" ,i,x);
	   	i++;
	   	}
	}
}



Measured memory_bytes: 17960
x, y = list(map(int, input().split(' ')))
set1 = {a + 1 for a in range(x)}
for i in range(y):
    num = int(input())
    row = set(map(int, input().split(' ')))
    for v in row:
        set1.discard(v)

print(len(set1))


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    map<string,int> mp;
    for (int i = 0;i < n;i++){
        cin >> a.at(i);
    }
    sort(a.begin(),a.end(),greater<int>());
    int A=0;
    int B=0;
    for (int i = 0;i < n;i++){
        if(i % 2 == 0){
            A += a.at(i);
        }
        else {
            B += a.at(i);
        }
    }
    cout << A - B << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int a[3];
    int sum=10000000;
    cin>>a[0]>>a[1]>>a[2];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            for(int t=0;t<3;t++){
                if(i!=j&&j!=t&&i!=t){
                    int b=abs(a[i]-a[j])+abs(a[j]-a[t]);
                    sum=min(sum,b);
                }
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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 dp[100010];
bool ng[100010];

int main(int argc, char const *argv[]) {
  int n,m;
  cin >> n >> m;
  rep(i,m){
    int t; cin >> t;
    ng[t]=true;
  }
  dp[0]=1;
  rep(i,n){
    if(ng[i+1] == false){
       dp[i+1]+=dp[i];
       dp[i+1]%=MOD;
   }
   if(ng[i+2] == false){
      dp[i+2]+=dp[i];
      dp[i+2]%=MOD;
 }
 }
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m; cin >> n >> m;
	string s, t; cin >> s >> t;
	int a = lcm(n, m);
	for (int i = 0; i < a; i += a / n) {
		if (i % (a / m) == 0) {
			if (s[i / (a / n)] != t[i / (a / m)]) {
				cout << -1 << endl; return 0;
			}
		}
	}
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 640
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

  	vector<Int> A(3);
    rep(i, 0, 3) cin >> A[i];
  
    cout << *max_element(A.begin(), A.end()) - *min_element(A.begin(), A.end()) << endl;
}


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

vector<ll> yakusu(ll n){
    vector<ll> ret;
    for(ll i = 1; i*i <= n; i++){
        if(n % i != 0) continue;
        ret.push_back(i);
        if(i*i != n) ret.push_back(n/i);
    }
    sort(ret.begin(), ret.end());
    return ret;
}

int main(){
    ll N, M;
    cin >> N >> M;
    auto vec = yakusu(M);
    ll ans = 1;
    for(auto v : vec){
        if(v * N <= M) ans = max(ans, v);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
                 
                using namespace std;
                 
                int main(){
                  int n,ans = 0;
                  int keta = 0;
                  cin >> n;
                  
                  while(n >= pow(10, keta)){
                    keta++;
                  }
                  if(keta % 2 == 0){
                    while(keta > 0){
                      ans += 9 * (pow(10, keta));
                      keta -= 2;
                    }
                  }
                  
                  else{
                    ans += (n-pow(10,keta-1) + 1);
                    ans = ans * 100;
                    keta--;
                    while(keta > 0){
                      ans += 9 * (pow(10, keta));
                      keta -= 2;
                    }
                  }
                  ans = ans/100;
                  cout << ans << endl;
                  return 0;
                }

Measured memory_bytes: 256
s = input()
t = input()
L = len(s)
l = len(t)
p = L-l
li = []
for i in range(p+1):
    ns = s[i:i+l]
    num = 0
    for j in range(l):
        if ns[j]!=t[j]:
            num +=1
    li += [num]
print(min(li))

Measured memory_bytes: 9004
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
const int maxn=5e5+10;
const int mod=1e9+7;
ll inv[maxn];
ll fac[maxn];
ll power(ll base,ll n)
{
    ll r=1;
    while(n)
    {
        if(n&1) r=r*base%mod;
        base=base*base%mod;
        n/=2;
    }
    return r;
}
void init()
{
    fac[0]=1;
    for(int i=1;i<maxn;i++)
    {
        fac[i]=fac[i-1]*i%mod;
    }
    inv[maxn-1]=power(fac[maxn-1],mod-2);
    for(int i=maxn-2;i>=0;i--)
    {
        inv[i]=inv[i+1]*(i+1);
        inv[i]%=mod;
    }

}
ll C(ll m,ll n)
{
    return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
ll A(ll m,ll n)
{
    return fac[n]*inv[n-m]%mod;
}


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	init();
	ll n,m;
	cin>>n>>m;
	//cout<<C(3,4)<<'\n';
	ll sum=A(n,m)*A(n,m)%mod;
	ll res=0;
	int f=-1;
	for(int i=1;i<=n;i++)
    {
        f*=-1;
        res+=C(i,n)*A(n-i,m-i)%mod*f;
        res=(res+mod)%mod;
    }
    sum=((sum-A(n,m)*res%mod)+mod)%mod;
    cout<<sum<<'\n';






}


Measured memory_bytes: 11420
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int d = scan.nextInt();
		int x = scan.nextInt();
		int a[] = new int[100];
		int cnt[] = new int[100];
		for(int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
			for(int k = 1; k <= d; k++) {
				if(k * a[i] + 1 <= d) {
					cnt[i]++;
				}
			}
		}
		int sum = 0;
		for(int i = 0; i < 100; i++) {
			sum += cnt[i];
		}
		System.out.println(sum + n + x);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
  cin>>N;
vector<int>  vec(N-1);//入力値
  vector<int> buka(N); //直属の部下数
  
for (int i = 0; i < N-1; i++) {
  cin >> vec.at(i);
  buka.at(vec.at(i)-1)++;
}

 for (int i = 0; i < N; i++) {
  cout<< buka.at(i)<<endl;}

}

Measured memory_bytes: 4844
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 200000+5;
const int dx[] = {0,0,-1,1,-1,-1,1,1};
const int dy[] = {-1,1,0,0,-1,1,-1,1};
using namespace std;
int fatherRoad[N],fatherRail[N];
int Find(int father[],int x){
    if(x!=father[x])
        return father[x]=Find(father,father[x]);
    return x;
}
void Union(int father[],int x,int y){
    x=Find(father,x);
    y=Find(father,y);
    if(x!=y)
        father[y]=x;
}
int main() {
    int n,k,l;
    scanf("%d%d%d",&n,&k,&l);
    for(int i=1;i<=n;i++){
        fatherRoad[i]=i;
        fatherRail[i]=i;
    }
    for(int i=1;i<=k;i++){
        int x,y;
        scanf("%d%d",&x,&y);
        Union(fatherRoad,x,y);
    }
    for(int i=1;i<=l;i++){
        int x,y;
        scanf("%d%d",&x,&y);
        Union(fatherRail,x,y);
    }
 
    for(int i=1;i<=n;i++){
        Find(fatherRoad,i);
        Find(fatherRail,i);
    }
    map<pair<int,int>,int> mp;
    for(int i=1;i<=n;i++)
        mp[make_pair(fatherRoad[i],fatherRail[i])]++;
    for(int i=1;i<=n;i++)
        printf("%d\n",mp[make_pair(fatherRoad[i],fatherRail[i])]);
    return 0;
}

Measured memory_bytes: 13568
using System;
using System.Collections.Generic;

class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');

		List<string> list = new List<string>();
		for (int i = 0; i < input.Length; i++)
		{
			list.Add(input[i]);
		}

		for (int i = 0; list.Count > 1; i++)
		{
			if (list[i] == "+" || list[i] == "-" || list[i] == "*")
			{
				int m = int.Parse(list[i - 2]);
				int n = int.Parse(list[i - 1]);
				switch (list[i])
				{ 
					case "+":
						list[i] = (m + n).ToString();
						break;
					case "-":
						list[i] = (m - n).ToString();
						break;
					case "*":
						list[i] = (m * n).ToString();
						break;
				}
				list.RemoveAt(i - 1);
				list.RemoveAt(i - 2);
				i -= 2;
			}
		}

		Console.WriteLine(list[0]);
	}
}


Measured memory_bytes: 16004
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	x := iScan()
	ans := 1
	for i := 2; i*i <= x; i++ {
		y := i * i
		for y <= x {
			ans = larger(ans, y)
			y *= i
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1772
import java.util.Scanner;

public class Main{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
String day=scan.next();

if(day.equals("SUN")){
    System.out.println(7);
}
if(day.equals("MON")){
    System.out.println(6);
}
if(day.equals("TUE")){
    System.out.println(5);
}
if(day.equals("WED")){
    System.out.println(4);
}
if(day.equals("THU")){
    System.out.println(3);
}
if(day.equals("FRI")){
    System.out.println(2);
}
if(day.equals("SAT")){
    System.out.println(1);
}

}
}

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

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

	int H[100] = {};

	int n = N;
	int i = 0;

	while (n--) {
		cin >> H[i];
		i++;
	}

	int view = 0;
	int max_H = 0;
	int a = 0;

	for (i = 0; i <= N; i++) {
		while (a <= i) {
			max_H = max(max_H, H[a]);
			a++;
			if (max_H == H[i]) {
				view++;
			}
		}
	}

	cout << view << endl;
}

Measured memory_bytes: 256
n = int(input())
L = list(map(int,input().split()))
m = 10**9+7
ans = 0
def gcd(x,y):
  while y != 0:
    cur = x
    x = y
    y = cur%y
  return x
if n != 1:
  lcm = L[0]*L[1]//gcd(L[0],L[1])
  for i in range(2,n):
    p = gcd(L[i],lcm)
    lcm = L[i]*lcm//p
  for i in range(n):
    k = (lcm%m)*pow(L[i],10**9+5,m)
    ans = (ans+k)%m
else:
  ans = 1
print(ans)

Measured memory_bytes: 4084