akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

int main(){
  int N;
  ll x;
  cin >> N >> x;
  vector<ll> a(N);
  REP(i, N)cin >> a[i];
  sort(All(a));
  ll ans = 0;
  for (int i = 0; i < N;i++){
    x -= a[i];
    if(x<0){
      cout << ans << endl;
      return 0;
    }
    ans++;
  }
  if(x>0)
    ans--;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
answer_printed = 0
answer=[]
for i in range(8):
    answer.append([])
for i in range(8):
    for j in range(8):
        answer[i].append('.')
row=[]
for i in range(8):
    row.append('.')
col=[]
for i in range(8):
    col.append('.')
right_slope=[]
for i in range(15):
    right_slope.append('.')
left_slope=[]
for i in range(15):
    left_slope.append('.')

def slope_change_r(x,y):
    return (x+y)%15

def slope_change_l(x,y):
    return (x-y+15)%15

def eightqueen(x,y,c):
    global answer_printed
    if c == 8:
        if answer_printed == 0:
            print_answer()
            answer_printed = 1
        return
    if x >= 8:
        return
    if row[x] == 'Q':
        if x<7:
            eightqueen(x+1,0,c)
        else:
            return
    for y in range(8):
        if is_all_clear(x,y):
            mark(x,y)
            eightqueen(x+1,0,c+1)
            unmark(x,y)

def mark(x,y):
    answer[x][y] = 'Q'
    row[x] = 'Q'
    col[y] = 'Q'
    right_slope[slope_change_r(x,y)] = 'Q'
    left_slope[slope_change_l(x,y)] = 'Q'

def unmark(x,y):
    answer[x][y] = '.'
    row[x] = '.'
    col[y] = '.'
    right_slope[slope_change_r(x,y)] = '.'
    left_slope[slope_change_l(x,y)] = '.'

def is_all_clear(x,y):
    if answer[x][y] == 'Q':
        return False
    if row[x] == 'Q':
        return False
    if col[y] == 'Q':
        return False
    if right_slope[slope_change_r(x,y)] == 'Q':
        return False
    if left_slope[slope_change_l(x,y)] == 'Q':
        return False
    return True

def print_answer():
    for i in range(8):
        for j in range(8):
            if answer[i][j] == 'Q':
                print('Q',end='')
            else:
                print('.',end='')
        print('',end='\n')
    
k = int(input())
while True:
    try:
        r,c = map(int,input().split())
    except:
            break
    else:
        mark(r,c)

eightqueen(0,0,k)




Measured memory_bytes: 5620
import itertools
import math

N,M = map(int,input().strip().split(" "))

al = [i for i in range(N)]
bl = [i for i in range(M)]

mod = (pow(10,9) + 7)
result = 0
if abs(N - M) > 1:
    result = 0
else:
    a_perm = math.factorial(N)
    b_perm = math.factorial(M)
    if abs(N - M) == 1:
        result = (a_perm * b_perm) % mod
    elif abs(N - M) == 0:
        result = ((a_perm * b_perm) * 2) % mod

print(result)



Measured memory_bytes: 13036
#include <iostream>
#include <algorithm>
#include <queue>
#include <cassert>
#include <set>
using namespace std; typedef long long ll; const int MINF=-1e9; typedef pair<int,int> P;

int main() {
  int h,w; cin>>h>>w;
  string s[h]; for(int i=0;i<h;i++) cin>>s[i];
  vector<vector<string>> t(2, vector<string>(h));
  for(int i=0;i<h;i++) t[0][i].resize(w);
  for(int i=0;i<h;i++) t[1][i].resize(w);

  for(int j=0;j<w;j++) {
    t[0][0][j]='#'; t[1][0][j]='.'; 
    t[0][h-1][j]='.'; t[1][h-1][j]='#'; 
  }
  for(int i=1;i<h-1;i++) {
    for(int j=0;j<w;j++) {
      t[j%2][i][j]='#'; t[(j+1)%2][i][j]='.';
    }
  }
  for(int i=0;i<h;i++) {
    for(int j=0;j<w;j++) {
      if (s[i][j]=='#')t[0][i][j]=t[1][i][j]=s[i][j];
    }
  }

  for(int o=0;o<2;o++){
    for(int i=0;i<h;i++) {
      cout<<t[o][i]<<endl;
    }
    cout<<endl;
  }
}

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

int main(){
  int n;
  cin >> n;
  map<string, int> dic;
  for(int i=0;i<n;i++){
    string s;
    cin >> s;
    dic[s] += 1;
  }
  int m = 0;
  for(pair<string, int> p:dic){
    m = max(m, p.second);
  }
  vector<string> ans;
  for(pair<string, int> p:dic){
    if(p.second == m){
      ans.push_back(p.first);
    }
  }
  sort(ans.begin(), ans.end());
  for(auto a:ans){
    cout << a << endl;
  }
}

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

int main() {
	int X, A, B;
	cin >> X >> A >> B;
	if (A >= B) {
		cout << "delicious" << endl;
	}
	else if (A + X - B >= 0) {
		cout << "safe" << endl;
	}
	else {
		cout << "dangerous" << endl;
	}
	return 0;
}

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

using namespace std;

int main() {
	string s, t;
	cin >> s;
	cin >> t;
	if (t.size() == s.size() + 1) {
		for (int i = 0; i < s.size(); i++) {
			if (s[i] != t[i])
			{
				cout << "No" << endl;
				return 0;
			}	
		}
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3572
/*

"""
2 1 1
3 4 2
4 16 8/3
5 84 7/2
6 516 43/10
7 3696 77/15
8 30096 209/35
9 275040 191/28
10 2786400 215/28
11 31000320 299/35

if n odd, try multiplying the fraction by (n-1)(n+3)
"""

import sys
sys.stdin=open("data.txt")
input=sys.stdin.readline

"""
import itertools,fractions
for n in range(8,9):
    tot=0
    cnt=0
    arrt=[0]*n
    for p in itertools.permutations(range(n-1)):
        cnt+=1
        arr=[1]*n
        tmp=0
        rem=n
        for i in p:
            tmp+=1
            if arr[i]:
                arr[i]=0
                rem-=1
            if arr[i+1]:
                arr[i+1]=0
                rem-=1
            if rem==0: break
        tot+=tmp
        arrt[tmp]+=1
        if tmp==3: print(p)
    print(arrt)
    print(n,tot,fractions.Fraction(tot*(n-1)*(n+3))/fractions.Fraction(cnt),tot/cnt)
"""

# O(N log MOD)?
# dp[i] = number of ways to get n-2 letters using i-1 words (a word is A or BB)


n=int(input())
fac=[1]*(n+1)

def choose(i,j):
    # i choose j
    if j<0 or j>i: return 0
    return fac[i]//fac[j]//fac[i-j]

for i in range(2,n+1):
    fac[i]=fac[i-1]*i

dp=[0]*(n+1)
ans=0
carry=0
for i in range(1,n+1):
    dp[i]=choose((i-1),(n-2)-(i-1))*fac[i]*fac[n-1-i]
    if not dp[i]: continue
    ans+=(dp[i]-dp[i-1])*i
print(ans%(10**9+7))
#print(dp)

*/

#include <stdio.h>

const int MOD=1000000007;
typedef long long ll;

int n;
ll fac[1000005];
ll invfac[1000005];

ll powmod(ll a,int b)
{
    if (b==1) return a;
    if (b&1) return (a*powmod((a*a)%MOD,b/2))%MOD;
    return powmod((a*a)%MOD,b/2);
}

ll inv(int i)
{
    return powmod(i,MOD-2);
}

ll choose(int i,int j)
{
    if (j<0 || j>i) return 0;
    return (((fac[i]*invfac[j])%MOD)*invfac[i-j])%MOD;
}

ll dp[1000005];
ll ans=0;

int main()
{
    #ifdef NOT_DMOJ
    freopen("data.txt","r",stdin);
    #endif // NOT_DMOJ
    scanf("%d",&n);
    fac[0]=1;
    invfac[0]=1;
    fac[1]=1;
    invfac[1]=1;
    for (int i=2; i<=n; i++) {
        fac[i]=(fac[i-1]*i)%MOD;
        invfac[i]=(invfac[i-1]*inv(i))%MOD;
    }
    for (int i=1; i<=n; i++) {
        dp[i]=(((choose(i-1,n-2-(i-1))*fac[i])%MOD)*fac[n-1-i])%MOD;
        if (!dp[i]) continue;
        ans+=(dp[i]-dp[i-1])*i;
        ans%=MOD;
    }
    printf("%lld\n",(ans+MOD)%MOD);     // negative ans is possible
}


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

using namespace std;
const int N = 600000;

int n;
string s;
map<string, int> mm;
vector<pair<int, string> > c;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && a != c)
    {
        cout << "Yes";
    }
    else
    if (a == c && a != b)
    {
        cout << "Yes";
    }
    else
    if (b == c && a != b)
    {
        cout << "Yes";
    }
    else
        cout << "No";
}


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

using namespace std;

int main() {
	vector<long long int> a(4);
	long long int ans1=0,ans2=0;
	long long int seki1, seki2,seki3,seki4;

	for(int i=0;i<4;i++){
		cin >> a.at(i);
	}



		seki1 = a.at(0)* a.at(2);
		seki2 = a.at(0) * a.at(3);
		ans1 = max(seki1,seki2);
		
		seki3 = a.at(1) * a.at(2);
		seki4 = a.at(1) * a.at(3);
		ans2 = max(seki3, seki4);


	cout << max(ans1,ans2) << endl;

}

Measured memory_bytes: 3616
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

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

  vector<int> a(N), b(N);
  for (auto &elm : a) {
    cin >> elm;
  }
  for (auto &elm : b) {
    cin >> elm;
  }

  queue<int> q;
  rep(i, N) {
    if (a[i] < b[i] and b[i] > b[(i - 1 + N) % N] + b[(i + 1) % N]) {
      q.push(i);
    }
  }

  int64_t result = 0;
  while (not q.empty()) {
    int i = q.front();
    q.pop();

    int d = b[(i - 1 + N) % N] + b[(i + 1) % N];
    int k = (b[i] - a[i]) / d;
    result += k;
    b[i] -= k * d;
    if (b[(i - 1 + N) % N] > b[(i - 2 + N) % N] + b[i]) {
      q.push((i - 1 + N) % N);
    }
    if (b[(i + 1) % N] > b[(i + 2) % N] + b[i]) {
      q.push((i + 1) % N);
    }
  }

  rep(i, N) {
    if (a[i] != b[i]) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << result << endl;

  return 0;
}

Measured memory_bytes: 5252
from sys import stdin, stdout

int_in = lambda: int(stdin.readline())
arr_in = lambda: [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for y in range(rows)]
str_in = lambda: stdin.readline().strip()
out = lambda o: stdout.write("{}\n".format(o))
arr_out = lambda o: out(" ".join(map(str, o)))
bool_out = lambda o: out("YES" if o else "NO")
tests = lambda: range(1, int_in() + 1)
case_out = lambda i, o: out("Case #{}: {}".format(i, o))


def solve(a):
    max_val = pow(10, 18)
    result = 1
    if 0 in a:
        return 0
    for item in a:
        result *= item
        if result > max_val:
            return -1
    return result


if __name__ == "__main__":
    n = int_in()
    a = arr_in()
    out(solve(a))

Measured memory_bytes: 82624
#include <iostream>
#include <map>
#include <set>
#include <utility>
#include <numeric> 
#include <bits/stdc++.h>
typedef long long ll;
typedef std::pair<std::pair<int,int>,int>pi;
using namespace std;

int main() {
    int n, m; cin >> n >> m;
    vector<int>v(n);
    int t = 0;
    for(int i = 0; i < n; i++){
        cin >> v[i];
        t += v[i];
    }
    sort(v.begin(), v.end());
    int pop = 0;
    for(int i = v.size()-1; i >=0; i--){
        float x = (float)t/(4*(float)m);
        if(v[i] < x) continue;
        else pop++;
    }
    if(pop >= m) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int n;
	int[] x, y, r, c;
	byte[] memo;

	void run() {
		for (;;) {
			n = sc.nextInt();
			if (n == 0) return;
			x = new int[n];
			y = new int[n];
			r = new int[n];
			c = new int[n];
			memo = new byte[1 << n];
			for (int i = 0; i < 1 << n; i++) memo[i] = -1;
			for (int i = 0; i < n; i++) {
				x[i] = sc.nextInt();
				y[i] = sc.nextInt();
				r[i] = sc.nextInt();
				c[i] = sc.nextInt();
			}
			int max = 0;
			// ????????????????????????????????????????±???????
			for (int i = 0; i < n; i++) {
				L: for (int j = i + 1; j < n; j++) {
					if (c[i] != c[j]) continue;
					for (int k = j - 1; k >= 0; k--) {
						int pDis_j = (x[k] - x[j]) * (x[k] - x[j]) + (y[k] - y[j]) * (y[k] - y[j]);
						int rDis_j = (r[k] + r[j]) * (r[k] + r[j]);
						int pDis_i = (x[k] - x[i]) * (x[k] - x[i]) + (y[k] - y[i]) * (y[k] - y[i]);
						int rDis_i = (r[k] + r[i]) * (r[k] + r[i]);
						// k?????????????????£??????????????§????????????
						if (pDis_j < rDis_j) continue L;
						if (k < i && pDis_i < rDis_i) continue L;
					}
					max = Math.max(max, 2 + bitDP(1 << i | 1 << j));
				}
			}
			System.out.println(max);
		}
	}

	int bitDP(int mask) {
		if (memo[mask] != -1) return memo[mask];

		byte res = 0;
		for (int i = 0; i < n; i++) {
			L: for (int j = i + 1; j < n; j++) {
				if (c[i] != c[j]) continue;
				// ??¢???i or j????????£?????????
				if ((mask & (1 << i)) != 0 || (mask & (1 << j)) != 0) continue;
				for (int k = j - 1; k >= 0; k--) {
					// ??¢???k???????????????????????????
					if ((mask & 1 << k) != 0) continue;
					int pDis_j = (x[k] - x[j]) * (x[k] - x[j]) + (y[k] - y[j]) * (y[k] - y[j]);
					int rDis_j = (r[k] + r[j]) * (r[k] + r[j]);
					int pDis_i = (x[k] - x[i]) * (x[k] - x[i]) + (y[k] - y[i]) * (y[k] - y[i]);
					int rDis_i = (r[k] + r[i]) * (r[k] + r[i]);

					// k?????????????????£??????????????§????????????
					if (pDis_j < rDis_j) continue L;
					if (k < i && pDis_i < rDis_i) continue L;
				}
				res = (byte) Math.max(res, 2 + bitDP(mask | (1 << i | 1 << j)));
			}
		}
		return memo[mask] = res;
	}

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

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

int main(){
	ll n,W;
	cin>>n>>W;
	ll w[n+1],v[n+1];
	ll m = 0;
	for(ll i=1;i<=n;i++){
		cin>>w[i]>>v[i];
		m += v[i];
	}
	ll dp[n+1][m+1];
	for(int i=0;i<=n;i++){
		for(int j=0;j<=m;j++){
			dp[i][j] = 1e14;
		}
	}
	dp[0][0] = 0;
	ll ans = 0;
	for(ll i=1;i<=n;i++){
		for(ll j=0;j<=m;j++){
			if(j == 0){
				dp[i][j] =0;
			}
			else if(v[i]<=j){
				dp[i][j] = min((dp[i-1][j-v[i]]+w[i]),dp[i-1][j]);
				
			}
			else{
				dp[i][j] = dp[i-1][j];
			}
		}
	}
	// for(ll i=0;i<=n;i++){
		for(ll j=0;j<=m;j++){
			// cout<<dp[n][j]<<endl;
			if(dp[n][j]<=W){
				ans = max(ans,j);
			}
		}
	// }
	cout<<ans<<endl;
}

Measured memory_bytes: 79104
import std.stdio;
import std.algorithm;
import std.conv;
import std.string;
import std.array;
import std.math;
 
int factnum(int n){
  int i = 0;
  while(n%2 == 0){
    n /= 2;
    i++;
  }
 
  return i;
}
 
void main(string[] args) {
  readln();
  auto input = readln().chomp.split.map!(to!int);
 
  input.map!factnum.sum.writeln();
}

Measured memory_bytes: 2556
/**
* Problem Link: 
*/              
#include <bits/stdc++.h>

using namespace std;

void test_case(int case_no) {
    double r;
    cin >> r;
    cout << std::setprecision(20);
    cout << 2 * acos(-1) * r << "\n";    
}

int main() {
    // freopen("in", "r", stdin), freopen("out", "w", stdout);
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t = 1;
    for(int i = 1; i <= t; ++i) {
        test_case(i);
    }
    return 0;
}

Measured memory_bytes: 3796
def resolve():
    (N, Q) = list(map(int, input().split(" ")))
    S = input()
    LRs = [list(map(int, input().split(" "))) for i in range(Q)]
    mem = [0] * N
    for i in range(N-1):
        if S[i] == "A" and S[i+1] == "C":
            mem[i+1] = mem[i] + 1
        else:
            mem[i+1] = mem[i]

    for (l, r) in LRs:
        print(mem[r-1]-mem[l-1])

if '__main__' == __name__:
    resolve()

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

// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define FI first
#define SE second
using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}


int main(int argc, char const* argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  map<char, char> mp;
  mp['A'] = 'T';
  mp['T'] = 'A';
  mp['C'] = 'G';
  mp['G'] = 'C';
  char c;
  cin >> c;
  cout << mp[c] << endl;
	return 0;
}


Measured memory_bytes: 256
/*
	 
	                              Jai Shree Krishna !!
	                                 Radhe Radhe !!
	                                 
	             उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।।
	             
	*/
	   
	   
	#include <bits/stdc++.h>
	using namespace std;
	 
	#define int long long
	typedef long long ll;
	#define loop(i,n)  for(int i=0;i<n;i++)
	#define read(a) int a; cin >>a;
	#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
	#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin >> a[i][j];
	#define pb push_back
	#define ff first
	#define ss second
	#define vi vector<int>
	#define pi pair<int,int>
	#define vvi vector<vector<int>>
	#define sti set<int>
	#define vpi vector<pair<int,int>>
	#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
	#define printmat(a,n,m) for(int i=0;i<n;i++) {for(int j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
	#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
	#define endl "\n"
	#define mp make_pair
	#define ins insert
	#define rep(i,s,e)   for(int i=s;i<=e;i++)
	#define repd(i,s,e)  for(int i=e;i>=s;i--)
	#define vb vector<bool>
	#define read2(n,m) int n,m; cin >> n >> m;
	#define range(v) v.begin(),v.end()
	#define sortd(v) sort(v.begin(),v.end(),greater<int>())
	#define sorti(v) sort(v.begin(),v.end())
	 
	const ll inf = 1e18;
	const ll mod = 1e9 + 7;


    void subsetsUtil(vector<int>& A, vector<vector<int> >& res, 
                 vector<int>& subset, int index) 
{ 
    res.push_back(subset); 
    for (int i = index; i < A.size(); i++) { 
  
        // include the A[i] in subset. 
        subset.push_back(A[i]); 
  
        // move onto the next element. 
        subsetsUtil(A, res, subset, i + 1); 
  
        // exclude the A[i] from subset and triggers 
        // backtracking. 
        subset.pop_back(); 
    } 
  
    return; 
} 
  
// below function returns the subsets of vector A. 
vector<vector<int> > subsets(vector<int>& A) 
{ 
    vector<int> subset; 
    vector<vector<int> > res; 
  
    // keeps track of current element in vector A; 
    int index = 0; 
    subsetsUtil(A, res, subset, index); 
  
    return res; 
} 

	signed main()
	{
	 
	    fast;
	    read(n);
	    vi a(n);
	    rep(i,0,n-1) cin >> a[i];
	    sortd(a);
	    vi v(n);
	    v[0]=0;
	    v[1]=a[0];
	    int ans = 0;
	    vi x;
	    for(int i=1;i<n;i++){
	    x.pb(a[i]);
	    x.pb(a[i]);
	    }
	    int j=0;
	    rep(i,2,n-1){
	    	v[i]=x[j];
	    	j++;
	    }
	    rep(i,0,n-1) ans+=v[i];
	    cout<<ans<<endl;
	    return 0;
	}
	 
	/* Pooja Yadav */

Measured memory_bytes: 10540
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC080A
{
    class Program
    {
        static void Main(string[] args)
        {
        int n, a, b, p1, p2, x;

        var word = Console.ReadLine().Split(' ');

            n = int.Parse(word[0]);
            a = int.Parse(word[1]);
            b = int.Parse(word[2]);

            if (a * n < b)
                x = a * n;
            else
                x = b;

            Console.WriteLine(x);
            Console.ReadKey();
      
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

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

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

int n, m;

const int MAXN = 100005;

int x[MAXN], y[MAXN];

void add(LL&x, LL y) {
    x += y;
    if (x >= MOD) x -= MOD;
}

LL sub(LL x, LL y) {
    x -= y;
    if (x < 0) x += MOD;
    return x;
}

LL mul(LL x, LL y) {
    return (x * y) % MOD;
}

int main() {
    GI(n);
    GI(m);

    LL sumxdiff = 0;
    LL sumx = 0;

    FOR1(i, n) {
        GI(x[i]);

        x[i] = ((x[i] % MOD) + MOD) % MOD;

        if (i > 1) {
            add(sumxdiff, sub(mul(i-1, x[i]), sumx));
        }

        add(sumx, x[i]);
    }

    LL sumydiff = 0;
    LL sumy = 0;

    FOR1(i, m) {
        GI(y[i]);

        y[i] = ((y[i] % MOD) + MOD) % MOD;

        if (i > 1) {
            add(sumydiff, sub(mul(i-1, y[i]), sumy));
        }

        add(sumy, y[i]);
    }

    cout << mul(sumxdiff, sumydiff) << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>


using namespace std;

typedef long long ll;

int main() {
	int n;
	cin >> n;
	ll score_t, score_a;
	cin >> score_t >> score_a;

	for (int i = 0; i < n - 1; i++) {
		int t, a;
		cin >> t >> a;
		if (score_t %t != 0) {
			score_t += t - (score_t%t);
		}
		if (score_a %a != 0) {
			score_a += a - (score_a %a);
		}

		if (score_a / a < score_t / t) {
			score_a = score_t / t * a;
		}
		else {
			score_t = score_a / a * t;
		}
	}
	
	cout << score_a + score_t << endl;
}


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

using ll = long long;

int main() {
	int N;
	ll K;
	cin >> N >> K;
	vector<int> A(N, 0);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		--A[i];
	}
	int p = A[0];
	int q = A[A[0]];
	int R = 1;
	while (p != q) {
		p = A[p];
		q = A[A[q]];
		++R;
	}
	int L = 0;
	int s = p;
	int r = -1;
	p = 0;
	while (p != q) {
		p = A[p];
		q = A[q];
		++L;
		if (r == -1 && q == s) r = L;
	}
	if (r != -1) R = r;
	ll a = (K - L) % R;
	if (K >= L) { 
		int ans = p;
		for (int i = 0; i < a; ++i) {
			ans = A[ans];
		}
		cout << ans + 1 << endl;
	} else {
		int ans = 0;
		for (int i = 0; i < K; ++i) {
			ans = A[ans];
		}
		cout << ans + 1 << endl;
	}
}

Measured memory_bytes: 3944
#define Z(V) for(v=360,m=g();--m;V+=sin(x*z))v-=x=g();V+=sin(v*z)
a;g(){scanf("%d",&a);a?a:exit(0);}main(m,v,x){for(;;){double s=0,t=0,z=.017453,e=.000001;Z(s);Z(t);puts(s>t+e?"1":s+e<t?"2":"0");}}

Measured memory_bytes: 0
#include <algorithm>
#include <string.h>
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9 + 7;
const int N = 3e5 + 10;
ll x[N], p[64], sum1[N], sum0[N];
int main()
{
    p[0] = 1;
    for (int i = 1; i < 63; i++)
        p[i] = ((p[i - 1]) * 2ll) % mod;
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> x[i];
    ll ans = 0;
    for (int i = 0; i < 63; i++)
    {
        memset(sum1, 0, sizeof(sum1));
        memset(sum0, 0, sizeof(sum0));
        for (int j = n; j >= 1; j--)
        {
            sum1[j] = sum1[j + 1];
            sum0[j] = sum0[j + 1];
            if ((x[j] >> i) & 1)
                sum1[j]++;
            else
                sum0[j]++;
            if ((x[j] >> i) & 1)
            {
                ll temp = (sum0[j + 1] % mod * p[i] % mod) % mod;
                ans = (ans % mod + temp % mod) % mod;
            }
            else
            {
                ll temp = (sum1[j + 1] % mod * p[i] % mod) % mod;
                ans = (ans % mod + temp % mod) % mod;
            }
        }
    }
    cout << ans % mod << endl;
    return 0;
}


Measured memory_bytes: 7296
#include <stdio.h>
int main()
{
    int n;
    int x[100];
    int ans = 100 * 100 * 100;

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

    for(int i = 0; i < 100; i++){
        int a = 0;
        for(int j = 0; j < n; j++){
            a += (x[j] - i) * (x[j] - i);
        }
        if(ans > a)ans = a;
    }

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

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    int h , w ;
    cin >> h >> w ;

    char a[h][w] ;
    for(int i = 0 ; i < h ; i++){
        for(int j = 0 ; j < w ; j++){
            cin >> a[i][j] ;
        }
    }

    for(int i = 0 ; i < h ; i++){
        for(int j = 0 ; j < w ;j++){
            cout << a[i][j] ;
        }
        cout << endl;
        for(int j = 0 ; j < w ; j++){
            cout << a[i][j] ;
        }
        cout << endl;
    }
    return 0;
}

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

#define rep(i, n)    for(int i = 0; i < n;i++)
#define repwi(i, ini, n) for(int i = ini; i < n;i++)

int main()
{
    string S;
    cin >> S;
    int max = -1;
    int sum = 0;
    rep(i, S.length())
    {
        if(S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T'){
            sum++;
        }
        else{
            if(max < sum){
                max = sum;
            }
            sum = 0;
        }
    }
    if(max < sum){
        max = sum;
    }

    cout << max << endl;
}

Measured memory_bytes: 256
N = int(input())
W = list(map(int, input().split()))
ans = 0

for i in range(N):
    if i == 0:
        ans = abs(sum(W[:i+1])-sum(W[i+1:]))
    else:
        if ans >abs(sum(W[:i+1])-sum(W[i+1:])):
            ans = abs(sum(W[:i+1])-sum(W[i+1:]))
    
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<algorithm>
#include<queue>
using namespace std;
int p[20];
int q[20];
int bfs[1<<15];
int c[20];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	int cnt=0;
	for(int i=0;i<a;i++){
		scanf("%d",p+i);
		if(p[i])cnt++;
	}
	for(int i=0;i<b;i++)scanf("%d",q+i);
	int L=0;
	int R=0;
	for(int i=0;i<b;i+=2)R+=q[i];
	for(int i=1;i<b;i+=2)L+=q[i];
	int ret=999999999;
	queue<int>Q;
	for(int i=0;i<(1<<a);i++)bfs[i]=-1;
	int st=0;
	for(int i=0;i<a;i++){
		st+=(1<<i)*p[i];
	}
	bfs[st]=0;Q.push(st);
	while(Q.size()){
		int at=Q.front();
		Q.pop();
		for(int i=0;i<a-1;i++){
			int to=at;
			if(at&(1<<i)){to-=(1<<i);to+=(1<<(i+1));}
			if(at&(1<<(i+1))){to-=(1<<(i+1));to+=(1<<i);}
			if(!~bfs[to]){
				bfs[to]=bfs[at]+1;
				Q.push(to);
			}
		}
	}
	if(L==cnt){
		int sz=0;
		for(int i=0;i<b;i++){
			for(int j=0;j<q[i];j++)c[sz++]=i%2;
		}
		int at=0;
		for(int i=0;i<a;i++)if(c[i])at+=(1<<i);
		ret=min(ret,bfs[at]);
		//printf("%d: %d\n",at,bfs[at]);
	}
	if(R==cnt){
		int sz=0;
		for(int i=0;i<b;i++){
			for(int j=0;j<q[i];j++)c[sz++]=!(i%2);
		}
		int at=0;
		for(int i=0;i<a;i++)if(c[i])at+=(1<<i);
		ret=min(ret,bfs[at]);
	//	printf("%d: %d\n",at,bfs[at]);
	}
	printf("%d\n",ret);
}

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

#define int long long
#define pb emplace_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(0);

string a,b,c;
char ans ;
int fun(char aa , string &s)
{
	if(s.size() == 0)
	{
		ans = aa;
		return 0;
	}
	else
	{
		char u = s[0];
		s.erase(s.begin());
		if(u == 'a')   return  fun('A',a);
		if(u == 'b')   return fun('B',b);
		if(u == 'c')   return fun('C',c);
	}
	return 0;
}
int32_t main(){
	fast;
	cin >> a >> b >> c;
	fun('A' , a);
	cout << ans;
}







Measured memory_bytes: 256
import sys
input = sys.stdin.readline
def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    pos = 0
    for i in range(1,N+1):
        pos = pos + L[i-1]
        if pos > X:
            print(i)
            break
    else:
        print(N+1)

if __name__ == '__main__':
    main()

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

int main() {
  int N, K;
  cin >> N >> K;
  int sum = 1;
  int i = 0;
  for (; i < N;) {
    if (sum+K <= sum*2) 
      sum+=K;
    else 
      sum*=2;
    i++;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
function Main(input) {
  const words = input.split(' ');
  console.log(`
  ${words[0].slice(0, 1).toUpperCase()
  + words[1].slice(0, 1).toUpperCase()
  + words[2].slice(0, 1).toUpperCase()}`)
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 22844
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <unordered_map>
#include <map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

long n, a, b;
VI hs;

bool ok(long k) {
    VI s;
    for (auto h: hs) {
        if (h > b * k) {
            s.push_back(h - b * k);
        }
    }
    long cnt = 0;
    for (auto t: s) {
        cnt += long(ceil(double(t) / (a - b)));
    }
    return cnt <= k;
}

int main() {
    cin >> n >> a >> b;
    REP(i,n) {
        long h;
        cin >> h;
        hs.push_back(h);
    }
    sort(hs.begin(), hs.end());
    long k = long(ceil(double(hs.back()) / b));
    long l = 1;
    
    long hoge = 0;
    
    while (k != l) {
        hoge++;
        if (hoge > 36) {
            cout << k << endl;
            return 0;
        }
        if (ok((k + l) / 2)) {
            k = (k + l) / 2;
        } else {
            l = (k + l) / 2;
        }
    }
    cout << k << endl;
}


Measured memory_bytes: 2896
#include<stdio.h>

int main()
{
	int a,b,c,d,e,f,g;

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


Measured memory_bytes: 2052
/*<----------------------------------------------------------------------->

<-------------------------------------------------------------------------->
            _           __                _      _____ _____ _____ 
  ___ _   _| |__   ___ / _|_ __ ___  __ _| | __ |___  |___  |___  |
 / __| | | | '_ \ / _ \ |_| '__/ _ \/ _` | |/ /    / /   / /   / / 
| (__| |_| | |_) |  __/  _| | |  __/ (_| |   <    / /   / /   / /  
 \___|\__,_|_.__/ \___|_| |_|  \___|\__,_|_|\_\  /_/   /_/   /_/   

*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vi;
typedef vector<pll> vpll;
typedef unordered_map <ll,ll> umap ; 
//#pragma GCC optimize "trapv"
#define loop(i,a,b) for(ll i=a ;i<b;i++)
#define For(i,n) for(int i=0;i<(ll)n;i++)
#define Rev(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,n) for(int i=1;i<=n;++i)
#define F first
#define S second
#define pb push_back
#define em emplace_back
#define all(v) (v).begin(),(v).end()
#define mems(x, y) memset(x, y, sizeof(x))
#define sz(v) (v).size()
#define mp(a,b) make_pair(a,b)
#define pf(n) cout<<n<<"\n"
#define pff(n) cout << n << " " ; 
#define ar array
#define endl "\n" 
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
long const M=1e9+7;
const long mxN =1e5+2 ;
const long mxNN =1e6+2 ;
void solve(){
    int r ; cin >> r ;
    cout << 2.0*(3.141592653589793238*r) ;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << setprecision(9) << fixed ;
    solve() ;
    //ll t ; cin >> t ; while(t--)solve();
	return 0;
}


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

using namespace std;

typedef long long ll;

int n, m, q;
vector<int> a, b, c, d, e;
int ans;

void dfs(vector<int> A)
{
    if (A.size() == n + 1) {
        int now = 0;
        for (int i = 0; i < q; i++) {
            if (A[b[i]] - A[a[i]] == c[i]) {
                now += d[i];
            }
        }
        ans = max(ans, now);
        return;
    }

    A.push_back(A.back());
    while (A.back() <= m) {
        dfs(A);
        A.back()++;
    }
}

int main(int argc, char *argv[])
{
    cin >> n >> m >> q;
    a = b = c = d = e = vector<int>(q);
    for (int i = 0; i < q; i++) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs(vector<int>(1, 1));
    cout << ans << endl;
    return 0;
}


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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.length();
    char c = s[n / 2];
    int ans = (n + 1) / 2;
    for (int i = n / 2 - 1; i >= 0; i--) {
        if (s[i] != c || s[n - 1 - i] != c) {
            break;
        }
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;



int main(){FIN

    ll n,m; cin>>n>>m;
    vector<P> ans(m);
    vector<vector<P>> v(n); 
    REP(i,m){
        ll a,b;cin>>a>>b;
        v[a-1].push_back(make_pair(b,i));
    }
    REP(i,n) VSORT(v[i]);
    REP(i,n){
        REP(j, v[i].size()){

            ans[v[i][j].second] = make_pair(i+1,j+1) ;
        }
    }
    REP(i,m){
        cout<<setfill('0') << setw(6) << ans[i].first<<setfill('0') << setw(6)<<ans[i].second<<endl;
    }

    return 0;
}

Measured memory_bytes: 8576
a0,a1,a2=map(int,input().split())
a3,a4,a5=map(int,input().split())
a6,a7,a8=map(int,input().split())
N=int(input())
b=[int(input()) for i in range(N)]

s=range(9)
lists=[]
lists.append(a0)
lists.append(a1)
lists.append(a2)
lists.append(a3)
lists.append(a4)
lists.append(a5)
lists.append(a6)
lists.append(a7)
lists.append(a8)

listb=[]
for j in range(N):
  listb.append(b[j])
t=0
for il in range(9):
  for ib in range(N):
    if b[ib]==lists[il]:
      lists[il]=0
            
if lists[0]==lists[1] and lists[2]==lists[1] and lists[0]==0:
  print ('Yes')
elif lists[3]==lists[4] and lists[5]==lists[4] and lists[3]==0:
  print ('Yes')
elif lists[6]==lists[7] and lists[8]==lists[7] and lists[6]==0:
  print ('Yes')
elif lists[0]==lists[3] and lists[3]==lists[6] and lists[0]==0:
  print ('Yes')
elif lists[1]==lists[4] and lists[4]==lists[7] and lists[1]==0:
  print ('Yes')
elif lists[2]==lists[5] and lists[5]==lists[8] and lists[2]==0:
  print ('Yes')
elif lists[0]==lists[4] and lists[4]==lists[8] and lists[0]==0:
  print ('Yes')
elif lists[2]==lists[4] and lists[4]==lists[6] and lists[2]==0:
  print ('Yes')
else:
  print ('No')

Measured memory_bytes: 3192
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n, m = MAP()

print(n + (m - 2 * n) // 4 if m >= 2 * n else m // 2)


Measured memory_bytes: 5148
import math
while True:
    a=[]
    n=int(input())
    if n==0:
        break
    c=0
    a=list(map(int,input().split()))
    ave=sum(a)/len(a)
    for i in range(n):
        c=c+(a[i]-ave)**2
    print('{:.10f}'.format(math.sqrt(c/n)))
        


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

vector<string> week = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

int main() {
    string s;
    cin >> s;
    int ans;
    if (s == "SUN")
        ans = 7;
    else if (s == "MON")
        ans = 6;
    else if (s == "TUE")
        ans = 5;
    else if (s == "WED")
        ans = 4;
    else if (s == "THU")
        ans = 3;
    else if (s == "FRI")
        ans = 2;
    else if (s == "SAT")
        ans = 1;
    cout << ans << endl;
    return 0;
}

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

int main(){
	int n;
	cin>>n;
	
	int tm=0;
	int bm=1000000001;
	
	for(int i=0;i<n;i++){
		int a,b;
		cin>>a>>b;
		bm=min(bm,b);
		tm=max(tm,a);
	}
	
	cout<<tm+bm<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int x, a, b;
  cin >> a >> b >> x;
  string ans = "NO";
  if (x >= a && x <= a + b) ans = "YES";
  cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
typedef pair<ll,ll> l_l;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back


ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

int main(){
    ll n;cin>>n;
    ll a[n];
    rep(i,0,n-1){
        cin>>a[i];
        
    }
    deque<ll> d;
    rep(i,0,n-1){
        if(i%2==n%2){
            d.push_back(a[i]);
        }else{
            d.push_front(a[i]);
        }
    }
    
    rep(i,0,n-1){
        cout<<d[i]<<' ';
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

int main() {
  ll n,k,q; cin >> n >> k >> q;
  vector<ll> v(n,0LL);
  for(ll i=0; i<q;++i){
    ll t; cin >> t;
    v[t-1] += 1;
  }
  for(ll j=0;j<n;++j){
    if(k - q + v[j]>0){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>

#include <set>
//#include <unordered_map>
#include <stack>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define INF 21474836

int N, K, S;


int main() {

	cin >> N >> K >> S;

	vector<int> A;

	rep(i, N) {
		if (S != 1000000000) {
			if (K > i)A.push_back(S);
			else A.push_back(1000000000);
		}
		else {
			if (K > i)A.push_back(S);
			else A.push_back(1);
		}
	}

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

	return 0;
}


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

#define MOD 1000000007LL

long long dp[33][4444444];

int main(){
	int N;
	cin >> N;
	int a[N][N];
	for(int i=0;i<N;i++)for(int j=0;j<N;j++)cin >> a[i][j];
	
	dp[0][0]=1;
	
	unordered_set<int> s;
	s.insert(0);
	
	for(int i=0;i<N;i++){
		unordered_set<int> s_next;
		for(auto j:s){
			dp[i][j]%=MOD;
			for(int w=0;w<N;w++){
				if(a[i][w]==0)continue;
				int k=(1<<w);
				if((j|k)==j)continue;
				dp[i+1][j|k]+=dp[i][j];
				s_next.insert(j|k);
			}
		}
		s=s_next;
	}
	cout << dp[N][(1<<N)-1]%MOD << endl;
	return 0;
}

Measured memory_bytes: 343668
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }



int main() {
	int N;
	char S[102];
	int ans = 0;
	scanf("%d", &N);
	scanf("%s", S);

	for (int i = 0; i < N; i++) {
		int cnt = 0;
		for (int c = 0; c <= 25; c++) {
			int l = 0, r = 0;
			for (int j = 0; j < i; j++) {
				if (S[j] == 97 + c) {
					l = 1;
				}
			}
			for (int j = i; j < N; j++) {
				if (S[j] == 97 + c) {
					r = 1;
				}
			}
			if (l == 1 && r == 1) {
				cnt++;
			}
			if (ans < cnt) {
				ans = cnt;
			}
		}
	}

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


#ifdef DEBUGF
	getch();
#endif
	return 0;
}


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

public class ABC0124_A3 {
    private static void Main(string[] args) {
        string input = Console.ReadLine().Trim();
        ConvertInput(input);
    }

    private static void ConvertInput(string input) {
        var isBlackList = new List<bool>();

        foreach (var character in input) {
            if (character == '1')
                isBlackList.Add(true);
            else
                isBlackList.Add(false);
        }

        var isBlackSatisfyLists = GetSatisfyLists(isBlackList.Count);

        Solve(isBlackList, isBlackSatisfyLists);
    }

    private static void Solve(List<bool> isBlackList, List<List<bool>> isBlackSatisfyLists) {
        var countA = CountDifferentPairs(isBlackList, isBlackSatisfyLists[0]);
        var countB = CountDifferentPairs(isBlackList, isBlackSatisfyLists[1]);
        OutputAnswer(Math.Min(countA, countB).ToString());
    }

    private static void OutputAnswer(string text) => Console.WriteLine(text);

    private static List<List<bool>> GetSatisfyLists(int size) {
        var isBlackSatisfyLists = new List<List<bool>>() {
            new List<bool>(),
            new List<bool>()
        };

        for (int index = 0; index < size; index++) {
            if (index % 2 == 0) {
                isBlackSatisfyLists[0].Add(true);
                isBlackSatisfyLists[1].Add(false);

            } else {
                isBlackSatisfyLists[0].Add(false);
                isBlackSatisfyLists[1].Add(true);
            }
        }

        return isBlackSatisfyLists;
    }

    private static int CountDifferentPairs(List<bool> a, List<bool> b) {
        var count = 0;

        for (var index = 0; index < a.Count; index++) {
            if (a[index] == b[index])
                count++;
        }

        return count;
    }
}

Measured memory_bytes: 12128
#include<iostream>
#include<algorithm>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
using namespace std;

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

  int A[N], B[N];
  rep(i,0,N-1) {
    cin >> A[i];
    B[i] = A[i];
  }

  sort(B, B+N, greater<int>());

  rep(i,0,N-1) {
    if (A[i] == B[0]) cout << B[1] << endl;
    else cout << B[0] << endl;
  }

  return 0;
}


Measured memory_bytes: 3200
//#define _GLIBCXX_DEBUG    //空コンテナ操作禁止　Clang環境では#define _LIBCPP_DEBUG 0
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;
using ll = long long;

int main(){
  /*int r;
  cin >> r;
  cout << r*r;
  return 0; */
  int N;
  cin >> N;
  string S;
  cin >> S;
  
  if( N%2 != 0 ){
    cout  << "No";
    return 0;
  }
  for( int i=0; i<N/2; i++ ){
    if( S[i] != S[i+N/2] ){
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vs = vector<string>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  yn     cout<<"Yes\n"; else cout<<"No\n";
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
const int INF=1000000009;
const ll LINF = 1e18;

int main()
{
    ll n,k,x[100010]={0},a,b;
    cin>>n>>k;
    rep(i,n){
        cin>>a>>b;
        x[a]+=b;
    }
    rep(i,100010){
        k-=x[i];
        if(k<=0) cout<<i<<endl,exit(0);
    }

    return 0;
}


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

typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << '\n'; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << std::endl;
}

using ll = long long int;
ll RepeatSquaring(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t = RepeatSquaring(N, P/2, M) % M;
        return t*t % M;
    }
    return N * RepeatSquaring(N, P-1, M) % M;
}

Int f(Int x) {
    Int ret = 0;
    while (x > 0) {
        ret++;
        x = x % (__builtin_popcount(x));
    }
    return ret;
}

int main() {
    Int n;
    cin >> n;
    string s;
    cin >> s;
    Int cnt = 0;
    for (Int i = 0; i < n; i++) {
        cnt += s[i] - '0';
    }  
    Int a = 0, b = 0;
    for (Int i = 0; i < n; i++) {
        if (cnt == 1) continue;
        if (i > 0) {
            a = a * 2 % (cnt - 1);
        }
        if (s[i] == '1') {
            a = (a + 1) % (cnt - 1);
        }
    }
    for (Int i = 0; i < n; i++) {
        if (i > 0) {
            b = b * 2 % (cnt + 1);
        }
        if (s[i] == '1') {
            b = (b + 1) % (cnt + 1);
        }
    }
    for (Int i = 0; i < n; i++) {
        Int x;
        if (s[i] == '0') {
            x = (b + RepeatSquaring(2, n - 1 - i, cnt + 1)) % (cnt + 1);
        } else {
            if (cnt == 1) {
                print(0);
                continue;
            }
            x = (a - RepeatSquaring(2, n - 1 - i, cnt - 1) + (cnt - 1)) % (cnt - 1);
        }
        print(f(x) + 1);
    }
    return 0;
}


Measured memory_bytes: 3684