akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<Integer> cc = new ArrayList<>(N);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	static int INF=1000000007;
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		//int a[]=new int[N];for(int i=0;i<N;i++) {}
		//Ae2+Be2=Ce2
		//StringBuffer str = new StringBuffer(hoge1);
		//for(int i=0;i<N;i++) {}
		long X=sc.nextLong();
		
		long T=X/11*2;
		if(X%11==0) {
			
		}else if(X%11>6) {
			T+=2;
		}else {
			T++;
		}
		p(T);
	}
	
		
	
	
		
	
	public static long modPow(long g,long N) {
		long T=1;
		for(int i=0;i<N;i++) {
			T*=g;
			T%=mod;
		}
		return T;
	}
	
	public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
	}
	
	public static long gcd(long a, long b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


Measured memory_bytes: 23764
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>
using namespace std;
using ll = long long;
#define rep(j,k) for (int j = 0; j < (int)(k); j++)

int n;
ll x[100010];
ll L;
int Q;
int a[100010], b[100010];

const int LOG = 20;
ll go[100010][LOG];

int f(int a, int x) {
    for (int i = 0; x; ++i, x /= 2) {
        if (x & 1) a = go[a][i];
    }
    return a;
}

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

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }
    x[n] = 2e9;
    cin >> L >> Q;
    for (int i = 0; i < n; i++) {
        int k = upper_bound(x + i, x + n, x[i] + L) - x;
        go[i][0] = k - 1;
    }
    for (int i = 0; i < LOG - 1; i++) {
        for (int j = 0; j < n; j++) {
            go[j][i + 1] = go[go[j][i]][i];
        }
    }
    for (int i = 0; i < Q; i++) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        if (a > b) swap(a, b);
        int lb = 0, ub = n;
        while (lb + 1 < ub) {
            int mid = (lb + ub) / 2;
            if (f(a, mid) >= b) ub = mid;
            else lb = mid;
        }
        cout << ub << endl;
    }
}

Measured memory_bytes: 17280
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

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

template<class T> inline auto __lcm(T& a, T& b) 
{ return a * b / __gcd(a, b); }

template<typename T> void remove(std::vector<T>& vector, unsigned int index)
{ vector.erase(vector.begin() + index); }


int main() {
    int N;  cin >> N;
    vector<int> L(N);
    rep(i, N) {
        cin >> L[i];
    }

    ll ans = 0;
    sort(L.begin(), L.end());
    for (int mid = N-1; mid > 0; --mid) {
        for (int low = mid-1; low >= 0; --low) {
            auto itr = lower_bound(L.begin(), L.end(), L[mid] + L[low]);
            ll ng = distance(itr, L.end());
            ans += N-1 - mid - ng;
        }
    }

    print(ans);

    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main()
{
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ans = 1e9;
    for (int i = 0; i <= max(x, y); i++)
    {
        int cost = 2 * c * i + a * max(x - i, 0) + b * max(y - i, 0);
        if (ans > cost)
        {
            ans = cost;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3468
#include<bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define printd(x) printf("%.12f\n", ans);
#define print(x) cout << (x) << endl;
#define Yes() cout << "Yes" << endl;
#define No() cout << "No" << endl;
#define YES() cout << "YES" << endl;
#define NO() cout << "NO" << endl;
#define all(x) (x).begin(),(x).end()
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

int main(void) {
    int n, k;
    cin >> n >> k;

    ll cnt = 0;
    while (n > 0) {
        n /= k;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

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

signed main(){
	int N,K; cin>>N>>K;
	vector<int> a(N);
	for(int i=0;i<N;i++)cin>>a[i];
	sort(a.begin(),a.end());
	bool pro=true;
	if(a[N-1]<K)pro=false;
	else{
		int g=a[0];
		for(int i=1;i<N;i++)g=gcd(g,a[i]);
		if((a[N-1]-K)%g!=0)pro=false;
	}
	cout<<(pro ? "POSSIBLE":"IMPOSSIBLE")<<endl;
}

Measured memory_bytes: 1024
#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++)
using ll = long long;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using P = pair<ll, ll>;

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
    int a,b;
    cin >> a >> b;
    if(a>8 || b>8) cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <utility>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <math.h>
#include <stdio.h>
#include <deque>

using namespace std;

#define REP(i,n,m) for( long long int i = (n); i < (m); i++ )
#define REV(v) for (auto itr = v.rbegin(); itr != v.rend(); itr++)
#define ll long long
#define ALL(a) (a).begin(), (a).end()
#define SORT(v) sort( ALL(v) );
#define LAST(v) v[v.size()-1]
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,-1,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pi pair<int, int>
#define MP make_pair
#define PB push_back
#define IIN(a) int a; cin >> a;
#define LIN(a) ll a; cin >> a;
#define SIN(a) string a; cin >> a;
#define VL(v,n) vector<ll> v(n);
#define Read_VL(v,n) vector<ll> v(n);REP(i,0,n)cin>>v[i];
#define sumV(v,n) Vl(acm,n) REP(i,0,n) acm[i] = v[i] + ( i == 0 ? 0 : acm[i - 1]);
#define EPS (1e-10)
#define INF 1000000000000LL

void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}


template<class T=ll>struct Graph{
	int n;
	vector<vector<tuple<ll,T>>>edge;
	Graph(int N=1):n(N){edge.resize(n);}
	void add(ll f,ll t,T c,bool d=false){
		edge[f].emplace_back(t,c);
		if(!d)edge[t].emplace_back(f,c);
	}
	void view(){
		REP(i,0,n)for(auto&e:edge[i])
			puta(i,"=>",get<0>(e),", cost :",get<1>(e));
	}
};

ll StoLL( string s )
{
	ll num=0;
  REP( i, 0, s.size() ){
    num = num*10 + ( s[i]^48 );
  }
  return num;
}

ll CtoLL( char c )
{
	if( 'a' <= c && c <= 'z'){
		return (ll)( c ^ 96 ) ;
	}
	else if( 'A' <= c && c <= 'Z'){
		return (ll)( c ^ 64 );
	}
  return 0;
}

int MOD=1000000007;
int dx[4] = {0, 0, -1, 1};
int dy[4] = {1, -1, 0, 0};
//I ASCII code: '0' = 48; 'A' = 65; 'a' = 97


signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    LIN(n)
    double ans = 0;
    REP( i, 0, n ){
      double a;cin>>a;
       SIN(s)

      if( s == "JPY"){
        ans += a;
      }else{
        ans += a * 380000.0;
      }
    }
    puta( ans );
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
char S[11111];

void MAIN() {
    scanf("%d%s", &N, S);
    int r = count(S, S+N, 'R');
    int b = count(S, S+N, 'B');
    bool yes = r > b;
    puts(yes? "Yes": "No");
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	long long int q,h,s,d,k,w = 0;
	int x = 1, y = 1,z = 1;
	long long int n;
	cin >> q >> h >> s >> d;
	cin >> n;
	if(min({q * 8,h * 4,s * 2,d}) != d)
	{
		z = 0;
	}
	if(min({q * 4,h * 2,s}) != s)
	{
		y = 0;
	}
	if(min(q * 2,h) != h)
	{
		x = 0;
	}
	if(z)
	{
		k = n / 2;
		w+=(d * k);
		n = n - (k * 2);
	}
	if(n == 0)
	{
		cout << w << endl;
		return 0;
	}
	if(y)
	{
		w+=(s * n);
		cout << w << endl;
		return 0;
	}
	if(x)
	{
		w+=(h * n * 2);
		cout << w << endl;
		return 0;
	}
	w+=(q * n * 4);
	cout << w << endl;
}

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

const int MOD = 1e+9 + 7;


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


    // C[i][j]: iをj個に分割する仕方(分割数)
    vector<vector<long long>> C(N+1, vector<long long>(N+1));
    for( int i = 0; i <= N; ++i ){
        C[i][0] = C[i][i] = 1;
        for( int j = 1; j < i; ++j ){
            C[i][j] = (C[i-1][j-1] + C[i-1][j]) % MOD;
        }
    }

    for( int i = 1; i <= K; ++i ){
        cout << (C[N-K+1][i]*C[K-1][i-1]) % MOD << endl;
    }

    return 0;
}

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

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

    int sum = 0;
    for (int i=N; i>0; --i) {
        string tmp = to_string(i);
        if (tmp.size()%2) sum++;
    }

    cout << sum << endl;
}


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

int main(){
  int n; cin >> n;
  vector<int> d(n), A(n);
  for (int i=0; i<n; i++){
    cin >> d[i];
    A[i] = d[i];
  }
  sort(d.begin(), d.end());

  for (int i=0; i<n; i++){
    if (A[i]<=d[(n-1)/2]) cout << d[n/2] << endl;
    else cout << d[(n-1)/2] << endl;
  }
  return 0;
}

Measured memory_bytes: 3712
module Main where

import Data.Functor ((<$>))
import Data.List (intercalate)

printList :: [Int] -> IO ()
printList = putStrLn . intercalate " " . map show

insert :: [Int] -> Int -> [Int]
insert [] x = [x]
insert (y:ys) x
  | x < y     = x:y:ys
  | otherwise = y:insert ys x

chattyInsertionSort :: [Int] -> IO ()
chattyInsertionSort [] = return ()
chattyInsertionSort (x:xs) = go [x] xs
  where
  go sorted [] = printList sorted
  go sorted (unsorted@(x:xs)) = do
    printList $ sorted ++ unsorted
    go (insert sorted x) xs

main = do
  -- Haskell doesn't need the number of elements, so drop it
  _ <- getLine
  xs <- map read . words <$> getLine
  chattyInsertionSort xs



Measured memory_bytes: 4092
# -*- coding: utf-8 -*-
import sys
from itertools import permutations 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))

x = max(A)
x_ind = A.index(x)
y = min(A)
y_ind = A.index(y)

if x >= 0 and y >= 0:
    print(N-1)
    for i in range(1,N):
        print(i,i+1)
elif x <= 0 and y <= 0:
    print(N-1)
    for i in range(N-1,0,-1):
        print(i+1,i)
else:
    cnt = N-1
    ans = []
    if abs(x) >= abs(y):
        for i in range(N):
            if A[i] < 0:
                cnt += 1
                ans.append((x_ind+1,i+1))
        for i in range(1,N):
            ans.append((i,i+1))
    else:
        for i in range(N):
            if A[i] > 0:
                cnt += 1 
                ans.append((y_ind+1,i+1))
        for i in range(N-1,0,-1):
            ans.append((i+1,i))
    print(cnt)
    for x,y in ans: 
        print(x,y)

Measured memory_bytes: 62712
use proconio::input;

fn main() {
    const MOD: i64 = 1_000_000_007i64;

    input! {
        n: usize,
        a: [i64; n],
    }

    let mut aa = vec![0i64; n + 1];
    for i in 1..=n {
        aa[i] = (aa[i - 1] + a[i - 1]) % MOD;
    }
    let aa = aa;

    let mut res = 0i64;
    for i in 0..n {
        let cur = (a[i] * (aa[n] - aa[i + 1])) % MOD;
        res = (res + cur) % MOD;
    }
    println!("{}", res.rem_euclid(MOD));
}


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

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

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

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

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

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

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long 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 N;
vector<int> G[100100];

ll dp1[100100];
ll dp2[100100];

ll MOD;

ll dfs1(int v, int p){

  ll ret = 1;

  for(auto nv : G[v]){

    if(nv == p) continue;

    ret = (ret * (dfs1(nv, v) + 1) % MOD) % MOD;

  }

  return dp1[v] = ret;

}

void dfs2(int v, int p){

  dp2[v] = 1;
  
  for(auto nv : G[v]){
    dp2[v] = (dp2[v] * (dp1[nv] + 1)) % MOD;
  }

  int n = G[v].size();
  vector<ll> L(n), R(n);
  rep(i, n) L[i] = R[i] = (dp1[G[v][i]] + 1) % MOD;
  rep(i, 1, n) L[i] = (L[i] * L[i-1]) % MOD;
  for(int i = n-2; i >= 0; i--) R[i] = (R[i] * R[i+1]) % MOD;

  rep(i, n){
    if(G[v][i] == p) continue;

    dp1[v] = 1;
    if(i > 0)   dp1[v] = (dp1[v] * L[i-1]) % MOD;
    if(i+1 < n) dp1[v] = (dp1[v] * R[i+1]) % MOD;
    dfs2(G[v][i], v);
  }
}


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

  cin >> N;
  cin >> MOD;

  int x, y;
  rep(i, N-1){
    cin >> x >> y;
    x--;
    y--;
    G[x].push_back(y);
    G[y].push_back(x);
  }

  dfs1(0, -1);
  dfs2(0, -1);

  rep(i, N){
    cout << dp2[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 19584
#include<cstdio>
#include<algorithm>
using namespace std;
int h,w,dp[105][105],gr[105][105];
char s[105];
void zy(int x,int y,int u,int v)
{
	if(gr[x][y]==0&&gr[u][v]==1)dp[u][v]=min(dp[u][v],dp[x][y]+1);
	else dp[u][v]=min(dp[u][v],dp[x][y]);
}
int main()
{
	scanf("%d%d",&h,&w);
	for(int i=1;i<=h;i++)
	{
		scanf("%s",s+1);
		for(int j=1;j<=w;j++)
		{
			if(s[j]=='#')gr[i][j]=1;
			else gr[i][j]=0;
		}
	}
	if(gr[1][1]==0)dp[1][1]=0;
	else dp[1][1]=1;
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			if(i==1&&j==1)continue;
			dp[i][j]=h*w+5;
			if(i-1>0)zy(i-1,j,i,j);
			if(j-1>0)zy(i,j-1,i,j);
		}
	}
	printf("%d\n",dp[h][w]);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string c="abcdefghijklmnopqrstuvwxyz";
  long long int n;
  cin>>n;
  string s="";
  if(n<=26)
  {
    cout<<c[n-1];
    return 0;
  }
  while(n)
  {
    int x=n%26;
    if(x)
    {
      s=c[x-1]+s;
    }
    else
    {
      s = 'z'+s;
    }
    if(!x)
    {
      n/=26;
      n--;
    }
    else
    {
      n/=26;
    }
  }
  cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 3516
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int main(int argc, char const *argv[]) {
  string s, t;
  cin >> s >> t;
  bool tf = true;
  map<char,int> smp, tmp;
  for (int i = 0; i < s.size() && tf; i++) {
    if (smp[s[i]]!=0) continue;
    for (int j = i; j < s.size(); j++) {
      bool stf = s[i]==s[j], ttf = t[i]==t[j];
      if ((stf&&ttf)||(!stf&&!ttf)) continue;
      else {
        tf = false;
        break;
      }
    }
    smp[s[i]]=1;
  }
  if (tf) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
#define int long long
using namespace std;
int MOD = 1000000007;

signed main(){
    int N;
    cin >> N;
    
    int A[N];
    map<int,int> mp;
    
    for(int i=0;i<N;i++){
        cin >> A[i];
        mp[A[i]]++;
    }
    
    
    set<int> st;
    for(int i=0;i<N;i++){
        if(mp[A[i]]%2!=0) st.insert(A[i]);
    }
    
    cout << st.size() << endl;
    
    return 0;
}



Measured memory_bytes: 11904
#include <stdio.h>

int main(void) {
int a,r,y,x;

scanf("%d %d ",&x,&y);
if(x>=y){
r = x % y;
while(r!=0){
x=y;
y=r;
r=x%y;
}
printf("%d\n",y);
}
else if(x<y){
a=x;
x=y;
y=a;
r = x % y;
while(r!=0){
x=y;
y=r;
r=x%y;

}

printf("%d\n",y);

}
return 0;
}

Measured memory_bytes: 1812
import java.util.Scanner;

public class Main {
	public static void main(String arg[]) {

		Scanner sc = new Scanner(System.in);

		int r = sc.nextInt();

		sc.close();

		if (r < 1200) {
			System.out.print("ABC");
		} else if (1200 <= r && r < 2800) {
			System.out.print("ARC");
		} else {
			System.out.print("AGC");
		}
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000000000000;
const int mod = 1000000007;
int test[12345678], res[12345678];
signed main() {
	vector<char> v; map<int, int> cost;
	int n, m, a, b, c, cnt = 0, ans = 0; string s, t;
	cin >> a >> b >> c >> n;
	if (a >= n) { cout << n << endl; return 0; }
	if (a + b >= n) { cout << a << endl; return 0; }
	cout << a - (n - (a + b)) << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<bits/stdc++.h>
#include<cmath>

using namespace std;

int main(){
	int l,r;
	cin>>l>>r;
	if(l == r-1)
		cout<<(l*r)%2019<<endl;
	else if(r-l >= 673)
		cout<<"0"<<endl;
	else{
		long long min = INT_MAX;
		for(int i=l;i<=r;i++){
			for(int j = i+1;j<=r;j++){
				long long l = ((i%2019) * (j%2019))%2019;
				if(min >l)
					min = l;
			}
		}
		cout<<min<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)

const ll MOD=998244353;
ll n,m,a[310][310];

ll ad(ll x,ll y){
  return (x+y)%MOD;
}

ll mlt(ll x,ll y){
  return (x*y)%MOD;
}

ll pwr(ll x,ll y){
  ll pw[32]={},w=1;
  pw[0]=x;
  fr(i,31) pw[i+1]=mlt(pw[i],pw[i]);
  fr(i,32){
    w=mlt(w,1+(y%2)*(pw[i]-1));
    y/=2;
  }
  return w;
}

ll rnk(ll n,ll m,ll M[][310]){
  ll t=0,y=0;
  bool f;
  for(;;){
    f=0;
    if(M[t][y]==0){
      f=1;
      for(ll i=t+1;i<n;i++){
        if(M[i][y]!=0){
          f=0;
          swap(M[t],M[i]);
        }
      }
    }
    if(f && y<m-1){y++;continue;}
    if(f) return t;
    for(ll i=t+1;i<n;i++){
      if(M[i][y]==0) continue;
      for(ll j=y;j<m;j++){
        M[i][j]=(M[i][j]+M[t][j])%2;
      }
    }
    t++;
    if(t==n) return n;
  }
}

int main(){
  cin>>n>>m;
  fr(i,n) fr(j,m) cin>>a[i][j];
  cout<<ad(pwr(2,n+m-1),MOD-pwr(2,n+m-1-rnk(n,m,a)))<<endl;
}

Measured memory_bytes: 1024
def resolve():
    '''
    code here
    '''
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    res = 0
    for i in range(A+1):
        for j in range(B+1):
            for k in range(C+1):
                if 500*i + 100*j + 50*k == X:
                    res += 1
    print(res)

if __name__ == "__main__":
    resolve()


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

int main(){
  int k, a, b;
  cin >> k >> a >> b;
  if(a % k == 0 || b % k == 0) cout << "OK" <<endl;
  else if(a == b) cout << "NG" << endl;
  else if(b - a >= k) cout  << "OK" << endl;
  else if(a % k >= b % k) cout << "OK" <<endl;
  else cout << "NG" <<endl;
}

Measured memory_bytes: 3640
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;
using System.Timers;

static class MainClass
{
    public static void Main(string[] args)
    {
        var ab = Console.ReadLine().SplittedStringToInt32List();
        var a = ab[0];
        var b = ab[1];
        Console.WriteLine($"{a*b} {2*a+2*b}");
    }

    #region ライブラリ

    #region 文字列処理

    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();

    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    #endregion
    #region DeepClone
    public static T DeepClone<T>(this T src)
    {
        using (var memoryStream = new MemoryStream())
        {
            var binaryFormatter
              = new BinaryFormatter();
            binaryFormatter.Serialize(memoryStream, src);
            memoryStream.Seek(0, SeekOrigin.Begin);
            return (T)binaryFormatter.Deserialize(memoryStream);
        }
    }
    #endregion

    public static int Gcd(int a,int b)
    {
        if (b == 0)
            return a;
        return Gcd(b, a % b);
    }
    public static BigInteger Gcd(BigInteger a, BigInteger b)
    {
        if (b == 0)
            return a;
        return Gcd(b, a % b);
    }


    public static BigInteger Factorial(int n)
    {
        var dp = new BigInteger[n];
        dp[0] = 1;
        for (int i = 1; i < n; i++)
        {
            dp[i] = dp[i - 1] * (i + 1);
        }
        return dp[n - 1];
    }

    #endregion

}



Measured memory_bytes: 14296
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        char[] A = sc.next().toCharArray();
        char[] B = sc.next().toCharArray();
        char[] C = sc.next().toCharArray();
        int counter = 0;
        for (int i = 0; i < N; i++) {
            if (A[i] == B[i] && B[i] == C[i]) {

            } else if (A[i] != B[i] && B[i] != C[i] && C[i] != A[i]) {
                counter += 2;
            } else counter++;
        }
        System.out.println(counter);
    }
}


Measured memory_bytes: 23508
#include<bits/stdc++.h>
using namespace std;
int a,b,ans;

int main(){

    while(1){
        cin >> a;
        if(a==0)break;
        for(int i=0;i<9;i++){
            cin >> b;
            ans+=b;
        }
        cout << a-ans << endl;
        ans=0;
    }

return 0;
}

Measured memory_bytes: 3008
/*	ex3_4
	suzuto	*/

#include <stdio.h>

int main(void) {
  int divident, divisor, quotient, det; /*変数の宣言*/

  scanf("%d",&divident); /*Nの入力*/
  divisor = 1; /*divisorの初期化*/
  det = 0; /*detの初期化*/

  /*divident = divisor * quotientとなる(1以上9以下の積で表せる)かどうかを調べる*/
  while(divisor <= 9){
    quotient = (divident / divisor) % 10; /*商quotientの一の位を算出する(quotient二桁以上の時必ずdivident > divisor * quotient)*/
    if(divident == divisor * quotient){
      det = 1; /*積として表すことができたことを記憶する*/
      printf("Yes\n");/*積で表せたのでYesを出力*/
      break;
    }
    divisor++; /*divisorの更新*/
  }
  if (det == 0){
    printf("No\n"); /*積で表せなかった(det初期値のまま)のでNoを出力*/
  }
  return 0;
}


Measured memory_bytes: 128
import java.util.*;
public class Main{
  public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  String ymd = sc.next();
    System.out.print("2018");
  for (int i = 4; i < ymd.length(); i++){
      System.out.print(ymd.charAt(i));
    }
  }
}


Measured memory_bytes: 21588
from collections import Counter
n=int(input())
stri=list(input())
cc=Counter(stri)

count=cc['R']*cc['G']*cc['B']


for i in range(n-2):
  for j in range(i+1,n-1):
    if stri[j]==stri[i]:continue
      
    lib=['R','G','B']
    lib.remove(stri[i])
    lib.remove(stri[j])
    t=lib.pop()
    
    skip_k=2*j-i
    #print(i,j,skip_k)
    if skip_k>n-1:continue
    if stri[skip_k]==t:
      count-=1
print(count)

Measured memory_bytes: 69128
/**
* Copyright(c)
* All rights reserved.
* Author : Universal
* Description : sample
*/
#include <bits/stdc++.h>
#define MAXN 100005
#define INF 0x3f3f3f3f
#define PI acos(-1)
using namespace std;
typedef long long ll;

string s;
int main(){
    int n;
    cin>>n;
    cin>>s;
    if(n<3200){
        cout<<"red"<<endl;
    }
    else{
        cout<<s<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll H, W;
    cin >> H >> W;
    rep(i, W+2) cout << "#";
    cout << endl;
    rep(i, H) {
        cout << "#";
        string s;
        cin >> s;
        rep(i, W) {
            cout << s[i];
        }
        cout << "#\n";
    }
    rep(i, W+2) cout << "#";
    cout << endl;
    return 0;
}


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

using namespace std;

#ifdef WIN32
	#define I64 "%I64d"
#else
	#define I64 "%lld"
#endif

typedef long long ll;

#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(s) s.begin(), s.end()
#define sz(s) (int(s.size()))
#define fname "a"
#define MAXN 2000002

int n;
vector <int> g[MAXN];
int d[MAXN];
int f[MAXN];

void dfs(int v = 0, int pr = -1) {
	int k = 0;
	int kd = 0;
	int kf = 0;
	for (const int& v2 : g[v]) {
		if (v2 == pr) continue;
		dfs(v2, v);
		if (d[v2]) ++kd;
		if (f[v2]) ++kf;
		++k;
	}
	if (kd) {
		f[v] = 1;
	}
	if (!k || (kf == k)) {
		d[v] = 1;
	}
	if (kd > 1 || (!v && d[v])) {
		puts("First");
		exit(0);
	}
}

int main()
{
	#ifdef LOCAL
	freopen(fname".in", "r", stdin);
	freopen(fname".out", "w", stdout);
	#endif

	scanf("%d", &n);
	for (int i = 0; i < n - 1; ++i) {
		int v1, v2;
		scanf("%d%d", &v1, &v2);
		--v1, --v2;
		g[v1].pb(v2);
		g[v2].pb(v1);
	}

	dfs();
	puts("Second");

	return 0;
}


Measured memory_bytes: 56064
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


m = Mod(10**9 + 7)


@mt
def slv(N, M, A):
    dp = [0] * (N+3)
    b = [False] * (N+3)
    for a in A:
        b[a] = True

    dp[0] = 1
    for i in range(N):
        if not b[i+1]:
            dp[i+1] = m.add(dp[i+1], dp[i])
        if not b[i+2]:
            dp[i+2] = m.add(dp[i+2], dp[i])
    return dp[N]


def main():
    N, M = read_int_n()
    A = [read_int() for _ in range(M)]
    print(slv(N, M, A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 66136
# -*- coding: utf-8 -*-
N,M=map(int,input().split())
pSlist=[0]*(N+1)
ansA=0
ansWA=0
for i in range(M):
    p,S=map(str,input().split())
    p=int(p)
    if S=="WA" and pSlist[p]!=-1:
        pSlist[p]=pSlist[p]+1
    elif S=="AC" and pSlist[p]!=-1:
        ansA=ansA+1
        ansWA=ansWA+pSlist[p]
        pSlist[p]=-1
print(ansA,ansWA)

Measured memory_bytes: 3828
/* Simplicity and Goodness */
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int N = 2e5+2;


void solve()
{
    ll n, m;
    lscn(n); lscn(m);

    ll g = 1;

    for(ll i=1; i*i<=m; i++) {
        if(m % i == 0) {
            if((i * n <= m) and ((m - (i*n)) % i == 0))
                g = max(g, i);

            ll d2 = m / i;

            if(((d2 * n) <= m) and ((m - (d2*n)) % d2 == 0)) 
                g = max(g, d2);
        }
    }

    lprin(g);
}

int main()
{
    int t = 1;
    // scn(t);

    while(t --) {
        solve();
    }
    return 0;
}

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

using namespace std;

typedef long long int ll;

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

  int n;
  cin >> n;
  vector < int > p(n);
  for(int i = 0; i < n; i++) cin >> p[i];
  vector < int > dp(n + 1, 0);
  int mx = 0;
  for(int i = 0; i < n; i++){
    dp[p[i]] = 1 + dp[p[i] - 1];
    mx = max(dp[p[i]], mx);
  }

  cout << n - mx << endl;
}


Measured memory_bytes: 1792
<?php
  fscanf(STDIN,"%d", $n);

  $cnt = [];
  $ans = 0;
  for ($i=0; $i<$n; $i++) {
	$s = str_split(trim(fgets(STDIN)));
    sort($s);
    $ans += $cnt[join('',$s)]++;
  }

  echo $ans;
?>

Measured memory_bytes: 13048
import sys
sys.setrecursionlimit(10 ** 5 + 1)
N,M = map(int,input().split())

G = [[] for i in range(N)]
for i in range(M):
  x,y = map(int,input().split())
  G[x - 1].append(y - 1)

dp = [-1] * N # dp[i] = 頂点iから進むことが出来る深さ
def search(v):
  if dp[v] != -1:
    return dp[v]
  max_depth = 0
  for child in G[v]:
    max_depth = max(max_depth, search(child) + 1)
    
  dp[v] = max(dp[v], max_depth)
  return dp[v]

for i in range(N):
  search(i)

print(max(dp))


Measured memory_bytes: 117164
N, M = map(int, input().split())
S = [list(map(int, input().split())) for k in range(N)]
C = [list(map(int, input().split())) for k in range(M)]

for s in S:
    d = 10**9
    t = 0
    for c in range(M):
        if d > abs(s[0]-C[c][0])+abs(s[1]-C[c][1]):
            d = abs(s[0]-C[c][0])+abs(s[1]-C[c][1])
            t = c
    print(t+1)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<queue>
using namespace std;

int a,b,n,m;
vector< vector<int> > edge;
vector<int> flag;
int ans = 0;

int dfs(int node, int k){
//  cout<< node << " ";
  flag[node] = 1;
  if(k == n){
    ans++;
    flag[node] = 0;
//    cout << endl;
    return 0;
  }
  for(int i = 0; i < edge[node].size() ; i++){
    if(!flag[edge[node][i]]) dfs(edge[node][i],k+1);
  }
  flag[node] = 0;
//  cout << endl;
  return 0;
}

int main(){
  cin >> n >> m;
  edge = vector< vector<int> >(n+1, vector<int>(0,0));
  for(int i = 0 ;  i < m; i++){
    cin >> a >> b;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  flag = vector<int>(n+1, 0);
  dfs(1,1);
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int d = fs.nextInt();
		int t = fs.nextInt();
		int s = fs.nextInt();
		
		if((double) t >= (double)d/s) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 32784
var s:ansistring;
    a,b,i:longint;
 begin
  readln(s);
  for i:=1 to length(s) do
   if s[i]='Z'then b:=i;
  for i:=length(s) downto 1 do
   if s[i]='A'then a:=i;
  writeln((b-a)+1);
 end.

Measured memory_bytes: 256
h,w=gets.split.map(&:to_i)
s=[]
c=0
h.times do
  s << gets.chomp
  c+=s[-1].count(".")
end
k=1
q=[[0,0]]
s[0][0]="#"
while s[-1][-1]=="."
  z=[]
  q.each do |i,j|
    [[1,0],[0,1],[-1,0],[0,-1]].each do |dx,dy|
      y,x=i+dy,j+dx
      if x>=0&&x<w&&y>=0&&y<h&&s[y][x]=="."
        z << [y,x]
        s[y][x]="#"
      end
    end
  end
  q=z.dup
  if q==[]
    puts "-1"
    exit
  end
  k+=1
end
puts c-k


Measured memory_bytes: 3836
#include <stdio.h>
#include <string.h>

int get_id(char enzansi) {
	static int id[128]={1};
	if(id[0]==1) {
		id[0]=0;
		id['+']=1;id['-']=2;
		id['*']=3;id['/']=4;
		id['<']=5;id['>']=6;
		id['=']=7;id['&']=8;
		id['|']=9;id['^']=10;
		id['(']=11;id[')']=12;
	}
	return id[enzansi];
}

int enzansi_yuusen[20];
int enzansi_right_ketugo[20];

int enzansi_isdopop(char onstack,char now) {
	int id1=get_id(onstack);
	int id2=get_id(now);
	if(onstack=='(')return 0;
	return enzansi_yuusen[id1]>enzansi_yuusen[id2] ||
		(enzansi_yuusen[id1]==enzansi_yuusen[id2] &&
		!enzansi_right_ketugo[id1]);
}

int main_stack_num;
char main_stack[100][500];
int enzansi_stack_num;
char enzansi_stack[100];
int calc_stack_num;
char calc_stack[100];

int main(void) {
	int data_num,cur_data;
	int teigi_num,nowteigi_num;
	char teigi_rule[4];
	char now_teigi[4];
	char now_siki[200];
	char enzansi_buf[4]={0};
	int siki_num;
	int i,j;
	scanf("%d",&data_num);
	for(cur_data=0;cur_data<data_num;cur_data++) {
		if(cur_data>0)putchar('\n');
		scanf("%d",&teigi_num);
		for(i=0;i<teigi_num;i++) {
			scanf("%s%d",teigi_rule,&nowteigi_num);
			for(j=0;j<nowteigi_num;j++) {
				scanf("%s",now_teigi);
				enzansi_yuusen[get_id(now_teigi[0])]=i;
				enzansi_right_ketugo[get_id(now_teigi[0])]=(teigi_rule[0]=='R');
			}
		}
		scanf("%d",&siki_num);
		for(i=0;i<siki_num;i++) {
			scanf("%s",now_siki);
			main_stack_num=enzansi_stack_num=calc_stack_num=0;
			for(j=0;now_siki[j];j++) {
				if(get_id(now_siki[j])) {
					if(enzansi_stack_num>0) {
						if(now_siki[j]=='(') {
							enzansi_stack[enzansi_stack_num++]=now_siki[j];
						} else if(now_siki[j]==')') {
							while(enzansi_stack_num>0 &&
									enzansi_stack[enzansi_stack_num-1]!='(') {
								calc_stack[calc_stack_num++]=
									enzansi_stack[--enzansi_stack_num];
							}
							if(enzansi_stack_num>0)enzansi_stack_num--;
						} else {
							while(enzansi_stack_num>0 &&
									enzansi_isdopop(
										enzansi_stack[enzansi_stack_num-1],
										now_siki[j])) {
								calc_stack[calc_stack_num++]=
									enzansi_stack[--enzansi_stack_num];
							}
							enzansi_stack[enzansi_stack_num++]=now_siki[j];
						}
					} else {
						enzansi_stack[enzansi_stack_num++]=now_siki[j];
					}
				} else {
					calc_stack[calc_stack_num++]=now_siki[j];
				}
			}
			while(enzansi_stack_num>0) {
				calc_stack[calc_stack_num++]=
					enzansi_stack[--enzansi_stack_num];
			}
			for(j=0;j<calc_stack_num;j++) {
				enzansi_buf[0]=calc_stack[j];
				if(get_id(calc_stack[j])) {
					if(main_stack_num<2)return 1;
					strcat(main_stack[main_stack_num-2],enzansi_buf);
					strcat(main_stack[main_stack_num-2],main_stack[main_stack_num-1]);
					strcat(main_stack[main_stack_num-2],")");
					memmove(&main_stack[main_stack_num-2][1],
						&main_stack[main_stack_num-2][0],
						strlen(main_stack[main_stack_num-2])+1);
					main_stack[main_stack_num-2][0]='(';
					main_stack_num--;
				} else {
					strcpy(main_stack[main_stack_num++],enzansi_buf);
				}
			}
			puts(main_stack[0]);
		}
	}
	return 0;
}

Measured memory_bytes: 0
loop do
    n, w = gets.split.map(&:to_i)
    break if n == 0 && w == 0
    vs = n.times.map{gets.to_i}
    h = Hash.new(0)
    vs.each do |v|
        h[v/w] += 1
    end
    ret = 0
    max = h.map{|k,v| v}.max
    maxk = h.map{|k,v| k}.max
    h.sort.each do |k,v|
        ret += (v.to_f * (maxk - k).to_f / maxk.to_f) / max.to_f
    end
    puts ret + 0.01
end

Measured memory_bytes: 6144
#ifndef VS
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<assert.h>
#include<math.h>
#endif

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {
	cww() { CIN_ONLY{ ios::sync_with_stdio(false); cin.tie(0); } }
}star;
#define DEBUG if(0)
#endif

#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r) { bool a = l>r; if (a)l = r; return a; }
template <typename T>inline bool chmax(T &l, T r) { bool a = l<r; if (a)l = r; return a; }
namespace prime {
	const int size = 1123456;
	int p[size];
	struct prime {
		prime(){
			REP(i, size)p[i] = 1;
			p[0] = p[1] = 0;
			REP(i, size)if (p[i]) {
				for (int j = i + i; j < size; j += i)p[j] = 0;
			}
			FOR(i, 1, size) {
				p[i] += p[i - 1];
			}
		}
	}prime_init;
}
int main() {
	int n;
	while (cin >> n) {
		cout << prime::p[n] << endl;
	}
}

Measured memory_bytes: 7560
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int a[200005],b[200005];
int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
rep(i,0,n-1)cin>>a[i],b[i]=a[i];
sort(a,a+n);
rep(i,0,n-1)
{
	if(b[i]>=a[n/2])
	ol(a[n/2-1]);
	else ol(a[n/2]);
	on;
}
return 0;
}



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

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  int a = 0, b = 0, c = 0;
  fscanf(stdin, "%d %d %d", &a, &b, &c);
  vector<int> v;
  v.push_back(a);
  v.push_back(b);
  v.push_back(c);
  sort(v.begin(), v.end());
  fprintf(stdout, "%d %d %d", v[0], v[1], v[2]);
  fprintf(stdout, "\n");
  return 0;
}

Measured memory_bytes: 1220
#include <iostream>
using namespace std;
int main(void){
    string s;
    cin>>s;
    if(s[0]!='A'){
        cout<<"WA"<<endl;
        return 0;
    }
    int count=0;
    for(int i=1;i<s.length();i++){
        if(isupper(s[i])){
            if(2<=i & i<=s.length()-2 & s[i]=='C'){
                count++;
            }
            else {
                cout<<"WA"<<endl;
                return 0;
            }
        }
    }
    if(count==1){
        cout<<"AC"<<endl;
    }
    else {
        cout<<"WA"<<endl;
    }
}

Measured memory_bytes: 256
n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
X=[]
Y=[]
for i in range(n-1):
  X.append(x[i+1]-x[i])
for i in range(m-1):
  Y.append(y[i+1]-y[i])
for i in range(n-1):
  X[i]=X[i]*(n-i-1)*(i+1)%(10**9+7)
for i in range(m-1):
  Y[i]=Y[i]*(m-i-1)*(i+1)%(10**9+7)
print((sum(X)%(10**9+7)*sum(Y)%(10**9+7))%(10**9+7))

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

int main()
{
    int a,b = 0,c =0,d =0,x = 0;
    cin >> a;
    vector<int> H(a); 
    for(int i =0; i < a; i++){
        cin >> H.at(i);
        if( i != 0){
            if( H.at(i) > c){
                c = H.at(i);
            }
        }
        if(H.at(i) >= c && H.at(i) >= d ){
            x++;
        }
        if( i == 0){
            c = H.at(i);           
        }
        d = H.at(i);
    }
    cout << x;
   cin >> a;
 }

Measured memory_bytes: 256
/*#include<iostream>
using namespace std;
const int MAXN=20005;
bool used[MAXN];
int main(){
	for(int i=0;i<MAXN;i++)used[i]=false;
	int n;
	int sum=1;
	cin>>n;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		for(int j=0;j<=sum;j++){
			if(used[j])used[j+x]=true;
		}
		sum+=x;
		used[x]=true;
	}
	int q;
	cin>>q;
	for(int i=0;i<q;i++){
		int x;
		cin>>x;
		if(used[x])cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
	return 0;
} */


#include<iostream>
using namespace std;
int n,A[50];
bool solve(int i,int m){
	if(m==0)return true;
	if(i>=n)return false;
	bool res=solve(i+1,m)||solve(i+1,m-A[i]);
	return res;
}

int main(){
	int q,M,i;
	cin>>n;
	for(int i=0;i<n;i++)cin>>A[i];
	cin>>q;
	for(int i=0;i<q;i++){
		cin>>M;
		if(solve(0,M))cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3100