akhauriyash/Code-Regression huggingface dataset:
#from collections import deque
#from heapq import heapify, heappop, heappush
#from bisect import insort
#from math import gcd
#mod = 10**9 + 7
#N = int(input())
#N, K = map(int, input().split())
#A = list(map(int, input().split()))
#flag = True
#for k in range(N):
#ans = 0
#print(ans)
#print('Yes')
#print('No')
S = input()
if S[-1] != 's':
	print(S + 's')
else:
	print(S+'es')


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

int main () {
  int N, Alice = 0, Bob = 0;
  cin >> N;
  vector<int> a(N);

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

  sort(a.begin(), a.end());
  for(int i = 0; i < N; i++) {
    if (i % 2 == 0) Alice += a.at(N - 1 - i);
    if (i % 2 == 1) Bob += a.at(N - 1 - i);
  }
  cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
using namespace std;
int main(){
  int N;
  cin >> N;
  int num[110];
  int cum[110]={0};
  int ans = 1000;
  
  rep(i,N){
    int x;
    cin >> x;
    num[i] = x;
    cum[i] = cum[i-1] + x;
    //cout << cum[i] << ' ';
  }
  rep(i,N){
    ans = min(ans,abs(2*cum[i]-cum[N]));
  }
  
  cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
template<class A, class B> ostream& operator <<(ostream& out, const pair<A, B> &p) {
    return out << "(" << p.first << ", " << p.second << ")";
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}

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

    int T;
    cin >> T;
    set<string> se;
    while (T--) {
        string s;
        cin >> s;
        se.insert(s);
    }
    cout << se.size() << endl;

    return 0;
}


Measured memory_bytes: 19272
#import<iostream>
#import<atcoder/all>
using namespace std;long N,Q,i,a;int main(){cin>>N>>Q;atcoder::fenwick_tree<long> b(N);for(;i<N;i++)cin>>a,b.add(i,a);while(Q--){cin>>i>>a>>N;if(i)cout<<b.sum(a,N)<<endl;else b.add(a,N);}}

Measured memory_bytes: 8208
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0 && W == 0)
				break;

			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					if (i == 0 || i == H - 1) {
						System.out.print("#");
					} else {
						if (j == 0 || j == W - 1) {
							System.out.print("#");
						} else {
							System.out.print(".");
						}
					}
				}
				System.out.println();
			}
			System.out.println();
		}
		sc.close();
	}

}


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

using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define sz(x) (int)x.size()
#define newl "\n"
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vl vector<ll>
#define pll pair<ll, ll>
#define vll vector<pll>
#define coutp cout << fixed << setprecision(12)
#define mem(x, val) memset(x, val, sizeof(x))
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define all(v) (v).begin(), (v).end()

const ld pi = 3.14159265359;
ll INF = 1e18 + 10;
ll MOD = 998244353;
ll mod = 1e9 + 7;

inline ll add(ll a, ll b, ll m)
{
    if ((a + b) >= m)
        return (a + b) % m;
    return a + b;
}

inline ll mul(ll a, ll b, ll m)
{
    if ((a * b) < m)
        return a * b;
    return (a * b) % m;
}

ll power(ll x, ll y, ll m)
{
    ll res = 1;
    x = x % m;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % m;
        y = y >> 1;
        x = (x * x) % m;
    }
    return res;
}

void solve()
{
    int n; ll k;
    cin>>n>>k;
    vl a(n);
    ll ans=0;
    for(int i=0;i<n;i++) {
        cin>>a[i];  
    }
    ll lo=1,hi=1e9;
    while(lo<=hi) {
        ll mid = (lo+hi)/2;
        ll cnt=0;
        for(int i=0;i<n;i++) {
            ll x = a[i];
            if(x>mid)
                cnt+=x/mid;
        }
        if(cnt<=k) {
            hi=mid-1;
            ans=mid;
        }
        else {
            lo=mid+1;
        }
    }

    cout<<ans;

}

int main()
{
    fastio;
    int t;

    t = 1;
    //cin >> t;
    //int test=t;
    while (t-- > 0)
    {
        //cout<<"Case #"<<(test-t)<<": ";
        solve();
        //cout << newl;
    }

    return 0;
}

Measured memory_bytes: 4724
#include<bits/stdc++.h>
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define ios; ios::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define ls(x) (x<<1)
#define rs(x) (ls(x)|1)
#define eps 1e-11
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef double db;
mt19937 rnd(random_device{}());
const int mod = 1e9 + 7;
const int N = 2e5 + 5;
const int M = 2e6 + 5;
inline ll gcd(ll a,ll b){ return b?gcd(b,a%b):a; }
inline ll lcm(ll a,ll b){ return a*b/gcd(a,b); }
inline ll ksm(ll x,ll y){ ll res=1; while(y){if(y&1) res=res*x%mod;
x=x*x%mod; y>>=1;} return res; }
int n, m, t;
struct node{
    int l,r;
}s[N];
multiset<pii> st;

int solve(){
    int L=0, R=0, l, r, ansl=0, ansr=0;
    for(auto it=st.begin();it!=st.end();it++){
        auto tmp=*it;
        if(tmp.se==1) L++;
        else R++;
        if(n&1){
            if(tmp.se==1&&L==n/2+1) ansl=tmp.fi;
            if(tmp.se==-1&&R==n/2+1) ansr=tmp.fi;
        }
        else{
            if(tmp.se==1&&L==n/2) l=tmp.fi;
            if(tmp.se==1&&L==n/2+1) ansl=tmp.fi+l;
            if(tmp.se==-1&&R==n/2) r=tmp.fi;
            if(tmp.se==-1&&R==n/2+1) ansr=tmp.fi+r;
        }
    }
    return ansr-ansl+1;
}

int main(){
    scanf("%d",&n);
    rep(i,1,n){
        cin>>s[i].l>>s[i].r;
        st.insert({s[i].l,1});
        st.insert({s[i].r,-1});
    }
    printf("%d\n",solve());
    return 0;
}
/*


*/
//
//                            _ooOoo_
//                           o8888888o
//                           88" . "88
//                           (| -_- |)
//                           O\  =  /O
//                        ____/`---'\____
//                      .'  \|     |//  `.
//                     /  \|||  :  |||//  \
//                    /  _||||| -:- |||||-  \
//                    |   | \  -  /// |   |
//                    | \_|  ''\---/''  |   |
//                    \  .-\__  `-`  ___/-. /
//                  ___`. .'  /--.--\  `. . __
//               ."" '<  `.___\_<|>_/___.'  >'"".
//              | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//              \  \ `-.   \_ __\ /__ _/   .-` /  /
//         ======`-.____`-.___\_____/___.-`____.-'======
//                            `=---='
//        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//                     佛祖保佑      永无BUG


Measured memory_bytes: 24084
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#include<time.h>
#include<fstream>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<(ll)m; i++)
#define FOR(i,n,m) for(long long i=n; i<(ll)m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

map<int,int> dp;
vector<vector<int>> co(4);
vector<pair<int,int>> pos;
vector<pair<int,int>> cir;
vector<int> mask;
ll dfs(int bit) {
	if(dp.count(bit)) return dp[bit];
	int ret=0;
	bitset<32> bi(bit);
	REP(i,4) {
		REP(j,(ll)co[i].size()) {
			if(bi[co[i][j]]==0||(bit&mask[co[i][j]])!=0) continue;
			REP(k,j) {
				if(bi[co[i][k]]==0||(bit&mask[co[i][k]])!=0) continue;
				bi[co[i][j]]=0;
				bi[co[i][k]]=0;
				ret=max((ll)ret,2+dfs(bi.to_ullong()));
				bi[co[i][j]]=1;
				bi[co[i][k]]=1;
			}
		}
	}
	return dp[bit]=ret;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	while(1) {
		ll n;
		cin>>n;
		if(n==0) return 0;
		dp.erase(ALL(dp));
		REP(i,4) co[i].resize(0);
		pos.resize(n);
		cir.resize(n);
		mask.resize(n);
		REP(i,n) {
			ll x,y,r,c;
			cin>>x>>y>>r>>c;
			c--;
			pos[i]=P(x,y);
			cir[i]=P(r,c);
		}
		REP(i,n) co[cir[i].second].pb(i);
		REP(i,n) {
			bitset<32> bi(0);
			REP(j,i) {
				if((pos[i].first-pos[j].first)*(pos[i].first-pos[j].first)+(pos[i].second-pos[j].	second)*(pos[i].second-pos[j].second)<(cir[i].first+cir[j].first)*(cir[i].first+cir[j].first)) {
					bi[j]=1;
				}
			}
			mask[i]=bi.to_ullong();
		}
		cout<<dfs((1ll<<n)-1ll)<<endl;
	}
}


Measured memory_bytes: 52244
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;

typedef pair <int, int> pii;

int v[300000], w[300000];
int dp[600][100010];
int maxj[300000];

int main () {
	int n; scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d%d", &v[i], &w[i]);
	}
	for (int i = 1; i <= min(n, 512); i++) {
		vector <pii> a;
		int x = i;
		while (x) {
			a.push_back(mp(w[x], v[x]));
			x >>= 1;
		}
//		cout << " i:" << i << endl;
		for (int mask = 0; mask < (1 << a.size()); mask++) {
			int sum = 0, val = 0;
			for (int j = 0; j < a.size(); j++) {
				if (mask >> j & 1) sum += a[j].fi, val += a[j].se;
			}
//			cout << "      sum:" << sum << " " << val << endl;
			if (sum > 100000) continue;
			dp[i][sum] = max(dp[i][sum], val);
		}
		for (int j = 1; j <= 100000; j++) {
			dp[i][j] = max(dp[i][j - 1], dp[i][j]);
		}
	}
	int q; scanf("%d", &q);
	while (q--) {
		int x, L; scanf("%d%d", &x, &L);
		vector <pii> a;
		while (x > min(n, 512)) {
			a.push_back(mp(w[x], v[x]));
			x >>= 1;
		}
		int ans = 0;
		for (int mask = 0; mask < (1 << a.size()); mask++) {
			int sum = 0, val = 0;
			for (int j = 0; j < a.size(); j++) {
				if (mask >> j & 1) sum += a[j].fi, val += a[j].se;
			}
			if (sum > L) continue;
			ans = max(ans, dp[x][L - sum] + val);
		}
		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 205868
import numpy as np

N, H = tuple(map(int, input().split(sep=" ")))
a = np.zeros((N,), dtype=np.uint32)
b = np.zeros((N,), dtype=np.uint32)
for i in range(N):
    a[i], b[i] = tuple(map(int, input().split(sep=" ")))

a_max_index = np.argmax(a)
a_max = a[a_max_index]
b_sorted_index = np.argsort(-b)
b_sorted = b[b_sorted_index]

s = np.searchsorted(-b_sorted, -a_max)
counter = 0
damage = 0

for b_selected in b_sorted[0:s]:
    damage += b_selected
    counter += 1
    if damage >= H:
        print(counter)
        exit()

# print("H: {}, damage: {}, counter: {}".format(H, damage, counter))

p, m = divmod((H - damage), a_max)
if m == 0:
    counter += p
else:
    counter += p + 1

print(counter)


Measured memory_bytes: 21648
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
int n;
struct st
{
    int s, c;
    bool operator<(const st &a) const
    {
        return s<a.s;
    }
}a[100010];
int main()
{
 
    scanf("%d", &n);
    for (int i = 1; i <= n;i++)
    {
        a[i].c = i;
        scanf("%d", &a[i].s);
    }
    sort(a+1, a + 1+n);

    for (int i = 1; i <= n; i++)
    {
        printf("%d ", a[i].c);
    } 
    return 0;
}

Measured memory_bytes: 1536
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;

//string?????§??¨?????´??°?????§?°???????
//x>y :1, x<y:-1, x=y:0
int cmp(string x, string y){
  int ret=0;
  if(x==y) ret=0;
  else{
    if(x.size() > y.size()) ret=1;
    else if(x.size() < y.size()) ret=-1;
    else{
      for(int i=0; i<x.size(); ++i){
        if(x[i]!=y[i]){
          if(x[i]>y[i]) ret=1;
          else ret=-1;
          break;
        }
      }
    }
  }
  return ret;
}

bool isNum(char c){
  return ('0'<=c && c<='9');
}

int main(){
  while(1){
    int w, h;
    cin>>w>>h;
    if(w==0 && h==0) break;

    char c[72][72];
    for(int i=1; i<=h; ++i)
    for(int j=1; j<=w; ++j)
    scanf(" %c", &c[i][j]);

    for(int i=0; i<=w; ++i) c[0][i]='0';
    for(int i=0; i<=h; ++i) c[i][0]='0';

    string dp[71][71];
    for(int i=0; i<=h; ++i){
      for(int j=0; j<=w; ++j){
        dp[i][j]="0";
      }
    }

    for(int i=1; i<=h; ++i){
      for(int j=1; j<=w; ++j){
        if(isNum(c[i][j])){
          string p=dp[i-1][j];
          string q=dp[i][j-1];

          if(p=="0") p=c[i][j];
          else p+=c[i][j];
          if(q=="0") q=c[i][j];
          else q+=c[i][j];

          if(cmp(p,q)==1) dp[i][j]=p;
          else dp[i][j]=q;
        }
      }
    }

    string ans="0";
    for(int i=1; i<=h; ++i){
      for(int j=1; j<=w; ++j){
        if(cmp(ans,dp[i][j])==-1) ans=dp[i][j];
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1416
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
#define ll long long
#define fr first
#define sc second
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()

int H, W;
int sy, sx, gy, gx;
string arr[1000];
int dist[1000][1000];

int dy[] = { 0, 0, -1, 1 };
int dx[] = { -1, 1 ,0 ,0 };

void Dijkstra() {
	for (int i = 0; i < H; i++)
		for (int j = 0; j < W; j++)
			dist[i][j] = 1e9;

	priority_queue<tuple<int, int, int>, vector<tuple<int, int, int>>
		, greater<tuple<int, int, int>>> pq;
	pq.push({ 0, sy, sx });
	dist[sy][sx] = 0;

	while (pq.size()) {
		int cury, curx, magicB;
		tie(magicB, cury, curx) = pq.top();
		pq.pop();
		
		if (magicB > dist[cury][curx]) continue;

		//0
		for (int i = 0; i < 4; i++) {
			int ny = cury + dy[i];
			int nx = curx + dx[i];
			if (ny < 0 || nx < 0 || ny >= H || nx >= W) continue;
			if (arr[ny][nx] == '#') continue;
			if (magicB < dist[ny][nx]) {
				dist[ny][nx] = magicB;
				pq.push({ magicB, ny, nx });
			}
		}

		//1
		for (int i = -2; i <= 2; i++)
			for (int j = -2; j <= 2; j++) {
				int ny = cury + i;
				int nx = curx + j;
				if (ny < 0 || nx < 0 || ny >= H || nx >= W) continue;
				if (arr[ny][nx] == '#') continue;
				if (magicB + 1 < dist[ny][nx]) {
					dist[ny][nx] = magicB + 1;
					pq.push({magicB + 1, ny, nx});
				}
			}
	}
}

int main(int argc, char** argv) {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> H >> W;
	cin >> sy >> sx >> gy >> gx;
	sy--, sx--, gy--, gx--;
	for (int i = 0; i < H; i++) cin >> arr[i];

	Dijkstra();
	int ans = dist[gy][gx];

	if (ans == 1e9) cout << -1 << '\n';
	else cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 8652
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <iomanip>
#include <stack>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

template<typename t1, class t2>
void input(t1 count,t2 array) {
	for(t1 i = 0;i < count;i++) {
		cin >> array[i];
	}
}

template<typename t1, class t2>
void output(t1 count,t2 array) {
	for(t1 i = 0;i < count;i++) {
		cout << array[i];
		if(i != count - 1) cout << " ";
	}
	cout << endl;
}

int n,s[500000],cnt;

void merge(int l,int m,int r) {
	int* ll = new int[m-l+1];
	int* rr = new int[r-m+1];
	ll[m-l] = 0x7fffffff;
	rr[r-m] = 0x7fffffff;
	for(int i = l;i < m;i++)ll[i-l]=s[i];
	for(int i = m;i < r;i++)rr[i-m]=s[i];
	int i = 0,j = 0,c = 0;
	while(c != r-l) {
		cnt++;
		if(ll[i] < rr[j]) {
			s[l+c] = ll[i];
			i++;
		}else {
			s[l+c] = rr[j];
			j++;
		}
		c++;
	}
}

void sort(int l,int r) {
	if(r <= l + 1) return;
	int m = (l + r) / 2;
	sort(l,m);
	sort(m,r);
	merge(l,m,r);
}

int main(void) {
	cin >> n;
	input(n,s);
	sort(0,n);
	output(n,s);
	cout << cnt << endl;
}



Measured memory_bytes: 65832
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll p=pow(10,9)+7;
ll phi(ll n) {
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if(n > 1)
        result -= result / n;
    return result;
}
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      
    x = x % p;  
   while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 

ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
}
ll solve(vector<ll> arr)
{
    ll i,j;
    if(arr.size()==2)
    return arr[0]+arr[1];
    vector<ll>temp;
    temp=arr;
    temp[0]=arr[0]+arr[1];
    temp.erase(temp.begin()+1);
    ll ans=arr[0]+arr[1]+solve(temp);
    
    
    for(i=1;i<arr.size()-1;i++)
    {
      temp=arr;
     
      temp[i]=arr[i]+arr[i+1];
       temp.erase(temp.begin()+i+1);
      ans=std::min(ans,arr[i]+arr[i+1]+solve(temp));
    }
    return ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m,j,k;
   cin>>n>>m;
   ll ans=(n*(n-1))/2+(m*(m-1))/2;
   cout<<ans;

   
  
 
    return 0;
    
}
    



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

using namespace std;

const int MAXN = 1000000 + 10;
int n;
string s;
int a[MAXN];

int main() {
    ios_base::sync_with_stdio(0);
    cin >> n;
    cin >> s;

    //s += '#';

    string res = "";
    int c = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == ')') {
            if (c > 0) {
                c--;
            }
                res += ")";
        } else {
            c++;
            res += "(";
        }
    }
    while (c > 0) {
        res += ")";
        c--;
    }


    s = res;
    cerr << s <<"\n";
    reverse(s.begin(), s.end());
    res = "";
    for (auto &c: s) {
        c = ')' - c +'(';
    }
    cerr << s << "\n";
    c = 0;
    n = s.length();
    for (int i = 0; i < n; i++) {
        if (s[i] == ')') {
            if (c > 0) {
                c--;
            }
                res += ")";
        } else {
            c++;
            res += "(";
        }
    }



    while (c > 0) {
        res += ")";
        c--;
    }

    reverse(res.begin(), res.end());
    for (auto &c: res) {
        c = ')' -c + '(';
    }

    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n=int(input())
count = 0

L=list(range(400,2001,200))
val=len(L)
ans = 0
for i in range(val-1):
    if L[i]<=n<L[i+1]:
        ans=8-count
        break
    else:
        count+=1
print(ans)


Measured memory_bytes: 61728
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		int d=scan.nextInt();
		int ans=0;
		for(int i=1;i!=a+1;i++) {
			if(i<=b) {
				ans+=c;
			}
			else {
				ans+=d;
			}
		}
		System.out.println(ans);
	}
	}

Measured memory_bytes: 22868
# 2020/05/06
# AtCoder Beginner Contest 151 - D

import copy

# Input
h, w = map(int,input().split())
s = list()
init_s = list('#' * (w+2))
s.append(init_s)

for i in range(h):
    ws = list(input())
    ws.insert(0, '#')
    ws.append('#')
    s.append(ws)

s.append(init_s)

q = list()
rflg = True

max_movecnt = 0
for i in range(1, h+1):
    for j in range(1, w+1):
        wk_s = copy.deepcopy(s)
        
        if s[i][j] == '.':
            wk_s[i][j] = '#'
            init_idx = [i, j]
            q.append(init_idx)
            movecnt = 0
            cntupidx = len(q)
            popcnt = 0
            # BFS
            while(len(q) > 0):
                stidx = q.pop(0)
                popcnt = popcnt + 1
                # North
                if wk_s[stidx[0]-1][stidx[1]] == '.':
                    q.append([stidx[0]-1, stidx[1]])
                    wk_s[stidx[0]-1][stidx[1]] = '#'
                # East
                if wk_s[stidx[0]][stidx[1]+1] == '.':
                    q.append([stidx[0], stidx[1]+1])
                    wk_s[stidx[0]][stidx[1]+1] = '#'
                # South
                if wk_s[stidx[0]+1][stidx[1]] == '.':
                    q.append([stidx[0]+1, stidx[1]])
                    wk_s[stidx[0]+1][stidx[1]] = '#'
                # West
                if wk_s[stidx[0]][stidx[1]-1] == '.':
                    q.append([stidx[0], stidx[1]-1])
                    wk_s[stidx[0]][stidx[1]-1] = '#'

                if popcnt >= cntupidx:
                    movecnt = movecnt + 1
                    cntupidx = len(q)
                    popcnt = 0

            max_movecnt = max(movecnt-1, max_movecnt)

# Output
print(max_movecnt)


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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

#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 irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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

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

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

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = 998244353;
const int MAX_NS = 3005;
ll A[MAX_NS];
ll dp[MAX_NS][MAX_NS];

int main()
{
	int N,S;
	cin >> N >> S;
	rep(i,N)
	{
		cin >> A[i];
	}
	dp[0][0] = 1;
	/*
	rep(i,MAX_NS-1)
	{
		dp[i+1][0] = ;
	}
	*/
	rep(i,MAX_NS-1)
	{
		rep(j,MAX_NS)
		{
			dp[i+1][j] = dp[i][j] * 2 % MOD;
			if (j >= A[i])
			{
				dp[i+1][j] = (dp[i+1][j] + dp[i][j-A[i]]) % MOD;
			}
		}
	}
	cout << dp[N][S] << endl;
	return 0;
}

Measured memory_bytes: 74136
#include<cstdio>
#include<deque>
#include<iostream>

using namespace std;
deque<int>_deq;
int main(){
	int Q,q,d,x;
	scanf("%d",&Q);
	while(Q--){
		scanf("%d",&q);
		if(q==0){
			scanf("%d%d",&d,&x);
			if(d==0) _deq.push_front(x);
			else _deq.push_back(x);
		}
		else if(q==1){
			scanf("%d",&d);
			printf("%d\n",_deq[d]);
		}
		else{
			scanf("%d",&d);
			if(d==0) _deq.pop_front();
			else _deq.pop_back();
		}
	}
	return 0;
}


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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  
  if(max(a,b)-min(a,b) == (max(a,c) -min(a,c))+(max(b,c) -min(b,c))){
    cout << "Yes" << endl;
  }
  
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const int INF = 1e6;
using namespace std;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    while(true){
        int h,w;
        cin >> h >> w;
        if(h == 0) break;
        h -= 2; w -= 2;
        rep(i,w+2) cout << '#';
        cout << endl;
        rep(i,h){
            cout << '#';
            rep(j,w){
                cout << '.';
            }
            cout << '#' << endl;
        }
        rep(i,w+2) cout << '#';
        cout << endl;
        cout << endl;
    }
}


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

def main():
    H, W, A, B = map(int, input().split())

    s0 = '1'*A + '0'*(W-A);
    s1 = '0'*A + '1'*(W-A);

    for _ in range(B):
        print(s0)

    for _ in range(H-B):
        print(s1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repX(i, n ,x) for (int i = x; i < (int)(n); ++i)
#define repBack(i, n) for (int i = n; i >= 0; --i)
#define dup(x,y) (((x)+(y)-1)/(y))

int main() {
    int K;
    string S;
    cin >> K >> S;
    if(K >= S.length())cout << S << endl;
    else{
        string ans = "";
        rep(i,K){
            ans = ans + S[i];
        }
        cout << ans+"..." << endl;
    }
    
    return 0;
}

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

int main(){
    string s;
    cin >> s;

    int len = s.size();
    for(int i = len-1; i >= 0;){
        if(s[i] == 'r' && s[i-1] == 'e' && s[i-2] == 's' &&
           s[i-3] == 'a' && s[i-4] == 'r' && s[i-5] == 'e'){
               i -= 6;
        }else if(s[i] == 'e' && s[i-1] == 's' && s[i-2] == 'a' &&
                 s[i-3] == 'r' && s[i-4] == 'e'){
            i -= 5;
        }else if(s[i] == 'r' && s[i-1] == 'e' && s[i-2] == 'm' &&
                 s[i-3] == 'a' && s[i-4] == 'e' && s[i-5] == 'r' && s[i-6] == 'd'){
            i -= 7;
        }else if(s[i] == 'm' && s[i-1] == 'a' && s[i-2] == 'e' &&
                 s[i-3] == 'r' && s[i-4] == 'd'){
            i -= 5;
        }else{
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 512
/* *Your Love Makes me STRONG,
   You'r Hate Makes Me UNSTOPABBLE.*

  *HOPE is a good thing,Maybe The BEST of Things.
   And No Good Things Ever Dies.*

  *Keep calm,Be patient And Chase Your DREAM*

*/


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MN7 ios::sync_with_stdio(0);cin.tie(nullptr);
using namespace std;
ll t, n, i, j, k, a, b, c, d, p, q, r, x, y, z, m, cnt, flag, ans;
string s;
void nahid()
{

	cin >> n;
	cin >> s;
	if (n % 2)cout << "No" << endl;
	else
	{	x = n / 2;
		for (i = 0, j = x; i < x, j < n; ++i, ++j)
		{
			if (s[i] != s[j])flag++;

		}
		if (flag)cout << "No" << endl;
		else cout << "Yes" << endl;
	}



}
int main()
{	MN7 //cin>>t;while(t--)
	nahid();
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<58;
const ll mod=1e9+7;


int main(){
  int i,j;
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(d==1) cout<<1<<endl;
  else cout<<0<<endl;
  
  return 0;
}

Measured memory_bytes: 256
/*input
211 5
31 41 59 26 53
*/

#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>

using namespace std;

void run() {
	ll h, n, i, sum=0;
	cin >> h >> n;
	for(i=0; i<n; i++) {
		ll x;
		cin >> x;
		sum += x;
	}
	if(sum >= h) cout << "Yes" << endl;
	else cout << "No" << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);		
	int t = 1;
	//cin >> t;
	while(t--) {
		run();
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back

#define N 100010
#define MOD 1000000007

ll n, m;


ll gcd(ll i, ll j)
{
	if(j == 0)
		return i;
	return gcd(j, i % j);
}
ll lcm(ll i, ll j)
{
	return (i * j)/gcd(i , j);
}

ll f(ll n)
{
	if(n == -1)
		return 0;
	ll k = n & 3;
	if(k == 0)
		return n;
	else if(k == 1)
		return 1;
	else if(k == 2)
		return n + 1;
	else
		return 0;
}

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

	ll a, b;
	cin >> a >> b;
	ll ans = f(b)^f(a - 1);
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	
	char S[3];
	int topping=0,i;
	
	scanf("%s",S);
	
	for(i=0;i<3;i++){
		if(S[i]=='o'){
		topping++;
		}
	}
	
	printf("\n%d\n\n",700+100*topping);
	
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Linq;

class DigitNumber
{
	static void Main()
	{
		var sums =
			from numpair in Enumerable.Range( 0, 1000000 )
				.Select( _ => Console.ReadLine() )
				.TakeWhile( _ => _ != null )
				.Select( _ => _.Split( ' ' ).Select( __ => int.Parse( __ ) ) )
			let a = numpair.First()
			let b = numpair.Last()
			select "" + ( a + b );
		foreach( var sum in sums )
			Console.WriteLine( sum.Length );
	}
}

Measured memory_bytes: 6028
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n;
void out(ll x,ll y,ll z){
	printf("%lld %lld %lld\n",x,y,z);
	exit(0);
}
void f(){
	ll c,m;
	for(ll i=1;i<=3500;i++)
		for(ll j=1;j<=3500;j++){
			c=n*i*j;
			m=4*i*j-n*i-n*j;
			if(m>0&&c%m==0)out(i,j,c/m);
		}
}
int main(){
	cin>>n;
	if(n%2==0)out(n,n,n/2);
	if(n%3==0)out(n,n/3*2,n/3*2);
	if((n-3)%4==0)out((n+1)/4,(n+1)*(n+1)/4,(n+1)*(n+1)*n/4);
	if((n-1)%4==0)f();
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int i;
	int a,b,c;
	while(1){
	b=0;
	scanf("%d",&a);
	if(a==0)return 0;
	for(i=0;i<9;i++){
		scanf("%d",&c);
		b+=c;
	}
	printf("%d\n",a-b);
	}
	return 0;
	
}

Measured memory_bytes: 600
N = int(input())

d = 1000000007
result = int(10 ** N) % d
result -= int(9 ** N) % d
result = result % d
result *= 2
result = result % d
result -= int(10 ** N) % d
result += int(8 ** N) % d

result = result if result >= 0 else d + result
print(result)

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

int main(){
    int k, a, b;
    cin >> k >> a >> b;
    for(int i = a; i <= b; i++){
        if(i % k == 0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}

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

int main() {
  int k;
  cin >> k;
  int a, b;
  cin >> a >> b;
  for(int i = 0; i < b - a + 1; i++) {
    if((i + a) % k == 0) {
      cout << "OK" << endl;
      break;
    } else if(i != b - a) {
    continue; 
    }
    cout << "NG" << endl;
    break;
  }
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int H, N;
  cin >> H >> N;
  vector<vector<int>> M(N, vector<int>(2));
  int K = 1000000000;
  for (int i = 0; i < N; i++) {
    cin >> M.at(i).at(0) >> M.at(i).at(1);
    K = min(K, M.at(i).at(1));
  }
  sort(M.begin(), M.end());
  vector<int> DP(H + 1, 1000000000);
  for (int i = 1; i < min(M.at(0).at(0), H + 1); i++) {
    DP.at(i) = K;
  }
  DP.at(0) = 0;
  for (int i = 0; i <= H; i++) {
    for (int j = 0; j < N; j++) {
      if (i >= M.at(j).at(0)) {
        DP.at(i) = min(DP.at(i), DP.at(i - M.at(j).at(0)) + M.at(j).at(1));
      }
      else {
        DP.at(i) = min(DP.at(i), M.at(j).at(1));
      }
    }
  }
  cout << DP.at(H) << endl;
}

Measured memory_bytes: 3732
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    for i in range(h):
        for j in range(w):
            if (i+j) % 2 == 0:
                print("#",end = "")
            else:
                print(".", end = "")
        print()
    print()


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

#define For(i,a,b) for(int (i) = (a);(i) < (b);i += 1)
#define Rep(i,n) For((i),0,(n))
#define All(a) (a).begin(),(a).end()
#define sp " "
#define INF 1e18
#define INT_INF 1e9
#define MAX_N 100000

typedef long long ll;
const ll MOD = 1000000007;
const ll MOD_9 = 998244353;

int main(){
    string S,T;
    cin >> S >> T;
    cout << T << S << endl;
    //cin >> T;
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/abc143/tasks/abc143_a
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n,b;
    cin >> n >> b;
    if(n-2*b>0) cout << n-2*b << endl;
    else cout << "0" << endl;
}

Measured memory_bytes: 256
import math

A, B, H, M = map(int, input().split())
m_angle = M * 6
h_angle = H * 30 + M * 0.5
angle = abs(m_angle - h_angle)
angle = min(angle, 360 - angle)

C = (A*A + B*B - 2*A*B*math.cos(math.radians(angle)))**0.5
print(C)


Measured memory_bytes: 9560
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
long long a[N];
int main()
{
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
	int a,b;
	cin>>a>>b;
	if(a==b)
	{
		for(int i=0;i<a;i++)cout<<a;return 0;
	}
	else if(a<b)
	{
		int t=b;
		b=a;
		a=t;

	}
		for(int i=0;i<a;i++)cout<<b;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    int n;  cin >> n;
    vector<int> x(n+1),y(n+1);
    rep(i,1,n+1) cin >> x[i] >> y[i];
    vector<int> t(n);
    rep(i,0,n) t[i] = i+1;

    long double dis = 0;
    ll count = 0;
    do{
        count++;
        for(int i=0;i<n-1;i++)
            dis += sqrt( (x[t[i]]-x[t[i+1]])*(x[t[i]]-x[t[i+1]]) + (y[t[i]]-y[t[i+1]])*(y[t[i]]-y[t[i+1]]) );
    }while(next_permutation(ALL(t)));

    cout << fixed << setprecision(10) << dis/count << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	var input string
	input = nextLine()
	var weather string
	if input == "Sunny" {
		weather = "Cloudy"
	} else if input == "Cloudy" {
		weather = "Rainy"
	} else if input == "Rainy" {
		weather = "Sunny"
	}
	fmt.Print(weather)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int n;
long long a[300001],maxn,ans,tot;
int b[300001][65];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%lld",&a[i]),maxn=max(maxn,a[i]);
	for(int i=1;i<=n;i++)
	for(int j=0;(1ll<<j)<=a[i];j++)
	if((1ll<<j)&a[i])
	b[i][j]=1;
	for(int i=0;(1ll<<i)<maxn;i++)
	{
		tot=0;
		for(int j=1;j<=n;j++)
		tot+=b[j][i];
		ans=(ans+(1ll<<i)%mod*((tot*(n-tot))%mod)%mod)%mod;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 78720
#include <cstdio>
#include <algorithm>
using namespace std;

int n, c, k, t[100001], q[100001];

int main(){
	scanf("%d %d %d", &n, &c, &k);
	for(int i=1; i<=n; i++)
		scanf("%d", &t[i]);
	sort(t+1, t+1+n);

	for(int i=1; i<=n; i++)
		q[i]=t[i]+k;
	int ans=0;
	for(int i=1; i<=n;){
		int cnt=0;
        for(int j=i; j<=min(n, i+c-1); j++){
			if(t[j]<=q[i] && q[i]<=q[j])
				cnt++;
			else break;
        }
        i=i+cnt;
        ans++;
	}
	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 896
N,M,X=map(int,input().split())
CA=[list(map(int,input().split())) for i in range(N)]
ans=10**18
x=[0]*M
for i in range(1,2**N):
  _ans=0
  _x=x[:]
  f=True
  for j in range(N):
    if i%2==1:
      for k,a in enumerate(CA[j]):
        if k==0:
          _ans+=a
        else:
          _x[k-1]+=a
    i=i//2
  for _ in _x:
    if _<X:
      f=False
      break
  if f:
    ans=min(ans,_ans)
if ans==10**18:
  ans=-1
print(ans)

Measured memory_bytes: 9228
s=[]

cnt=0

while 1:
    max=0
    n,m =map(int,input().split())
    if n==0 and m==0:
        break
    l=list(map(int,input().split()))


    for i in range(len(l)):
        for j in range(len(l)):
            if max<l[i]+l[j] and i!=j and m>=l[i]+l[j]:
                max=l[i]+l[j]

    if max==0:
        s+=["NONE"]
    else:
        s+=[max]


for x in s:
    print(x)



Measured memory_bytes: 5712
#include<stdio.h>

int n,A[1000];

void printSort(int A[]){

	printf("%d",A[0]);
	for(int i = 1; i < n; i++){
		printf(" %d",A[i]);
	}
	printf("\n");
}


void insertionSort(){

	int v;

	for(int i = 1; i < n; i++){

		v = A[i];
		
		for(int j = i-1; j >= 0; j--){

		if(A[j] > v){
			A[j+1] = A[j];
			A[j] = v;
		}
		else	break;

		}

		printSort(A);

	}

}


int main(){

	scanf("%d",&n);

	for(int i = 0; i < n; i++){
		scanf("%d",&A[i]);
                            //printf("%d", A[i]);
	}
              printSort(A);
	insertionSort();

	return 0;
}

Measured memory_bytes: 1036
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
typedef vector<vector<ll>> Matrix;
Matrix operator*(Matrix &A, Matrix &B) {
	int r1 = A.size(), c1 = A[0].size();
	int r2 = B.size(), c2 = B[0].size();
	Matrix res(r1, vector<ll>(c2));
	for (int i = 0; i < r1; i++) {
		for (int j = 0; j < c2; j++) {
			ll s = 0;
			for (int k = 0; k < c1; k++) {
				(s += A[i][k] * B[k][j]) %= MOD;
			}
			res[i][j] = s;
		}
	}
	return res;
}
Matrix pow(Matrix &A, ll n) {
	if (n == 1) return A;
	Matrix t = pow(A, n / 2);
	t = t * t;
	if (n & 1) t = A * t;
	return t;
}
int main() {
	int N;
	cin >> N;
	ll K;
	cin >> K;
	Matrix a(N, vector<ll>(N));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> a[i][j];
		}
	}
	Matrix b = pow(a, K);
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			(ans += b[i][j]) %= MOD;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <math.h>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int N = 1e5 + 10;
const int mod = 998244353;
const double eps = 1e-8;


int main()
{
    int n, k, h[N];
    cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>h[i];

    sort(h+1, h+1+n);

    int ans = 1e9;

    for(int i=1;i<=n-k+1;i++) {
        ans = min(ans, h[i+k-1] - h[i]);
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 640
#!usr/bin/env python3
import sys
import math
import string
import collections
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect

MOD = 10 ** 9 + 7
INF = 10 ** 18
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)

H = int(input())
while H != 0:
    table = [list(map(int, input().split())) for _ in range(H)]
    prev_ans = -1
    ans = 0
    while ans != prev_ans:
        prev_ans = ans
        for i in range(H):
            for j in range(3):
                if table[i][j] != -1:
                    if table[i][j] == table[i][j + 1] == table[i][j + 2]:
                        for l in range(j + 2, 5):
                            if table[i][j] != table[i][l]:
                                ans += (l - j) * table[i][j]
                                for k in range(j, l):
                                    table[i][k] = -1
                                break
                            elif l == 4:
                                ans += (l - j + 1) * table[i][j]
                                for k in range(j, 5):
                                    table[i][k] = -1
                                break
        for i in range(H - 2, -1, -1):
            for j in range(5):
                if table[i][j] != -1:
                    if table[i + 1][j] == -1:
                        for l in range(i + 1, H):
                            if table[l][j] != -1:
                                table[l - 1][j] = table[i][j]
                                for k in range(i, l - 1):
                                    table[k][j] = -1
                                break
                            elif l == H - 1:
                                table[l][j] = table[i][j]
                                table[i][j] = -1
                                break

    print(ans)
    H = int(input())



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

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

    ll ans=1,lim=1000000000000000000;
    bool flg=true;
    
    rep(i,n){
        ll a;
        cin >> a;
        if(ans!=0&&lim/ans<a){
            flg=false;
        }
        if(a==0){
            flg=true;
            ans=0;
            break;
        }
        ans*=a;
    }
    if(!flg||ans>lim){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <stack>

using ll = long long;

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

    std::vector<int > a(9);
    for (int i = 0; i < N; i++) {
        int x;
        std::cin >> x;
        int in = std::min(8, (x / 400));
        a[in]++;
    }

    int ans = 0;
    for (int i = 0; i < 8; i++) {
        if (a[i] > 0)ans++;
    }

    if (ans == 0) {
        std::cout << 1 << " " << a[8];
    }
    else {
        std::cout << ans << " ";
        ans += a[8];
        std::cout << ans << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
import math

def is_sosuu(X):
  # 2以外の偶数は素数ではないので無視する
  if X % 2 == 0 and N != 2:
    return False
  
  # 繰り返しの上限を対象の平方根にする
  limit = int(math.sqrt(X)) + 1
  # ２の倍数を省く
  numbers = [i for i in range(3, limit) if i % 2 == 1]
  for i in numbers:
    if X % i == 0:
      return False

  return True

N = int(input())
while True:
  if is_sosuu(N):
    print(N)
    break
  N+=1

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>
#include <set>

using namespace std;

template<typename T>inline T get(){T x;cin>>x;return x;}

int main()
{
    char prev = '?';
    const char* ans = "Good";

    for (int i = 0; i < 4; i++) {
        char c;

        cin >> c;
        if (c == prev)
            ans = "Bad";
        prev = c;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    tmp0 = input[0].split(" ");
    N = Number(tmp0[0]);
    M = Number(tmp0[1]);
 
    var l=1;r=N;
    for(var i=1; i<=M;i++){
        tmp1 = input[i].split(" ")
        L = Number(tmp1[0])
        R = Number(tmp1[1])
       // console.log(L);
        //console.log(R);
        if(l<L){var l=L}
        if(r>R){var r =R}
    }
    if(r >= l){console.log(r-l+1);}
    else{console.log(0);}
  }
  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//   

Measured memory_bytes: 28988
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x7f
#define MAX_INF_VAL 0x7f7f7f7f
#define pi 3.141592653589
#define eps 1e-10
//#define p 2173412051LL
#define sz 2
 
using namespace std;

int n, m, l;

struct status {
	int u, times, _left;
};
struct cmp {
	bool operator () ( const status &a, const status &b ) const {
		if( a.times == b.times )
			return a._left < b._left;
		return a.times > b.times;
	}
};
struct e {
	int v, dis;
};
vector< e > edge[ 301 ];
int dis[ 301 ], _left[ 301 ];
priority_queue< status, vector< status >, cmp > q;

int ans[ 301 ][ 301 ];

void dijk( int );
void update( int, int, int );

int main() {
	int a, b, c;
	int q;
	scanf( "%d%d%d", &n, &m, &l );
	while( m-- ) {
		scanf( "%d%d%d", &a, &b, &c );
		if( c > l )
			continue;
		edge[ a ].push_back( e{ b, c } );
		edge[ b ].push_back( e{ a, c } );
	}
	for( int i = 1; i <= n; ++i ) {
		dijk( i );
		for( int j = 1; j <= n; ++j )
			ans[ i ][ j ] = dis[ j ];
	}
	scanf( "%d", &q );
	while( q-- ) {
		scanf( "%d%d", &a, &b );
		if( ans[ a ][ b ] == MAX_INF_VAL )
			printf( "-1\n" );
		else
			printf( "%d\n", ans[ a ][ b ] );
	}
	return 0;
}

void dijk( int x ) {
	status p;
	memset( dis, MAX_INF, sizeof( dis ) );
	memset( _left, 0, sizeof( _left ) );
	q.push( status{ x, 0, l } );
	dis[ x ] = 0;
	_left[ x ] = l;
	while( !q.empty() ) {
		p = q.top();
		q.pop();
		if( p.times == dis[ p.u ] && p._left == _left[ p.u ] )
			update( p.u, p.times, p._left );
	}
}

void update( int u, int d, int lt ) {
	int v, nd, nlt;
	int ddd;
	for( int i = 0; i < edge[ u ].size(); ++i ) {
		v = edge[ u ][ i ].v;
		ddd = edge[ u ][ i ].dis;
		if( lt >= ddd ) {
			nd = d;
			nlt = lt - ddd;
		} else {
			nd = d + 1;
			nlt = l - ddd;
		}
		if( nd < dis[ v ] || ( nd == dis[ v ] && nlt > _left[ v ] ) ) {
			dis[ v ] = nd;
			_left[ v ] = nlt;
			q.push( status{ v, nd, nlt } );
		}
	}
}

Measured memory_bytes: 2048