akhauriyash/Code-Regression huggingface dataset:
using System;

namespace ABC057B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] bufs;
            bufs = Console.ReadLine().Split(' ');
            int N = Int32.Parse(bufs[0]);
            int M = Int32.Parse(bufs[1]);
            int[,] s = new int[N, 2];
            int[,] p = new int[M, 2];

            for (int i = 0; i < N; i++)
            {
                bufs = Console.ReadLine().Split(' ');
                s[i,0] = Int32.Parse(bufs[0]);
                s[i,1] = Int32.Parse(bufs[1]);
            }
            for (int i = 0; i < M; i++)
            {
                bufs = Console.ReadLine().Split(' ');
                p[i, 0] = Int32.Parse(bufs[0]);
                p[i, 1] = Int32.Parse(bufs[1]);
            }

            for (int i = 0; i < N; i++)
            {
                int min = 1000000007;
                int res = -1;

                for (int j = 0; j < M; j++)
                {
                    int diff = ((s[i, 0] > p[j, 0]) ? s[i, 0] - p[j, 0] : p[j, 0] - s[i, 0])
                        + ((s[i, 1] > p[j, 1]) ? s[i, 1] - p[j, 1] : p[j, 1] - s[i, 1]);
                    if (min > diff)
                    {
                        min = diff;
                        res = j;
                    }
                }

                Console.WriteLine(res + 1);
            }

        }
    }
}


Measured memory_bytes: 11092
#include<queue>
#include<cstdio>

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

using namespace std;

int main(){
	for(int n,T;scanf("%d%d",&n,&T),n;){
		vector<int> pttn[100];
		rep(i,n){
			while(1){
				int t; scanf("%d",&t);
				if(t==0) break;
				pttn[i].push_back(t);
			}
		}

		int ans=0;
		int idx[100]={},cons[100]={},charge=-1;
		queue<int> wait;
		while(T--){
			if(charge==-1 && !wait.empty()){
				charge=wait.front();
				wait.pop();
			}

			rep(i,n){
				if(idx[i]%2==0 || i==charge){
					cons[i]++;
					if(cons[i]==pttn[i][idx[i]]){ // 充電したくなる or 充電が終わる
						if(idx[i]%2==0) wait.push(i);
						else            charge=-1;
						idx[i]=(idx[i]+1)%pttn[i].size();
						cons[i]=0;
					}
				}
				else{ // 充電器が空くのを待つ
					ans++;
				}
			}
		}

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

	return 0;
}

Measured memory_bytes: 1076
#include <stdio.h>

int diff(int a, int b)
{
    return a - b > 0 ? a - b : b - a;
}

int main(void)
{
    int n;
    scanf("%d", &n);
    int t[n], x[n], y[n];
    int i;
    for (i = 0; i < n; i++)
        scanf("%d%d%d", &t[i], &x[i], &y[i]);
    
    if ((t[0] < x[0] + y[0]) || diff(t[0], x[0] + y[0]) % 2 != 0) {
        puts("No");
        return 0;
    }

    for (i = 0; i < n - 1; i++) {
        int timed = t[i + 1] - t[i];
        int moved = diff(x[i + 1], x[i]) + diff(y[i + 1], y[i]);
        if (timed == moved)
            continue;
        else if (timed >= diff(timed, moved) && diff(timed, moved) % 2 == 0)
            continue;
        else {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

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

int n,ans=0;
int a[1005];

int cmp(int a,int b)
{
	return a<b;
}

signed main()
{
	cin>>n;
	for (int i=1;i<=2*n;i++)  cin>>a[i];
	sort(a+1,a+2*n+1,cmp);
	for (int i=0;i<=n-1;i++)  ans+=1ll*a[2*i+1];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
/*Author : Hrishi*/

/*When I wrote this, only God and I understood what I was doing.
Now, only God knows.*/

#include <bits/stdc++.h>

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define PB push_back
#define F(i,L,R) for(auto i=L; i<R ;i++)
#define FR(i,L,R) for(auto i=R-1;i>=L;i--)
#define show(x) cout<<(#x)<<" is "<<(x)<<"\n";
#define BOOST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define M 1000000007

using namespace std;

vi graph[100001];
int ans[100001];
vi vis(100001,0);
int n,m,a,b;

void dfs(int i,vi &depth)
{
    vis[i]=1;
    if(graph[i].empty())
        depth[i]=0;
        
    for(auto it=graph[i].begin();it!=graph[i].end();it++)
    {
        if(vis[*it]!=1)
        {
            dfs(*it,depth);
        }
        if(depth[*it]+1>depth[i])
            depth[i] = depth[*it]+1;
    }
}

int main() 
{
    cin>>n>>m;
    F(i,0,m)
    {
        cin>>a>>b;
        a--;b--;
        graph[a].PB(b);
    }
	int ans=0;
    vi depth(n,0);
	F(i,0,n)
	{
	    if(!vis[i])
	        dfs(i,depth);
	     
	    
	//    ans = max(ans, ));
	}
	cout<<(*max_element(depth.begin(),depth.end()))<<"\n";
}




Measured memory_bytes: 8576
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
typedef long long ll;
typedef double dd;
#define For(i,j,k) for (int i=(int)j;i<=(int)k;++i)
#define Forr(i,j,k) for (int i=(int)j;i>=(int)k;--i)
#define Set(a,p) memset(a,p,sizeof(a))
using namespace std;

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

const int maxn=1e5+1e2;
struct node {
	int to,nxt;
}e[maxn<<1];
int n,m;
int tot;
int a[maxn],b[maxn],c[maxn];
int head[maxn],fa[maxn],Ord[maxn],vis[maxn];
ll sum[maxn],dp[maxn];
vector<int>g[maxn];

inline void file() {
	freopen("ARC098F.in","r",stdin);
	freopen("ARC098F.out","w",stdout);
}

inline int read() {
	int x=0,p=1;
	char c=getchar();
	while (!isdigit(c)) { if (c=='-') p=-1; c=getchar();}
	while (isdigit(c)) { x=(x<<1)+(x<<3)+(c-'0'); c=getchar();}
	return x*p;
}

int find(int x) {
	if (x!=fa[x]) fa[x]=find(fa[x]);
	return fa[x];
}

inline bool cmp(int x,int y) { return c[x]<c[y]; }

inline void add(int from,int to) {
	e[++tot]=(node){to,head[from]}; head[from]=tot;
}

void dfs(int u) {
	sum[u]=b[u];
	for (int i=head[u];i!=0;i=e[i].nxt) {
		int v=e[i].to;
		dfs(v); sum[u]+=sum[v];
	}
	dp[u]=sum[u]+1ll*c[u];
	for (int i=head[u];i!=0;i=e[i].nxt) {
		int v=e[i].to;
		chkmin(dp[u],sum[u]-sum[v]+max((ll)c[u],dp[v]));
	}
}

int main() {
//	file();
	n=read(); m=read();
	For (i,1,n) a[i]=read(),b[i]=read(),c[i]=max(a[i]-b[i],0);
//	For (i,1,n) cout << c[i] << " " ; cout << endl;
	For (i,1,m) {
		int x=read(),y=read();
		g[x].push_back(y); g[y].push_back(x);
	}
	For (i,1,n) fa[i]=i,Ord[i]=i;
	sort(Ord+1,Ord+n+1,cmp);
//	For (i,1,n) cout << Ord[i] << " " ; cout << endl;
	For (i,1,n) {
		int u=Ord[i];
		vis[u]=1;
		For (j,0,g[u].size()-1) {
			int v=g[u][j];
			if (vis[v]) {
				v=find(v);
				if (v!=u) {
					fa[v]=u; add(u,v);
				}
			}
		}
	}
	dfs(Ord[n]);
	printf("%lld",dp[Ord[n]]);
	return 0;
}

Measured memory_bytes: 13948
#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 sa, sb, sc;
  cin >> sa >> sb >> sc;
  int a = sa.length();
  int b = sb.length();
  int c = sc.length();

  int i = 0, j= 0, k = 0;
  char x = 'a';
  while (i != a+1 && j != b+1 && k != c+1) {  
    if (x == 'a') {
      x = sa[i];
      i++;
    } else if (x == 'b') {
      x = sb[j];
      j++;
    } else if (x == 'c') {
      x = sc[k];
      k++;
    }
  }
  char ans;
  if (i == a+1) ans = 'A';
  else if (j == b+1) ans = 'B';
  else if (k == c+1) ans = 'C';
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
/* (๑╹◡╹) */
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll MOD = 1000000007;
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;
}
/* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹) */
///////////////////////////////////////////////

int main() {
   int ans = 0;
   int H,W;
   cin >> H >> W;
   char a[H+1][W+1];
   int vec[H+1][W+1][2] = {};
   rep (i,H){ rep(j,W){ cin >> a[i][j]; } }

   rep(i,H)
   {
      rep(j,W)
      {
         if (a[i][j] == '#') continue;
         if(i > 0 && vec[i-1][j][0] > 0) {vec[i][j][0] = vec[i-1][j][0];}
         else
         {
            vec[i][j][0] = 0;
            FOR(p,i,H)
            {
               if(a[p][j] == '.') vec[i][j][0] += 1;
               else break;
            }
         }
         
         if(j > 0 &&vec[i][j-1][1] > 0) {vec[i][j][1] = vec[i][j-1][1];}
         else
         {
            vec[i][j][1] = 0;
            FOR(p,j,W)
            {
               if(a[i][p] == '.') vec[i][j][1] += 1;
               else break;
            }
         }
         if (ans < vec[i][j][0]+vec[i][j][1]) ans = vec[i][j][0]+vec[i][j][1] -1;
      }
   }
   cout << ans << endl;
}

Measured memory_bytes: 35456
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int matsubi(int x) {
    return x % 10;
}

int sentou(int x) {
    while (x >= 10) {
        x /= 10;
    }
    return x;
}

int main() {
    int n; cin >> n;
    map<pair<int, int>, int> mp;
    for (int i = 1; i <= n; i++) {
        mp[{sentou(i), matsubi(i)}]++;
    }
    ll ans = 0;
    for (auto p : mp) {
        if (mp.find({p.first.second,p.first.first}) != mp.end()) {
            ans += (ll)p.second * mp[{p.first.second, p.first.first}];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/* ex5_3
   KKOO  */

#include<stdio.h>

int main(void){
    int row, col, count;
    char grid[100][100], extra_row[100], extra_col[100];
    //マス目の行数、列数を入力
    scanf("%d %d", &row, &col);

    //マス目に入る文字を入力
    for(int i=0; i<row; i++){
        for(int j=0; j<col; j++){
            scanf(" %c", &grid[i][j]);
        }
    }

    //配列の中身を全て1にする
    for(int i=0; i<row; i++){
        extra_row[i] = 1;
    }
    for(int j=0; j<col; j++){
        extra_col[j] = 1;
    }

    //ある行が全て'.'である場合はその行数を記憶
    for(int i=0; i<row; i++){
        for(int j=0; j<col; j++){
            if(grid[i][j] == '.'){
                count ++;
            }
        }
        if(count == col){
            //余分な行の要素は0にする
            extra_row[i] = 0;
        }
        count = 0;
    }

    //ある列が全て'.'である場合はその列数を記憶
    for(int j=0; j<col; j++){
        for(int i=0; i<row; i++){
            if(grid[i][j] == '.'){
                count ++;
            }
        }
        if(count == row){
            //余分な列の要素は0にする
            extra_col[j] = 0;
        }
        count = 0;
    }

    //配列の要素が1である部分のみ出力
    for(int i=0; i<row; i++){
        if(extra_row[i] == 1){
            for(int j=0; j<col; j++){
                if(extra_col[j] == 1){
                    printf("%c", grid[i][j]);
                }
            }
            printf("\n");
        }
    }

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n);i>0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+5  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
//ll const mod=998244353;
ll const mod=1e9+7;
const ll MAX=1000005;
using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvl =vector<vector<ll>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}

ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}
//////////////////////////////////////
int main(){
    int n;
    cin>>n;
    vi x(n),y(n);
    rep(i,n){
        cin>>x[i]>>y[i];
    }
    map<P,int>mp;
    rep(i,n){
        rep(j,i){
            int p=x[i]-x[j];
            int q=y[i]-y[j];
            if(p<0){
                p=-p;
                q=-q;
            }
            else if(p==0&&q<0)q=-q;
            mp[P(p,q)]++;
        }
    }
    int mx=0;
    for(auto x:mp){
        chmax(mx,x.second);
    }
    int ans=n-mx;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    ll a, b, k;
    cin >> a >> b >> k;

    cout << max(0LL, a - k) << " " << max(0LL, min(b, a + b - k)) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int H, W; 
  cin >> H >> W;

  vector<string> s(H);
  REP(i, H) cin >> s[i];

  REP(i, W+2) cout << "#";
  cout << "\n";
  REP(i, H){
    cout << "#" << s[i] << "#" << "\n";
  }
  REP(i, W+2) cout << "#";
  cout << "\n";

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int N,X,Y;
int count[2020];
main()
{
	cin>>N>>X>>Y;
	//X--,Y--;
  	for(int i=1; i<=N-1; i++){
   	 for(int j=i+1; j<=N; j++){
    	  count[min(j-i,abs(X-i)+1+abs(Y-j))]++;
   	 }
  	}


	for(int k=1;k<N;k++)cout<<count[k]<<endl;
}


Measured memory_bytes: 256
n = int(input())
lis = list(map(int, input().split()))


ans = []

for j in range(n):
    if lis == []:
        break
    else:
        for i in range((len(lis)-1),-1,-1):
            if lis[i]==i+1:
                del lis[i]
                ans.append(i+1)
                break
            else:
                pass


if lis==[]:
    ans.reverse()
    for i in range(n):
        print(ans[i])
else:
    print(-1)




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

#define NDEBUG
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair



int solve(int N, int K, vi& h) {
    sort(ALL(h));
    int ans = INT_MAX;
    rep(i,N) {
        if (i+K-1 >= N) break;
        int diff = h[i+K-1] - h[i];
        ans = min(ans, diff);
    }
    return ans;
}

int main() {
    int N,K; scanf("%d%d", &N, &K);
    vi h(N);
    rep(i,N) scanf("%d", &h[i]);
    cout << solve(N,K,h) << endl;
    return 0;
}


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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000007
#define EPS 1E-12

int a, b, n;

int main()
{
  while(cin >> a >> b >> n){
    int s = 0;
    rep(i, n){
      a *= 10;
      s += (a / b) % 10;
      a %= b;
    }
    cout << s << endl;
  }


  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long unsigned int ll;

int main() {
  int K;
  cin >> K;
  cout << (K / 2) * ((K + 1) / 2) << endl;
  return 0;
}


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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

struct Node{
  int key;
  Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;
  
  z= new Node;
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while( x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  
  z->parent = y;
  if( y == NIL ) root = z;
  else{
    if( z->key < y->key ) y->left = z;
    else y->right = z;
  }
}

Node * find(Node *u,int k){
  while(u != NIL && k != u->key){
    if(k<u->key) u=u->left;
    else u=u->right;
  }
  return u;
}

void inorder(Node *u){
  if(u==NIL) return;
  inorder(u->left);
  cout<<" "<<u->key;
  inorder(u->right);
}
void preorder(Node *u){
  if(u==NIL) return;
  cout<<" "<<u->key;
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,x;
  string com;
  
  cin>>n;
  
  rep(i,n){
    cin>>com;
    if(com=="insert"){
      cin>>x;
      insert(x);
    }
    else if(com=="find"){
      cin>>x;
      Node *t=find(root,x);
      if(t != NIL) cout<<"yes"<<endl;
      else cout<<"no"<<endl;
    }
    else if(com=="print"){
      inorder(root);
      cout<<endl;
      preorder(root);
      cout<<endl;
    }
  } 
  
  return 0;
}


Measured memory_bytes: 21732
// atcoder/abc124/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int fn(string s)
{
  int cnt = 0;
  for (int i = 0; i < s.size(); ++i) {
    cnt += (s[i] - '0' == i % 2);
  }
  return cnt;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  string s;
  while (cin >> s) {
    string t = s;
    replace(begin(t), end(t), '0', '@');
    replace(begin(t), end(t), '1', '0');
    replace(begin(t), end(t), '@', '1');
    cout << min(fn(s), fn(t)) << endl;
  }

  return 0;
}


Measured memory_bytes: 720
import std;

long calc(long a, long b, long c, long k) {
    long ans = 0;
    long x = min(a, k);
    ans += x;
    k -= x;
    k -= min(b, k);
    long y = min(c, k);
    ans += -1 * y;
    return ans;
}

void main() {
    long a, b, c, k; scan(a, b, c, k);
    writeln(calc(a, b, c, k));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T=string)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readints = reads!int;


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

const int N = (int)3e4;

char s[N+5];
int pos[N+5][15];

int move(int num) {
    int res = 0;
    for (int i=0; i<3; i++) {
        res = pos[res][num % 10];
        num /= 10;
    }
    return res;
}

int main() {
    int n; scanf("%d", &n);
    scanf("%s", s+1);

    for (int num=0; num<=9; num++) {
        pos[n+1][num] = pos[n][num] = n+1;
    }

    for (int i=n; i>=1; i--) {
        for (int num=0; num<=9; num++) {
            pos[i-1][num] = pos[i][num];
        }
        pos[i-1][s[i]-'0'] = i;
    }

    int res = 0;
    for (int i=0; i<1000; i++) res += move(i) != n + 1;

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


Measured memory_bytes: 2048
#include <stdio.h>

int main(){
	int h,w;
	int i,t;
	while(1){
		scanf("%d %d", &h, &w);
		if(h==0 && w==0)break;
		for(i = 0;i < h;i++){
			for(t = 0;t < w;t++){
				if(i==0 || t==0 || i==h-1 || t==w-1)
					printf("#");
				else
					printf(".");
			}
			puts("");
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 588
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    int A,B;
    cin >> A >> B;
    string s;
    cin >> s;
    bool flag = true;
    for(int i = 0;i < s.size(); i++){
        if(i < A || i > A){
            if('0' <= s[i] && s[i] <= '9') continue;
            else flag = false;
        }
        else if(s[i] != '-') flag = false; 
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)
#define fi first
#define se second

using ll = long long;
using v_int = std::vector<int>;
using v2_int = std::vector<v_int>;
using v_ll = std::vector<ll>;
using v2_ll = std::vector<v_ll>;
using v_string = std::vector<std::string>;
using v_bool = std::vector<bool>;
using v2_bool = std::vector<v_bool>;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using mii = std::map<int, int>;
using mll = std::map<ll, ll>;

const double PI = 3.1415926535897932;
const int INF = 2*(int)1e9;
const ll LINF = (ll)1e18;
const ll MOD = 1000000007;
const int dc[4] = {1, -1, 0,  0};
const int dr[4] = {0,  0, 1, -1};
//const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
//const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

using namespace std; 

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p)
{
    return o << "{" << p.first << "," << p.second << "}";
}

template<typename T> inline
istream& operator>>(istream &is, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) {
        is >> v[i]; 
    }
    return is;
}

template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) { 
        os << v[i];
        if(i != len-1) { os << ","; } 
    } 
    return os;
}

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

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

int n;

void dfs(string s, char mx)
{
    if(s.size() == n) {
        cout << s << endl;
        return; 
    }

    for(char c = 'a'; c <= mx+1; c++) {
        string t = s;
        t += c;
        dfs(t, max(mx,c));
    }
}

int main(void)
{
    cin >> n;

    dfs("", 'a'-1);

    return 0;
}

/*atcoder*/


Measured memory_bytes: 3556
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <cstdint>
#include <istream>
#include <sstream>
#include <cctype>
#include <functional>
#include <iomanip>
#define rep(i,N) for(ll i=0;i<N;i++)
#define disp(a) cout << a << endl;
#define PI 3.1415926535897932384626433
//cout << fixed << setprecision(20) << ** << endl;
typedef long long ll;
using namespace std;
double deg2rad(double degree)
{
    return degree * PI / 180.0000000000;
}
int main()
{
	ll N,K,ANS=0;
	vector<ll>V;
	cin>>N>>K;
	rep(i,N){
		ll t;
		cin>>t;
		V.push_back(t);
	}
	sort(V.begin(),V.end());
	rep(i,K){
		ANS=ANS+V[i];
	}
	cout<<ANS<<endl;
}

Measured memory_bytes: 3200
def isEven(s):
    for i in s:
        if(i%2==0):
            continue
        else:
            return False
    return True

n=int(input())
a=list(map(int, input().split()))
c=0
while isEven(a):
    for i in range(n):
        a[i]=a[i]/2
    c+=1

print(c)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nuintptr)
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
 
const int MAX= 4e5+6;
const ll inf =1e18;
 
 
 

int main(){
	fastio;
	ll k,a,b;
	cin>>k;
	ll n=100,ans=0;
	while(1){
		if(n>=k){
			cout<<ans<<endl;
			break;
		}
		n+=n/100;
		ans++;
	}
}

Measured memory_bytes: 3652
N = int(input())
As = [int(n) for n in input().split()]

Alice = []
Bob = []

while len(As):
    ma = max(As)
    Alice.append(ma)
    As.remove(ma)
    if len(As):
        mb = max(As)
        Bob.append(mb)
        As.remove(mb)

print(sum(Alice) - sum(Bob))


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

N, W = [int(t) for t in input().split()]
item = [tuple(int(t) for t in input().split()) for _ in range(N)]

# value[u] = 品物 0〜i だけ, かつ容量 u での最大価値
value = {u: 0 for u in range(W + 1)}

# 品物の種類をだんだん増やす
for v, w in item:
    value = {u: (max(value[u - w] + v, value[u]) if u >= w else value[u])
             for u in range(W + 1)}

print(value[W])



Measured memory_bytes: 7676
#define DBG 1 //submit 0
#define ll long long
#if DBG
    #include <algorithm>
    #include <array>
    #include <ctime>
    #include <cstdlib>
    #include <string>
    #include <vector>
    #include <unordered_map>
    #include <iostream>
    #include <cmath>
    #include <queue>
    #include <numeric>
#else
    #include <bits/stdc++.h>
#endif
 
using namespace std;
 
 
int main(){
    int n,k,m,x,sum=0,ok=0,ng=0;
    int ans=0;
    vector<string> s(100005);
    bool flag[100005];
    bool flag2[100005];
    int p[100005];
    //char s[100];
    //for(int i=0;i<n;i++)
   
    cin >> n >> m;
    for(int i=0;i<m;i++) cin >> p[i] >> s[i];
    for(int i=0;i<n;i++) flag[i] = false;
    for(int i=0;i<n;i++) flag2[i] = false;

    for(int i=0;i<m;i++){
        if((!flag[p[i]-1]) && s[i] == "AC"){
            flag[p[i]-1]=true;
        }
    }

    for(int i=0;i<m;i++){
        if(flag[p[i]-1]&&(!flag2[p[i]-1]) && s[i] == "WA") ng++;
        if(flag[p[i]-1]&&(!flag2[p[i]-1]) && s[i] == "AC"){
            ok++;
            flag2[p[i]-1]=true;
        }
    }

    
   
    //cout << (flag ? "Yes" : "No");
    cout << ok << " " << ng;
    //for(int i=0;i<m;i++) cout << s[i];
    //printf("%.10f",ans_d);
    cout << endl;
}


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

int main()
{
	int x, n;
	cin >> x >> n;
	int ans = 102;
	vector<int> c(102);
	rep(i, 102) c[i] = i;
	rep(i, n)
	{
		int a;
		cin >> a;
		c[a] = 200;
	}
	rep(i, 102)
	{
		if (c[i] == 200) continue;
		ans = min(abs(i - x) + x, ans);
	}
	if (ans > x && c[x - (ans - x)] != 200) ans = x - (ans - x);
	
	cout << ans;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
#include <iostream>
#define llint long long
#define MOD 1000000007
using namespace std;
int main(void){
  llint N, K;
  cin >> N >> K;
  llint a[N];
  for(int i=0; i<N; i++){
    cin >> a[i];
  }
  llint dp[N+1][N+1][256] = {};
  dp[0][0][0] =1;
  for(int i=0; i<N; i++){
    for(int j=0; j<i+1; j++){
      for(int k=0; k<256; k++){
	(dp[i+1][j][k] += dp[i][j][k]) %= MOD;
	(dp[i+1][j+1][k^a[i]] += dp[i][j][k]) %= MOD;
      }
    }
  }
  llint ans = 0;
  llint c = 1;
  for(int i=1; i<=N; i++){
    c = c * i % MOD;
    ans += dp[N][i][K] * c % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;

int main(){
	char c;
	cin >> c;
	if(c == 'A')cout << 'T' << endl;
	else if(c == 'C')cout << 'G' << endl;
	else if(c == 'T')cout << 'A' << endl;
	else cout << 'C' << endl;
    return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int X = int.Parse(input[0]);
            int Y = int.Parse(input[1]);
            int Z = int.Parse(input[2]);
            int K = int.Parse(input[3]);

            List<long> A = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToList();
            List<long> B = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToList();
            List<long> C = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToList();

            A.Sort();
            A.Reverse();
            B.Sort();
            B.Reverse();
            C.Sort();
            C.Reverse();

            List<long> ans = new List<long>();

            //2 3000 > 3000 x
            //2 1500 = 3000 o
            for (int a = 0; a < X; a++)
            {
                for (int b = 0; b < Y; b++)
                {
                    if ((a + 1) * (b + 1) > K) break;
                    for (int c = 0; c < Z; c++)
                    {
                        if ((a + 1) * (b + 1) * (c + 1) > K) break;
                        ans.Add(A[a] + B[b] + C[c]);
                    }
                }
            }
            ans.Sort();
            ans.Reverse();

            for (int k = 0; k < K; k++)
            {
                Console.WriteLine(ans[k]);
            }

        }
    }
}


Measured memory_bytes: 15456
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int n,k;cin>>n>>k;
    double ans=0;
    for(int i=1;i<=n;i++){
        double res = (double)1/n;
        int now=i;
        while(k>now){
            now *= 2;
            res /= 2;
        }
        ans += res;
    }
    cout << fixed << setprecision(12) << ans << endl;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC107_B();
        }

        static void ABC107_B()
        {
            var HW = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var masu = new string[HW[0] + 1, HW[1] + 1];
            for (var h = 1; h <= HW[0]; h++)
            {
                var a = Console.ReadLine();
                for (var w = 1; w <= HW[1]; w++)
                    masu[h, w] = a[w - 1].ToString();
            }

            for (var h = 1; h <= HW[0]; h++)
            {
                var whiteOnly = true;
                for (var w = 1; w <= HW[1]; w++)
                {
                    if (masu[h, w] == "#")
                        whiteOnly = false;
                }

                if (whiteOnly)
                {
                    for (var w = 1; w <= HW[1]; w++)
                        masu[h, w] = "";
                }
            }

            for (var w = 1; w <= HW[1]; w++)
            {
                var whiteOnly = true;
                for (var h = 1; h <= HW[0]; h++)
                {
                    if (masu[h, w] == "#")
                        whiteOnly = false;
                }

                if (whiteOnly)
                {
                    for (var h = 1; h <= HW[0]; h++)
                        masu[h, w] = "";
                }
            }

            for (var h = 1; h <= HW[0]; h++)
            {
                for (var w = 1; w <= HW[1]; w++)
                {
                    if (masu[h, w] != "")
                        Console.Write(masu[h, w]);
                }

                var count = 0;
                for (var w = 1; w <= HW[1]; w++)
                {
                    if (masu[h, w] == "")
                        count++;
                }
                if (count != HW[1])
                    Console.WriteLine("");
            }
        }
    }
}

Measured memory_bytes: 13308
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
    double n;
    while(cin>>n)
    {
        if(n<=48.00)cout<<"light fly"<<endl;
        else if(48.00<n&&n<=51.00)cout<<"fly"<<endl;
        else if(51.00<n&&n<=54.00)cout<<"bantam"<<endl;
        else if(54.00<n&&n<=57.00)cout<<"feather"<<endl;
        else if(57.00<n&&n<=60.00)cout<<"light"<<endl;
        else if(60.00<n&&n<=64.00)cout<<"light welter"<<endl;
        else if(64.00<n&&n<=69.00)cout<<"welter"<<endl;
        else if(69.00<n&&n<=75.00)cout<<"light middle"<<endl;
        else if(75.00<n&&n<=81.00)cout<<"middle"<<endl;
        else if(81.00<n&&n<=91.00)cout<<"light heavy"<<endl;
        else if(91.00<n)cout<<"heavy"<<endl;
    }
    return 0;
}

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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)
#define fi first
#define se second

using ll = long long;
using v_int = std::vector<int>;
using v2_int = std::vector<v_int>;
using v_ll = std::vector<ll>;
using v2_ll = std::vector<v_ll>;
using v_string = std::vector<std::string>;
using v_bool = std::vector<bool>;
using v2_bool = std::vector<v_bool>;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using mii = std::map<int, int>;
using mll = std::map<ll, ll>;

const double PI = 3.1415926535897932;
const int INF = 2*(int)1e9;
const ll LINF = (ll)1e18;
const ll MOD = 1000000007;
const int dc[4] = {1, -1, 0,  0};
const int dr[4] = {0,  0, 1, -1};

using namespace std; 

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p)
{
    return o << "{" << p.first << "," << p.second << "}";
}

template<typename T, typename U, typename V> inline
ostream& operator<<(ostream &o, tuple<T,U,V> &p)
{
    return o << "{" << get<0>(p) << "," << get<1>(p) << "," << get<2>(p) << "}";
}

template<typename T> inline
istream& operator>>(istream &is, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) {
        is >> v[i]; 
    }
    return is;
}

template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) { 
        os << v[i];
        if(i != len-1) { os << ","; } 
    } 
    return os;
}

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

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

int main(void)
{
    int n, a, b;
    cin >> n >> a >> b;
    
    v_int x(n);
    cin >> x;
    
    ll ans = 0;
    irep(i, n-1) {
        ll diff = x[i+1]-x[i];
        if(diff*a < b) {
            ans += diff*a;
        } else {
            ans += b;
        }
    }
    cout << ans << endl;
    return 0;
}

/*atcoder*/


Measured memory_bytes: 3740
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AGC008
{
    public class A
    {
        private void Run()
        {
            var input = Console.ReadLine().Trim().Split();
            var x = long.Parse(input[0]);
            var y = long.Parse(input[1]);

            long res = Math.Abs(Math.Abs(x) - Math.Abs(y));
            if (x >= 0)
            {
                if (x > y)
                {
                    if (y > 0) { res += 2; }
                    else { res += 1; }
                }
            }
            else
            {
                if (y > 0) { res += 1; }
                if (x > y) { res += 2; }
            }

            Console.WriteLine(res);
        }

        public static void Main()
        {
            var old = Console.Out;
            using (var writer = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })
            {
                Console.SetOut(writer);
                new A().Run();
                Console.Out.Flush();
                Console.SetOut(old);
            }
        }
    }
}


Measured memory_bytes: 2776
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=200010;
const ll mod=1e9+7;


int main(){
  int h,w;
  cin >> h >> w;
  rep(i,h){
    string s;
    cin >> s;
    cout << s << endl;
    cout << s << endl;
  }
  return 0;
}

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

int main()
{
  // 標準入力
  int N;
  cin >> N;

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

  sort(A, A + N);

  for (int i = 1; i<N; i++) {
    if (A[i-1] == A[i]) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";

  return 0;

}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#define ll long long int
#define rep(i,n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair

using namespace std;

int main(){

    int n;
    cin >> n;
    cout << pow(n,2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include"stdio.h"
int main(void){
  int n;
  scanf("%d",&n);
  int a[n];
  for(int i=0;i<n;i++)
    scanf("%d",&a[i]);
  int max = a[0];
  int count=1;
  for(int i=1;i<n;i++){
    if(max<=a[i]){
      max=a[i];
      count++;
    }
  }
  printf("%d",count);
  return 0;
}


Measured memory_bytes: 128
#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>;
const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int mod = 1000000007;

int main() {

  int n, m;
  cin >> n >> m;
  int s[n];
  if (n == 1) s[0] = 0;
  else {
    s[0] = 1;
    for(int i = 1; i < n; ++i) s[i] = 0;
  }

  if(n == 1){
    rep(j, m) {
      int t, c;
      cin >> t >> c;
      --t;
      if(s[t] != 0 && s[t] != c) {
        cout << "-1" << endl;
        return 0;
      } else {
        s[t] = c;
      }
    }
    cout << s[0] << endl;
    return 0;
  }

  rep(j, m) {
    int t, c;
    cin >> t >> c;
    --t;
    if(t==0 && c==0){
      cout << "-1" << endl;
      return 0;
    }
    if(t == 0){
      if(s[t] != 1 && s[t] != c) {
        cout << "-1" << endl;
        return 0;
      } else {
        s[t] = c;
      }
    } else {
      if(s[t] != 0 && s[t] != c) {
        cout << "-1" << endl;
        return 0;
      } else {
        s[t] = c;
      }
    }
  }
  int ans = 0;

  for(int i = 0; i < n; ++i){
    ans = ans * 10 + s[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io, flush := NewIO()
	defer flush()

	n := io.ScanInt()
	a := io.ScanInts(n)

	var count int
	for i, num := range a {
		if (i+1)%2 != 0 && num%2 != 0 {
			count++
		}
	}
	fmt.Println(count)
}

type IO struct {
	scanner *bufio.Scanner
	writer  *bufio.Writer
}

func NewIO() (*IO, func()) {
	io := &IO{
		scanner: newScanner(),
		writer:  newWriter(),
	}
	return io, func() { io.writer.Flush() }
}

func newScanner() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Buffer(make([]byte, 10000000), 10000000)
	s.Split(bufio.ScanWords)
	return s
}

func newWriter() *bufio.Writer {
	return bufio.NewWriter(os.Stdout)
}

func (io *IO) ScanBytes() []byte {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Bytes()
}

func (io *IO) ScanString() string {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Text()
}

func (io *IO) ScanStrings(n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		strs[i] = io.ScanString()
	}
	return strs
}

func (io *IO) Scan2DStrings(y, x int) [][]string {
	strings := make([][]string, y)
	for i := 0; i < y; i++ {
		strings[i] = io.ScanStrings(x)
	}
	return strings
}

func (io *IO) Scan2DGraph(y int) [][]string {
	strs := make([][]string, y)
	for i := 0; i < y; i++ {
		strs[i] = strings.Split(io.ScanString(), "")
	}
	return strs
}

func (io *IO) ScanInt() int {
	return int(io.ScanInt64())
}

func (io *IO) ScanInt2() (int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInt3() (int, int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInt4() (int, int, int, int) {
	return int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64()), int(io.ScanInt64())
}

func (io *IO) ScanInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = io.ScanInt()
	}
	return ints
}

func (io *IO) Scan2DInts(y, x int) [][]int {
	ints := make([][]int, y)
	for i := 0; i < y; i++ {
		ints[i] = io.ScanInts(x)
	}
	return ints
}

func (io *IO) ScanInt64() int64 {
	i, err := strconv.ParseInt(io.ScanString(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *IO) ScanFloat64() float64 {
	i, _ := strconv.ParseFloat(io.ScanString(), 64)
	return i
}

func (io *IO) ScanFloat64s(n int) []float64 {
	floats := make([]float64, n)
	for i := 0; i < n; i++ {
		floats[i] = io.ScanFloat64()
	}
	return floats
}

func (io *IO) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 2164
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

ll gcd(ll a, ll b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> A(N);
    REP(i, 0, N) {
        cin >> A[i];
    }
    ll ans = A[0];
    REP(i, 0, N) {
        ans = gcd(ans, A[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10**6)
n=int(input())
def res(v:int, all:list):
    if v>n:
        return
    if "3" in list(str(v)) and "5" in list(str(v)) and "7" in list(str(v)):
        all.append(v)
    res(10*v+3,all)
    res(10*v+5,all)
    res(10*v+7,all)
all=[]

res(3,all)
res(5,all)
res(7,all)


print(len(all))

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

int main(){
  int H, W;
  cin >> H >> W;

  vector<vector<char>> vec(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> vec.at(i).at(j);
    }
  }

  bool ans = true;

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      char X=vec.at(i).at(j);
      if (X=='#'){
        if (i-1>=0 && vec.at(i-1).at(j)=='#') ans = true;
        else if (i+1<H && vec.at(i+1).at(j)=='#') ans = true;
        else if (j-1>=0 && vec.at(i).at(j-1)=='#') ans = true;
        else if (j+1<W && vec.at(i).at(j+1)=='#') ans = true;
        else ans=false;
      }
      if (ans==false) break;
    }
    if (ans==false) break;
  }

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

Measured memory_bytes: 256