akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int gcd(int n,int m){
  int a;
  
  if(n == m) return n;
  if(n < m){
    a = m % n;

    if(a == 0) return n;
    else return gcd(n,a);
  }
  else{
    a = n % m;

    if(a == 0) return m;
    else return gcd(m,a);
  }
}

int main(){
  int n,m;

  scanf("%d %d",&n,&m);
  printf("%d\n",gcd(n,m));

  return 0;
}


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

#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define ep emplace_back
int main(void) 
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie();
	ll n; 
	cin >> n;
	ll ans = LLONG_MAX; 
	for (ll i=1; i*i<=n; i++) 
	{
		if (n%i==0) 
		{
			ans = min(ans, i-1+(n/i)-1);
		}
	}
	cout << ans << "\n";

	return false; 
}




Measured memory_bytes: 256
while buf=gets do
        a,b,c,d,e,f = buf.split.map(&:to_i)
        x = ((e*c-b*f)*1.0/(a*e-b*d)*1000).round/1000.0
        y = ((a*f-c*d)*1.0/(a*e-b*d)*1000).round/1000.0
#       if x.to_s[0]=='-'
#               x*=-1
#       end
#       if y.to_s[0]=='-'
#               y*=-1
#       end
        printf("%.3f %.3f\n",x,y)

end
=begin
=end

Measured memory_bytes: 8672
#include <bits/stdc++.h>
 
using namespace std;
 
const long long MOD=1e9+7;
const double PI=3.14159265359;



int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin>>n;
    vector<int> v(n);
    int sum=0;
    for(auto& i:v){
        cin>>i;
        sum+=i;
    }
    int goal=sum/2+sum%2;
    
    
    bitset<4000000> cur, prev;
    
    prev[0]=1;
    //cout<<cur.size()<<endl;
    for(int i=0; i<n; i++){
        cur=prev|(prev<<v[i]);
        prev=cur;
    }
    
    for(int i=0; i<=2002000; i++){
        if(cur[i] && i>=goal){
            cout<<i;
            return 0;
        }
    }
    
    
    
    
   
    return 0;
}

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

long long dp[10000][100][2];
long long mod = 1e9 + 7;
int main() {
  string n;
  cin>>n; 
  int d;
  cin>>d;

  int len = n.length();
  for (int i=0; i<len; i++) {
    for (int j=0; j<d; j++) {
      dp[i][j][0] = 0;
      dp[i][j][1] = 0;
    }
  }
  for (int j=0; j<10; j++) {
    if (j < n[0] - '0') {
      dp[0][j%d][1] += 1;
    } else if (j == n[0] - '0') {
      dp[0][j%d][0] += 1;
      break;
    }
  }
  for (int i=1; i<len; i++) {
    for (int j=0; j<d; j++) {
      for (int k=0; k<10; k++) {
        if (k < n[i] - '0') {
          dp[i][(j+k)%d][1] += dp[i-1][j][1] + dp[i-1][j][0];
          dp[i][(j+k)%d][1] %= mod;
        } else if (k == n[i] - '0') {
          dp[i][(j+k)%d][1] += dp[i-1][j][1];
          dp[i][(j+k)%d][1] %= mod;
          dp[i][(j+k)%d][0] += dp[i-1][j][0];
          dp[i][(j+k)%d][0] %= mod;
        } else {
          dp[i][(j+k)%d][1] += dp[i-1][j][1];
          dp[i][(j+k)%d][1] %= mod;
        }
      }
    }
  }
  long long ans = dp[len-1][0][0] + dp[len-1][0][1];
  cout<<(ans-1 + mod) % mod<<endl;
}


Measured memory_bytes: 15872
#include <stdio.h>
int main(void)
{
	int data[10000],i,j;
	long MAX,MIN,amount = 0;
	scanf("%d",&i);
	for(j=0;j<i;j++)
	{
		scanf(" %d",&data[j]);
	}
	for(j=0;j<i;j++)
	{
		amount+=data[j];
			if (j==0)
			{
				MAX = data[j];
				MIN = data[j];
			}
			if (MAX <data[j])
			{
				MAX = data[j];
			}
			if (MIN >data[j])
			{
				MIN=data[j];
			}
	}
	printf("%ld %ld %ld\n",MIN,MAX,amount);

	return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define P pair<int, int>
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
const int ALPHA = 26;

int N, len;

bool isValid(map<char, int> &num, vector<string> &s){
  int sum = 0;
  REP(i, N) if(s[i].length() != 1 && num[s[i][(int)(s[i].length()) - 1]] == 0) return false;
  REP(j, len){
    REP(i, N){
      if(j >= s[i].length()) continue;
      if(num[s[i][j]] == -1) return true;
      if(s[i].length() != 1 && j + 1 >= s[i].length() && num[s[i][j]] == 0) return false;
      if(i + 1 >= N && num[s[i][j]] != sum % 10) return false;
      if(i + 1 < N) sum += num[s[i][j]];
    }
    sum /= 10;
  }
  return (sum == 0 ? true : false);
}

int dfs(int now, map<char, int> &num, vector<bool> &used, string &cs, vector<string> &s){
  if(now >= cs.size()) return 1;
  int res = 0;
  REP(i, 10){
    if(used[i]) continue;
    used[i] = true;
    num[cs[now]] = i;
    if(isValid(num, s)) res += dfs(now + 1, num, used, cs, s);
    used[i] = false;
    num[cs[now]] = -1;
  }
  return res;
}

int main(){
  while(scanf("%d", &N) && N){
    len = 0;
    vector<string> s(N);
    REP(i, N){
      cin >>s[i];
      len = max(len, (int)(s[i].length()));
      REVERSE(s[i]);
    }
    if(s[N - 1].length() < len){
      cout <<0 <<endl;
      continue;
    }
    stringstream cs;
    bool _cs[ALPHA];
    memset(_cs, 0, sizeof(_cs));
    REP(j, len){
      REP(i, N){
        if(j >= s[i].length() || _cs[s[i][j] - 'A']) continue;
        _cs[s[i][j] - 'A'] = true;
        cs << s[i][j];
      }
    }
    string css = cs.str();

    vector<bool> used((int)(cs.str().length()), false);
    map<char, int> num;
    REP(i, css.size()) num[css[i]] = -1;
    cout <<dfs(0, num, used, css, s) <<endl;
  }
  return 0;
}

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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<unsigned long> ans(N);
    for(unsigned long i{1}; i * i <= N; ++i)for(unsigned long j{1}; i * (i + j) + j * j <= N; ++j)for(unsigned long k{1}; i * (i + j + k) + j * (j + k) + k * k <= N; ++k)++ans[i * (i + j + k) + j * (j + k) + k * k - 1];
    for(const auto& i : ans)cout << i << endl;
    return 0;
}

Measured memory_bytes: 3628
package main

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

func main() {
	fmt.Printf("%d\n", resolve(parseProblem(os.Stdin)))
}

func parseProblem(r io.Reader) (int, int, []int, []int) {
	const (
		initialBufSize = 100000
		maxBufSize     = 1000000
	)
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	n, w := scanInt(sc), scanInt(sc)
	ws, vs := make([]int, n), make([]int, n)
	for i := 0; i < n; i++ {
		ws[i] = scanInt(sc)
		vs[i] = scanInt(sc)
	}

	return n, w, ws, vs
}

func resolve(n, w int, ws, vs []int) int {
	states := make([][]int, n)
	states[0] = make([]int, w)
	for j := 0; j < w; j++ {
		if j >= ws[0]-1 {
			changeToMax(&(states[0][j]), vs[0])
		}
	}
	for i := 1; i < n; i++ { // 0-indexed
		states[i] = make([]int, w)
		for j := 0; j < w; j++ {
			if j+1-ws[i] >= 0 {
				if j+1-ws[i] == 0 {
					changeToMax(&(states[i][j]), vs[i])
				} else {
					changeToMax(&(states[i][j]), states[i-1][j-ws[i]]+vs[i])
				}
			}
			changeToMax(&(states[i][j]), states[i-1][j])
		}
	}
	return states[n-1][w-1]
}

const (
	inf  = math.MaxInt32
	ninf = math.MinInt32
)

func changeToMin(v *int, cand int) (updated bool) {
	if *v > cand {
		*v = cand
		updated = true
	}
	return updated
}

func changeToMax(v *int, cand int) (updated bool) {
	if *v < cand {
		*v = cand
		updated = true
	}
	return updated
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 81152
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int N = sc.nextInt();
        int M = sc.nextInt();
        ArrayList<ArrayList<Integer>> G = new ArrayList<>();
        for(int i = 0; i < N; i++){
            G.add(new ArrayList<>());
        }
        for(int i = 0; i < M; i++){
            int u = sc.nextInt()-1;
            int v = sc.nextInt()-1;
            G.get(u).add(v);
        }
        int s = sc.nextInt()-1;
        int t = sc.nextInt()-1;
        long[][] dist = new long[N][3];
        for(int i = 0; i < N; i++){
            Arrays.fill(dist[i],-1);
        }
        dist[s][0] = 0;
        Deque<Point> q = new ArrayDeque<>();
        q.add(new Point(s,0));
        while (q.size() > 0) {
            Point P = q.poll();
            int v = P.v;
            int p = P.p;
            for(int nv : G.get(v)){
                int np = (p+1)%3;
                if(dist[nv][np] == -1){
                    dist[nv][np] = dist[v][p]+1;
                    q.add(new Point(nv,np));
                }
            }
        }
        pw.println(dist[t][0] != -1 ? dist[t][0]/3 : -1);
        pw.flush();
    }
}

class Point{
    int v, p;
    public Point(int v, int p){
        this.v = v;
        this.p = p;
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 71952
package main

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

// AtCoder Functions
var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	N := nextInt()
	K := nextInt()

	h := make([]int, N)
	for i := 0; i < N; i++ {
		h[i] = nextInt()
	}

	sort.Sort(sort.Reverse(sort.IntSlice(h)))

	ret := 0
	for i := 0; i < N; i++ {
		if h[i] >= K {
			ret++
		} else {
			break
		}
	}

	fmt.Println(ret)
}


Measured memory_bytes: 1792
N = int(raw_input())
S = raw_input()

leftAdd = 0
leftCount = 0
for i in range(N):
  if S[i]=='(':
    leftCount += 1
  elif leftCount == 0:
    leftAdd += 1
  else:
    leftCount -= 1

result = '(' * leftAdd + S + ')' * leftCount
print(result)

Measured memory_bytes: 2568
N = int(input())
h = list(map(int,input().split()))
ans = 0
for j in range(max(h)):
    for i in range(N-1):
        if h[i] != 0 and h[i+1] == 0:
            ans += 1
        if h[i] != 0:
            h[i] -= 1
    if h[N-1] != 0:
        h[N-1] -= 1
        ans += 1
print(ans)

Measured memory_bytes: 3064
//naveen mall
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb               push_back
#define sz(c)            (int)c.size()
#define len(c)           (int)c.length()
#define vec              vector
#define int              long long int
#define all(c)           c.begin(), c.end()
#define rall(c)          c.rbegin(), c.rend()
#define trav(a,i)        for(auto i: a)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define invect(v,n)       for(int i=0;i<n;i++ ){int arb;cin>>arb;v.pb(arb);}
#define inset(s,n)        fl(i,0,n){int aset;cin>>aset;s.insert(aset);}
#define display(c)        trav(c,i) cout<<i<<" ";cout<<"\n";
#define F                 first
#define S                 second
#define pii               pair<int,int>
#define PB                pop_back
#define endl              "\n"
#define what(x) cerr <<  #x << " is " << x << endl;
int sum() { return 0; }template<typename T,typename... Args>T sum(T a, Args... args) { return a + sum(args...); }


 
void solve()
{  
  int r;
  cin>>r;
  float pi =3.14159265;
   float ans=2*pi*r;
   cout<<ans;
 
}
signed main()
{fast
    int t;
 t=1;
  //cin>>t;
  while(t--)
     {
      solve();
     }
 
 
 
}


Measured memory_bytes: 3800
#include <cstdio>
#include <algorithm>
using namespace std;
int n,m,q;
struct Node{
	int a,b,c,d;
}a[55];
int lst[55],res=0;
void dfs(int cur,int pre){
	if(cur==n+1){
		int ans=0;
		for(int i=1;i<=q;++i){
			if(lst[a[i].b]-lst[a[i].a]==a[i].c){
				ans+=a[i].d;
			}
		}
		res=max(res,ans);
		return;
	}
	for(int i=pre;i<=m;++i){
		lst[cur]=i;
		dfs(cur+1,i);
		lst[cur]=0;
	}
}
int main()
{
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=q;++i){
		scanf("%d%d%d%d",&a[i].a,&a[i].b,&a[i].c,&a[i].d);
	}
	dfs(1,1);
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 1688
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define lli long long int
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF 9223372036854775807+1
#define sosuu 1000000007

int main(){
  int N;
  cin>>N;
  vector<lli> A(N);
  rep(i,N)
    cin >> A[i];
  sort(ALL(A));
  rep(i, N-1){
  if(A[i]==A[i+1]){
  cout << "NO" << endl;
    return 0;
  }
  }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.util.*;
import java.io.*;
import static java.lang.Integer.parseInt;

public class Main {
    
    public static void main(String[] arg) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        ArrayList<Integer> al = new ArrayList<>();
        int i = 0,j=0;
        while(i<10){
            int x = parseInt(br.readLine());
            if(0<=x&&x<=10000){
            al.add(x);
            }
            i++;
        }
        Collections.sort(al,Comparator.reverseOrder());
        while(j<3){
            System.out.println(al.get(j));
            j++;
        }
    }
}

Measured memory_bytes: 24196
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (ll)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
//get_be biger & equal
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll n,k,r,S,p,ans;
string s; 
map<char,int> score;
map<char,int> id;
int help(vector<int>& slices) {
	 int len = sz(slices),ans;
     vector<VI> dp(len,VI(3,0));
     ans = dp[0][id[s[slices[0]]]] = score[s[slices[0]]];
     for(int i=1;i<len;i++){
     	for(int j=0;j<3;j++){
     		 int mx=0;
     		 for(int k=0;k<3;k++){
     		 	if(k!=j)mx = max(mx,dp[i-1][k]);
			  }
			  dp[i][j] = mx+(j==id[s[slices[i]]]?score[s[slices[i]]]:0);
			  ans = max(ans,dp[i][j]);
		 }
	 }
	 //cout<<ans<<endl;
	 return ans;
} 
void solve(){
	cin>>n>>k>>r>>S>>p>>s;
	score['r'] = p;
	score['s'] = r;
	score['p'] = S;
	id['r'] = 0;
	id['s'] = 1;
	id['p'] = 2;
	rep(i,0,k){
		int j = i;
		VI slices;
		while(j<n){
			slices.pb(j);
			j+=k;
		}
		ans+=help(slices);
	}
	cout<<ans;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}





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

int main(){
    ll n;
    cin >> n;
    ll ans = 1e18;
    bool prime = 1;
    for ( ll i = 2; i * i <= n; ++i ) {
        if ( n % i != 0 ) continue;
        prime = 0;
        ans = min(ans, n / i - 1 + i - 1 );
    }
    if ( prime ) {
        cout << n -1 << endl;
    }
    else {
        cout << ans << endl;
    }
    return 0;
}


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

#define PI 3.14159265359
#define EPS 1e-16
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = (a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (a); i <= (long long)(n); i++)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

struct Edge { 
    int from;
    int to;
    ll cost;

    Edge(int from_, int to_, int cost_) : 
        from(from_), to(to_), cost(cost_) { }
};

void shortest_path(int s, vector<Edge> &edges, v_ll &dist, v_bool &negative, ll &ans) 
{ 
    irep(i, dist.size()) { dist[i] = LINF; }
    irep(i, negative.size()) { negative[i] = false; }
    dist[s] = 0;

    irep(v, dist.size()) {
        irep(i, edges.size()) { 
            Edge e = edges[i];
            if(dist[e.from] != LINF && 
               dist[e.to] > dist[e.from] + e.cost) {
                dist[e.to] = dist[e.from] + e.cost;
            }
        }
    }

    ans = dist[dist.size()-1];

    irep(v, dist.size()+3) {
            
        irep(i, edges.size()) { 
            Edge e = edges[i];
            if(dist[e.from] != LINF && 
               dist[e.to] > dist[e.from] + e.cost) {
                dist[e.to] = dist[e.from] + e.cost;
                negative[e.to] = true; 
                if(negative[e.from]) {
                    negative[e.to] = true; 
                }
            }
        }
    }
}

bool find_negative_loop(vector<Edge> &edges, v_ll &dist) { /*find negative loop*/

    irep(i, dist.size()) { dist[i] = LINF; }

    for(int i = 0; i < dist.size(); i++) {
        for(int j = 0; j < edges.size(); j++) {
            Edge edge = edges[j];
            if(dist[edge.to] > dist[edge.from] + edge.cost) {
                dist[edge.to] = dist[edge.from] + edge.cost;
                if(i == dist.size()-1) return true;
            }
        }
    }
    return false;
}

int main(void)
{
    int n, m;
    cin >> n >> m;
    
    vector<Edge> edges;
    v_ll dist(n);
    v_bool negative(n);

    irep(i, m) {
        ll a, b, c;
        cin >> a >> b >> c;
        Edge e(a-1, b-1, -c);
        edges.push_back(e);
    }

    ll ans = 0;
    shortest_path(0, edges, dist, negative, ans);

    if(negative[n-1]) {
        cout << "inf" << endl;
    } else {
        cout << -dist[n-1] << endl;
    }

    return 0;
}



Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))
flag = True
for i in range(N-2, 0, -1):
    defe = H[i] - H[i+1]
    if defe > 1:
        flag = False
        break
    elif defe == 1:
        H[i] -= 1
print('Yes' if flag else 'No')


Measured memory_bytes: 14396
from collections import deque

def iin(): return int(input())
def iln(): return list(map(int, input().split()))


S = input()

queue = deque()
for c in S:
    queue.append(c)

is_reversed = False

QN = iin()

for i in range(QN):
    operation = input().split()
    if len(operation) == 1:
        is_reversed = not is_reversed
    else:
        _, op, new_char = operation
        if op == "1":
            # append to head
            if is_reversed:
                queue.append(new_char)
            else:
                queue.appendleft(new_char)
        else:
            # append to tail
            if is_reversed:
                queue.appendleft(new_char)
            else:
                queue.append(new_char)

if is_reversed:
    print("".join(reversed(queue)))
else:
    print("".join(queue))



Measured memory_bytes: 8692
#include<bits/stdc++.h>
using namespace std;
map<string,int>a; int n,tot;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		string s; cin>>s;
		if(a.count(s)==0) tot++,a[s]=1;
	}
	cout<<tot;
	return 0;
}

Measured memory_bytes: 19116
#include <stdio.h>
 int main(void){
 	int a,b,c,x,y;
 	scanf("%d",&x);
 	a=x/3600;
 	y=x%3600;
 	b=y/60;
 	c=y%60;
 	printf("%d:%d:%d\n",a,b,c);
 	return 0;
 	}


Measured memory_bytes: 1996
#include<iostream>
#include<vector>
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int n;
 cin>>n;
  vector <int> v(n);
  for(int i=0;i<n;i++)
    cin>>v[i];
  sort(v.begin(),v.end());
  double result;
  result=v[0];
  for(int i=1;i<n;i++)
  {
    result=(result+v[i])/2;
  }
  cout<<result<<endl;
  return 0;
}

Measured memory_bytes: 256
n=int(input())
s=input()
if len(s)%2==1:
    print('No')
else:
    ok=1
    mid=len(s)//2
    for i in range(mid):
        if s[i]!=s[mid+i]:
            ok=0
            break
    if ok:
        print('Yes')
    else :
        print('No')


Measured memory_bytes: 2940
from math import floor,ceil
K = int(input())
A = [int(x) for x in input().split()]
A.reverse()
jmax, jmin = 2,2

for i in range(0,K):
    if jmin % A[i] != 0:
        if (jmin + (A[i] - (jmin % A[i]))) > jmax:
            print(-1)
            exit()

    jmin = ceil(jmin / A[i]) * A[i]
    jmax = floor(jmax / A[i]) * A[i] + A[i] -1
    
print(jmin, jmax)


    #計算量はO(3K)すなわちO(K)

Measured memory_bytes: 14252
#include <stdio.h>

int main(void)
{
 int a,b,c;
 int cnt =0;
 
 scanf("%d %d %d",&a,&b,&c);

 if((a+b)>=c)
  cnt++;

 if(cnt!=0)
  printf("Yes");
 else
  printf("No");

 return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	factors := getFactors(N)

	h := make(map[int]bool)

	ret := 0

	sum := 1
	prevFactor := -1
	for _, factor := range factors {
		if _, exists := h[factor]; !exists {
			// first value
			h[factor] = true
			ret++
			sum = 1
			prevFactor = -1
			continue
		}

		if prevFactor == factor {
			sum *= factor
			if _, exists := h[sum]; !exists {
				// first value
				h[sum] = true
				ret++
				sum = 1
				prevFactor = -1
				continue
			}
			continue
		}

		prevFactor = factor
		sum = factor
	}

	fmt.Println(ret)
}

func getFactors(n int) []int {
	nums := []int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			nums = append(nums, i)
			n /= i
		}
	}
	if n != 1 {
		nums = append(nums, n)
	}
	return nums
}


Measured memory_bytes: 1840
while 1:
    a, op, b = map(str, raw_input().split())
    if op == "+":
        print int(a) + int(b)
    elif op == "-":
        print int(a) - int(b)
    elif op == "*":
        print int(a) * int(b)
    elif op == "/":
        print int(a) / int(b)
    elif op == "?":
        break

Measured memory_bytes: 6432
import math
def Sieve_of_Eratosthenes(N):
	prime={}
	for i in range(2,N+1):
		prime[i]=1

	for i in range(2,math.ceil(N**0.5)+1):
		tmp=set()
		for j in prime:
			if j>i and j%i==0: tmp.add(j)
		for j in tmp:
			prime.pop(j)

	return prime

N=10**5
prime=Sieve_of_Eratosthenes(N)
a=[0]*(N)
for i in range(2,N):
	if i in prime and (i+1)//2 in prime: a[i]=a[i-1]+1
	else: a[i]=a[i-1]

for i in range(int(input())):
	l,r=map(int,input().split())
	print(a[r]-a[l-1])

Measured memory_bytes: 17380
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;

class _Class
{
  void _Do()
  {
    var Nx = Split.ints();
    var an = Split.ints();

    int ret = 0;
    Array.Sort(an);

    int z = Nx[1];

    for (int i =0;i<an.Length-1 ;i++)
    {
      if (an[i] <= z)
      {
        ret += 1;
        z -= an[i];
      }
      else
      {
        break;
      }
    }
    {
      if (an[an.Length - 1] == z)
        ret += 1;
    }
    Console.WriteLine(ret);
  }

  int s(int x , int y)
  {
    Debug.Write("start");

    var z = new int[1000000];

    for (int i = 0; ; i++)
    {
      Debug.WriteLine(x + " " + y);

      if (z[x * 1000 + y] == 1)
      {
        return i-1;
      }
      z[x * 1000 + y] = 1;

      if (x * y == 0)
      {
        return 0;
      }

      //
      if (x < y)
      {
        x = rev(x);
      }
      else
      {
        y = rev(y);
      }

      if (x < y)
      {
        y= y - x;
      }
      else
      {
       x= x - y;
      }
    }
  }


  int rev(int a)
  {
    if (a < 10)
    {
      return a;
    }
    if (a<100)
    {
      int b = (a % 10)*10;

      b += ((a / 10) % 10);
      return b;
    }

    {
      int b = (a % 10)*100;

      b += ((a / 10) % 10) * 10;

      b += (a / 100);

      return b;
    }
  }


  static void Main(string[] args)
  {
    _(args);
    new _Class()._Do();
  }

  [Conditional("DEBUG")]
  static void _(string[] args)
  {
    if (args.Length != 0 && File.Exists(args[0]))
      Console.SetIn(new StreamReader(args[0]));
    else
      Console.Error.WriteLine("in");
  }
}

static class Split
{


  // 1
  public static string[] strings()
  {
    return Console.ReadLine().Split();
  }


  // [2.1] -2,147,483,648 ~ +2,147,483,647
  public static int[] ints()
  {
    var _s = Console.ReadLine().Split();

    var x = new int[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = int.Parse(_s[i]);

    return x;
  }

  // [2.2] 
  // -9,223,372,036,854,775,808 ~ 
  // +9,223,372,036,854,775,807
  public static long[] longs()
  {
    var _s = Console.ReadLine().Split();

    var x = new long[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = long.Parse(_s[i]);

    return x;
  }

  public static double[] doubles()
  {
    var _s = Console.ReadLine().Split();

    var x = new double[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = double.Parse(_s[i]);

    return x;
  }

  public static BigInteger[] bigs()
  {
    var _s = Console.ReadLine().Split();

    var x = new BigInteger[_s.Length];
    for (var i = 0; i < _s.Length; i++)
      x[i] = BigInteger.Parse(_s[i]);

    return x;
  }
}





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

int main() {
  int n;
  int a[100];

  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }

  sort(a, a + n, greater<>());

  int alice = 0;
  int bob = 0;

  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      alice += a[i];
    } else {
      bob += a[i];
    }
  }

  printf("%d\n", (alice-bob));
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(long long x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<long long,long long> P;
typedef pair<long long,P> PP;

long long n,m;
long long ans;
int main()
{
	cin>>n>>m;
	rep2(i,1,(long long)sqrt(m)+1)
	{
		if(m%i!=0)continue;
		if(m/i>=n)
		{
			ans=max(ans,i);
		}
		if(i>=n)
		{
			ans=max(ans,m/i);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<climits>
#include<cstring>
#include<iomanip>

using namespace std;

int main(void) {
    int a,b,k;cin>>a>>b>>k;
    int x=0;
    int i=101;
    while(x<k){
        i--;
            if(a%i==0&&b%i==0){
                x++;
            }
    }
    cout<<i<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int i,j,N,a[100];
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d",&a[i]);
	}
	for(j=N-1;j>=1;j--){
		printf("%d ",a[j]);
	}
	printf("%d",a[0]);
	printf("\n");
	return 0;
}

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

int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	if(a>=13)
		printf("%d\n",b);
	else if(a>=6&&a<=12)
		printf("%d\n",b/2);
	else if(a<=5)
		printf("0");
		return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 11;
char cn[cm], * ci = cn, ct;
inline int getint() {
	int A = 0;
	while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	fread(cn, 1, cm, stdin);
	int N = getint(), W = getint();

	ll dp[100001] = {};
	rep(i, N) {
		int w = getint();
		int v = getint();
		for (int j = W - w; j >= 0; j--) {
			chmax(dp[j + w], dp[j] + v);
		}
	}

	printf("%lld", dp[W]);

	Would you please return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <array>

using namespace std;
typedef long long ll;

ll num_bits(ll x){
    ll ret = 0;
    for(ret = 0; x > 0; ret++, x /= 2){}
    return ret;
}

int main(){
    ll l;
    cin >> l;
    ll k = num_bits(l);
    const ll n = k;
    vector<array<ll, 3>> edges;
    for(ll i = 1; i < k; ++i){
        edges.push_back({i, i + 1, 1 << (i - 1)});
        edges.push_back({i, i + 1, 0});
    }
    ll shift = 1 << (k - 1);
    l -= shift;
    while(l > 0){
        k = num_bits(l);
        edges.push_back({k, n, shift});
        l -= (1 << (k - 1));
        shift += 1 << (k - 1);
    }

    cout << n << ' ' << edges.size() << endl;
    for(int i = 0; i < edges.size(); ++i){
        cout << edges.at(i).at(0) << ' ' << edges.at(i).at(1) << ' '
          << edges.at(i).at(2) << endl;
    }
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N ;
  cin >> N ; 
  int ans = 100 ;
  for ( int i=0 ; i<N ;i++){
  int x ;
  cin >> x ;
    int count = 0 ;
  for ( int j = x ; j %2 ==0 ; ){
    j /=2 ;
      count ++ ;
  }
    ans = min ( ans , count ) ;
  }
  cout << ans << endl;
}


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

int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll> a(n), f(n);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> f[i];
	sort(a.begin(), a.end());
	sort(f.rbegin(), f.rend());
	ll ok = inf, ng = -1;
	while (ok - ng > 1) {
		ll mid = (ok + ng) / 2;
		ll cnt = 0;
		rep(i, n) {
			if (a[i] > mid / f[i]) cnt += a[i] - mid / f[i];
		}
		if (cnt <= k) ok = mid;
		else ng = mid;
	}
	cout << ok << endl;
	return 0;
}


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

public class Main {
	public static void main(String args[]) {
		FastScanner scanner = new FastScanner();
		String s=scanner.next();
		int min=100000000;
		for(int i=0;i<s.length()-2;i++){
			int tmp=Integer.parseInt(s.substring(i, i+3));
			min=Math.min(min, Math.abs(753-tmp));
		}
		System.out.println(min);
	}
}

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


Measured memory_bytes: 20820
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e9
#define MOD 1000000007
typedef long long ll;
//------------------------------------------------------------------------



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

  int x,y,z; cin >> x >> y >> z;
  cout << z << " " << x << " " << y << 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 rep2(i,a,n) for(int i=(a); i<(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

int main(){
  string S; cin >> S;
  const string akb = "AKIHABARA";
  
  if(S[0] == 'K') S.insert(S.begin(), 'A');
  else if(S[0] == 'A'){}
  else goto ng;
  if(S[1] != 'K') goto ng;
  if(S[2] != 'I') goto ng;
  if(S[3] != 'H') goto ng;
  if(S[4] == 'B') S.insert(S.begin()+4, 'A');
  else if(S[4] == 'A'){}
  else goto ng;
  if(S[5] != 'B') goto ng;
  if(S[6] == 'R') S.insert(S.begin()+6, 'A');
  else if(S[6] == 'A'){}
  else goto ng;
  if(S[7] != 'R') goto ng;
  if(S[8] != 'A') S.push_back('A');
  
  if(S == akb) cout << "YES" << endl;
  else goto ng;
    
  return 0;
ng:
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

   int k;
   cin >> k;
   vector<ll> a;
   rep(i, 1, 10) a.push_back(i);
   while (true) {
      if (k <= a.size()) {
         cout << a[k - 1] << endl;
         return 0;
      }
      k -= a.size();
      vector<ll> old;
      swap(old, a);
      for (ll x : old) {
         rep(i, -1, 2) {
            int d = x % 10 + i;
            if (d < 0 || d > 9) continue;
            ll nx = x * 10 + d;
            a.push_back(nx);
         }
      }
   }
   return 0;
}

Measured memory_bytes: 1712
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  while(cin>>m>>n,n||m) {
    bool ex[8000000]; CLR(ex);
    int cnt = 0;
    FOR(i,m,8000000) {
      if(ex[i]) continue;
      for(int j = i; j < 8000000; j += i) {
        ex[j] = true;
      }
      cnt++;
      if(cnt == n) break;
    }
    FOR(i,m,8000000) {
      if(!ex[i]) {
        cout << i << endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 10976
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 100010
#define LL long long
int a[MAXN],n;
LL ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
	{
		ans+=1LL*a[i]/2;
		if((a[i]&1)&&a[i+1]>0)
		{
			a[i+1]--;
			ans++;
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>

#define pb push_back
#define mp make_pair

using namespace std;

template<typename T>inline void upmin(T &x,T y) { y<x?x=y:0; }
template<typename T>inline void upmax(T &x,T y) { x<y?x=y:0; }

typedef unsigned int u32;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod pi=acos(-1);
const int oo=1<<30;
const LL OO=1e18;

const int N=1e5+100;

int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}

int fa[N];inline int find(int x) { return fa[x]==x?x:fa[x]=find(fa[x]); }
int G[N];inline int Find(int x) { return G[x]==x?x:G[x]=Find(G[x]); }
struct E{ int u,v,w; }e[N];
int col[N];
int main()
{
	int n=gi(),m=gi(),c=gi(),i,a,b;LL ans=0;
	for (i=1;i<=n;i++) col[i]=gi(),fa[i]=i;
	for (i=1;i<=c;i++) G[i]=i;
	for (i=0;i<m;i++) e[i].u=gi(),e[i].v=gi(),e[i].w=gi();
	sort(e,e+m,[&](E a,E b){return a.w<b.w;});
	for (i=0;i<m&&c>1;i++)
		if ((a=find(e[i].u))!=(b=find(e[i].v))) {
			fa[b]=a;
			if (!col[a]||!col[b])
				col[a]|=col[b],ans+=e[i].w,c--;
			else if (Find(col[a])!=Find(col[b]))
				G[G[col[a]]]=col[b],ans+=e[i].w,c--;
		}
	cout<<(c==1?ans:-1)<<endl;
	return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod ((ll)(1e9+7LL))
ll dp[2001];

ll n;

ll recur(int sum = 0){
    if(sum == n) dp[sum] = 1;
    if(sum > n) return 0;
    if(dp[sum] != -1) return dp[sum];
    dp[sum] = 0;
    for(int i = 3;i <= n;i++){
        ll ans = recur(sum+i);
        dp[sum] = (dp[sum] + ans)%mod;
    }
    return dp[sum] % mod;
}

int main(){
    cin >> n;
    memset(dp,-1,sizeof dp);
    cout<<recur()<<"\n";
}

Measured memory_bytes: 3648
from sys import stdin
 
lines = stdin.readlines()
X,Y = map(int, lines[0].split())

price = 0
if X == 1:
  price += 300000
elif X == 2:
  price += 200000
elif X == 3:
  price += 100000

if Y == 1:
  price += 300000
elif Y == 2:
  price += 200000
elif Y == 3:
  price += 100000

if X == 1 and Y == 1:
  price += 400000
  
print(price)
  

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <fstream>
#include <cstdio>
using namespace std;
// vector<pair<int,int> > v;
// cin.ignore();//twice getline(cin,s);
// g++ iterator.cpp -std=c++17
// cout<<(A + B == C ? "YES" : "NO")<<endl;
// __gcd(a,b)
// string s=to_string(n);
// sort(arr, arr+n, greater<int>());
// const long double pi = acos(-1.0);
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define vll vector<ll>
#define mll map<ll,ll >
#define mlli map<ll,ll>::iterator
#define size size()
#define endl "\n"
#define ll long long int
#define ld long double
void fast(){ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);}


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

Measured memory_bytes: 3640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main{
    public static void main(String[] args){
        BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
        try {
            int a = Integer.parseInt(br.readLine());
            int h = a / 3600;
            int m = a % 3600 / 60;
            int s = a % 3600 % 60;
            System.out.printf("%d:%d:%d\n", h, m, s);
        }
        catch (IOException e){
            
        }
    }
}


Measured memory_bytes: 24680
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vec> mat;
const int MAX_N=1<<17;
int n,dat[2*MAX_N-1];
void init(int n_){
    n=1;
    while(n<n_) n*=2;
    rep(i,2*n-1) dat[i]=INT_MAX;
}
void update(int k,int a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
        k=(k-1)/2;
        dat[k]=min(dat[k*2+1],dat[k*2+2]);
    }
}
int query(int a,int b,int k,int l,int r){
    if(r<=a||b<=l) return INT_MAX;
    if(a<=l&&r<=b) return dat[k];
    else{
        int vl=query(a,b,k*2+1,l,(l+r)/2);
        int vr=query(a,b,k*2+2,(l+r)/2,r);
        return min(vl,vr);
    }
}
int main(){
    int m,q;
    cin>>m>>q;
    init(m);
    rep(i,q){
        int c,x,y;
        cin>>c>>x>>y;
        if(c==0) update(x,y);
        if(c==1) cout<<query(x,y+1,0,0,n)<<"\n";
    }
}


Measured memory_bytes: 4112
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;

// Extended Print Func
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& input){
    os << "[ ";
    REP(i, input.size()){
        os << input[i];
        if (i < input.size()-1) { os << " "; }
    }
    os << " ]";
    return os;
}
void print() { std::cout << "\n"; }
template<class T, class... A> void print(const T& first, const A&... rest) { std::cout << first << " "; print(rest...); }
template<class... A> void print(const A&... rest) { print(rest...); }



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  vector<vector<ll>> A(3,vector<ll>(3));
  vector<vector<ll>> bingo(3, vector<ll>(3));
  REP(i,3){
    REP(j,3){
      cin >> A[i][j];
    }
  }
  ll N;
  cin >> N;
  REP(i,N){
    ll bi;
    cin >> bi;
    REP(j,3){
      REP(k,3){
        if (A[j][k] == bi){
          bingo[j][k] = 1;
        }
      }
    }
  }

  // tate
  REP(i,3){
    if (bingo[i][0] + bingo[i][1] + bingo[i][2] == 3){
      cout << "Yes" << "\n";
      return 0;
    }
  }
  // yoko
   REP(i,3){
    if (bingo[0][i] + bingo[1][i] + bingo[2][i] == 3){
      cout << "Yes" << "\n";
      return 0;
    }
  } 

  // naname
  if (bingo[0][0] + bingo[1][1] + bingo[2][2] == 3){
    cout << "Yes" << "\n";
    return 0;
  }  

  // naname
  if (bingo[0][2] + bingo[1][1] + bingo[2][0] == 3){
    cout << "Yes" << "\n";
    return 0;
  }  

  cout << "No" << "\n";
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedInputStream;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=a/b;
        if(c*b==a)
            System.out.println(c);
        else
            System.out.println(c+1);
    }
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,K;string S;
    cin>>N>>K>>S;
    deque<int> sum;char temp;
    int zero;
    if(S.at(0)=='1'){
        sum.push_back(0);
        temp='1';
        zero=0;
    }else{
        sum.push_back(0);
        sum.push_back(0);
        temp='0';
        zero=1;
    }int count=1;
    for(int i=1;i<N;i++){
        if(S.at(i)==temp){
            count++;
        }else{
            sum.push_back(sum.back()+count);
            count=1;
            if(S.at(i)=='0'){
                zero++;
            }
        }temp=S.at(i);
    }sum.push_back(sum.back()+count);
    if(S.at(N-1)=='0'){
        sum.push_back(sum.back());
    }
    
    K=min(zero,K);
    deque<int> ans;
    int j=0;
    while(2*j+2*K+1<sum.size()){
        ans.push_back(sum[2*j+2*K+1]-sum[2*j]);
        //cout<<ans[j]<<endl;
        j++;
    }sort(ans.begin(),ans.end());
    cout<<ans.back()<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const  int maxn = 1e6 + 5;
typedef long long ll;
int a[maxn], h[maxn];
const  ll inf = 1e18;
ll dp[maxn];
int main() {

    int n, k;
//freopen("in.in", "r", stdin);
    cin >> n;
    for (int i = 1; i <= n; i++) dp[i] = inf;
    for (int i = 1; i <= n; i++) {
        cin >> h[i];
    }
    dp[1] =0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= 2; j++) {
            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
        }
    }
//    for (int i = 1; i <=n; i++) cout << dp[i] << " "; cout << endl;
    cout << dp[n] << endl;
    return 0;
}

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

int main() {
	int r,c;
	cin>>r>>c;
	char p[r][c];
	for( int i=0; i<r; i++)
	{
	    for( int j=0; j<c; j++)
	    cin>>p[i][j];
	}
	
	long long int dp[r][c];
	int flag=0, flag1=0;
	
	for( int i=0; i<r; i++)
	{
	    if(flag==0)
	    {
	        if(p[i][0]=='#')
	        {   flag=1;
	            dp[i][0]=0;
	        }
	        else
	        dp[i][0]=1;
	    }
	    else
	    dp[i][0]=0;
	}
	
	for( int j=0; j<c; j++)
	{
	    if(flag1==0)
	    {
	        if(p[0][j]=='#')
	        {   flag1=1;
	            dp[0][j]=0;
	        }
	        else
	        dp[0][j]=1;
	    }
	    else
	    dp[0][j]=0;
	}
	    
	long long int k= 1e9+7;
	for( int i=1; i<r; i++)
	{
	    for( int j=1; j<c; j++)
	    {
	        if(p[i][j]=='#')
	        dp[i][j]=0;
	        else
	        {
	            dp[i][j] = (dp[i-1][j] + dp[i][j-1])%k;
	        }
	    }
	}
	
	cout<<dp[r-1][c-1]%k<<endl;
	
	return 0;
}

Measured memory_bytes: 9088