akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <valarray>
#include <vector>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(__typeof((X).begin()) it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)x.size())

using namespace std;

struct timer{
	time_t start;
	timer(){start=clock();}
	~timer(){cerr<<1.*(clock()-start)/CLOCKS_PER_SEC<<" secs"<<endl;}
};

typedef istringstream iss;
typedef long long ll;
typedef pair<int,int> pi;
typedef stringstream sst;
typedef vector<int> vi;

int Q;

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	cin>>Q;
	while(Q--){
		string s;
		cin>>s;
		int b[33];
		rep(i,sz(s)){
			int m=isdigit(s[i]) ? s[i]-'0' : s[i]-'a'+10;
			rep(j,4){
				b[4*i+j] = m>>(3-j)&1;
			}
		}
		int v=0;
		rep2(i,1,32)v|=b[i]<<(31-i);
		if(b[0]==1)cout<<"-";
		if((v&127)==0){
			cout<<v/128<<".0"<<endl;
		}
		else{
			cout<<setprecision(16)<<v/128.<<endl;
		}
	}
}

Measured memory_bytes: 1296
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int main()
{
int a;
cin>>a;
int b;
cin>>b;
for(int i=0;i<=a;i++)
for(int j=0;(j+i)<=a;j++){
int s=a-i-j;
int d=10000*i+5000*j+1000*s;
if(d==b){
cout<<i<<' '<<j<<' '<<s<<endl;
system("pause");
return 0;
}}
cout<<"-1 -1 -1"<<endl;
system("pause");
return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
char a[5] = {'a','i','e','o','u'};
signed main(){
    char c;cin >> c;
    bool ok = false;
    rep(i,5){
        if(c == a[i]){
            ok = true;
            break;
        }
    }
    cout << (ok?"vowel":"consonant") << endl;

    return 0;
}

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

int main(void){
    int a[5];
    for(int i = 0; i < 3; i++){
        cin >> a[i];
    }
    sort(a, a + 3);
    cout << a[0] + a[1] << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np


def RunLengthEncoding(S):
    res = []
    N = len(S)
    i = 0
    while i < N:
        cnt = 1
        while i < N - 1 and S[i] == S[i + 1]:
            cnt += 1
            i += 1
        res.append(S[i])
        i += 1
    return res


N = int(input())
A = np.array(input().split(), dtype=int)

ans = 0
flower = np.zeros_like(A)
for i in range(1, A.max() + 1):
    f = flower.copy()
    f[A >= i] = 1
    RLE = RunLengthEncoding(f)
    ans += sum(RLE)

print(ans)

Measured memory_bytes: 18200
using System;
class p
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    char A = input[0][0];
    char B = input[1][0];
    if (A < B) {
      Console.WriteLine("<");
    } else if (A > B) {
      Console.WriteLine(">");
    } else {
      Console.WriteLine("=");
    }
  }
}


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

int main(){
    int r,g,b;
    cin >> r >> g >> b;
    int s=0;
    s = r*100+g*10+b*1;

    if(s%4==0){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3644
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>

using namespace std;

#define rep(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool smin(T &a, const T &b)   { return a > b ? a = b : a;    }
template<typename T> inline bool smax(T &a, const T &b)   { return a < b ? a = b : a;    }

typedef long long LL;

const int N = (int) 1e6 + 6, mod = (int) (1 << 23) * 17 * 7 + 1;
int dp[1 << 26];
int main() {
	string s;
	cin >> s;
	memset(dp, 63, sizeof dp);
	dp[0] = 0;
	int cur_mask = 0, last = 1e9;
	for (auto c : s) {
		int x = c - 'a';
		cur_mask ^= 1 << x;
		int here_dp = dp[cur_mask] + 1;
		for (int j = 0; j < 26; ++j) {
			here_dp = min(here_dp, dp[cur_mask ^ (1 << j)] + 1);
		}
		dp[cur_mask] = min(dp[cur_mask], here_dp);
		last = here_dp;
	}
	cout << last << endl;
}






Measured memory_bytes: 262660
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int N;
    cin >> N;
    vector<P> dim(N);
    REP(i, N) cin >> dim[i].first >> dim[i].second;

    vector< vector<int> > dp(N, vector<int>(N, 1e9));
    vector< vector<P> > mat_size(N, vector<P>(N));
    REP(i, N)
        FOR(j, i, N-1) mat_size[i][j] = make_pair(dim[i].first, dim[j].second);
    REP(i, N) dp[i][i] = 0;
    FOR(l, 1, N - 1) {
        REP(i, N - l) {
            FOR(j, 0, l-1)
                dp[i][i + l] = min(dp[i][i + l],  mat_size[i][i+j].second * mat_size[i][i+j].first * mat_size[i+j+1][i+l].second  + dp[i][i+j] + dp[i+j+1][i+l]);
        }
    }

    // REP(i, N) {
    //     REP(j, N) cerr << dp[i][j] << " ";
    //     cerr << endl;
    // }

    cout << dp[0][N-1] << endl;
    return 0;
}


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

int N,M;
vector<int> par;

void initialize(){
 par.resize(N);
 for(int i = 0; i < N; i++){
par[i] = i;} //始めは任意のノードの親が自分自身
  }

int root(int x){
if(par[x] == x){ return x;}
else{ return par[x] = root(par[x]);}}

void unite(int x, int y){
if( root(x) == root(y)){ return;}
else{
 par[root(x)] = root(y);}}

bool issame(int x, int y){
return root(x) == root(y);}

int main(){
 cin >> N >> M;  int ans = 0;
  vector<int> p(N);
  for(int i = 0; i < N; i++){ cin >> p[i]; p[i]--;}
  initialize();
  for(int i = 0; i < M; i++){
    int x,y; cin >> x >> y; x--; y--;
    unite(x,y);}
  
  
  for(int i = 0; i < N; i++){
    if( issame(i,p[i])){ ans++;}
  }
  
  cout << ans << endl; return 0;}
  
  

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

s1=s[0]
count_1=0
#1枚目をそのまま使う
for i in range(1,n):
    if i%2==0:
        if s[i]!=s1:
            count_1+=1
    else:
        if s[i]==s1:
            count_1+=1

count_2=1
for i in range(1,n):
    if i%2==0:
        if s[i]==s1:
            count_2+=1
    else:
        if s[i]!=s1:
            count_2+=1

if count_1>count_2:
    print(count_2)
else:
    print(count_1)


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

int main(){
    string s; cin >> s;
    int cnt = 0, tmp = 0;

    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'A' || s[i] == 'C'|| s[i] == 'G' || s[i] == 'T'){
                tmp++;
        }else{
            tmp = 0;
        }
        cnt = max(tmp, cnt);
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=998244353;
const LL LINF=1LL<<62;

LL memo[2001][2];
vector<LL> a;
int N,Z,W;


LL dfs(int l,int r,int c){
    int t=max(l,r);
    if(l!=-1&&r!=-1&&~memo[t][c]) return memo[t][c];
    if(l==N-1||r==N-1){
        if(l==-1) return abs(Z-a[r]);
        else if(r==-1) return abs(W-a[l]);
        return abs(a[r]-a[l]);
    }
    LL ret;
    if(c==0){
        ret=0;
        for(int i=t+1;i<N;i++){
            ret=max(ret,dfs(i,r,c^1));
        }
        return (t==-1?ret:memo[t][c]=ret);
    }
    else{
        ret=LINF;
        for(int i=t+1;i<N;i++){
            ret=min(ret,dfs(l,i,c^1));
        }
        return (t==-1?ret:memo[t][c]=ret);
    }
}




int main(){
    cin >> N >> Z >> W;
    memset(memo,-1,sizeof(memo));
    for(int i=0;i<N;i++){
        LL A;
        cin >> A;
        a.pb(A);
    }
    cout << dfs(-1,-1,0) << endl;
    return 0;
}

Measured memory_bytes: 384
fn main() {
    let k = read::<usize>();
    let v: Vec<usize> = vec![1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51];

    println!("{}", v[k-1]);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

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

using namespace std;

#define int long long

signed main() {
    string S;
    cin >> S;
    int n = 0, e = 0, w = 0, s = 0;

    for (int i = 0; i < S.length(); i++) {
        if (S[i] == 'N') n++;
        if (S[i] == 'S') s++;
        if (S[i] == 'W') w++;
        if (S[i] == 'E') e++;
    }
    bool f = (n > 0 && s > 0 || n == 0 && s == 0) && (e > 0 && w > 0 || e == 0 && w == 0);
    
    cout << (f ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

int main()
{
   FAST/**/
   
   ll a,b,c;
   cin>>a>>b>>c;
   
   if(a+b+c>=22)
        cout<<"bust";
   else cout<<"win";        
   
   return 0;
}  
   

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())
As.sort()
from itertools import accumulate
cumAs = list(accumulate([0]+As))

ans = 0
cum = 0
for i in range(N-1):
    a = As[i]
    cum += a
    if cum*2<As[i+1]:
        ans = 0
    else:
        ans += 1

print(ans+1)

Measured memory_bytes: 92528
#include<stdio.h>
int main(void)
{
  int n, a, b, o, m, c, d;

  scanf("%d", &n);
  scanf("%d", &a);
  scanf("%d", &b);

  d = a + b;

  if (n > d) {
    m = 0;
  }else if (n == d) {
    m = 0;
  }else if (n < d && a < b) {
    c = n - b;
    m = a - c;
  }else if (n < d && a == b) {
    c = n - a;
    m = a - c;
  }else if (n < d && a > b) {
    c = n - a;
    m = b - c;
  }

  if (n > d && a < b) {
    o = a;
  }else if (n > d && a == b) {
    o = a;
  }else if (n > d && a > b) {
    o = b;
  }else if (n = d && a < b) {
    o = a;
  }else if (n = d && a == b) {
    o = a;
  }else if (n = d && a > b) {
    o = b;
  }else if (n < d && a < b) {
    o = a;
  }else if (n < d && a == b) {
    o = a;
  }else if (n < d && a > b) {
    o = b;
  }

  printf("%d %d", o, m);

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,a,n)  for (int i=(int)(a); i<=(int)(n); ++i)
#define rrep(i,a,n) for (int i=(int)(a); i>=(int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(f, 0, (x.size()-1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;
vector<int> A;
vector<int> B;
//=============================
void input()
{
    cin>>N>>M;
}
//=============================
void func(){}
/*
 - 樹形図をかく
*/
//=============================
void solve()
{
    int x = (N+M+1)/2 ;
    cout<<x<<endl;

}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main() {
  double t,x;
  cin>>t>>x;
  
  cout<<t/x<<endl;

  return 0;
}

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

int main()
{
	ll n;

	cin >> n;

	ll waru = 1e9 + 7;

	ll ans = 1;
	ll hachi = 1;
	ll kyu = 1;

	for (int i = 0; i < n; i++)
	{
		ans *= 10;
		hachi *= 8;
		kyu *= 9;
		if (ans >= waru)
			ans %= waru;
		if (hachi >= waru)
			hachi %= waru;
		if (kyu >= waru)
			kyu %= waru;
	}

	ans = ans + hachi - 2 * kyu;
	ans %= waru;

	if(ans < 0)
		ans += waru;
	if (ans < 0)
		ans += waru;
	if (ans < 0)
		ans += waru;

	cout << ans;

	// cout << ans;
}


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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//print
#define pv(val) cerr << #val << '=' << (val) << endl

const int INF = 1e9;

int main(void){

	int N; cin >> N;
	vector<int> H(N);

	REP(i,N) cin >> H[i];
	reverse(H.begin(), H.end());

	bool ok = true;
	FOR(i,1,N){
		if(H[i-1] >= H[i]) continue;
		else if(H[i-1] >= H[i] -1) H[i]--;
		else ok = false;
	}


	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;



	return 0;

}


Measured memory_bytes: 640
import heapq
n= int(input())
a=list(map(int,input().split()))
pres = a[:n]
heapq.heapify(pres)
apresum = [0]*(n+1)
aps = sum(pres)
apresum[0]=aps
posts = list(map(lambda x: -1 * x, a[::-1][:n]))
heapq.heapify(posts)
apossum = [0]*(n+1)
aqs = sum(posts)
apossum[0]=aqs
for i in range(1,n+1):
    tempprea = a[n+i-1]
    tempposta = -1 * a[2*n-i]
    heapq.heappush(pres,tempprea)
    tempprepop=heapq.heappop(pres)
    aps += tempprea-tempprepop
    apresum[i]=aps
    heapq.heappush(posts,tempposta)
    temppostpop=heapq.heappop(posts)
    aqs += tempposta - temppostpop
    apossum[i]=aqs
print(max([x+y for x,y in zip(apresum,apossum[::-1])]))


Measured memory_bytes: 37212
#!/usr/bin python3
# -*- coding: utf-8 -*-

# 双方向グラフで幅優先探索

from collections import deque

n, m = map(int, input().split())
g = [set([]) for _ in range(n)]
#隣接リストの作成
for i in range(m):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    g[a].add(b)

s, t = map(int, input().split())
s, t = s-1, t-1

#幅優先探索
q = deque()
level = [[-1]*n for i in range(3)]
q.append((s, 0))
level[0][s] = 0
while len(q)>0:
    cur, lvl = q.popleft()
    nxtl = lvl + 1
    nxthp = nxtl%3
    for i in g[cur]:
        if level[nxthp][i]==-1:
            #階層
            level[nxthp][i] = nxtl
            q.append((i, nxtl))
print(level[0][t]//3)


Measured memory_bytes: 47240
N,M=map(int, input().split())
E=[]
for i in range(M):
    a,b,c=map(int, input().split())
    E.append((a-1,b-1,c))
INF=1<<60

D=[[INF]*N for _ in range(N)]
for a,b,c in E:
    D[a][b]=D[b][a]=c
for z in range(N):
    for x in range(N):
        Dx=D[x]
        for y in range(N):
            Dx[y]=min(Dx[y], Dx[z]+D[z][y])

ans=M
for a,b,c in E:
    if D[a][b]==c: ans-=1
print(ans)


Measured memory_bytes: 41964
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

int main() {
  int N;
  char S[11];
  map<string, int> counter;

  scanf("%d", &N);

  int max_val = 0;

  for (int i = 0; i < N; i++) {
    scanf("%s", S);
    counter[S]++;
    max_val = max(max_val, counter[S]);
  }

  for (auto p : counter) {
    if (p.second == max_val) {
      printf("%s\n", p.first.c_str());
    }
  }

  return 0;
}


Measured memory_bytes: 23808
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {
	static int n, m;
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		sc.close();

		boolean ret = exec(n - 1);
		if (!ret) {
			ret = exec(n - 2);
			if (!ret) {
				throw new Exception();
			}
		}
	}

	static boolean exec(int start) {
		boolean[] used = new boolean[n + 1];
		Set<Integer> set = new HashSet<>();
		int cnt = 0;
		int j = start;
		List<String> list = new ArrayList<>(m);
		for (int i = 1; i <= n; i++) {
			if (used[i]) {
				continue;
			}
			for ( ; j >= 0; j--) {
				if (j == 0) {
					j = n - 1;
				}
				if (set.contains(j)) {
					continue;
				}
				int i2 = i + j;
				if (i2 > n) {
					i2 -= n;
				}
				if (used[i2]) {
					continue;
				}
				if (j == n - j) {
					continue;
				}
				if (!set.contains(n - j)) {
					set.add(j);
					set.add(n - j);
					used[i] = true;
					used[i2] = true;
					list.add(Math.min(i, i2) + " " + Math.max(i, i2));
					cnt++;
					if (cnt == m) {
//						if (set.size() != m * 2) {
//							throw new RuntimeException();
//						}
//						int t = 0;
//						for (int k = 1; k <= n; k++) {
//							if (used[k]) {
//								t++;
//							}
//						}
//						if (t != m * 2) {
//							throw new RuntimeException();
//						}
						PrintWriter pw = new PrintWriter(System.out);
						for (int k = 0; k < m; k++) {
							pw.println(list.get(k));
						}
						pw.flush();
						return true;
					}
					break;
				}
			}
		}
		return false;
	}
}


Measured memory_bytes: 68172
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N,A,B=get_i
puts min(B,A*N)

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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;

const int N = 100010, mod = 1e9 + 7;

int n;
int a[N], b[N], c[N];

int main()
{
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%d", a + i);
    for(int i = 1; i <= n; i++) scanf("%d", b + i);
    for(int i = 1; i <= n; i++) scanf("%d", c + i);
    sort(a + 1, a + 1 + n);
    sort(b + 1, b + 1 + n);
    sort(c + 1, c + 1 + n);

    LL res = 0;
    for(int i = 1; i <= n; i++)
    {
        int x, y;
        int l = 1, r = n;
        while(l < r)
        {
            int mid = l + r + 1 >> 1;
            if(a[mid] < b[i]) l = mid;
            else r = mid - 1;
        }
        if(a[r] < b[i]) x = r;
        else x = 0;

        l = 1, r = n;
        while(l < r)
        {
            int mid = l + r >> 1;
            if(c[mid] > b[i]) r = mid;
            else l = mid + 1;
        }
        if(c[r] > b[i]) y = n - r + 1;
        else y = 0;

        res += (LL)x * y;
    }

    printf("%lld\n", res);
    return 0;
}


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

int main() {
	int h, w;
	while (true) {
		cin >> h >> w;
		if (h == 0 && w == 0) {
			return 0;
		}
		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < w; ++j) {
				if ((i +j)%2==0) {
					cout << "#";
				} else {
					cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
	}
}

Measured memory_bytes: 3080
// E - Cell Distance
#include <bits/stdc++.h>

using namespace std;

#define	MOD	1000000007

long long mpow(long long x, long long n)
{
	long long r = 1;
	for ( ; n > 0; x = x * x % MOD, n >>= 1) if (n & 1) r = r * x % MOD;
	return r;
}

int main(int argc, char *argv[])
{
	long long n, m, k;
	cin >> n >> m >> k;

	long long r = 0, t = 1;
	for (long long i = 0; i < n; i++) r = (r + (1 + i) * i / 2 * m % MOD * m % MOD) % MOD;
	for (long long i = 0; i < m; i++) r = (r + (1 + i) * i / 2 * n % MOD * n % MOD) % MOD;
	for (long long i = 2; i <= k - 2; i++) t = t * i % MOD;
	for (long long i = 2; i <= (n * m - k); i++) t = t * i % MOD;
	for (long long i = 2; i <= n * m - 2; i++) r = r * i % MOD;
	r = r * mpow(t, MOD - 2) % MOD;
	cout << r << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        Map<Character, Integer> map = new HashMap<>();
        for(int i = 0; i < 4; i++) {
            if(map.containsKey(s[i])) map.put(s[i], map.get(s[i]) + 1);
            else map.put(s[i], 1);
        }
        if(map.size() == 2) {
            Set<Character> set = map.keySet();
            boolean flag = true;
            for(char c : set) {
                if(map.get(c) != 2) {
                    flag = false;
                    break;
                }
            }
            System.out.println(flag? "Yes":"No");
        }else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 22228
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    while (true) {
        int n; cin >> n;
        if (n==0) break;

        int ans = 0;
        FOR(i, 1, n) {
            int tmp = 0;
            FOR(j, 0, n/i+1) {
                tmp += i+j;
                if (tmp==n) ans++;
                if (tmp>=n) break;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3068
s = input()
t =  input()
slen = len(s)
tlen = len(t)
slenpo = len(s) + 1
ta = t[0:-1]
if slenpo == tlen:
  if str(ta) == s:
  	print("Yes")
  else:
    print("No")
else:
  print("No")

Measured memory_bytes: 61608
n = int(input())
t = list(map(int, input().split()))
m = int(input())
px = [list(map(int, input().split())) for _ in range(m)]

sum_t = sum(t)
for i in range(m):
    print(sum_t - t[px[i][0] - 1] +  px[i][1])

Measured memory_bytes: 3060
n, x = map(int,input().split())
l = list(map(int,input().split()))
d = []
ans = 1

for i in range(n):
    if i == 0:
        p = 0 + l[i]
        d.append(p)
        if p <= x:
            ans += 1
    else:
        p = d[i-1] + l[i]
        d.append(p)
        if p <= x:
            ans += 1
print(ans)

Measured memory_bytes: 3060
sentence = list(input().split())

maxcount = 0
maxlen = 0
cs = ''
ls = ''

for i in sentence:
    if maxcount < sentence.count(i):
        maxcount = sentence.count(i)
        cs = i

    if maxlen < len(i):
        maxlen = len(i)
        ls = i

print(cs, ls)


Measured memory_bytes: 5552
from itertools import permutations
from math import hypot

N = int(input())
xs, ys = [], []
for _ in range(N):
    x, y = map(int, input().split())
    xs.append(x)
    ys.append(y)

ans = 0
num = 0
for ps in permutations(range(N)):
    dist = 0
    for i in range(N-1):
        dist += hypot(xs[ps[i]]-xs[ps[i+1]], ys[ps[i]]-ys[ps[i+1]])
    ans += dist
    num += 1

print(ans/num)


Measured memory_bytes: 3064
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(0);
    cout << std::fixed;

    ll d,n;
    cin >> d >> n;
    if(n == 100){
      if(d == 0) cout << 101 << endl;
      if(d == 1) cout << 10100 << endl;
      if(d == 2) cout << 1010000 << endl;
      return 0;
    }
    cout << pow(100,d)*n << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> P(N);
    for (int i = 0; i < N; ++i) {
        cin >> P[i];
    }

    int smallest = numeric_limits<int>::max();
    int answer = 0;
    for (int j = 0; j < N; ++j) {
        if (P[j] < smallest) {
            answer++;
            smallest = P[j];
        }
    }
    cout << answer;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long int
const int N=1000000000;
int hl[20005];
int hl2[20005];
int cost[10005];
main() {
	int h, n;
	cin>>h>>n;
	for(int i=1; i<=10000; i++){
		cost[i]=N;
	}
	for(int i=0; i<n; i++){
		int a, b;
		cin>>a>>b;
		cost[a]=min(cost[a], b);
	}
	for(int i=1; i<=20000; i++){
		hl[i]=N;
		hl2[i]=N;
	}
	for(int i=1; i<=10000; i++){
		if(cost[i]==N){
			continue;
		}
		for(int j=0; j<=10000; j++){
			if(hl[j]==N){
				continue;
			}
			for(int x=1; x*i+j<=20000; x++){
				hl2[x*i+j]=min(hl2[x*i+j], hl[j]+x*cost[i]);
			}
		}
		for(int j=0; j<=20000; j++){
			hl[j]=min(hl[j], hl2[j]);
		}
	}
	int mini=N;
	for(int i=h; i<=20000; i++){
		mini=min(mini, hl[i]);
	}
	cout<<mini;
	return 0;
}

Measured memory_bytes: 3980
N = int(input())
x = []
y = []
h = []

for i in range(N):
    _x, _y, _h = map(int, input().split())
    x.append(_x)
    y.append(_y)
    h.append(_h)

for c_x in range(101):
    for c_y in range(101):
        thres = 10**10
        H = []
        for i in range(N):
            if h[i] > 0:
                H.append(h[i] + abs(x[i] - c_x) + abs(y[i] - c_y))
            elif thres > abs(x[i] - c_x) + abs(y[i] - c_y):
                thres = abs(x[i] - c_x) + abs(y[i] - c_y)

        if len(set(H)) == 1 and 0 < H[0] <= thres:
            print(str(c_x) + " " + str(c_y) + " " + str(H[0]))

Measured memory_bytes: 3064
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int len = sc.nextInt();
			int size = sc.nextInt();
			int max = 0;
			int maxAt = 0;
			int[] arr = new int[len];
			for (int i = 0; i < len; i++) {
				arr[i] = sc.nextInt();
			}
			if (len == size) {
				int temp = 0;
				for (int i = 0; i < size; i++) {
					temp += arr[i] + 1;
				}
				System.out.print(new BigDecimal(temp).divide(new BigDecimal(2), 1, 3));
				return;
			}
			for (int i = 0; i < size; i++) {
				max += arr[i];
			}
			int tempMax = max;
			int left = len - size;
			for (int i = 0; i < left; i++) {
				tempMax -= arr[i];
				tempMax += arr[i + size];
				if (tempMax > max) {
					maxAt = i;
					max = tempMax;
				}
			}
			int temp = 0;
			for (int i = 0; i < size; i++) {
				temp += arr[maxAt + i + 1] + 1;
			}
			System.out.print(new BigDecimal(temp).divide(new BigDecimal(2), 1, 3));
		}
	}
}

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

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

    map<int, int> count;
    for (int i = 0; i < N; i++)
    {
        int a;
        cin >> a;
        count[a]++;
    }

    int best = 0;
    for (const auto kv : count)
    {
        const int x = kv.first;

        int option = 0;
        for (int delta = -1; delta <= 1; delta++)
            if (count.count(x+delta))
                option += count[x+delta];
        best = max(best, option);
    }
    cout << best << endl;
}



Measured memory_bytes: 3200
import sys
input = sys.stdin.readline
read = sys.stdin.read

import heapq

def main():
  n, q = map(int, input().split())
  event = []
  stop = set()
  minque = []
  for _ in range(n):
    s, t, x = map(int, input().split())
    event.append((s-x, 1, x))
    event.append((t-x, -1, x))
  event.sort()
  event.append((float("inf"), 0, 0))
  D = list(map(int, read().split()))
  now = 0
  for t, b, x in event:
    while minque and minque[0] not in stop:
      heapq.heappop(minque)
    m = minque[0] if minque else -1
    while t > D[now]:
      print(m)
      now += 1
      if now == q:
        exit()
    if b == 1:
      stop.add(x)
      heapq.heappush(minque, x)
    else:
      stop.remove(x)
      
if __name__ == "__main__":
  main()

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

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  bool judge = 0;
  rep(i, B){
    if (A * i % B == C) judge = 1;
  }
  if (judge) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
r=raw_input;N,M=r().split();c,A=[0,2,5,5,4,5,6,3,7,6],sorted(r().split());N=int(N);D,a=[0]+[-1]*N*9,[0,0]*N
for i in range(1,N+1):
 for j in A:
  p=i-c[int(j)]
  if min(p,D[p],D[p]+1-D[i])>=0:D[i],a[i]=D[p]+1,j
S=""
while N:S+=a[N];N-=c[int(a[N])]
print S

Measured memory_bytes: 4100
using System;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        char[] chars = s.ToCharArray();

        HashSet<char> set = new HashSet<char>();

        foreach(var c in chars)
        {
            set.Add(c);
        }

        Console.Write(set.Count == 2 ? "Yes" : "No") ;
    }
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

bool prime_check(ll x){
	bool flag = true;
	if(x==1) flag = false;
	ll sqx = sqrt(x)+1;
    for(ll j=2;j<sqx+1;j++){
    	if(x==j) continue;
        if(x%j==0){
            flag = false;
            break;
        }
    }
    return flag;
}

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

    ll X;
    cin >> X;
    while(1){
    	if(prime_check(X)){
    		cout << X << endl;
    		break;
    	}
    	X++;
    }
    return 0;
}

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

int main(){
    ll n, m, t;
    vector<ll> a, b, c;
    cin >> n;
    for(ll i = 0; i < n; i++){
        cin >> t;
        a.push_back(t);
    }
    cin >> m;
    for(ll i = 0; i < m; i++){
        cin >> t;
        b.push_back(t);
    }
    set_difference(a.begin(), a.end(), b.begin(), b.end(), back_inserter(c));
    for(auto i = c.begin(); i != c.end(); i++){
        cout << *i << endl;
    }
    return 0;
}



Measured memory_bytes: 9072
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.4.3)

import math
import statistics
import numpy as np
import queue

s = input()
cnt = 0

for i in range(len(s) // 2):
  if s[i] != s[len(s) - 1 - i]:
    cnt += 1

print(cnt)

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

int main() {
    ll a, b, n;
    cin >> a >> b >> n;
    if (n < b-1) {
        ll x = n;
        cout << a*x/b - a*(x/b) << endl;
    } else {
        ll x = b - 1;
        cout << a*x/b - a*(x/b) << endl;
    }
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
    return x;

}

Node treeMaximum(Node x){
  while(x->right != NIL){
    x = x->left;
  }
    return x;
  
}

Node treeSearch(Node x, int k){
  if(x == NIL || k == x->key)
    return x;
  if(k < x->key)
    return treeSearch(x->left,k);
  else return treeSearch(x->right,k);

}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL)
    return treeMinimum(x->right);
  y = x->parent;
  while(y != NIL && x == y->right){
    x=y;
    y = y->parent;
    return y;
  }

}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }
    else{
      x = x->right;
    }
  }
  z -> parent = y;
  if( y == NIL){
    root = z;
  }
  else{
    if(z->key < y->key){
      y -> left = z;
    }
    else{
      y->right = z;
    }
  }
   
}

 void inorder(Node u){
   if( u == NIL)return;
   inorder(u->left);
   printf(" %d",u->key);
   inorder(u->right);
 }
 void preorder(Node u){
  if( u == NIL )return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
 
}
 
 
 int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
  
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
  
  return 0;
}



Measured memory_bytes: 25144
type tree = Nil | Node of int * tree * tree

let create () = Nil

let insert x t =
  let rec doit = function
    | Nil -> Node (x, Nil, Nil)
    | Node (y, l, r) ->
      if x < y then Node (y, doit l, r)
      else Node (y, l, doit r) in
  doit t

let preorder f t =
  let rec doit = function
    | Nil -> ()
    | Node (x, l, r) -> f x; doit l; doit r in
  doit t

let inorder f t =
  let rec doit = function
    | Nil -> ()
    | Node (x, l, r) -> doit l; f x; doit r in
  doit t

let print t =
  inorder (fun e -> print_string " "; print_int e) t;
  Printf.printf "\n";
  preorder (fun e -> print_string " "; print_int e) t;
  Printf.printf "\n"

let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let () =
  let m = read_int () in
  let t = ref (create ()) in
  for _ = 0 to m - 1 do
    match read_line () |> split_on_char ' ' with
    | ["insert"; n] -> t := insert (int_of_string n) !t
    | _ -> print !t
  done

Measured memory_bytes: 31944
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

#define INF 100000000



int main() {
	int n, m;
	cin >> n >> m;
	bool exist = false;
	vector<int> broken(n+1);
	rep(i, m) {
		int a;
		cin >> a;
		broken[a] = 1;
	}
	vector<int> dp(n+2);
	const int mod = 1000000007;
	dp[n] = 1;
	for (int i = n - 1; i >= 0; --i) {
		if (broken[i]) {
			dp[i] = 0;
			continue;
		}
		dp[i] = (dp[i + 1] + dp[i + 2]) % mod;
	}

	cout << dp[0] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

#define mod 1000000007LL
#define eps 0.0001
#define pi acos(-1)
#define INF 10000000000000000

#define rep(i, n) for(int i = 0;i < n;++i)
#define rep1(i, n) for(int i = 1;i < n;++i)
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define chmin

#define lset(h, n) memset(h, n, sizeof(h));
    

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // ---------------------
    // コーディング開始
    // ---------------------
    string n;
    cin >> n;
    
    int ansi ;
    int ansi1 ;
    int ansi2 ;
    int ansi3 ;
    for(int i=0;i<2;i++){
        ansi=n[0] - '0';
        ansi1 = ansi;
        if(i==0){
            ansi1 += (n[1] - '0');
        }else{
            ansi1 -= (n[1] - '0');
        }
        for(int j=0;j<2;j++){
            ansi2 = ansi1;
            if(j==0){
                ansi2 += (n[2] - '0');
            }else{
                ansi2 -= (n[2] - '0');
            }
            for(int k=0;k<2;k++){
                ansi3 = ansi2;
                if(k==0){
                    ansi3 += (n[3] - '0');
                }else{
                    ansi3 -= (n[3] - '0');
                }
                if(ansi3==7){
                    string ans = "";
                    ans += n[0];
                    if(i==0){
                        ans += ("+");
                    }else{
                        ans += ("-");
                    }
                    ans += n[1];
                    if(j==0){
                        ans += ("+");
                    }else{
                        ans += ("-");
                    }
                    ans += n[2];
                    if(k==0){
                        ans += ("+");
                    }else{
                        ans += ("-");
                    }
                    ans += n[3];
                    ans += "=7";
                    pri(ans);
                    return 0;
                }
            }
        }
    }
    return 0;
}











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

int main(){
    int n,x;
    int cards[4][14];
    char m;
    cin >> n;

    for(int i=0;i<4;i++)
        for(int j=1;j<=13;j++)
        cards[i][j]=0;

    for(int k=0; k<n; k++){
        cin >> m >> x;

        if(m=='S') cards[0][x]= 1;
        if(m=='H') cards[1][x]= 1;
        if(m=='C') cards[2][x]= 1;
        if(m=='D') cards[3][x]= 1;
    }
    
    for(int i=0;i<4;i++){
        for(int j=1;j<=13;j++){
            if(cards[i][j])continue;
            if(i==0) m = 'S';
            if(i==1) m = 'H';
            if(i==2) m = 'C';
            if(i==3) m = 'D';
            cout << m << " " << j << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
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/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll i = 2; i < MAX; i++){fac[i] = fac[i - 1] * i % MOD;inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;finv[i] = finv[i - 1] * inv[i] % MOD;}}
long long COM(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}

int main() {
  int n,x;
  cin>>n>>x;
  vi l(n);
  rep(i,n) cin>>l[i];
  int cnt=0;
  int ans=1;
  rep(i,n){
    cnt+=l[i];
    if(cnt>x){
      cout<<ans<<endl;
      return 0;
    }
    ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3572
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int first = 1; first < 10; first++)
            {
                for (int second = 1; second < 10; second++)
                {
                    Console.WriteLine(first.ToString() + "x" + second.ToString() + "=" + (first * second).ToString());                
                }
            }

        }
    }
}

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

#define f(i,a,b) for(  ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x);
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)

#define PI acos(-1)

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;

const ll MAX = 1e3+12;
const ll inf = 5e18;


int main(){
	fastio;
	ll tc,n,m,k;
//	cin>>tc;
	tc=1;
	string s;
	f(tt,1,tc+1){
		cin>>k;
		ll ans=0;
		f(i,1,k+1) f(j,1,k+1) f(l,1,k+1) ans+= __gcd(i,__gcd(j,l));
		cout<<ans<<endl;
	}

}


Measured memory_bytes: 3648
#include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#include<utility>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define fori(i,k,n) for(int i=k;i<(int)n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
/*
(char)'1' - (int)48 = (int)1;


*/


int main()
{
	int x, y, s;
	cin >> x >> y >> s;
	while (x != 0 || y != 0 || s != 0)
	{
		int ans = 0;
		for (int i = 1; i <= 1000; i++)
		{
			double a, A;
			a = i*(100 + x) / 100;
			for (int l = 1; l <= 1000; l++)
			{
				A = l*(100 + x) / 100;
				int b, B;
				b = a;
				B = A;
				if (b + B == s)
				{
					double c, C;
					c = l*(100 + y) / 100;
					C = i*(100 + y) / 100;
					int d = c, D = C;
					ans = max(ans, d + D);
				}


			}

		}

		cout << ans << endl;
		cin >> x >> y >> s;
	}

}

Measured memory_bytes: 1160