akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
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 (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;
const double pi = 3.141592653589;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {return (a%b) ? gcd(b, a%b) : b;}
ll modPow(ll x, ll n) {
    if(n==0) return 1;
    ll res = modPow(x*x%MOD, n/2);
    if(n&1) res=res*x%MOD;
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;cin>>n;
    vector<vector<bool>> vs(4,vector<bool>(13,false));
    rep(i,n) {
        char s;
        int t;
        cin >> s >> t;
        int q;
        if (s=='S') {
            q=0;
        }
        if (s=='H') q=1;
        if (s=='C') q=2;
        if (s=='D') q=3;
        vs[q][t-1]=true;
    }
    rep(i,4) {
        rep(j,13) {
            if (vs[i][j]==false) {
                if (i==0) {
                    cout << "S" << " " << j+1 << "\n"; 
                } else if (i==1) {
                    cout << "H" << " " << j+1 << "\n"; 
                } else if (i==2) {
                    cout << "C" << " " << j+1 << "\n"; 
                } else {
                    cout << "D" << " " << j+1 << "\n"; 
                }
            }
        }
    }
}


Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    while(cin>>n){
        vector<int> v(n+5),dp(n+5,0);
        for(int i=0;i<n;i++){
            cin>>v[i];
        }dp[1]=abs(v[1]-v[0]);
        for(int i=2;i<n;i++){
            dp[i]=min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
        }cout<<dp[n-1]<<"\n";
    }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repb(i, n) for (int i = (n-1); i >= 0; i--)
#define rea(i, a, b) for (int i = (a); i < (b); i++)
#define reab(i, a, b) for (int i = (a)-1; i >= (b); i--)
#define ALL(a) (a).begin(),(a).end()
#define SZ(x) ((int)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const int MOD = 1000000007;
/* END OF TEMPLATE */

int main(){
    int N;
    cin >> N;
    vvll F(N, vll(10, 0));
    rep(i, N){
        rep(j, 10){
            cin >> F[i][j];
        }
    }
    vvll P(N, vll(11, 0));
    rep(i, N){
        rep(j, 11){
            cin >> P[i][j];
        }
    }
    // ci = F[i][0-9]A[i][0-9]
    ll ans = -10000000000;
    rea(b, 1, 1024){
        vll c(N, 0);
        ll profit = 0;
        rep(i, N){
            rep(j, 10){
                c[i] += F[i][j] * ((b >> j) & 1);
            }
            profit += P[i][c[i]];
        }
        ans = max(ans, profit);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void)
{
    int n,cnt;
    int sum=0;
    cin >> n;
    for(int i=1;i<=n;i+=2)
    {
        cnt=0;
        for(int j=1;j<=i;j++)
            if(i%j==0)
                cnt++;
        if(cnt==8)
            sum++;
    }
    cout << sum;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());
		int[] a = new int[n];
		for (int i=0; i<n; i++) {
			a[i] = Integer.parseInt(br.readLine());
		}

		int[] dp = new int[n];
		dp[0] = a[0];
		int length = 1;

		for (int i=1; i<n; i++) {
			if (dp[length-1] < a[i]) {
				dp[length++] = a[i];
			}else {
				int index = Arrays.binarySearch(dp,0,length,a[i]);
				if (index < 0)
					index = ~index;
				dp[index] = a[i];
			}
		}

		System.out.println(length);

		br.close();
	}
}

Measured memory_bytes: 31524
def myAnswer(C:list) -> int:
   return "Yes" if(C[0][0] + C[1][1] + C[2][2] == C[0][1]+C[1][2]+C[2][0] == C[0][2]+C[1][0]+C[2][1]) else "No"




def modelAnswer():
   return
def main():
   C = [list(map(int,input().split())) for _ in range(3)]
   print(myAnswer(C[:]))
   
if __name__ == '__main__':
   main()









Measured memory_bytes: 3068
#include <bits/stdc++.h>
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 all(x) (x).begin(),(x).end()
typedef long long lint;
typedef vector<long long> vlint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<vector<long long>> vlint2;



int main() {
    lint n, k; cin >> n >> k;
    lint ans = 0;

    // a = y (mod b) の個数
    int ans_mod_b;
    int n_mod_b;
    For(b, k+1, n+1){
        n_mod_b = n%b;
        ans_mod_b = n/b;
        ans += ans_mod_b * (b - k);
        //端数
        ans += max((lint)0, n_mod_b - k + 1);
    }
    if (k == 0){
        ans = n * n;
    }
    cout << ans << endl;

    


}



Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <iostream>
//#include <iomanip>
//#include <vector>
//#include <cmath>
//#include <algorithm>
using namespace std;


#define F first
#define PB push_back
#define MP make_pair

typedef unsigned long long ll;

ll p = pow(10, 9) + 7;


void dfs(vector<vector<int> >& g, int v, vector<bool>&taken, vector<int>& inDegree, vector<int>&dis)
{
    taken[v] = true;
    for(int i = 0; i < g[v].size(); i++)
    {
        dis[g[v][i]] = max(dis[v] + 1, dis[g[v][i]]);
        inDegree[g[v][i]]--;
        if(inDegree[g[v][i]] == 0) {
            dfs(g, g[v][i], taken, inDegree, dis);
        }
    }
}



int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
     int n, m;
     cin >> n >> m;
     vector<vector<int> > g(n + 1);
     vector<int> inDegree(n + 1);
     vector<int> distance(n + 1);
     vector<bool> taken(n + 1);
     for(int i = 0; i < m; i++)
     {
         int a, b;
         cin >> a >> b;
         inDegree[b]++;
         g[a].push_back(b);
     }

     vector<bool> visited(n);

     for(int i = 1; i <= n; i++)
     {
         if(!taken[i] && inDegree[i] == 0)
         {
             dfs(g, i, taken, inDegree, distance);
         }
     }

     int ans = 0;
     ans = *max_element(distance.begin(), distance.end());
     cout << ans << endl;
     
}

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

using namespace std;

int main()
{
    string s,t;
    cin>>s>>t;
    int n = s.length();
    int m = t.length();
    int ans = 0;
    for(int i=0;i<=n-m;i++)
    {
        int count =0;
        for(int j=0;j<m;j++)
        {
            if(s[i+j] == t[j])
                count++;
        }
        ans = max(ans,count);
    }
    cout<<m-ans<<endl;
}

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

int main()
{
  char b;
  cin >> b;
  if(b == 'A'){
    cout << "T";
  }
  else if (b == 'T')
  {
    cout << "A";
  }
  else if (b == 'C')
  {
    cout << "G";
  }
  else if (b == 'G')
  {
    cout << "C";
  }
}


Measured memory_bytes: 3560
import java.util.Scanner;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s1 = sc.nextLine();
        String s2 = sc.nextLine();
        int a = Integer.parseInt(s1);
        int b = Integer.parseInt(s2);
        int c = 6;
        System.out.println(c - a - b);
	}
}


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

const static ll MOD = (1e+9)+7;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main(){
    int n;cin>>n;
    ll ans = 1;
    for(int i = 2;i<=n;i++){
        if(!IsPrime(i))continue;
        ll cnt = n/i;
        ll j = i*i;
        while(j <= n){
            cnt += n/j;
            j *= i;
        }
        ans = ans * (cnt+1) % MOD;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
  ll n;
  cin>>n;
  ll a[100005];
  ll ans=1;
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(a[i]==0){
    	cout<<"0"<<endl;
      	return 0;
    }
  }
  for(int i=0;i<n;i++){
    if(a[i]<=1000000000000000000/ans){
      ans*=a[i];
    }
    else{
    	cout<<"-1"<<endl;
      	return 0;
    }
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 4336
#include <iostream>
using namespace std;
 
int main() {
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a+b>c+d){
		cout<<"Left"<<endl;
	}
	if(c+d>a+b){
		cout<<"Right"<<endl;
	}
	if(a+b==c+d){
		cout<<"Balanced"<<endl;
	}
}

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

void solve(){
  int n; cin >> n;
  int a[n], c[10001] = {0}, ans[n + 1];
  int maxa = 0;
  for(int i = 0; i < n; i++){
    cin >> a[i];
    maxa = max(a[i], maxa);
    c[a[i]]++;
  }
  for(int i = 1; i <= maxa; i++){
    c[i] += c[i - 1];
  }

  for(int i = 0; i < n; i++){
    ans[c[a[i]]] = a[i];
    c[a[i]]--;
  }
  for(int i = 1; i <= n - 1; i++){
    cout << ans[i] << " ";
  }
  cout << ans[n] << endl;

  return;
}

int main(){
  solve();
  return 0;
}



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

int main(){
    int n,w,vi,wi;
    cin>>n>>w;
    int dp[n+1][w+1];
    for(int j=0;j<w+1;j++){
        dp[0][j]=0;
        //cout<<dp[0][j]<<' ';
    }
    //cout<<endl;
    for(int i=1;i<n+1;i++){
        cin>>vi>>wi;
        for(int j=0;j<w+1;j++){
            if((j-wi)<0){dp[i][j]=dp[i-1][j];}
            else{dp[i][j]=max(dp[i-1][j-wi]+vi,dp[i-1][j]);}
            //cout<<dp[i][j]<<' ';
        }
        //cout<<endl;
    }
    cout<<dp[n][w]<<endl;
}


Measured memory_bytes: 7028
#include <bits/stdc++.h>
using namespace std;
int main(){
    int H, N;
    cin >> H >> N;
    int a[N];
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    for(int i = 0; i < N; i++){
        H -= a[i];
    }
    if(H <= 0) printf("Yes");
    else printf("No");
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();

		int wa=a+b;
		int sa=a-b;
		int seki=a*b;
		if(wa>=sa&&wa>=seki) {
			System.out.print(wa);
		}
		else if(sa>=wa&&sa>=seki) {
			System.out.print(sa);
		}
		else {
			System.out.print(seki);
		}

	}

}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
/*cout<<setprecision(5)<<ret<<endl;で、数字部分を計5桁表示かつゼロ埋め無*/
/*cout<<fixed<<setprecision(5)<<ret<<endlで、小数部のみ5桁表示かつゼロ埋め有*/
using namespace std;

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
/* [Shift+Command+b]（コンパイル）ー＞[Ctrl+Shift+`]（ターミナル起動）ー＞[./a.out] */

//////////////////
//  A
/*int main(void){
    int a;cin>>a;
    cout<<3*a*a<<endl;
    return 0;
}*/
//////////////////
//  B
int main(void){
    int n,d;cin>>n>>d;
    if(n%(2*d+1)==0){
        cout<<(n/(2*d+1))<<endl;
    }else{
        cout<<(n/(2*d+1))+1<<endl;
    }
    return 0;
}
//////////////////
//  C 
/*int main(void){

    return 0;
}*/
//////////////////
//  D
/*int main(void){

    return 0;
}*/


Measured memory_bytes: 3620
/* *
 *
 * Author: Hamkor
 *
 * */
 
#include <bits/stdc++.h>
 
using namespace std;
 
/* * * *   * * *   	* * * */
typedef long long ll;
const int oo = 1e9;
const ll mod = 100000000;
typedef complex<ll> P;
#define X real()
#define Y imag()
/* * * *   * * *   	* * * */
 
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int a, b, k; cin>>a>>b>>k;
	for (int i = min(a,b); i>=1; --i){
	  if (a%i == 0 && b%i == 0){
	      k--;
	      if (k == 0){cout<<i; return 0;}
	  }
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順

#define M 1000000007

using namespace std;
using ll = long long int;

int main(){
    int N,K;cin>>N>>K;
    ll sum = 0;
    for(ll i=K;i<=N+1;i++){
        ll min = i * (i - 1) / 2;
        ll max = i * (N - (i - 1) + N) / 2;
        sum += max - (min - 1);
        sum %= M;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
using namespace std;
using Graph=vector<vector<int> >;

vector<bool> seen;
vector<int> gid;
vector<int> Gcount;

void dfs(const Graph &G,int v,int num){
    seen[v]=true;
    gid[v]=num;
    Gcount[num]++;
    for(auto next_v:G[v]){
        if(seen[next_v])continue;
        dfs(G,next_v,num);
    }
}
int main(){
    int N,M,K;
    cin>>N>>M>>K;
    Graph G(N+1);
    vector<int> F,B;
    F.assign(N+1,0);
    B.assign(N+1,0);
    for(int i=1;i<=M;i++){
        int a,b;
        cin>>a>>b;
        G[a].push_back(b);
        G[b].push_back(a);
        F[a]++;
        F[b]++;
    }
    seen.assign(N+1,false);
    gid.assign(N+1,0);
    int num=0;
    Gcount.push_back(0);
    for(int i=1;i<=N;i++){
        if(!seen[i]){
            num++;
            Gcount.push_back(0);
            dfs(G,i,num);
        }
    }
    for(int i=0;i<K;i++){
        int c,d;
        cin>>c>>d;
        if(gid[c]==gid[d]){
            B[c]++;
            B[d]++;
        }
    }
    for(int i=1;i<=N;i++){
        if(i==N){
            cout<<Gcount[gid[i]]-F[i]-B[i]-1<<endl;
        }else{
            cout<<Gcount[gid[i]]-F[i]-B[i]-1<<" ";
        }
    }
    return 0;
}

Measured memory_bytes: 8448
import heapq
 
X,Y,Z,K = map(int,input().split(' '))
An = list(map(int,input().split(' ')))
Bn = list(map(int,input().split(' ')))
Cn = list(map(int,input().split(' ')))
output = []
ABn = [0] * (X*Y)
count = 0
for a in An:
    for b in Bn:
        ABn[count] = a + b
        count += 1
ABn.sort(reverse=True)
ABn = ABn[0:K]

for ab in ABn:
    for c in Cn:
        heapq.heappush(output,(ab+c)*(-1))
 
for _ in range(K):
    print(heapq.heappop(output) * (-1))

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

char ok[256][11];
int n, m;

int main(void)
{
    int i, j, now = 0, fl;
    char input[11];
    scanf("%d",&n);
    for (i = 0; i < n; i++) {
        scanf("%s",ok[i]);
    }
    scanf("%d",&m);
    for (i = 0; i < m; i++) {
        scanf("%s",input);
        fl = 0;
        for (j = 0; j < n; j++) {
            if (strcmp(input, ok[j]) == 0) {
                fl = 1;
                break;
            }
        }
        if (fl) {
            if (now) {
                printf("Closed by %s\n",input);
                now = 0;
            } else {
                printf("Opened by %s\n",input);
                now = 1;
            }
        } else {
            printf("Unknown %s\n",input);
        }
    }
    return 0;
}
         

Measured memory_bytes: 604
#include<iostream>
 
using namespace std;
 
int main(){
	int s;
  	cin >> s;
  	int i=1;
  	do{
      if(s == 4 || s == 2 || s == 1){
      	cout << i+3 << endl;
        break;
      }
      i++;
      if(s%2 == 0){
        s = s/2;
      }else{
        s = 3*s + 1;
      }
    } while(1);
    return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll long long int
#define endl "\n"
#define db(x) cout<<#x<<" ->"<<x<<endl
#define db2(x,y) cout<<#x<<"->"<<x<<", "<<#y<<" -> "<<y<<endl
#define db3(x,y,z) cout<<#x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define db4(w,x,y,z) cout<<#w <<" -> " << w << " , " << #x<<" -> "<<x<<" , "<<#y<<" -> "<<y<<" , "<<#z<<" -> "<<z<<endl
#define prt(x) for(auto it = x.begin(); it!=x.end(); it++) { cout<<*it<<" "; } cout<< endl
#define IN freopen("input.txt","r",stdin)
//typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = (int)2e5+5;

int32_t main(){
    ios_base::sync_with_stdio(false); cin.tie(0);
//    IN;
    ll x;
    cin >> x;
    ll ans  = (x / 500);
    ans*=1000;
    ll bal = x % 500;
    bal/=5;
    ans+=(bal * 5);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	private static Scanner sc;
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		int t[] = new int[3];
		
		int l = sc.nextInt();
		for(int i = 0; i < l; i++){
			t[0] = sc.nextInt();
			t[1] = sc.nextInt();
			t[2] = sc.nextInt();
			Arrays.sort(t);
			
			if(t[0]*t[0] == t[2]*t[2] - t[1]*t[1] && 
			   t[1]*t[1] == t[2]*t[2] - t[0]*t[0] &&
			   t[2]*t[2] == t[0]*t[0] + t[1]*t[1]){
				System.out.println("YES");
			}else{
				System.out.println("NO");
			}
		}
	}
}

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

typedef long long ll;
typedef unsigned long long ull;

#define FRO freopen("in.txt","r",stdin);

ll arr[100005],n;
vector<ll >dp(100005,0);

int main()
{
      ll i,j;
      cin>>n;
      for(i=1;i<=n;i++)
            cin>>arr[i];
      arr[0]=0;
      for(i=2;i<=n;i++)
      {

            if(i>2)
                  dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
            else
                  dp[i]=abs(arr[i]-arr[i-1]);
      }
      cout<<dp[n]<<endl;

	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n;
  cin>>n;
  int s[n];
  for(int i=0;i<n;i++) cin>>s[i];
  int ans=1;
  for(int i=2;i<=n;i++){
    if(n%i) continue;
    bool f=1;
    for(int j=0;j<n-n/i;j++){
      if(s[j]!=s[j+n/i]){
	f=0;
	break;
      }
    }
    if(f) ans=i;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3868
#include <bits/stdc++.h>
#define  f first
#define s second
#define vi vector<int>
#define pb emplace_back
#define ll long long int
#define vll vector<long long int>
#define vpi vector<pair<int,int>>
#define bit(x) __builtin_popcount(x)
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i=0 ; i<n ; ++i)
#define deb(x) cout << #x << " - " << x << endl;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll MOD = 1e9 + 7;
const ll INF = 1 << 29;
const ll MAX_N = 1e5 + 7;

using namespace std;

int main() {
    IOS;
    int a,b,c,d,i=0;
    cin>>a>>b>>c>>d;
    
    while(1){
        if(i%2==0){
            c-=b;
            if(c<=0){
                cout<<"Yes";
                break;
            }
        }else{
            a-=d;
            if(a<=0){
                cout<<"No";
                break;
            }
        }
        i++;
    }
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define mod 1000000007
#define MOD 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 2e9


int main()
{
    fastio;
    lli a,b,n;
    cin >>a >> b >> n;
    lli c=min(b-1,n);
    c=a*c;
    lli ans=c/b;
    cout << ans << endl;
}

Measured memory_bytes: 3652
from bisect import bisect_left
N=int(input())
ll=list(map(int,input().split()))
ll.sort()
ans=0
for i in range(N):
    for j in range(i+1,N):
        delta=bisect_left(ll,ll[i]+ll[j],lo=j)-j-1
        if delta>0:
            ans+=delta
        #print(i,j,delta)
print(ans)



Measured memory_bytes: 43996
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long a,c;
    char b[5]={};
    cin>>a>>b;
    c=(b[0]-'0')*100+(b[2]-'0')*10+(b[3]-'0');
    cout<<(a*c)/100<<'\n';

    return 0;

}

//      *   *  *****  *   *  *   *   ****  ****    ****     **  ***
//     *   *  *      **  *  *   *  *      *   *  *        * *  *  *
//    *****  *****  * * *  *   *  *      ****   *       *  *    *
//   *   *      *  *  **  *   *  *      *  *   *       *****  *
//  *   *  *****  *   *   ***    ****  *   *    ****     *   ****

//     ****  *   *  *   *   ***   *   *  *****  *   *
//    *     *   *  *   *  *   *  *   *  *      *   *
//    ***  *****  *   *  *****  * * *  ****   *   *
//      *   *    *   *  *   *  * * *  *      *   *
//  ****   *     ***   *   *   * *   *****   ***


Measured memory_bytes: 3648
/*
 * Author: madlogic
 * It's better to do something than nothing
*/
#include <bits/stdc++.h>
using namespace std;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
#define int long long
const int INF = 1000000000;
const int MOD = 1000000007;
const double PI = 2*acos(0.0);
signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int a,b;
	cin>>a>>b;
	vector<int> p;
	int lim = sqrt(a);
	if(a%2==0)
	{
		p.push_back(2);
		while(a%2==0)
			a/=2;
	}
	for(int i=3;i<=lim;i+=2)
	{
		if(a%i==0)
		{
			p.push_back(i);
			while(a%i==0)
				a/=i;
		}
	}	
	if(a>2)
		p.push_back(a);
	vector<int> sieve;
	for(int i=0;i<p.size();i++)
		if(b%p[i]==0)
			sieve.push_back(p[i]);
	cout<<sieve.size()+1<<endl;
	return 0;	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))

using namespace std;


struct Marathon{
  using timer = chrono::system_clock;
  timer::time_point tstart,tend;
  random_device rd;
  mt19937 mt{rd()};
  
 //define variable
  const int limit = 1900;
  int D,day,alpha,ncost,bcost;
  int c[26];
  int d[365][26];
  vector<int> ans,state;

  Marathon(){
    tstart = timer::now();
    tend = timer::now();
    input();
    init();
    solve();
  }

  bool until(){
     int time = static_cast<double>(chrono::duration_cast<chrono::microseconds>(tend-tstart).count()/1000.0);
     return limit > time;
  }

  int cost(){
    int mae[26] = {};
    int ret = 0;
    for(int i=0;i<D;i++){
      mae[state[i]] = i+1;
      ret += d[i][state[i]];
      for(int j=0;j<26;j++){
	//	cout<<c[j]<<" "<<(i+1-mae[j])<<endl;
	ret -= c[j] * (i+1-mae[j]); 
      }
    }
    return ret;
  }

  void ch_state(){
    state[day] = alpha;
  }

  int nextInt(int to){
    uniform_int_distribution<int> ranum(0,to);
    return ranum(mt);
  }

  double nextDouble(double to){
    uniform_real_distribution<double> ranumf(0,to);
    return ranumf(mt);
  }

  void init(){
    ans.resize(D);
    state.resize(D);
    for(int i=0;i<D;i++){
      ans[i] = i%26;
      state[i] = i%26;
    }
    bcost = cost();
  }

  void solve(){
    while(until()){
      day = nextInt(D-1);
      alpha = nextInt(25);
      ch_state();
      ncost = cost();

      if(ncost > bcost){
	bcost = ncost;
	ans = state;
      }
      tend = timer::now();
    }
  }

  void input(){
    cin>>D;
    for(int i=0;i<26;i++){
      cin>>c[i];
    }
    for(int i=0;i<D;i++){
      for(int j=0;j<26;j++){
	cin>>d[i][j];
      }
    }
  }

  void output(){
    for(int i=0;i<D;i++){
      cout<<ans[i]+1<<endl;
    }
  }
};
int main(){
  Marathon solver;
  solver.output();
  return 0;
}


Measured memory_bytes: 3684
# coding: utf-8 -*-

N, M, X, Y = map(int, input().split())

a = list(map(int, input().split()))
b = list(map(int, input().split()))

# print(X, a)

x_max = max(a)
y_min = min(b)


# print(x_max, y_min)

count = 'War'


for i in range(X, Y + 1):
    if i > x_max and i <= y_min and i > X and i < Y:
        count = 'No War'

print(count)











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

using namespace std;

int main(void){
  long long N,M,tmp;
  long long sum=0;

  cin >> N >> M;

  for(int i=0;i<M;i++){
    cin >> tmp;
    sum += tmp;
  }

  if(N>=sum){
    cout << N - sum << endl;
  }else{
    cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int n,m,ans,a[52],b[52];
vector <int> v[52];
bool vis[52];
void dfs (int x)
{
    vis[x]=true;
    for (int i=0;i<v[x].size();i++)
    {
        if (!vis[v[x][i]])
            dfs(v[x][i]);
    }
}
int main()
{
    cin >>n>>m;
    for (int i=0;i<m;i++)
    {
        cin >>a[i]>>b[i];
        v[a[i]].push_back(b[i]);
        v[b[i]].push_back(a[i]);
    }
    for (int i=0;i<m;i++)
    {
        memset(vis,0,sizeof vis);
        bool yes=false;
        int n1=a[i];
        int n2=b[i];
        v[n1].erase(find(v[n1].begin(),v[n1].end(),n2));
        v[n2].erase(find(v[n2].begin(),v[n2].end(),n1));
        for (int j=1;j<=n;j++)
        {
            if (!vis[j])
            {
                if (yes)
                {
                    ans++;
                    break;
                }
                yes=true;
                dfs (j);
            }
        }
        v[n1].push_back(n2);
        v[n2].push_back(n1);
    }
    cout <<ans;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <random>
#include <map>
#include <set>

using namespace std;


using ULL = decltype(0ull);
constexpr auto DIV = 1000000007ull;
constexpr auto MAX = numeric_limits<ULL>::max();

struct Int {
  int value;
  Int() {
    value = 0;
  }
  Int(int v) {
    value = v;
  }
  Int& operator++() {
    ++this->value;
    return *this;
  }
};

int main() {
  int N;
  int card = 0;
  cin >> N;
  map<int, Int, std::greater<int>> c;
  unordered_map<int, Int> map_;
  for (int i = 0; i < N; ++i) {
    int ai;
    cin >> ai;
    ++map_[ai];
  }
  for (auto&& val : map_) {
    if (val.second.value == 1) {
      ++card;
    }
    else {
      while (val.second.value > 3) {
        val.second.value = val.second.value / 3 + val.second.value % 3;
      }
      if (val.second.value == 3) {
        ++card;
      }
      else {
        c[val.first] = val.second;
      }
    }
  }
  if (c.size() == 1) {

  }
  else {
    card += c.size() / 2 * 2;
  }
  cout << card << endl;

  return 0;
}

Measured memory_bytes: 4388
#include <stdio.h>
#include <math.h>

int main(){
	
	int n, i, j=0,sum;
	int  a[1000];
	double avg,temp;
	double b[50];
	
	while(1){
		scanf("%d", &n);
		if(n==0){
			break;
		}
		sum = 0;
		temp = 0.0;
		for(i=0;i<n;i++){
			scanf("%d", &a[i]);
			sum = sum + a[i];
		}
		avg = (double)sum / n;
		for(i=0;i<n;i++){
			temp = temp + pow((double)a[i] - avg, 2);
		}
		b[j++] = sqrt((double)temp/ n);
	}
	
	for(i=0;i<j;i++){
		printf("%.8f\n", b[i]);
	}
    
	return 0;

}

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

int main() {
  string A, B, C;
  cin >> A >> B >> C;
  
  if (A[A.size() - 1] == B[0] && B[B.size() - 1] == C[0]) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	long long int h1,m1,h2,m2,king,hd1,hd2,hd;
	cin>>h1>>m1>>h2>>m2>>king;
	hd1=60*h2+m2;
	hd2=60*h1+m1;
	hd=hd1-hd2;
	cout<<hd-king<<endl;
	
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  if(N%111==0) cout << N << endl;
  else {
    REP(i,1000) {
      N++;
      if(N%111==0) {
        cout << N << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProCon
{

    class Program
    {

        static void Main(string[] args)
        {
            Console.ReadLine();
            string[] input = Console.ReadLine().Split(' ');
            int Target = (input.Count());
            int N4 = 0;
            int N2 = 0;
            foreach( string str in input)
            {
                int i = int.Parse(str);
                if(i%4 == 0)
                {
                    N4++;
                }
                else if (i % 2 == 0)
                {
                    N2++;
                }
            }
            if(N4 * 2 + 1 == Target || (N4 * 2) + N2 >= Target)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }

}

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

signed main(){
	string a,b;
	cin>>a>>b;
	int sum=0;
	r(i,3)if(a[i]==b[i])sum++;
	cout<<sum<<endl;
}


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

void solve() {
	int N, M; cin >> N >> M;
	vector<llong> X(M);
	rep(i, M) scanf("%lld", &X[i]);
	sort(X.begin(), X.end());

	vector<llong> diffs;
	for (int i = 1; i < X.size(); i++) diffs.push_back(X[i] - X[i - 1]);
	sort(diffs.begin(), diffs.end(), greater<llong>());

	llong res = X.back() - X[0];
	for (int i = 0; i < min((int)diffs.size(), N - 1); i++) res -= diffs[i];
	cout << res << endl;
}

int main(void) {
	solve();

	return 0;
}

Measured memory_bytes: 2168
n,m=map(int,input().split())

num=m//n
ans=1
for i in range(1,int(m**0.5)+1):
    if m%i==0:
        Num=m//i
        if Num <= num and ans < Num:
            ans = Num

        if i<=num and ans<i:
            ans=i
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> time(n);
  vector<int> time2(n);
  for (int i = 0; i < n; i++) cin >> time.at(i);
  for (int j = 0; j < n; j++) time2[j] = time[j];
  int m;
  cin >> m;
  vector<int> drink(2 * m);
  for (int i = 0; i < 2 * m; i++) cin >> drink.at(i);
  for (int i = 0; i <= (m - 1) * 2; i += 2) {
    time2[drink[i] - 1] = drink[i + 1];
    cout << accumulate(time2.begin(), time2.end(), 0) << endl;
    for (int j = 0; j < n; j++) time2[j] = time[j];
  }
}

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

#define ll long long
#define repeat(i, x) for(register ll i = 0; i < x; i++)

using namespace std;

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

  cout << ((500 * K >= X) ? "Yes" : "No") << endl; 
}

Measured memory_bytes: 3536
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin>>A>>B;
  if(A==1){A=14;}
  if(B==1){B=14;}
  if(A>B){cout<<"Alice"<<endl;}
  else if(A==B){cout<<"Draw"<<endl;}
  else{cout<<"Bob"<<endl;}
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <climits>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define si(x) int x = scanInt();
#define sll(x) LL x = scanLong();
#define sci(x) int x; scanf("%d", &x);
#define scll(x) LL x; scanf("%lld", &x);
#define pi(x) printf("%d ", x)
#define pll(x) printf("%lld ", x)
#define nl printf("\n")
#define clr(a) memset(a, 0, sizeof(a))
#define PB push_back
#define MP make_pair
using namespace std;
typedef unsigned int UI; // 32 bit integer
typedef long int LI; // 32 bit integer
typedef unsigned long int ULI; // 32 bit unsigned integer
typedef long long int LL; // 64 bit integer
typedef unsigned long long int  ULL; // 64 bit unsigned integer
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLD;
LL mod = 1e9+7;

/* Fast I/O */
inline int scanInt() {
	int n = 0;
	char ch = getchar();
	int sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(int)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

inline LL scanLong() {
	LL n = 0;
	char ch = getchar();
	LL sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(LL)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

int main() {
	sll(n); sll(k);
	LL ans = 0, cnt = 0, cnt2 = 0;
	rep(i, 1, n+1) {
		if(i%k == 0)	cnt++;
		if(k%2 == 0 && i%k == k/2)	cnt2++;
	}
	ans += (cnt * cnt * cnt) + (cnt2 * cnt2 * cnt2);
	pll(ans); nl;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n; cin >> n;

	vl a(n);
	FOR(i,0,n) cin >> a[i];

	vector<pll> b(n);
	FOR(i,0,n) b[i] = {a[i],i};
	sort(all(b),greater<pll>());
	
	FOR(i,0,n) {
		cout << (i == b[0].yy ? b[1].xx : b[0].xx) << endl;
	}


}



Measured memory_bytes: 6272
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define X second.first
#define Y second.second
int main(){
	int n,m,a;
	while(cin >> n >> m >> a , a){
		vector<int> amd(n);
		vector<pair<int,pair<int,int> > > info(m);
		for(int i=0;i<m;i++){
			cin >> info[i].first >> info[i].second.first >> info[i].second.second;
		}
		sort(info.begin(),info.end(),greater<pair<int,pair<int,int> > >());
		for(int i=0;i<m;i++){
			if(a == info[i].X)a = info[i].Y;
			else if(a == info[i].Y)a = info[i].X;
		}
		cout << a << endl;
	}
}

Measured memory_bytes: 924
import java.util.*;

public class Main {
    static int MAX = 5_000;
    static int MOD = 1_000_000_007;

    private static long[] FAC = new long[MAX];
    private static long[] INV_FAC = new long[MAX];

    private static void initCom(){
        FAC[0]=FAC[1]=1;
        INV_FAC[0]=INV_FAC[1]=1;
        for(int i=2;i<MAX;i++){
            FAC[i]=FAC[i-1]*i % MOD;
            INV_FAC[i]=modinv(FAC[i]);
        }
    }

    private static long comb(int n, int k){
        return (((FAC[n] * INV_FAC[n-k]) % MOD) * INV_FAC[k]) % MOD;
    }


    private static long modpow(long a, long b){
        if(b == 1){
            return a % MOD;
        }
        if(b == 0){
            return 1;
        }
        long res = b/2;
        long rem = b%2;
        long p = modpow(a, res) % MOD;
        if(rem == 1){
            return (((p*p) % MOD)*a) % MOD;
        }else{
            return (p*p) % MOD;
        }
    }

    private static long modinv(long a){
        return modpow(a, MOD-2);
    }

    private static long lucus(int n, int k, int mod){
        long res = 1L;
        while(n > 0){
            int n1 = n % mod;
            int k1 = k % mod;
            if(n1 == k1){
                res *= 1;
                n /= mod;
                k /= mod;
                continue;
            }else if(n1 < k1){
                res = 0;
                break;
            }else {
                res *= (long) comb(n1, k1);
                res %= mod;
                n /= mod;
                k /= mod;
            }
        }
        return res;
    }

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        char[] s = S.toCharArray();
        int[] ans = new int[N];
        long sum = 0;
        initCom();
        boolean aruflag = false;
        for(int i=0;i<N;i++) {
            ans[i] = s[i] - '1';
            if(ans[i] == 1){aruflag = true;}
        }
        for(int i=0;i<N;i++){
            sum += lucus(N-1, i, 2) * ans[i];
            //System.out.print(lucus(N-1, i, 2)+" ");
            sum %= 2;
        }
        int res = 20;
        if(sum % 2 == 1){
            res = 1;
        }else if(!aruflag){
            sum = 0;
            for(int i=0;i<N;i++){
                sum += lucus(N-1, i, 2) * (ans[i]/2);
                sum %= 2;
            }
            if(sum % 2 == 1){
                res = 2;
            }else{
                res = 0;
            }
        }else{
            res = 0;
        }
        System.out.println(res);
    }

}


Measured memory_bytes: 39168
#include<iostream>
#include<cstdio>
#include<cctype>
using namespace std;


int main()
{
        char ch;
        int alph[26];

        for(int i=0; i<26; i++){alph[i]=0;}

        while((ch=getchar())!=EOF){
                if(isalpha(ch)){
                        ch = tolower(ch);
                        alph[ch-'a']++;
                }
        }

        for(int i=0; i<26; i++){
                printf("%c : %d\n", 'a'+i, alph[i]);
        }

        return 0;
}

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

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)

using ll = long long;
using namespace std;

int h[3][100010];
int dp[3][100010] = {0};

int main() {
    int N;
    cin >> N;
    rep(j, N)
        rep(i, 3)
            cin >> h[i][j];

    rep(i, 3)
        dp[i][0] = h[i][0];

    rep1(j, N-1) {
        rep(i, 3) {
            int tmp = max(dp[(i+1)%3][j-1],dp[(i+2)%3][j-1]) + h[i][j];
            dp[i][j] = tmp;
        }
    }
    
    int ans = 0;
    rep(i, 3)
        ans = max(ans, dp[i][N-1]);
    cout << ans;
    cout << "\n";
    return 0;
}


Measured memory_bytes: 2560
def main():
    n = int(input())
    arr = list(map(int,input().split()))
    total = 0
    for i in range(n):
        a = arr[i]
        for j in range(i+1,n):
            b = arr[j]
            for k in range(j+1,n):
                c = arr[k]
                if a+b > c and b+c > a and a+c > b and a != b and a != c and b != c:
                    total += 1

    print(total)

main()


Measured memory_bytes: 67804
from sys import stdin

input = stdin.readline

n = int(input())
a = [int(x) for x in input().split()]
dp = [[0] * 3 for x in range(n)]

dp[0][0] = a[0]
dp[1][1] = a[1]


if n > 2:
    dp[2][0] = a[0] + a[2]
    dp[2][2] = a[2]

if n > 3:
    dp[3][1] = max(a[0] + a[3], a[1] + a[3])

for x in range(4, n):
    if x % 2 == 0:
        dp[x][0] = dp[x - 2][0] + a[x]
    dp[x][1] = max(dp[x - 2][1] + a[x], dp[x - 3][0] + a[x])
    dp[x][2] = max(dp[x - 2][2] + a[x], dp[x - 3][1] + a[x], dp[x - 4][0] + a[x])


if n % 2 == 0:
    print(max(dp[-2][0], dp[-1][1]))
else:
    print(max(dp[-3][0], dp[-2][1], dp[-1][2]))

Measured memory_bytes: 61552
N=int(input())
l=list(map(int,input().split()))
li=[]
for i in range(N):
  li.append((l[i],str(i+1)))
li.sort()
lis=[]
for i in range(1,N):
  lis.append(' '+li[i][1])
ans=li[0][1]+''.join(lis)
print(ans)

Measured memory_bytes: 27648
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
template <class T>
inline void chmin(T &a, const T &b) { a = min(a, b); }
template <class T>
inline void chmax(T &a, const T &b) { a = max(a, b); }
template <class T>
inline bool kbit(const T &x, const int &k) { return ((x >> k) & 1LL); }
inline int popcount(const int &n) { return __builtin_popcount(n); }
inline ll popcountll(const ll &n) { return __builtin_popcountll(n); }
inline ll mask(const ll &k) { return (1LL << k) - 1LL; }
template <class T>
void zip(V<T> &v) {
    sort(all(v));
    v.erase(unique(all(v)), v.end());
}
template <class T>
int lwb(V<T> &v, const T &x) { return lower_bound(all(v), x) - v.begin(); }
template <class T>
int upb(V<T> &v, const T &x) { return upper_bound(all(v), x) - v.begin(); }
void dump() {
    cerr << '\n';
}
template <class Head, class... Tail>
void dump(Head &&head, Tail &&... tail) {
    cerr << head << (sizeof...(Tail) == 0 ? " " : ", ");
    dump(std::move(tail)...);
}
template <class T>
void print(const vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
}
template <class T>
void read(vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}
constexpr char sp = ' ', newl = '\n';
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
constexpr ll INF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
//////////////////////////////////////////////INSERT ABOVE HERE
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int m = 1000010;
    V<int> co(m);
    int n;
    cin >> n;
    V<int> a(n);
    read(a);
    for (int i = 0; i < n; i++) {
        co[a[i]]++;
    }
    bool f = true;
    for (int i = 2; i < m; i++) {
        for (int j = i + i; j < m; j += i) {
            co[i] += co[j];
        }
        if (co[i] > 1) {
            f = false;
        }
    }
    int g = a[0];
    for (int i = 1; i < n; i++) {
        g = __gcd(g, a[i]);
    }
    if (f) {
        cout << "pairwise coprime" << newl;
    } else if (g > 1) {
        cout << "not coprime" << newl;
    } else {
        cout << "setwise coprime" << newl;
    }
}

Measured memory_bytes: 11112
# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N = read_a_int()
S = read()[:-1]


def permutation_3to2(new3num: str):
    return (new3num[1:], new3num[0] + new3num[2])


passes = set()
set_2num = set()
passes.add(S[:3])
set_2num.add(S[:2])
tmp1, tmp2 = permutation_3to2(S[:3])
set_2num.add(tmp1)
set_2num.add(tmp2)
for c in S[3:]:
    for a, b in list(set_2num):
        tmp = a + b + c
        tmp1, tmp2 = permutation_3to2(tmp)
        set_2num.add(tmp1)
        set_2num.add(tmp2)
        passes.add(tmp)

print(len(passes))


Measured memory_bytes: 41708
k, t = map(int, input().split())
a = list(map(int, input().split()))
while len(a) > 1:
    a.sort()
    a[0] -= 1
    a[-1] -= 1
    while 0 in a:
        a.remove(0)
if len(a) == 0:
    print(0)
else:
    print(a[0]-1)


Measured memory_bytes: 2940
/* Click on the checkbox for Add Custom Input and then write the input there before running the program */
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
	    Scanner input = new Scanner(System.in);
	    int n = input.nextInt();
	    System.out.println((int)Math.ceil(n/2.0));
	}
}

Measured memory_bytes: 21972
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<map>
#define ll long long
#define inf 20021225
#define N 110
#define LL __int128
#define mdn 998244353
using namespace std;
int read()
{
	int s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
void upd(int &x,int y){x+=x+y>=mdn?y-mdn:y;}
char ch[N]; map<LL,int> f;
int n,pw[N];
LL get(LL w,int l,int r)
{
	return w>>l&(((LL)1<<(r-l+1))-1);
}
int solve(LL k)
{
	if(f.find(k)!=f.end())	return f[k];
	int ans=0,w=k>>n; if(!w)	return f[k]=1;
	LL S=get(k,0,n-1);
	for(int i=0;i<w;i++)	if(S>>i&1)	ans++;
	ans=pw[ans]; int cnt=0;
	for(int i=0;i<w;i++)
	{
		for(int j=i;j<w;j++)
		{
			int len=j-i+1; if(j+len>w-1)	break;
			LL nw=get(S,i,j);
			for(int t=i+len;t+len-1<w;t+=len)
			{
				nw&=get(S,t,t+len-1);
				upd(ans,1ll*pw[cnt]*solve(nw|(LL)len<<n)%mdn*solve(get(S,t+len,w-1)|((LL)w-t-len<<n))%mdn);
			}
		}
		if(S>>i&1)	cnt++;
	}
	return f[k]=ans;
}
int main()
{
	scanf("%s",ch+1); n=strlen(ch+1); pw[0]=1; LL s=0;
	for(int i=1;i<=n;i++)	pw[i]=(pw[i-1]<<1)%mdn;
	for(int i=0;i<n;i++)	s|=((LL)ch[i+1]-'0'<<i);
	s|=(LL)n<<n; printf("%d\n",solve(s));
	return 0;
}


Measured memory_bytes: 3328
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };

    let x: i32 = sc.read();
    let n: usize = sc.read();
    let vec: Vec<i32> = sc.vec(n);

    let mut i = 0;
    loop {
        if !vec.contains(&(x - i)) {
            println!("{}", x - i);
            break;
        }
        if !vec.contains(&(x + i)) {
            println!("{}", x + i);
            break;
        }
        i = i + 1;
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 2152