akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cout << #x << ": " << x << ", "
#define debugln(x) cout << #x << ": " << x << '\n'

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

int extgcd(int a, int b, int &x, int &y) {
  int d = a;
  if (b != 0) {
    d = extgcd(b, a%b, y, x);
    y -= (a/b)*x;
  } else {
    x = 1;
    y = 0;
  }
  return d;
}

// m is a large prime integer. Usually 1000000007 is used.
int mod_inverse(int a, int m) {
  int x, y;
  extgcd(a, m, x, y);
  return (m + x%m)%m;
}

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

  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) {
    cin >> a.at(i);
  }

  ll fact = 1;
  for(int i=1; i<=n; i++) {
    fact *= i;
    fact %= mod;
  }

  vector<ll> s(n+1);
  s.at(1) = fact;
  for(int i=2; i<=n; i++) {
    s.at(i) = s.at(i-1) + (fact*mod_inverse(i, mod));
    s.at(i) %= mod;
  }

  ll ans = 0;
  rep(i, n) {
    ll k = s.at(n-i);
    k += s.at(i+1) - s.at(1) + mod;
    k %= mod;
    ans += a.at(i) * k;
    ans %= mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define RREP(i, n) for(int i = n; i >= n; i--)

#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))

#define endl "\n"
#define pb push_back
#define rtn return
#define elif else if

#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

typedef long long ll;
typedef unsigned long long ull;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

/********************Template********************/

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

	int w, h, n, x[100], y[100], a[100], ans = 0;
	cin >> w >> h >> n;
	REP(i, n) cin >> x[i] >> y[i] >> a[i];

	REP(i, w){
		REP(j, h){
			int cnt = 1;
			REP(k, n){
				if(a[k]==1 and i >= x[k]) continue;
				if(a[k]==2 and i < x[k]) continue;
				if(a[k]==3 and j >= y[k]) continue;
				if(a[k]==4 and j < y[k]) continue;
				cnt = 0;
			}
			ans += cnt;
		}
	}
	cout << ans << endl;
	rtn 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    if (a<b&&b<c)
        cout << a << " " << b << " " << c<<"\n";
    
    else if (a>b&&b>c)
        cout << c <<" " <<b <<" "<< a <<"\n";

    else if (a<b&&b>c)
        cout << a <<" "<< c <<" "<< b<<"\n";

    else if (a<b&&a>c)
        cout << c <<" "<< a <<" "<< b<<"\n";
    
    else if (a>b&&a<c)
        cout << b <<" "<< a <<" "<< c<<"\n";
     
    else if (a>b&&a>c)
        cout << b <<" "<< c <<" "<< a<<"\n";
}
    


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

int main(){
  ll n,p,ans=1,count=0;
  map<ll,ll> mp;
  cin >> n >> p;
  ll q=p;
  if(n>=40)cout<<1<<endl;
  else if(n==1)cout<<p<<endl;
  else{
    ll i=2;
    while(i<=sqrt(q)){
      if(p%i!=0){
      count=0;
      if(i==2)i++;
        else i+=2;
      }
      else {
        p/=i;
        count++;
        if(count==n){
        count=0;
        ans*=i;
      }
      }
    }
    cout<<ans<<endl;
  }
}

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

int main() {
  int K, X;
  cin >> K >> X;
  for (int i=-K+1; i<K; i++) {
    if (i==K-1) {
      cout << X+i << endl;
    }
    else {
      cout << X+i << " ";
    }
  }
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }

const ll INF=1e18;
//aising2020
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    V<int> a(n);
    cinf(n,a);
    int ans=0;
    rep(i,n){
        if((i+1)%2==1&&a[i]%2==1)ans++;
    }
    cout<<ans<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
doubleを扱うときには(abs)ではなく'fabs'!!!
*/

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

int main() {
	long long n,m;
	cin >> n >> m;
	long long sum = 0,x;
	for(long long i=0;i<m;i++){
	  cin >> x;
	  sum = sum + x;
	}
	if(sum>n){
	    cout << -1 << endl;
	}
	else{
	    cout << n-sum << endl;
	}
	return 0;
}


Measured memory_bytes: 3596
#                         author:  kagemeka 
#                         created: 2019-11-07 13:09:56(JST)
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator

def main():
    a, b = (int(x) for x in sys.stdin.readline().split())
    ans = a if b >= a else a - 1
    print(ans)


if __name__ == "__main__":
    # execute only if run as a script
    main()


Measured memory_bytes: 2940
package main

import (
  "fmt"
)

func main(){
  var n int64;
  fmt.Scan(&n);
  var sum int64;
  for i:=int64(1);i<=n;i++{
    if(i%3==0 || i%5==0){
    	continue;
    }else{
    	sum+=i
    }
  }
  fmt.Println(sum)

}

Measured memory_bytes: 1752
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
using namespace std;

int main()
{
    int a,b,c;
    while(scanf("%d %d %d",&a,&b,&c)!=EOF)
    {
        int K;
        scanf("%d",&K);
        int temp=a;
        if(temp<b)
            temp=b;
        if(temp<c)
            temp=c;
        int sun=temp;
        for(int i=0;i<K;i++)
        {
            sun=sun*2;
        }
        sun=sun+a+b+c-temp;
        printf("%d\n",sun);
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<queue>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=100005,MAXM=200005;
int n,m,q;
int cl[MAXN],co[MAXN];
struct edge
{
	int v,nxt;
	edge(){}
	edge(int vv,int nn)
	{
		v=vv,nxt=nn;
	}
}E[MAXM];
int w[MAXN],ncnt=0;
void addedge(int u,int v)
{
	E[++ncnt]=edge(v,w[u]);
	w[u]=ncnt;
	E[++ncnt]=edge(u,w[v]);
	w[v]=ncnt;
}
struct node
{
	int u,t,id;
	node(){}
	node(int uu,int tt,int ii)
	{
		u=uu,t=tt,id=ii;
	}
	bool operator<(const node &a)const
	{
		if(a.t==t)
			return a.id>id;
		return a.t>t;
	}
};
struct Que
{
	int v,d,c;
}que[MAXN];
priority_queue<node>Q;
int main()
{
	//freopen("splatter.in","r",stdin);
	//freopen("splatter.out","w",stdout);
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int u,v;
		scanf("%d %d",&u,&v);
		addedge(u,v);
	}
	scanf("%d",&q);
	for(int i=1;i<=q;i++)
	{
		int v,d,c;
		scanf("%d %d %d",&v,&d,&c);
		Q.push(node(v,d,i));
		co[i]=c;
	}
	while(!Q.empty())
	{
		node x=Q.top();
		Q.pop();
		if(cl[x.u]>=x.id)
			continue;
		cl[x.u]=x.id;
		if(x.t==0)
			continue;
		for(int i=w[x.u];i;i=E[i].nxt)
		{
			int v=E[i].v;
			if(cl[v]>=x.id)
				continue;
			Q.push(node(v,x.t-1,x.id));
		}
	}
	for(int i=1;i<=n;i++)
	{
		printf("%d\n",co[cl[i]]);
	}
	fclose(stdin);
	fclose(stdout);
}

Measured memory_bytes: 10096
#include<bits/stdc++.h>
#define ull unsigned long long
# define ll long long
# define mod 1000000007LL 
using namespace std;
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    ll arr[n];
    priority_queue<ll>ans;
    for(int i=0;i<n;i++)
    {
    cin>>arr[i];
    ans.push(arr[i]);
    }
    ll temp=0;
    while(k--)
    {
        temp=ans.top();
        temp=temp/2;
        ans.pop();
        ans.push(temp); 
    }
    ll sum=0;
    while(ans.size()!=0)
    {
        temp=ans.top();
        ans.pop();
        sum+=temp;
    }
    cout<<sum;


    
    return 0;
}

Measured memory_bytes: 5032
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

    int N; cin >> N;
    vel A(N), B(N), C(N);
    rep(i,N) cin >> A[i]; rep(i,N) cin >> B[i]; rep(i,N) cin >> C[i];

    sort(all(A)), sort(all(B)) , sort(all(C));

    ll ans = 0;
    rep(i,N) {
        auto it = lower_bound(all(A), B[i]);
        ll index = it - A.begin();
        auto it2 = lower_bound(all(C), B[i]+1);
        ll index2 = C.end() - it2;
        ans += index * index2;
    }
    cout << ans << endl;
    return 0;
}

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


int main(){
    int x,hour,min,sec;
    cin>>x;
    hour=x/3600;
    min=(x-hour*3600)/60;
    sec=x%3600-min*60;
    cout<<hour<<":"<<min<<":"<<sec<<endl;
    return 0;
}


Measured memory_bytes: 3100
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

using namespace std;

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int main()
{
    int n;
    while (cin >> n, n) {
        int d[10][10];
        fill_n((int *)d, 10 * 10, INF);
        for (int i = 0; i < n; i++) {
            int from, to, cost;
            cin >> from >> to >> cost;
            d[from][to] = d[to][from] = cost;
        }
        for (int k = 0; k < 10; k++) {
            for (int i = 0; i < 10; i++) {
                for (int j = i+1; j < 10; j++) {
                    d[i][j] = d[j][i] = min(d[i][k] + d[k][j], d[i][j]);
                }
            }
        }
        vi sums;
        for (int i = 0; i < 10; i++) {
            int sum = 0;
            for (int j : d[i]) {
                if (j != INF) sum += j;
            }
            if (sum != 0) sums.pb(sum);
        }
        int m = sums[0];
        int ind = 0;
        for (int i = 0; i < sums.size(); i++) {
            if (m > sums[i]) {
                m = sums[i];
                ind = i;
            }
        }
        cout << ind << " " << m << endl;
    }
    return 0;
}

Measured memory_bytes: 1208
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf_int = 1e9 + 100;
const ll inf_ll = 1e18;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double dbl;
#define pb push_back
const double pi = 3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz(a) (int(a.size()))
#define all(a) a.begin(),a.end()
bool debug = 0;
const int MAXN = 4100 + 100;
const int LOG = 22;
const int mod = 1e9 + 7;
const int MX = 1e6 + 100;
typedef long long li;
const li MOD = 1000000000949747713ll;


void solve() {
    int n;
    cin >> n;
    map<int,int> mp;
    int last = -1;
    for(int i=1;i<=n;++i){
        int x;
        cin >> x;
        last = x;
        mp[x]++;
    }
    if(mp.count(0)==1 && mp[0] == n){
        cout <<"Yes";
        return;
    }
    if(sz(mp) != 3){
        if(sz(mp) == 2 && n%3==0 && mp[0] == n/3){
            cout <<"Yes";
            return;
        }
        
        cout <<"No";
        return;
    }
    int val = mp[last];
    vector<int> v;
    for(auto x:mp){
        if(x.se != val){
            cout <<"No";
            return;
        }
        v.pb(x.fi);
    }
    if(n%3 != 0){
        cout <<"No";
        return;
    }

    sort(all(v));
    for(int val:v){
        dout << val<<" ";
    }
    dout << endl;


    do{
        bool flag = true;
        for(int i = 0;i < 3;++i){
            if((v[i] ^ v[(i+2)%3]) != (v[(i+1)%3])){
                flag = false;
                break;
            }
        }
        if(flag){
            cout <<"Yes";
            return;
        }
    }while(next_permutation(all(v)));
    cout <<"No";
    return;
}

signed main() {
#ifdef zxc
    debug = 1;
    freopen("../input.txt", "r", stdin);
  //  freopen("../output.txt", "w", stdout);
#else

#endif //zxc
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(20);

    int t = 1;
    while (t--)
        solve();

    if (debug)
        cerr << endl << "time : " << (1.0 * clock() / CLOCKS_PER_SEC) << endl;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
pair<ll,pair<ll,ll>> p[110];
#define f first
#define sf second.first
#define ss second.second
int main() {
  ll n;
  cin>>n;
  for(ll i=0;i<n;i++)cin>>p[i].ss>>p[i].sf>>p[i].f;
  sort(p,p+n);
  for(ll i=0;i<=100;i++){
    for(ll j=0;j<=100;j++){
      bool f=1;
      ll yan=abs(p[n-1].ss-i)+abs(p[n-1].sf-j)+p[n-1].f;
      if(yan<=0)continue;
      for(ll k=0;k<n;k++){
        if(max(yan-abs(p[k].ss-i)-abs(p[k].sf-j),0ll)!=p[k].f)f=0;
      }
      if(f){
        cout<<i<<' '<<j<<' '<<yan<<endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 1000007
#define INF63 1061109567
#define INF127 9187201950435737471
#define UINF 18446744073709551615
#define F first
#define S second
#define ll long long
using namespace std;
long double a,b,c;
int main(){
	long double x;
	cin>>a>>b>>c;
	x=sqrt(a*b*4);
	if(a+b+x<c)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
 
using namespace std;

void check_white(int x, int y);
void check_black(int x, int y);
// map[x][y]とする。 x:↓ y:→

int W, H;
int issearched[50][50];
char landmap[50][50];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
// 上、左、下、右の順で探す
int nx, ny;

int main()
{
    while(1){
        cin >> W >> H;
        if(W == 0 && H == 0) break;
        vector<pair<int, int> > whitepost(2500);
        vector<pair<int, int> > blackpost(2500);
        int whitecnt = 0, blackcnt = 0;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                cin >> landmap[i][j];
                if(landmap[i][j] == 'W'){
                    whitepost[whitecnt] = make_pair<int, int>(i, j);
                    whitecnt++;
                } else if(landmap[i][j] == 'B'){
                    blackpost[blackcnt] = make_pair<int, int>(i, j);
                    blackcnt++;
                }
            }
        }
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                issearched[i][j] = 0;
            }
        }
        for(int i = 0; i < whitecnt; i++) check_white(whitepost[i].first, whitepost[i].second);
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                issearched[i][j] = 0;
            }
        }
        for(int i = 0; i < blackcnt; i++) check_black(blackpost[i].first, blackpost[i].second);
        int white_land = 0, black_land = 0;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if(landmap[i][j] == 'w') white_land++;
                else if(landmap[i][j] == 'b') black_land++;
            }
        }
        cout << black_land << ' ' << white_land << endl;
    }
    return 0;
}

void check_white(int x, int y)
{
    for(int i = 0; i < 4; i++){
        nx = x + dx[i];
        ny = y + dy[i];
        if(nx < 0 || ny < 0 || nx >= H || ny >= W) continue;
        else {
            if(issearched[nx][ny] == 0){
                issearched[nx][ny] = 1;
                if(landmap[nx][ny] == '.'){
                    landmap[nx][ny] = 'w';
                    check_white(nx, ny);
                }
                 // else if(map[nx][ny] == 'w'){
                    // check_white(nx, ny);
                // }
            }
        }
    }
    return;
}

void check_black(int x, int y)
{
    for(int i = 0; i < 4; i++){
        nx = x + dx[i];
        ny = y + dy[i];
        if(nx < 0 || ny < 0 || nx >= H || ny >= W) continue;
        else {
            if(issearched[nx][ny] == 0){
                issearched[nx][ny] = 1;
                if(landmap[nx][ny] == '.'){
                    landmap[nx][ny] = 'b';
                    check_black(nx, ny);
                } else if(landmap[nx][ny] == 'w'){
                    landmap[nx][ny] = '.';
                    check_black(nx, ny);
                }
            }
        }
    }
    return;
}

Measured memory_bytes: 1284
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var dg = Console.ReadLine().Split(' ').Select(v => double.Parse(v)).ToList();

            var n = dg[0];
            var m = dg[1];
            var x = dg[2];
            var y = dg[3];

            var xx = Console.ReadLine().Split(' ').Select(v => double.Parse(v)).ToList();
            xx.Add(x);
            var mx = xx.Max();
            
            var yy = Console.ReadLine().Split(' ').Select(v => double.Parse(v)).ToList();
            yy.Add(y);
            var my = yy.Min();
            
            Console.WriteLine(mx < my ? "No War" : "War");
        }
    }
}


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

int main(){
    int N;
    int cake_val = 4;
    int donut_val = 7;
    string ans = "No";

    cin >> N;

    int i=0;
    while( (N - cake_val * i) >= 0 ){
        if( (N - cake_val * i) % donut_val == 0) {
            ans = "Yes";
            break;
        }
        i++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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

	int N,x;
	cin >> N >> x;

	if (x == 1 || x == 2 * N - 1) {
		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;

	if (N == 2) {
		cout << 1 << " " << 2 << " " << 3 << endl;
		return 0;
	}

	VI ans(2 * N - 1);
	ans[N - 1] = x;
	ans[N-2] = x - 1;
	ans[N] = x + 1;

	int j = 1;
	REP(i, 2*N-1) {
		if (i == N - 1 || i==N || i==N-2)continue;
		if (j==x-1)j+=3;
	
		ans[i] = j;
		j++;
	}
	REP(i, 2 * N - 1)
		cout << ans[i] << endl;

	return 0;
}



Measured memory_bytes: 3072
// J'aime
// Chemise Blanche

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  int n, i;
  cin >> n >> i;
  cout << n - i + 1 << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3628
#include <algorithm>
#include <array>
#include <assert.h>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvd;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;



int main() {
    cout << setprecision(30);
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    ll n;
    cin >> n;
    vl b;
    b.pb(1e6);
    for (ll i = 0; i < n - 1; ++i) {
        ll x;
        cin >> x;
        b.pb(x);
    }
    b.pb(1e6);
    ll ans = 0;
    for (ll i = 0; i < n; ++i) {
        ans += min(b[i], b[i + 1]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
using namespace std;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
//     tree_order_statistics_node_update>;
 
typedef long long int ll;
const ll N = 1e5 +9;
const ll p = 31;
// const ll m = 1e9 + 7;
const ll inf= 1e14;
const ll mod = 1e9+7;
#define x first
#define y second
#define pb push_back
#define mp make_pair
using pii = pair<ll, ll>;
ll powm(ll a, ll b) { a = a%mod;ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }
ll ct[N];
int main()
{   
    ios::sync_with_stdio(false);
     cin.tie(0);
     cout.tie(0);
                            

    ll T= 1;
    // cin >> T;
    while(T--){
        ll n;cin>>n;
        for(int i = 0;i<n;i++){
            ll a;cin>>a;
            ct[a]++;
        }
        ll h = n/2;
        ll ans= 0;
        for(int i = 1;i<N;i++){
            ct[i]+=ct[i-1];
            if(ct[i]==h){
                ans++;
            }
        }
        cout<<ans<<'\n';
    }
    return 0;
}   

Measured memory_bytes: 1024
/****************************************************************
# @Author:      iLovePKU_zbtxdy
# @DateTime:    2020-02-06 21:52:03
# @Description: Think twice. Code once. 
# @More: Once lots of AC, try Brute-force,dynamic programming
****************************************************************/
#include<bits/stdc++.h>
using namespace std;
#define close std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define eps 1e-8
typedef long long ll;
const int maxn = 1e6+10;
const int INF = 0x3f3f3f3f;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0);
ll mod = 1e9+7;
int main()
{
    ll a , b , x;
    cin >> a >> b >> x;
    cout << (a > 0 ? b / x - (a - 1) / x : b / x + 1) << endl;
    
    system("pause");
}
/***************************************************************************
*stuff you should look for
*int overflow, array bounds
*special cases (n=1?), set tle
*do smth instead of nothing and stay organized
***************************************************************************/

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll A, B, C;
    cin >> A >> B >> C;
    if(min(A, B) <= C && C <= max(A,B)) cout << "Yes";
    else cout << "No";
    cout << endl;
    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <vector>

using namespace std;
int GetMaxKouyaku(int, int);

int main()
{
    int N = 0;
    int m = 0;

    cin >> N >> m;

    for(int i = 1; i < N; i++)
    {
        int a = 0;
        cin >> a;
        if(a < m)
        {
            m = GetMaxKouyaku(m, a);
        }
        else
        {
            m = GetMaxKouyaku(a, m);
        }
    }

    cout << m << endl;
    return 0;
}

int GetMaxKouyaku(int Waru, int Amari)
{
    int a = Waru % Amari;
    if(a == 0) return Amari;
    else return GetMaxKouyaku(Amari, a);
}

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

int main(){
  int n,count=0;
  cin>>n;
  vector<int> num(n);
  cin>>num[0];
  for(int i=1;i<n;i++){
    cin>>num[i];
    if(num[i]==num[i-1]){
      num[i]=0;
      count++;
    }
  }
  cout<<count<<endl;
}

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

namespace ABC88D
{
    class Program
    {
        static List<int[]> directions = new List<int[]>() {
            new int[2] {1,0 },
            new int[2] {-1,0 },
            new int[2] {0,1 },
            new int[2] {0,-1 },
        };

        static void Main(string[] args)
        {
            string[] stringHW = Console.ReadLine().Split(' ');
            int H = int.Parse(stringHW[0]);
            int W = int.Parse(stringHW[1]);
            string[] map = new string[H];
            for (int i = 0; i < H; i++) map[i] = Console.ReadLine();

            int[] startPos = { 0, 0, 0 };
            int[] goal = { H - 1, W - 1, 0 };
            bool[,] doneTile = new bool[H, W];
            Queue<int[]> queue = new Queue<int[]>();
            queue.Enqueue(startPos);
            bool isGoal = false;

            while (queue.Count!=0)
            {
                int[] currentPos = queue.Dequeue();
                //Console.WriteLine(currentPos[0] + "," + currentPos[1]);
                if(currentPos[0] == goal[0]&&currentPos[1] == goal[1])
                {
                    isGoal = true;
                    goal[2] = currentPos[2];
                    break;
                }

                foreach (var item in directions)
                {
                    int[] nextPos = { currentPos[0] + item[0], currentPos[1] + item[1],currentPos[2]+1 };
                    if (nextPos[0] >= 0 && nextPos[0] < H && nextPos[1] >= 0 && nextPos[1] < W)
                    {
                        if (!doneTile[nextPos[0], nextPos[1]])
                        {
                            if (map[nextPos[0]][nextPos[1]] == '.')
                            {
                                doneTile[nextPos[0], nextPos[1]] = true;

                                queue.Enqueue(nextPos);
                            }
                        }
                    }
                }
            }


            int whiteCount = 0;

            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    if (map[i][j] == '.') whiteCount++;
                }
            }

            
            if (isGoal) { 
                //スタートは塗れないから-1
                Console.WriteLine(whiteCount - goal[2] - 1); 
            }
            else { Console.WriteLine(-1); }
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<cmath>
using namespace std;
using Graph = vector<vector<int>>;
typedef unsigned long long ll;
ll mod = (10e+8)+ 7;

#define For(N,i) for(int i = 0; i < N; i++)
	
int main(){
	int N;
	int K;
	int H;
	cin>>N>>K;
	int ans=0;
	For(N,i){
		cin>>H;
		if(H >= K){
			ans++;
			//puts("a");
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define INF 100000000
using namespace std;
const int mod = 1000000007;

int main() {

    int N, a, b, c, d, sum = 0;
    string ans = "";
    cin >> N;
    a = N / 1000;
    b = (N / 100)%10;
    c = (N / 10)%10;
    d = N % 10;
    vector<int> A = { a,b,c,d };
    for (int i = 0; i < (1 << 3); i++) {
        sum = a;
        ans = to_string(a);
        for (int j = 0; j < 3; j++) {
            if (i & (1 << j)) {
                sum += A[j + 1];
                ans.push_back('+');
                ans += to_string(A[j + 1]);
            }
            else {
                sum -= A[j + 1];
                ans.push_back('-');
                ans += to_string(A[j + 1]);
            }
        }
        if (sum == 7)break;
    }
    cout << ans << "=7"<<endl;
}


Measured memory_bytes: 256
def abs(n):
    if n<0:
        return -n
    else:
        return n

n=int(input())
h=list(map(int,input().split()))

cost=[100000 for i in range(n)]
cost[0]=0
cost[1]=abs(h[1]-h[0])

for i in range(2,n):
    cost[i]=min(cost[i-1]+abs(h[i]-h[i-1]),cost[i-2]+abs(h[i]-h[i-2]))

print(cost[n-1])


Measured memory_bytes: 13924
#include <stdio.h>

 int main()
 {
 	int a, b, c;
 	int max, min, total;
 	scanf ("%d %d %d", &a, &b, &c);
 	total = a + b + c;
 	if (a > b && a > c)
	{
		max = a;	
	}
	else if (b > a && b > c)
	{
		max = b;
	}
	else  
	{
		max = c;
	}
	
	if (a < b && a < c)
	{
		min = a;	
	}
	else if (b < a && b < c)
	{
		min = b;
	}
	else 
	{
		min = c;
	}
	printf("%d %d %d\n", min, total-(max+min), max);

 	return 0;
 } 


Measured memory_bytes: 2072
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
using namespace std;
int main(){
	int N,T,min=1001;
	cin>>N>>T;
	int a[N],b[N];
	for(int i=0;i<N;i++){
		cin>>a[i]>>b[i];
	}
	for(int i=0;i<N;i++){
		if(b[i]<=T){
			if(a[i]<=min){
				min=a[i];
			}		
		}
	}
	if(min==1001){
		cout<<"TLE"<<endl;
	}else{
		cout<<min<<endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
long long n, s;

long long sumDigit(long long b, long long n){
    if(n < b){
        return n;
    }else{
        return sumDigit(b, n/b) + (n%b);
    }
}

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

    if(n == s){
        cout << n+1 << endl;
        return 0;
    }
    
    for(int i=2; i<=sqrt(n); i++){
        if(sumDigit(i,n) == s){
            cout << i << endl;
            return 0;
        }
    }
    long long mi = 1000000000000;
    for(int i=1; i<=sqrt(n-s); i++){
        if((n-s)%i == 0){
            long long b = (n-s)/i + 1;
            if(sumDigit(b,n) == s){
               mi = min(mi, b);
            }
        }
    }
    if(mi == 1000000000000){
         cout << "-1" << endl;
    }else{
        cout << mi << endl;
    }

    return 0;
}

Measured memory_bytes: 256
<?php

function input($func = null) {
    if ($func === null) {
        return trim(fgets(STDIN));
    } else {
        return $func(trim(fgets(STDIN)));
    }
}
function input_array($func = null) {
    if ($func === null) {
        return explode(' ', input());
    } else {
        return array_map(function($v) use ($func) {
            return $func($v);
        }, explode(' ', input()));
    }
}

list($k, $a, $b) = input_array('intval');

if ($a <= $b - 3 && $a - 1 <= $k) {
    echo ($a + intdiv($k - $a + 1, 2) * ($b - $a) + ($k - $a + 1) % 2) . "\n";
} else {
    echo (1 + $k) . "\n";
}

Measured memory_bytes: 4728
#include<bits/stdc++.h>
#define lld long long
#define pb push_back
#define mk make_pair
#define MAX (lld)1e18+7
#define lim (lld)1e9+7
#define MAX2 (int)2e5+9
#define ff first
#define ss second
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

const lld mod=lim;

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


int extend_gcd(int a, int b, int& x, int& y) {
    if (b == 0) { x = 1;y = 0;return a;}
    int x1, y1;
    int d = extend_gcd(b, a % b, x1, y1);
    x = y1; y = x1 - y1 * (a / b);return d;	}

int rowNum[]={-1,0,0,1};
int colNum[]={0,-1,1,0};

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

	std::vector<int> v(n);
	for(int i=0;i<n;i++)
		cin>>v[i];

	sort(v.begin(), v.end());

	int ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i;j<n;j++)
		{
			for(int k=j;k<n;k++)
			{
				if(v[i]==v[j]||v[i]==v[k]||v[j]==v[k])
					continue;

				else if(v[i]+v[j]>v[k])
					ans++;
			}
		}
	}

	cout<<ans<<endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define int             long long
#define ld              long double
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(int i=1;i<=n;i++)
#define fox(i,x,y)      for(int i=x;i<=y;i++)
#define rfo(i,n)       for(int i=n;i>0;i--)
#define rfo1(i,n)       for(int i=n-1;i>=0;i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x,y)         fixed<<setprecision(y)<<x
#define setbits(x)      __builtin_popcount(x)
#define zerobits(x)     __builtin_ctz(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define endl            '\n'
#define mod             1000000007
#define M               (int)1e6+6
#define inf             1e18
using namespace std;

int n,m,k,x,y,z,a1,b,c,d,i,j,l,r;

int dp[M][105]={};

int profit(int w[],int v[],int i,int W)
{
  if(i<0)return 0;
  
  if(dp[W][i]!=0)return dp[W][i];
  if(w[i]>W)return dp[W][i]=profit(w,v,i-1,W);

  int op1=v[i]+profit(w,v,i-1,W-w[i]);
  int op2=profit(w,v,i-1,W);

  return  dp[W][i]=max(op1,op2);
}



void sol()
{   int W;
    cin>>n>>W;
    int w[n],v[n];
    fo(i,n)
    {
        cin>>w[i]>>v[i];
    }
    
    
    
    
    cout<< profit(w,v,n-1,W) <<endl;
}





int32_t main(){

    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    // w(t)
    sol();
    return 0;
}



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

namespace ABC_C
{
    class C101
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int N = int.Parse(s[0]), K = int.Parse(s[1]);
            List<int> A = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();

            int c = (N - 1 - 1) / (K - 1) + 1;
            Console.WriteLine(c);
        }
    }
}


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

int main() {
  string s;
  cin >> s;
  int ans = 0;
  if (s.find("R") != std::string::npos) {
    ans++;
    if (s.find("RR") != std::string::npos) {
      ans++;
      if (s.find("RRR") != std::string::npos) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

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

    int H, W;
    cin >> H >> W;
    string c[H];

    for(int i = 0; i < H; ++i){
        cin >> c[i];
    }

    for(int i = 0; i < H; ++i){
        cout << c[i] << endl;
        cout << c[i] << endl;
    }
    return 0;
}

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

cnt = int(input())
input_list = [int(i) for i in input().split()]

num_dict = {}
# 各数値ごとに数を集計
for num in input_list:
    # 辞書にその数値のキーが存在すれば+1追加
    if num in num_dict:
        num_dict[num] += 1
    # なければ新たにキー作成
    else:
        num_dict[num] = 1

ans = 0
# 数値(key)と個数(value)の大小によって処理を分ける
for key, value in num_dict.items():
    # valueのが大きければkeyとvalueを揃える
    if key < value:
        ans += value - key
    # 元々揃っていれば何もしない
    elif key == value:
        continue
    # keyのが大きければその値を取り除く
    elif key > value:
        ans += value
print(ans)

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

const int64_t MAX = 510000;
const int64_t MOD = 1000000007;

int64_t fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
int64_t COM(int64_t n, int64_t k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

  for(int64_t i=0;i<n;++i){
    if(k>=i){
      ans += COM(n,i)*COM(n-1,n-i-1);
      ans %= MOD;
    }
   }

  cout<<ans<<endl;
}

Measured memory_bytes: 12160
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = [0] * n
    for i in range(n):
        ans[a[i]-1] = i + 1
    print(*ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 20592
N, M = map(int, input().split())
total_count=0
minimum_donut=1000
for i in range (N):
    total_count+=1
    m=int(input())
    M=M-m
    if minimum_donut>=m:
        minimum_donut=m

while M>=0:
    M=M-minimum_donut
    total_count+=1


#total補正
total_count=total_count-1
print(total_count)

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

int gcd(int a, int b){
  if (b == 0){
    return a;
  }
  return gcd(b, a%b);
}

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

  vi x(n+1);
  rep(i,n) cin >> x.at(i);
  x.at(n) = X;
  sort(x.begin(),x.end());

  vi diff(n);
  rep(i,n){
    diff.at(i) = abs(x.at(i+1) - x.at(i));
  }

  int ans = diff.at(0);
  REP(i,1,n){
    ans = gcd(ans, diff.at(i));
  }
  cout << ans << endl;
}


Measured memory_bytes: 4032
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int n;
ll dp[101][100010];

int main() {
	int capacity;
	cin >> n >> capacity;
	vector<int> w(n);
	vector<ll> v(n);
	rep(i,n) {
		cin >> w[i] >> v[i];
	}
	for(int j=0; j<=capacity; j++) {
		dp[0][j] = 0;
	}
	for(int i=1; i<=n; i++) {
		for(int j=0; j<=capacity; j++) {
			if (j >= w[i - 1]) {
				dp[i][j] = max(dp[i - 1][j - w[i - 1]] + v[i - 1], dp[i - 1][j]);
			}
			else {
				dp[i][j] = dp[i - 1][j];
			}
		}
	}
	cout << dp[n][capacity] << endl;
  return 0;
}


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

typedef long long ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define debug(x) cerr << #x << ": " << x << '\n'

int main()
{

    ll N;
    cin >> N;
    ll maxindex = 0;
    ll num = 0;
    for (ll i = 0; i < N; ++i)
    {
        ll A, B;
        cin >> A >> B;
        if (maxindex < A)
        {
            maxindex = max(maxindex, A);
            num = B;
        }
    }
    cout << num + maxindex << endl;
}


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

int main() {
 int n;
    cin >> n;
    
   if(n % 1000 != 0) {
       cout << 1000 - n  % 1000;
   }
    else {
    cout << 0;
    }
    
}

Measured memory_bytes: 3640
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	long n = rlong;
	long m = n.to!real.sqrt.to!long;
	
	long ans;
	foreach(i; 1 .. m + 1){
		if(n % i == 0 && i * i <= n) ans = (i - 1) + (n / i - 1);
	}
	
	ans.writeln;
	
}


Measured memory_bytes: 380
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>

int main(void)
{
    int n, t[100001], x[100001], y[100001];
    int i, dt, dist;
    bool flag = false;
    scanf("%d", &n);
    t[0] = x[0] = y[0] = 0;
    for (i=1; i<=n; i++)
    {
        scanf("%d %d %d", &t[i], &x[i], &y[i]);
    }

    for (i=0; i<=n-1; i++)
    {
        dt =  t[i+1] - t[i];
        dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
        if (dt < dist) {
            flag = true;
            break;
        }
        if (dt%2 != dist%2) {
            flag = true;
            break;
        }
    }

    if (flag == true) {
        printf("No\n");
    } else {
        printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 1280
li = [0]*4
li2 = [0]*2
for _ in range(3):
    a,b = [int(x) for x in input().split()]
    li[a-1]+=1
    li[b-1]+=1

for i in li:
    if(i == 1):
        li2[0]+=1
    elif(i == 2):
        li2[1]+=1
if(li2[0] == 2 and li2[1] == 2):
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3064
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


int main(){
  int K, N; cin >> K >> N; int a[N]; int ma =0;
  rep(i, N){
    cin >> a[i];
    if(i!=0) ma = max(ma, a[i] - a[i-1]);
  }
  ma = max(ma, K+a[0]-a[N-1]);
  cout << K - ma << endl;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint x;cin >> x;
    lint ans=0;
    ans += (x / 11) * 2;
    lint z = (x % 11);
    if(z!=0){
        if(z<=6){
            ans += 1;
        }else{
            ans += 2;
        }
    }

    cout << ans <<"\n";

    return 0;
}

Measured memory_bytes: 256