akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;

int main(void){
    int a,b,c;cin>>a>>b>>c;
    if((a<c&&c<b)||(a>c&&c>b))cout<<"Yes\n";
    else cout<<"No\n";
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int i, k, v,an1,an2,suu;
    int MAX_V = 10000;
    int prime[MAX_V+1];
    for(i = 2; i <= MAX_V; i++) {
        prime[i] = 1;
    }
    for(i = 2; i*i <= MAX_V; i++) {
        if(prime[i]) {
            for(k = 2 * i; k <= MAX_V; k += i) {
                prime[k] = 0;   
            } 
        }
    }
   while(1){
        scanf("%d",&suu);
        if(suu != 0){
            for(k=2;k<=suu;k++){
            	if(prime[k-2]==1 && prime[k]==1){
        	    	an1=k-2;
        	    	an2=k;
            	}
            }
            printf("%d %d\n",an1,an2);
        }
        else{
    	    break;
        }
    }
    return 0; 
}

Measured memory_bytes: 1064
s = input()
n = len(s)

l1 = [i % 2 for i in range(n)]
l2 = [(i+1) % 2 for i in range(n)]
c1 = ''.join(map(str, l1))
c2 = ''.join(map(str, l2))


def diff(s, c):
    count = 0
    for i in range(n):
        if s[i] != c[i]:
            count += 1
    return count


print(min(diff(s, c1), diff(s, c2)))


Measured memory_bytes: 11124
#include<iostream>
#include<string>
#include<stack>/*** LIFO *** stack<type> var;
push(), top():to get data, pop():to remove, size(), empty() ***/
using namespace std;

#define Fp(I, STAT, END) for(int I = STAT; I < END; I++)
#define Fm(I, STAT, END) for(int I = STAT; I > END; I--)

int main(){
    int N;
    cin >> N;
    cout << (N - 2) * 180 << endl;
}


Measured memory_bytes: 256
// author: hjy
// Problem:
#include<bits/stdc++.h>
//#pragma GCC optimize(2)
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define rep(i,n) for(register int i=0; i<(int)(n); ++i)
#define per(i,n) for(register int i=(int)(n)-1; i>=0; --i)
#define rep1(i,n) for(register int i=1; i<=(int)(n); ++i)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<"="<<x<<'\n'
template<typename T1, typename T2>
inline bool umin(T1 &a, const T2 &b) { return a > b ? a = b, true : false; }
template<typename T1, typename T2>
inline bool umax(T1 &a, const T2 &b) { return a < b ? a = b, true : false; }
inline int read() {
	int x=0,ng=0;
	char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-') ng=1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return ng?-x:x;
}
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const int seed=20040305;

string s;
int n;

int main()
{
	cin>>s;
	n=s.size();
	int cnt=0;
	ll res=0;
	for(int i=n-1;i>=0;i--)
	{
		if(s[i]=='W') continue;
		int tmp=(n-1)-i;
		tmp-=cnt;
		res+=tmp;
		cnt++;
	}
	cout<<res;
	
}


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

#define all(a) a.begin() , a.end()
#define print(x)   cout<<x<<"\n";
#define pb push_back

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; if (i != v.size() - 1) os << ", "; } os << "]\n"; return os;
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
    os << "["; for (auto it : v) {os << it; if (it != *v.rbegin())os << ", ";} os << "]\n"; return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v) {
    for (auto it : v)os << it.first << " : " << it.second << "\n"; return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, const pair<T, S>& v) {
    os << "("; os << v.first << ", " << v.second << ")"; return os;
}
void go() {
    cin.tie(nullptr) -> sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
#define int long long
const int mod = 1e9 + 7, N = 1e6 + 5;
int32_t main() {
    //go();
    int n;
    cin >> n;
    int res = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1;; j++) {
            if (i * j < n) {
                ++res;
            } else break;
        }
    }
    cout << res;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
#define hhh cerr<<"hhh"<<endl
#define see(x) cerr<<(#x)<<'='<<(x)<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}

const int maxn = 4e5+7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;

struct P{
    int x, in, id;
    bool operator < (const P &rhs) const {
        if(x==rhs.x) return in<rhs.in;
        return x<rhs.x;
    }
}p[maxn];

int n, cnt;


int main() {
    n=read();
    for(int i=1; i<=n; ++i) {
        int x=read(), l=read();
        p[++cnt]=(P){x-l,1,i};
        p[++cnt]=(P){x+l,0,i};
    }
    sort(p+1,p+1+cnt);
    set<int> s;
    int ans=0;
    for(int i=1; i<=cnt; ++i) {
        //see(p[i].id);
        if(p[i].in) {
            s.insert(p[i].id);
        }
        else if(s.find(p[i].id)!=s.end()) {
            //see(s.size());
            if(s.size()>1) ans+=s.size()-1;
            s.clear();
        }
    }
    cout<<n-ans<<endl;
}

Measured memory_bytes: 6656
aryMondai = gets.split();

intComparison1 = aryMondai[0].to_i;
intComparison2 = aryMondai[1].to_i;

if intComparison1 > intComparison2 then
	puts "a > b";
elsif intComparison1 < intComparison2 then
	puts "a < b";
elsif intComparison1 = intComparison2 then
	puts "a == b";
end

Measured memory_bytes: 8676
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(o) {cerr<<#o<<" "<<o<<endl;}
#define DUMPC(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	for (int n; cin >> n&&n;) {
		int f[16][16] = {};
		for (int i = n / 2 + 1, j = n / 2, cnt = 1; cnt <= n*n; cnt++) {
			while (f[i][j] != 0) (i += 1) %= n, (j += -1 + n) %= n;
			f[i][j] = cnt;
			(i += 1) %= n, (j += 1) %= n;
		}
		REP(i, n) {
			cout << setw(4) << f[i][0];
			FOR(j, 1, n) {
				cout << setw(4) << f[i][j];
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	int n, k, ans = 0; cin >> n >> k;
	if(n==1&&k==1){
      ans+=400000;
    }
    if(n==1){
      ans+=300000;
    }
    if(n==2){
      ans+=200000;
    }
    if(n==3){
      ans+=100000;
    }
    if(k==1){
      ans+=300000;
    }
    if(k==2){
      ans+=200000;
    }
    if(k==3){
      ans+=100000;
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589

using namespace std;

int gcd(int a, int b){return (a % b)? gcd(b, a % b) : b;}
int lcm(int a, int b){return a * b / gcd(a, b);}

void solve_127A(){
    int a, b;
    cin >> a >> b;

    if(a >= 13) cout << b << endl;
    else if(a >= 6) cout << b/2 << endl;
    else cout << 0 << endl;
}

int main(void){
    solve_127A();
    
    return 0;
}

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

using namespace std;
typedef unsigned long long ll;
const int INF = 1e9;
const ll mod = 1e9 + 7;

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

int main(){
setup();
	ll T = 1;
	//cin >> T;	
	while (T--){
		string s, t; cin >> s >> t;
		ll ans = INF;
		for (int i = 0; i<s.size()-t.size()+1; i++){
			ll diff = 0;
			for (int j = 0; j<t.size(); j++){
				if (t[j] != s[i+j]) diff++;
			}
			ans = min(ans, diff);
		}
		cout << ans << endl;

	}
}

Measured memory_bytes: 3620
def first_and_last_num_by(n)
  first = n % 10
  last = n
  while n > 0
    last = n
    n /= 10
  end
  [first, last]
end

n = gets.to_i

count = Hash.new(0)
(1..n).each do |e|
  first, last = first_and_last_num_by(e)
  key = [first, last].join(',')
  count[key] += 1
end

ans = 0
(1..n).each do |e|
  first, last = first_and_last_num_by(e)
  key = [last, first].join(',')
  ans += count[key]
end

puts ans


Measured memory_bytes: 1916
// A - ><
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
	string s;
	cin >> s;

	int n = s.size() + 1;
	vector<long long> a(n);
	for (int i = 0; i < n - 1; i++)
		if (s[i] == '<') a[i + 1] = max(a[i + 1], a[i] + 1);
	for (int i = n - 2; i >= 0; i--)
		if (s[i] == '>') a[i] = max(a[i], a[i + 1] + 1);
	cout << accumulate(a.begin(), a.end(), 0LL) << endl;

	return 0;
}


Measured memory_bytes: 4740
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstdlib>
#include <cstdio>

using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
	int N, total = 0, A[10] = {},y;
	char x;
	string S;
	cin >> N;
	cin >> S;
	for (int i = 0; i <= 9; i++) {
		for (int j = 0; j <= 9; j++) {
			for (int k = 0; k < N; k++) {
				x = S[k];
			    int y=x-'0';
				if (y == i) {
					//cout << "jiaod" << endl;
					for (int l = k + 1; l < N; l++) {
						x = S[l];
						int z=x-'0';
						if (z == j) {
							for (int m = l + 1; m < N; m++) {
								x = S[m];
								int zz =x-'0';
								if (A[zz] == 0) {
									total++;
									A[zz] = 1;
								}
							}
							break;
						}
					}
					break;
				}
			}
			for (int a = 0; a <= 9; a++) {
				A[a] = 0;
			}
		}
	}

	cout << total << endl;


	return 0;
}

Measured memory_bytes: 256
var body = '';
var readable = process.stdin;
readable.resume();
readable.setEncoding('utf-8');
readable.on('data', function (chunk) {
    body += chunk;
});

readable.on('end', function () {
    var data = body.split('\n');
    var output = [];
    for(var i = 0; i < data.length; i++) {
        if(0 != data[i]) {
            output.push('Case ' + (i + 1) + ': ' + data[i]);
        }
    }
    console.log(output.join('\n'));
});

Measured memory_bytes: 19324
#include<stdio.h>
int main()
{
  int a,b;
  scanf("%d %d",&a,&b);
  if(a>b)
    printf("a > b\n");
  else if(a<b)
    printf("a < b\n");
  else
    printf("a == b\n");
  return 0;
}

Measured memory_bytes: 2576
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(ll i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const ll INF=1e16;

 
 
int main() {
    ios_base::sync_with_stdio(false); 
    
    ll a;
    string b;
    cin >> a >> b; 
    ll bb=(b[0]-'0')*100+(b[2]-'0')*10+b[3]-'0';
    cout << fixed << setprecision(20) << (a*bb)/100 << endl;
    
    return 0;
}

Measured memory_bytes: 3648
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int cur = 0;
        for (int i = 0; i <= n; i++)
        {
            cur *= 10;
            cur += 7;
            cur %= n;
            if (cur == 0)
            {
                Console.WriteLine(i + 1);
                return;
            }
        }
        Console.WriteLine(-1);
    }
}

Measured memory_bytes: 27488
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	string s;cin>>s;
	int n=s.size(),out=0,now=0;
	rep(i,n){
		if(s[i]=='A' || s[i]=='T' || s[i]=='C' || s[i]=='G') now++;else now=0;
		out=max(now,out);
	}
	cout<<out<<endl;
}


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

int main(void)
{
  int i;
  char s[1010];

  scanf("%s", s);
  for (i = 0; i < strlen(s); i++) {
    if (s[i] == 'A') {
      printf("X");
    } else if (s[i] == 'B') {
      printf("Y");
    } else if (s[i] == 'C') {
      printf("Z");
    } else {
      printf("%c", s[i] - 3);
    }
  }
  puts("");

  return (0);
}

Measured memory_bytes: 524
# B - Contest with Drinks Easy
def main():
    import copy
    _ = int(input())
    t = list(map(int, input().split()))
    m = int(input())
    px = [input().split() for i in range(m)]
    

    for i in range(m):
        tt = copy.copy(t)
        tt[int(px[i][0])-1] = int(px[i][1])
        print(sum(tt)) 


if __name__ ==  "__main__":
    main()

Measured memory_bytes: 9304
N=int(input())
S=(input(),input())
a=1
i=0
s=0
mod=10**9+7
while i<N:
    if S[0][i]==S[1][i]:
        if s==0:
            a=3 if i==0 else (a*2)%mod
        s=0
    else:
        if s==0:
            a=6 if i==0 else (a*2)%mod
        else:
            a=6 if i==0 else (a*3)%mod
        s=1
        i+=1
    i+=1
print(a)

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

dic = {}
for i in range(K):
    _ = int(input())
    A = list(map(int, input().split()))
    for a in A:
        if not a in dic:
            dic[a] = 1

ans = 0
for i in range(1, N+1):
    if not i in dic:
        ans += 1
print(ans)


Measured memory_bytes: 67796
import java.util.Scanner;

public class Main {
	int selval;
	int sumval;
	int res = 0;

	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			selval = sc.nextInt();
			sumval = sc.nextInt();
			if(selval == 0 && sumval == 0)break;
			calc(0,0,selval);
			System.out.println(res++);
			res = 0;
		}
	}

	void calc(int i, int sum, int n){
		if(n == 0 && sum == sumval){
			res++;
		}

		if(i > 9)return;
		for(int k = i; k <= 9; k++){
			calc(k+1, sum+k,n-1);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

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

bool check(int64 n,int64 b,int64 s){
	int64 sum = 0;
	while(n){
		sum+=n%b;
		n/=b;
	}
	if(s==sum) return true;
	else return false;
}

int main(){
	int64 n,s;
	cin>>n>>s;
	
	if(s==n){
		cout<<n+1;
		return 0;
	}
	if(s>n){
		cout<<-1;
		return 0;
	}
	
	for(int64 i=2;i*i<=n;i++){
		if(check(n,i,s)){
			cout<<i;
			return 0;
		}
	}
	
	int64 ns = n-s;
	int64 res = 0;
	for(int64 i=1;i*i<=ns;i++){
		
		if(ns%i==0){
			int64 b = (ns/i)+1;
			if(check(n,b,s)){
				res = b ;
			}
			// int64 x = i+1;
			// if(check(n,x,s)){
				// cout<<x;
				// return 0;
			// }
		}
	}
	if(res){
		cout<<res;
		return 0;
	}
	cout<<-1;
	
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    int t[n];
    int sum = 0;
    rep(i,n) {
        cin >> t[i];
        sum += t[i];
    }
    int m;
    cin >> m;
    rep(i,m){
        int p,x;
        cin >> p >> x;
        cout << sum-(t[p-1] -x) << endl;
    }



    
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N, A, B, C, D = map(int, input().split(' '))
A -= 1
B -= 1
C -= 1
D -= 1


S = input()
if S[A:C+1].count('##') or S[B:D+1].count('##'):
    print('No')
    exit(0)

if C > D:
    if not S[B-1: D+2].count('...'):
        print('No')
        exit(0)

print('Yes')


















Measured memory_bytes: 40816
x=int(input())

dp=[0]*101000

dp[100]=1
dp[101]=1
dp[102]=1
dp[103]=1
dp[104]=1
dp[105]=1

for i in range(100000):
    if dp[i]!=0:
        dp[i+100]+=1
        dp[i+101]+=1
        dp[i+102]+=1
        dp[i+103]+=1
        dp[i+104]+=1
        dp[i+105]+=1

if dp[x]!=0:
    print("1")

else:
    print("0")



Measured memory_bytes: 3828
#include<iostream>
using namespace std;
int main(){
    int n, m, l;
    long sum = 0;
    cin >> n >> m >> l;
    int a[n][m] = {}, b[m][l] = {};
    
    //入力
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> a[i][j];
        }
    }
    for(int j=0;j<m;j++){
        for(int k=0;k<l;k++){
            cin >> b[j][k];
        }
    }
    
    //計算・出力
    for(int i=0;i<n;i++){
        for(int k=0;k<l;k++){
            for(int j=0;j<m;j++){
                sum += a[i][j] * b[j][k];
            }
            cout << fixed << sum;
            if(k<l-1){
                cout << " ";
            }
            sum = 0;
        }
        cout << endl;
    }
    
}


Measured memory_bytes: 3148
#include<iostream>
#include<climits>

int count;

void merge(int*, int, int, int);
void mergeSort(int*, int, int);

using namespace std;

int main(){
  int i, n, s_in;
  int l, m, r;
  int S[500000];
  cin >> n;
  for(i=0;i<n;++i) cin >> S[i];
  mergeSort(&S[0], 0, n);

  for(i=0;i<n;++i){
    cout << S[i];
    if(i != n-1) cout << " ";
  }
  cout << "\n" << count << "\n";
  
  return 0;
}

void merge(int* A, int left, int mid, int right){
  int i, j;
  int n1 = mid - left, n2 = right - mid;
  int L[n1], R[n2];
  for(i=0;i < n1;++i) L[i] = A[left+i];
  for(i=0;i < n2;++i) R[i] = A[mid+i];
  L[n1] = INT_MAX, R[n2] = INT_MAX;
  
  i=0, j=0;
  for(int k=left;k < right;++k){
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }else{
      A[k] = R[j];
      j++;
    }
    count++;
  }
}

void mergeSort(int* A, int left, int right){
  int mid;
  if(left+1 < right){
    mid = (left+right)/2;
    mergeSort(&A[0], left, mid);
    mergeSort(&A[0], mid, right);
    merge(&A[0], left, mid, right);
  }
}



Measured memory_bytes: 6984
//use proconio::{input, fastout};
use proconio::input;

//#[fastout]
fn main() {
    input! {
        a: i64,
        b: i64,
        _c: i64,
        k: i64,
    }
    if a >= k {
        println!("{}", k);
    } else if a + b >= k {
            println!("{}", a);
    } else {
        println!("{}", a - (k - a - b));
    }
}


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

int M;
int a[7];
int s, g;
int N[301];

bool isChecked[301];
vector<int> milestone[301];  //そのマスで出せばゴールにたどり着ける目を格納する

int iabs(int x){ return x >= 0 ? x : -x; }

bool search(int now){
	if (isChecked[now]) return false;
	else if (now == g)  return true;

	isChecked[now] = true;
	for (int dice = 1; dice <= 6; dice++){
		if (now + a[dice] <= M && search(now + a[dice] + N[now + a[dice]])){
			milestone[now].push_back(a[dice]);
		}
		if (now - a[dice] >= 1 && search(now - a[dice] + N[now - a[dice]])){
			milestone[now].push_back(-a[dice]);
		}
	}

	return milestone[now].size() > 0 ? true : false;
}

int main(){
	cin >> M;
	for (int i = 1; i <= 6; i++){
		cin >> a[i];
	}
	cin >> s >> g;
	for (int i = 1; i <= M; i++){
		cin >> N[i];
	}
	bool canGoal = search(s);

	int now = s; //自分が今いるマスの番号
	for (;;){
		int dice;
		cin >> dice;

		bool found = false;
		for (vector<int>::iterator it = milestone[now].begin(); it != milestone[now].end(); it++){
			if (iabs(*it) == a[dice]){
				if (*it > 0){
					now = now + a[dice] + N[now + a[dice]];
					cout << 1 << endl;
				}
				else{
					now = now - a[dice] + N[now - a[dice]];
					cout << -1 << endl;
				}
				found = true;
				break;
			}
		}
		if(!found) cout << 0 << endl;
		cout.flush();

		if (now == g) return 0;
	}
	
	return 0;
}

Measured memory_bytes: 1304
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = int(1e09) + 7
INF = int(1e15)


class Edge():
    def __init__(self, to_, id_):
        self._to = to_
        self._id = id_


G = [[Edge]]
ans = []

sys.setrecursionlimit(1000000)


def dfs(v, color, parent=-1):
    global G
    global ans
    c = 1
    if c == color:
        c += 1
    for g in G[v]:
        if g._to == parent:
            continue
        if ans[g._id] != -1:
            continue
        ans[g._id] = c
        dfs(g._to, c, v)
        c += 1
        if c == color:
            c += 1
    return


def main():
    # sys.stdin = open("sample.txt")
    global G
    global ans
    N = Scanner.int()
    G = [[] for _ in range(N)]
    for i in range(N-1):
        a, b = Scanner.map_int()
        a -= 1
        b -= 1
        G[a].append(Edge(b, i))
        G[b].append(Edge(a, i))
    ans = [-1 for _ in range(N-1)]
    dfs(0, 0)
    print(max(ans))
    print(*ans, sep="\n")
    return


if __name__ == "__main__":
    main()


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

int main(){
  int x,n[10000],d,s=0;
  cin >> x;
  for(int i=0;i<x;i++) cin >> n[i];
    
  for(int i=0;i<x;i++){
	  d=1;
	  for(int j=2;j*j<=n[i];j++){
		  if(n[i]%j==0){
			  d=0;
			  break;
		  }
	  }
	  if(d==1) s++;
  }
  cout << s << "\n";
  return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
#define INF 2e9
#define ll long long


int main(){
    int n;
    cin>>n;
    
    if(n<=9){
        cout<<n<<endl;
    }
    else if(n<=99){
        cout<<"9"<<endl;
    }
    else if(n<=999){
        cout<<9+n-100+1<<endl;
    }
    else if(n<=9999){
        cout<<"909"<<endl;
    }
    else if(n<=99999){
        cout<<909+n-10000+1<<endl;
    }
    else{
        cout<<90909<<endl;
    }

    return 0;
}

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

using namespace std;
#define ll long long
const ll INF=1e18;
const int N=1e5+5;
ll a[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    long long a,b;
    string s;
    cin>>a>>s;
    b=(s[0]-'0')*100+(s[2]-'0')*10+(s[3]-'0');
    cout<<a*b/100<<endl;
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define INF 0x7fffffff
#define mem0(x) memset(x, 0, sizeof(x))
#define mem1(x) memset(x, -1, sizeof(x))
#define all(x) x.begin(), x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define de(x) cout << #x << " = " << x << ", "
#define dl(x) cout << #x << " = " << x << endl
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = a; i > b; i--)
#define setI freopen("input.txt", "r", stdin);
#define setIO freopen("input.txt", "r", stdin); freopen("output.txt","w", stdout);
typedef long long LL;
typedef pair<int, int> pii;
typedef vector<int> vi;
//---------------------------------------------------------//
const int N = 55;

struct P
{
	int x, y;
	int rx, ry;
} p[N];
int n, k;
int sum[N][N];
vi vx, vy;

int main()
{
	#ifdef LOCAL
		setI;
	#endif
//	ios::sync_with_stdio(false);
	scanf("%d%d", &n, &k);
	rep(i, 0, n)
	{
		scanf("%d%d", &p[i].x, &p[i].y);
		vx.pb(p[i].x);
		vy.pb(p[i].y);
	}
	sort(all(vx)); vx.erase(unique(all(vx)), vx.end());
	sort(all(vy)); vy.erase(unique(all(vy)), vy.end());
	rep(i, 0, n)
	{
		p[i].rx = lower_bound(all(vx), p[i].x) - vx.begin() + 1;
		p[i].ry = lower_bound(all(vy), p[i].y) - vy.begin() + 1;
	}
	int X = sz(vx), Y = sz(vy);
	rep(i, 1, X + 1)
	{
		rep(j, 1, Y + 1)
		{
			int f = 0;
			rep(r, 0, n)
			{
				if (p[r].rx == i && p[r].ry == j)
				{
					f = 1;
					break;
				}
			}
			sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + f;
		}
	}
	LL ans = (1LL<<62);
	rep(i, 1, X + 1)
	{
		rep(j, 1, Y + 1)
		{
			rep(a, i + 1, X + 1)
			{
				rep(b, j + 1, Y + 1)
				{
					if (sum[a][b] - sum[i - 1][b] - sum[a][j - 1] + sum[i - 1][j - 1] >= k)
					{
						if (1LL * (vx[a - 1] - vx[i - 1]) * (vy[b - 1] - vy[j - 1]) < ans)
							ans = 1LL * (vx[a - 1] - vx[i - 1]) * (vy[b - 1] - vy[j - 1]);
					}
				}
			}
		}
	}
	printf("%lld\n", ans);

	return 0;
}


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

using namespace std;

#define int long long

int n,a,b;

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

	cin >> n >> a >> b;
	int tmp = n/(a+b);
	cout << tmp*a + min(a,n%(a+b));
}

Measured memory_bytes: 256
def power_func(a,n,p):
    bi = str(format(n,"b"))#2進表現に
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res



K = int(input())
seven=0

if str(K)[-1] in ['0','2','4','5','6','8']:
    print(-1)

else:
    i=0
    seven_mod=0
    while True:
        i+=1

        seven_mod = (seven_mod + 7%K * power_func(10,i,K))%K
        if seven_mod == 0:
            break

    print(i)

Measured memory_bytes: 68068
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int count = 0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='o') count++;
    }
    if((15-s.size())+count>=8){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

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

using namespace std;

long long perm(vector<long long>& ns, int n, int r, vector<int>& selected, int begin){
    if(selected.size()==r){
        long long res=1;
        for(int i=0; i<r; ++i){
            res*=ns[selected[i]];
        }
        return res;
    }
    long long res=0;
    for(int i=begin; i<n; ++i){
        selected.push_back(i);
        res+=perm(ns, n, r, selected, i+1);
        selected.pop_back();
    }
    return res;
}

int main(){
    int n;
    cin >> n;
    auto ns=vector<long long>(5, 0);
    for(int i=0; i<n; ++i){
        string s;
        cin >> s;
        int j;
        switch(s[0]){
            case 'M': j=0; break;
            case 'A': j=1; break;
            case 'R': j=2; break;
            case 'C': j=3; break;
            case 'H': j=4; break;
            default: continue;
        }
        ++ns[j];
    }
    vector<int> selected;
    cout << perm(ns, 5, 3, selected, 0) << 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++)
typedef long long ll;

int main(){
	int n; cin>>n;
	int cnt=0;
	for(int i=1; i<=n; i++){
		int a; cin>>a;
		if(i%2==0) continue;
		else {
			if(a%2==1) cnt++;
		}
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 3564
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <queue>
#include <deque>
#include <string.h>
#include <math.h>
typedef long long ll;
typedef long long int lli;
#define MAXI		100001
#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define MIN(x, y)	(((x) < (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define SWAP
#define REP(i,x,y)	for (int (i)=(x);(i)<(y);(i)++)
#define REP_(i,x,y)	for ((i)=(x);(i)<(y);(i)++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

using namespace std;
typedef pair<int, int> Point;
typedef vector<vector<Point>> Graph;
typedef vector<lli> AdList;

lli n,m;
lli x[MAXI];
lli color[MAXI];
AdList g[MAXI];

void dfs(lli r, lli c) {
	stack<lli> s;
	s.push(r);
	color[r] = c;
	while (!s.empty()) {
		lli u = s.top();s.pop();
		REP(i,0,g[u].size()) {
			lli v = g[u][i];
			if (color[v] == 0) {
				color[v] = c;
				s.push(v);
			}
		}
	}
}

void fix_color( lli n ) {
	lli id = 1;
	REP(i,0,n) if (color[i] == 0) dfs(i,id++);
}

int main() {
	lli ans;
	
	cin >> n >> m;
		
	REP(i,0,n) cin >> x[i];

	REP(i,0,m) {
		int a,b;
		cin >> a >> b;
		g[a-1].push_back(b-1);
		g[b-1].push_back(a-1);
	}
	
	fix_color(n);
	
	/* n個毎に、iとpiが連結かどうかみる */
	REP(i,0,n) {
		if ((i+1) == x[i] || color[i] == color[x[i]-1]) ans++;
	}
	
	cout << ans;
	
	return 0;
}


Measured memory_bytes: 7808
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

// 約数の列挙O(√n)
vector<ll> enum_divisors(ll n){
    vector<ll> res;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            res.push_back(i);
            // 重複しないならばiの相方であるN/iもpush
            if(i!=n/i) res.push_back(n/i);
        }
    }
    // 小さい順に並び替える
    sort(res.begin(), res.end());
    return res;
}

int main() {
    ll x;
    cin>>x;
    auto ed=enum_divisors(x);
    for(auto e : ed){
        for(ll b=-1000;b<=1000;b++){
            ll a=b+e;
            if(a*a*a*a*a-b*b*b*b*b==x){
                cout<<a<<" "<<b<<endl;
                return 0;
            }
        }
    }
}



Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;

P calc(P a,P b,P c,P d){
  a-=d;b-=d;c-=d;
  double A=imag(a/c);
  double B=imag(b/c);
  return d+a+(b-a)*A/(A-B);
}

int main(){
  int n;
  double ax,ay,bx,by,cx,cy,dx,dy;
  scanf("%d",&n);
  while(n--){
    scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&ax,&ay,&bx,&by,&cx,&cy,&dx,&dy);
    P ans=calc(P(ax,ay),P(bx,by),P(cx,cy),P(dx,dy));
    printf("%.8f %.8f\n",ans.real(),ans.imag());
  }
  return 0;
}

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

int main(){
  int N, M;
  cin >> N >> M;
  priority_queue<double> pq;
  for(int i=0; i<N; i++){
    double x;
    cin >> x;
    pq.push(x);
  }
  
  for(int i=0; i<M; i++){
    double y = pq.top();
    pq.pop();
    pq.push(y/2.0);
  }
  
  int64_t ans = 0;
  
  for(int i=0; i<N; i++){
    int z = pq.top();
    ans += z;
    pq.pop();
  }
    
  cout << ans << endl;

} 

Measured memory_bytes: 1400
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
struct robot
{
	int x,y; 
}r[200005];
int left1[200005];
int right1[200005];
int res[200005];
int cmp(struct robot a,struct robot b)
{
	return a.x<b.x;
}
int main(void)
{
	int n;
	int m;
	while(~scanf("%d %d",&n,&m))
	{
		for(int i=0;i<=n;i++)
		{
			left1[i]=right1[i]=i;
		}
		memset(res,0,sizeof(res));
		for(int i=1;i<=m;i++)
		{
			scanf("%d %d",&r[i].x,&r[i].y);
		}
		sort(r+1,r+m+1,cmp);
		for(int i=1;i<=m;i++)
		{
			int xx=r[i].y;
			left1[xx]=left1[xx+1]=min(left1[xx],left1[xx+1]);
			right1[xx]=right1[xx+1]=max(right1[xx],right1[xx+1]);
		}
		cout<<right1[1]-left1[1]+1;
		for(int i=2;i<=n;i++)
		{
			cout<<" "<<right1[i]-left1[i]+1;
		}
		cout<<endl;
		
		
	}
}

Measured memory_bytes: 6356
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
long long fib[86];
int main()
{
    fib[0]=2;fib[1]=1;
    for(int i=2;i<=86;i++)
        fib[i]=fib[i-1]+fib[i-2];
    int n;
    scanf("%d",&n);
    printf("%lld",fib[n]);
    return 0;
}

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

import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9);
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		String s = sc.next();
		
		System.out.println(s.replace(',', ' '));
		
		
	}
	
	static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


Measured memory_bytes: 22484
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define RG register
#define inf 0x7fffffff
#define maxn 200005
#define maxm 200005
using namespace std;
typedef long long ll;
inline ll read(){
    ll x = 0, f = 1;
    char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x *10 + ch -'0';ch = getchar();}
    return x * f;
}
ll n,k,d;
int main(){
	int i,j,u,v;
	n=read(),k=read(),d=read();
	ll t=abs(n/d);
	if(k<=t){
		printf("%lld\n",abs(abs(n)-d*k));
	}
	else{
		if(n<0) n=n+d*t,n=-n;
		else n=n-d*t;
		k-=t;
		k%=2;
		if(k) printf("%lld\n",abs(n-d));
		else printf("%lld\n",n);
	}
	return 0;
}

Measured memory_bytes: 3760
#include<iostream>
#include <stdio.h>
using namespace std;

int main(){
    int n,m;
    int a[100][100];
    int b[100];
    int i,j;
    int ans=0;
    
    cin >> n >> m;
    for (i = 0; i < n; i++){
        for (j = 0; j < m; j++){
            cin >> a[i][j];    
        }
    }
    
    for (i = 0; i < m; i++){
        cin >> b[i];
    }
    
    for (i = 0; i < n; i++){
        for (j = 0; j < m; j++){
            ans = ans + a[i][j] * b[j];
        }
        cout << ans << endl;
        ans = 0;
    }
    
    return 0;
}

Measured memory_bytes: 3108
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

bool hatiyaku(int x){

	int yaku = 1;
	for(int i=2; i<= x; i++){
		if(x % i == 0){
			yaku++;
		}
	}

	if(yaku == 8) return true;
	else return false;

}

using namespace std;

int main(){

	int n;

	cin >> n;

	int count=0;

	for(int i=1;i<=n;i++){
		if(i % 2 == 0) continue;
		if(hatiyaku(i) == true) count++;
	}

	cout << count << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
vector<double> inp;
vector<vector<double>> dp;

double solver()
{
    dp.assign(n+1,vector<double> (n+1,0));
    //preinit
    dp[0][0] = 1;
    for(int i=1;i<=n;i++) dp[0][i] = dp[0][i-1]*(1-inp[i]);

    for(int i=1;i<=n;i++)
    {
        for(int j=i;j<=n;j++)
        {
            double ans = 0;
            ans += dp[i-1][j-1]*inp[j];
            ans += dp[i][j-1]*(1-inp[j]);
            dp[i][j] = ans;
        }
    }
    double ans=0;
    for(int i=n;i>n/2;i--)
    {
        ans += dp[i][n];
    }
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    cin>>n;
    inp.resize(n+1);

    for(int i=1;i<=n;i++)
    {
        cin>>inp[i];
    }
    
    cout.precision(13);
    cout<<solver()<<"\n";

    
}


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

namespace ITP1_5_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var list = new List<string[]>();
            string input;
            while ((input = Console.ReadLine()) != "0 0")
                list.Add(input.Split(' '));
            foreach (var l in list)
            {
                int height = int.Parse(l[0]);
                int width = int.Parse(l[1]);
                string line = new string('#', width);
                for (int i = 0; i < height; i++)
                    Console.WriteLine(line);
                Console.WriteLine();
            } 
        }
    }
}

Measured memory_bytes: 9156
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main{
	static Scanner s=new Scanner(System.in);

	class Edge{
		int		f,t;
		long	jpy,snk;
		public Edge(int f,int t,long l,long m){
			super();
			this.f=f;
			this.t=t;
			this.jpy=l;
			this.snk=m;
		}
	}

	void solve(){
		int n=gInt();
		int[]a=INTS(n).toArray();
		int r=0,c=1;
		for(int i=1;i<n;++i) {
			if(a[i-1]==a[i]) {
				++c;
			}else {
				r+=c/2;
				c=1;
			}
		}
		r+=c/2;
		System.out.println(r);
	}
	public static void main(String[] A){
		new Main().solve();
	}

	static int gInt(){
		return Integer.parseInt(s.next());
	}
	static long gLong(){
		return Long.parseLong(s.next());
	}
	static double gDouble(){
		return Double.parseDouble(s.next());
	}

	SupplyingIterator<Integer> ints(int n){
		return new SupplyingIterator<>(n,Main::gInt);
	}
	SupplyingIterator<Long> longs(int n){
		return new SupplyingIterator<>(n,Main::gLong);
	}
	SupplyingIterator<Double> doubles(int n){
		return new SupplyingIterator<>(n,Main::gDouble);
	}
	SupplyingIterator<String> strs(int n){
		return new SupplyingIterator<>(n,s::next);
	}

	Range rep(int i){
		return Range.rep(i);
	}
	Range rep(int f,int t,int d){
		return Range.rep(f,t,d);
	}
	Range rep(int f,int t){
		return rep(f,t,1);
	}
	Range rrep(int f,int t){
		return rep(t,f,-1);
	}

	IntStream REP(int v){
		return IntStream.range(0,v);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return IntStream.generate(Main::gInt).limit(n);
	}
	Stream<String> STRS(int n){
		return Stream.generate(s::next).limit(n);
	}

}
class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{
	int			t;
	Supplier<T>	supplier;

	SupplyingIterator(int t,Supplier<T> supplier){
		this.t=t;
		this.supplier=supplier;
	}

	@Override
	public Iterator<T> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return t>0;
	}

	@Override
	public T next(){
		--t;
		return supplier.get();
	}

}

class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
	int to,cur,d;

	Range(int from,int to,int d){
		this.cur=from-d;
		this.to=to;
		this.d=d;
	}

	Range(int n){
		this(0,n-1,1);
	}

	@Override
	public Iterator<Integer> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
	}

	@Override
	public int nextInt(){
		return cur+=d;
	}
	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	static Range rep(int f,int t){
		return rep(f,t,1);
	}
	static Range rrep(int f,int t){
		return rep(f,t,-1);
	}
}


Measured memory_bytes: 30036
import java.util.Scanner;

public class Main {

    static int abs(int x) {
        if (x < 0) {
            x = -x;
        }
        return x;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while (n > 0) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }
            int y = 1000000;
            int z = 0;
            for (int b = 0; b < n; b++) {
                for (int c = b + 1; c < n; c++) {
                    z = abs(a[b] - a[c]);

                    if (z < y) {
                        y = z;
                    }
                }
            }
            System.out.println(y);
            n = sc.nextInt();
            

        }
    }
}



Measured memory_bytes: 48828
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <cmath>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

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

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
キュー　queue<int> q;
   q.push(7);　//７が入る
   cout << q.front() << endl;  // 先頭の値を出力
   q.pop();  // 先頭の値を削除
   q.empty();
*/
//座標　corrdinateト深さヲ保持スルタメノ構造体
struct Coor{
  ll y;
  ll x;
  ll depth;
};
 ll N,M;  
 ll sy,sx,gy,gx;
 ll y,x,depth;//キューから取り出した座標
vector<string> vec;
queue<Coor> q;
vector<ll> y_vec={0,0,-1,+1};//technique
vector<ll> x_vec={-1,+1,0,0};

int BFS(){
  while(!q.empty()){
    Coor now=q.front();q.pop();//キューの先頭を取り出す
    y=now.y,x=now.x,depth=now.depth;
    
    //停止条件
    if(y==gy&&x==gx){return depth;}
    
    //上下左右４方向を探索、進むことができればキューに格納
    for(int i=0;i<4;i++){
      Coor next={y+y_vec[i],x+x_vec[i],depth+1};
      if(0<=next.y&&next.y<=N-1&&0<=next.x&&next.x<=M-1&&vec[next.y][next.x]=='.'){
        vec[next.y][next.x]='x';//同じ場所を探索しないようにする
        q.push(next);
      }
    }
  }
  return 0;
}
                   
  


int main(void){
cout<<fixed<<setprecision(14);
//cin.tie(0); ios::sync_with_stdio(false);

  
string S1,S2;
  cin>>S1>>S2;
  
  if(S1[0]==S2[2]&S1[1]==S2[1]&&S1[2]==S2[0]){
    cout<<"YES"<<endl;
  }else{cout<<"NO"<<endl;
       }
  
  
  
  
  
  
  
}



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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define intMAX 1000000000
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod = 1e9+7;

ll a,b,c,d;

ll gcd(ll x, ll y){
  if(y == 0)return x;
  else return gcd(y, x%y);
}

int main(){
  cin >> a >> b >> c >> d;

  ll tmp1 = b - b/c - b/d + b/(c*d/gcd(c,d));
  a = a - 1;
  ll tmp2 = a - a/c - a/d + a/(c*d/gcd(c,d));

  cout << tmp1 - tmp2 << endl; 
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	if(n%10==7 || n/10%10==7 || n/100==7){
		cout << "Yes\n";
	}
	else{
		cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}




int main() {
   
   int a;
  cin >> a;
  cout << a+a*a +a*a*a << endl;


    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define ALL(v) (v).begin(),(v).end()
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
typedef long long ll;

template<class T> T gcd(T a,T b) {return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b) {return a/gcd(a,b)*b; }
template<class T> bool isPrime(T num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (T i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

ll a,b,c,ans;

main()
{
        cin>>a>>b;

        c=gcd(a,b);
        for(ll i=2;i*i<=c;i++)
        {
                if(c%i==0)
                {
                        ans++;
                        while(c%i==0)c/=i;
                }
        }
        ans+=(c!=1)+1;
        cout<<ans<<endl;
}

Measured memory_bytes: 256
# coding: utf-8
import sys
sys.setrecursionlimit(10 ** 7)

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

K = ir()
num = -1

def dfs(A, i, bl):
    global num
    if i == 11:
        num += 1
        if num == K:
            ans = ''.join(map(str, A))
            ans = int(ans)
            print(ans)
            exit()
        return
    last = A[-1]
    if bl:
        dfs([0], i+1, True)
        for j in range(1, 10):
            dfs([j], i+1, False)
    else:
        if last > 0:
            dfs(A+[last-1], i+1, False)
        dfs(A+[last], i+1, False)
        if last < 9:
            dfs(A+[last+1], i+1, False)

dfs([0], 0, True)


Measured memory_bytes: 9268
#include <bits/stdc++.h>
using namespace std;
int n,d;
int main () {
	scanf("%d%d",&n,&d);
	if (n%(2*d+1)==0) {printf("%d\n",n/(2*d+1));}
	else {printf("%d\n",n/(2*d+1)+1);}
	return 0;
}

Measured memory_bytes: 256