akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

int main(){
    int A, B;
    cin >> A >> B;
    if(A == 1) A = 14;
    if(B == 1) B = 14;
    if(A == B){
        cout << "Draw" << endl;
    }else if(A < B){
        cout << "Bob" << endl;
    }else{
        cout << "Alice" << endl;
    }
    return 0;
}

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

using namespace std;

int n, m;
long long dp[100][3][3];
string s;

long long rec(int pos, int flag, int k) {
    if (pos == n) {
        return k == m;
    }
    if (k == m) {
        return dp[pos][flag][k] = 1;
    }
    long long &res = dp[pos][flag][k];
    if (res != -1) return res;
    res = 0;
    int border = flag ? 9 : s[pos];
    for (int digit = 0; digit <= border; digit++) {
        int nflag = flag | (digit < border);
        int nk = k + (digit != 0);
        res += rec(pos + 1, nflag, nk);
    }
    return res;
}

void solve() {
    cin >> s >> m;
    for (auto &x : s) x -= '0';
    n = s.size();
    memset(dp, -1, sizeof dp);
    cout << rec(0, 0, 0);
}

int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(20);
    solve();
}


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

int main() {
  char a, b;
  cin >> a >> b;
  int ans = (a == 'H') + (b == 'H');
  if (ans%2)
    cout << "D\n";
  else
    cout << "H\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{ 
    char x,y;
    cin>>x>>y;
    if (x<y)
      cout<<"<"<<endl;
    if (x>y)
      cout<<">"<<endl;
    if (x==y)
      cout<<"="<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
using ll = long long;

struct Query {
	int a,b,c,d;
};

vector<Query> qa[11];
int nbElem, maxVal, nbQuery;
int cur[11];
int maxAns=0, curAns=0;

void backtrack(int pos) {
	if (pos == nbElem+1) {
		maxAns = max(maxAns, curAns);
		return;
	}
	for (int val = cur[pos-1]; val <= maxVal; ++val) {
		cur[pos] = val;
		int rd = 0;
		for (auto q : qa[pos]) {
			if (cur[q.b] - cur[q.a] == q.c) rd += q.d;
		}
		curAns += rd;
		backtrack(pos+1);
		curAns -= rd;
	}
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> nbElem >> maxVal >> nbQuery;
	vector<Query> queries(nbQuery);
	for (auto &q : queries) {
		cin >> q.a >> q.b >> q.c >> q.d;
		qa[q.b].push_back(q);
	};

	cur[0] = 1;
	backtrack(1);
	cout << maxAns << "\n";

	return 0;
}


Measured memory_bytes: 3660
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  for_each(begin(A), end(A), [](auto& x) { cin >> x; });
  ll INF = 1001001001;
  ll curmin = INF;
  ll count = 0;
  for (const auto& x : A) {
    if (curmin >= x) {
      count++;
      curmin = x;
    }
  }

  cout << count << endl;
  return 0;
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;

void solve() {

}

int main() {
  int n,k;
  cin >> n >> k;
  int cnt = 0 ;
  while( n >= k ) {
    ++cnt;
    n = n / k;
  }
  cout << cnt+1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Test | diff Test.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Test.cpp && ./a.out

/*

 7/4/2020

 17:58-

 */

const int MAX_N=1e3+1;
int A[MAX_N][MAX_N];
int N;

void solve() {
  VI ps(N,0);
  int res=0;
  while(count(ALL(ps),N-1)<N) {
    VI X(N,-1);
    REP(i,N) if(ps[i]<N-1) X[i]=A[i][ps[i]];
    VI is;
    REP(i,N) if(X[i]!=-1&&i==X[X[i]]) {
      is.push_back(i);
    }
    assert(SZ(is)%2==0);
    if(is.empty()) {
      cout<<-1<<endl;
      return;
    }
    FORR(i,is) ps[i]++;
    ++res;
  }
  cout<<res<<endl;
}

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

  cin>>N;
  REP(i,N)REP(j,N-1) cin>>A[i][j],A[i][j]--;
  solve();

  return 0;
}


Measured memory_bytes: 7488
#include <iostream>
#include <vector>
#include <algorithm>

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

class UnionFindTree{
public:
	std::vector<int> parent;
	std::vector<int> rank;

	UnionFindTree(int n){
		parent.resize(n, 0);
		rank.resize(n, 0);

		for(int i = 0; i < n; i++){
			parent[i] = i;
		}
		return;
	}
	~UnionFindTree(){
		return;
	}

	int find(int x){
		if(parent[x] == x){
			return x;
		}
		else{
			return parent[x] = find(parent[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);

		if(x == y){
			return;
		}

		if(rank[x] < rank[y]){
			parent[x] = y;
		}
		else{
			parent[y] = x;
			if(rank[x] == rank[y]){
				rank[x]++;
			}
		}
	}

	bool is_same(int x, int y){
		return find(x) == find(y);
	}
};

class Edge{
public:
	int u;
	int v;
	int cost;

	Edge(){
		return;
	}

	~Edge(){
		return;
	}

	bool operator < (const Edge &r){
		return this->cost < r.cost;
	}
};


int main(int argc, char **argv){
	int n, m;
	int s, t, w;
	std::vector<Edge> edges;
	int result = 0;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif



#if INPUT_FROM_FILE
	ifs >> n >> m;
#else
	std::cin >> n >> m;
#endif

	for(int i = 0; i < m; i++){
#if INPUT_FROM_FILE
		ifs >> s >> t >> w;
#else
		std::cin >> s >> t >> w;
#endif
		Edge e;

		e.u = s;
		e.v = t;
		e.cost = w;
		edges.push_back(e);
	}
	
	std::sort(edges.begin(), edges.end());

	UnionFindTree uft(n);

	for(int i = 0; i < m; i++){
		Edge &e = edges[i];
		if(!uft.is_same(e.u, e.v)){
			uft.unite(e.u, e.v);
			result += e.cost;
		}
	}

	std::cout << result << std::endl;

	return 0;
}


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

long long md(pair<long long,long long> x,pair<long long,long long> y){
    return max(x.first,y.first)-min(x.first,y.first)+max(x.second,y.second)-min(x.second,y.second);
}

int main(){
    int K,S,ans=0;
    cin >> K >> S;
    for(int i=0;i<K+1;i++){
        for(int j=0;j<K+1;j++){
            if(0<=S-i-j&&S-i-j<=K)
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	string s;
	int ans=0;
	cin >>n>>s;
	int w=0;
	rep(i,n){
		if(s[i]=='R'){
			w++;
		}
	}
	int at1=0;
	int at2=n-1;
	if(w==n or w==0){
		ans=0;
	}else{
		while(at1<n){
			while(s[at1]!='W' and at1<n){
				at1++;
			}
			while(s[at2]!='R' and at2>=0){
				at2--;
			}
			if(at1<n and at2>=0 and at1 <at2){ans++;}
			s[at1]='R';
			s[at2]='W';
			//clog<<at1<<at2<<endl;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3924
#include<iostream>
using namespace std;
int x[1000], y[1000];
int main() {
    int n, sum; cin >> n;
    for (int i = 0; i < n; i++)cin >> x[i] >> y[i];
    for (int i = 0; i < n; i++) { sum += (x[i] - x[(i + 1) % n])*(y[i] + y[(i + 1) % n]); }
    cout << sum / 2 << '.' << (sum % 2) * 5 << endl;
    return 0;
}


Measured memory_bytes: 3096
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

b = readline().rstrip().decode()
if b == 'A':
    print('T')
elif b == 'T':
    print('A')
elif b == 'G':
    print('C')
else:
    print('G')


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

namespace MyProgram
{
    public class Program
    {	
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            
            int max = 0;
            string s1 = "";
            string s2 = "";
            
            int cnt = 0;
            for(int i = 1 ; i < s.Length ; i++)
            {
                s1 = s.Substring(0,i);
                s2 = s.Substring(i,n-i);
                cnt = 0;
                
                for(int j = 0 ; j < 26 ; j++)
                {
                    char c = (char)('a'+j);
                    if(s1.Contains(c) && s2.Contains(c)) cnt++;
                }
                max = Math.Max(max,cnt);
            }
            Console.WriteLine(max);
        }
    }
}

Measured memory_bytes: 13268
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 1e5 + 5, M = 1e5 + 5;


int main(){
    int a, b;
    cin >> a >> b;
    int hna = 1, ans = 1;
    while(hna < b){
        hna += (a - 1);
        ++ans;
    }
    printf("%d\n", --ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;
int fac(int n) {
	int val = 1;
	rep(i, 1, n + 1)val *= i;
	return val;
}
int main(void) {
	int n;
	cin >> n;
	int num = fac(n);
	vector<int> a(n), b(n), c(n);
	rep(i, 0, n) {
		cin >> a[i] >> b[i];
		c[i] = i;
	}
	double dist = 0;
	do {
		rep(i, 0, n-1) {
			dist += sqrt((a[c[i]] - a[c[i+1]])*(a[c[i]] - a[c[i + 1]])+
				(b[c[i]] - b[c[i + 1]])*(b[c[i]] - b[c[i + 1]]));
		}
	} while (next_permutation(c.begin(), c.end()));
	printf("%f\n",dist / num );

	return 0;
}


Measured memory_bytes: 256
//package cp;
import java.util.*;
import java.io.*;
public class Main {
	long gcd(long a,long b) {if(b==0)return a;else return gcd(b,a%b);}
	void swap(long a,long b) {long temp=a;a=b;b=temp;}
	StringBuilder sb=new StringBuilder();
	Integer[] ARR=new Integer[5];
	//Integer sort-TLE-Initialize object elements i.e a[0].
	long ceil(double n) {
//		System.out.println(n);
		return (long)Math.ceil(1.0*n);}
	void divisor(long n,int start) {
		int cnt=0;for(int i=start;i<=Math.sqrt(n);i++) {
		if(n%i==0) {if(i==n/i)cnt++;else cnt+=2;}}}
	
	public static void main(String[] args) throws IOException {	
		PrintWriter out = new PrintWriter(System.out);
		Readers.init(System.in);
		Main obj=new Main();
		int a=Readers.nextInt();
		int b=Readers.nextInt();
		int c=Readers.nextInt();
		int k=Readers.nextInt();
		long ans=0;
		long ans2=0;
		int num2=0;
		int val=b;
		if(b>a)num2=b/c;
		else {
			int num1=a/b;
			ans=obj.ceil(1.0*Math.log(num1)/Math.log(2));
			if(Math.pow(2, ans)==num1)ans++;
			val=b*(int) Math.pow(2, ans);
//			System.out.println(val);
			num2=val/c;
		}
		if(c>val);
		else {
//			System.out.println(num2+" oh");
			ans2=obj.ceil(1.0*Math.log(num2)/Math.log(2));
			if(Math.pow(2, ans2)==num2)ans2++;
		}
//		System.out.println(ans+" "+ans2);
		if(ans+ans2<=k)System.out.println("Yes");
		else System.out.println("No");
		out.flush();
	}
//	7 8 2
//	4

}
class Readers {
 
    static BufferedReader reader;
 
    static StringTokenizer tokenizer;
 
 
 
    /** call this method to initialize reader for InputStream */
 
    static void init(InputStream input) {
 
        reader = new BufferedReader(
 
                     new InputStreamReader(input) );
 
        tokenizer = new StringTokenizer("");
 
    }
 
 
 
    /** get next word */
 
    static String next() throws IOException {
 
        while ( ! tokenizer.hasMoreTokens() ) {
 
            //TODO add check for eof if necessary
 
            tokenizer = new StringTokenizer(
 
                   reader.readLine() );
 
        }
 
        return tokenizer.nextToken();
 
    }
 
 
 
    static int nextInt() throws IOException {
 
        return Integer.parseInt( next() );
 
    }
 
	
 
    static double nextDouble() throws IOException {
 
        return Double.parseDouble( next() );
 
    }
    
    
    static long nextLong() throws IOException{
    	
		return Long.parseLong(next());
	}
 
}


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

int main(){
  while(true){
    int n,m;
    cin >> n >> m;
    if(n==0 && m==0){
      break;
    }

    int INF=1000000000;
    int way_co[m][m];
    int way_ti[m][m];
    for(int i=0; i<m; i++){
      for(int j=0; j<m; j++){
        way_co[i][j] = INF;
        way_ti[i][j] = INF;
        if(i==j){
          way_co[i][j] = 0;
          way_ti[i][j] = 0;
        }
      }
    }

    int a,b,cost,tim;
    for(int i=0; i<n; i++){
      cin >> a >> b >> cost >> tim;
      way_co[a-1][b-1] = way_co[b-1][a-1] = cost;
      way_ti[a-1][b-1] = way_ti[b-1][a-1] = tim;
    }

    int d_co[m][m];
    int d_ti[m][m];
    for(int i=0; i<m; i++){
      for(int j=0; j<m; j++){
        d_co[i][j] = way_co[i][j];
        d_ti[i][j] = way_ti[i][j];
      }
    }

    for(int k=0; k<m; k++){
      for(int i=0; i<m; i++){
        for(int j=0; j<m; j++){
          if(d_co[i][j] > d_co[i][k] + d_co[k][j]){
            d_co[i][j] = d_co[i][k] + d_co[k][j];
          }
          if(d_ti[i][j] > d_ti[i][k] + d_ti[k][j]){
            d_ti[i][j] = d_ti[i][k] + d_ti[k][j];
          }
        }
      }
    }
    int y;
    cin >> y;
    for(int i=0; i<y; i++){
      int a,b,c;
      cin >> a >> b >> c;
      if(c==0){
        cout << d_co[a-1][b-1] << endl;
      }else{
        cout << d_ti[a-1][b-1] << endl;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3240
#include<cstdio>

using namespace std;

int main()
{
	double v,t,y;
	int n,h[100000];

	for(int i=0;i<100000;i++){
		h[i]=i*5-5;
	}

	while(scanf("%lf",&v)!=EOF){
		t=v/9.8;
		y=4.9*t*t;
		n=(int)((y+5.0)/5.0);
		for(int i=0;i<100000;i++){
			if(h[i]>=y){
				n=i;
				break;
			}
		}
		printf("%d\n",n);
	}
	return 0;
}

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

using namespace std;

const int MaxN = 1e2 + 12;

int a[MaxN];
int b[MaxN];
int n;

void fail()
{
    cout << -1 << '\n';
    exit(0);
}

void moveTo(int r, int l)
{
    int x = a[r];
    for(int i = r; i > l; --i)
        a[i] = a[i - 1];
    a[l] = x;
}

int main()
{
    cin >> n;
    for(int i = 1; i <= n; ++i)
        cin >> a[i];

    /*
    for(int j = n; j > 0; --j)
    {
        for(int l = 1; l <= n; ++l)
            if(a[l] == j)
            {
                int r;
                for(r = l + 1; r <= n && a[r] == a[l]; ++r);

                for(int i = l; i < r; ++i)
                {
                    if(i - a[i] + 1 <= 0)
                        fail();
                    moveTo(i, i - a[i] + 1);
                }

                l = r;
            }
    }*/

    for(int i = 1; i <= n; ++i)
        if(a[i] > i)
            fail();
        else
            moveTo(i, i - a[i] + 1);

    for(int i = n; i > 0; --i)
        cout << a[i] << '\n';

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define sz(x) (int)x.size()
#define F first
#define S second
#define ppb pop_back
#define mp make_pair
#define all(n) n.begin(), n.end()
#define timefaster ios_base::sync_with_stdio(0);cin.tie(0)

 using namespace std;

 const int N = (int)2e5 + 123;
 const int mod = (int)1e9 + 7;
 const ll INF = (ll)1e18;

 int main(){
 	timefaster;
 	string s,s1;
 	int cnt=0;
 	cin >> s >> s1;
 	for(int i=0;i < 3;i ++){
 	 	if(s[i] == s1[i]) cnt ++;
 	}
 	cout << cnt;
 }
 // Aksay sila

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
   ios::sync_with_stdio(0);
   cin.tie(0);
   char s;
   cin>>s;
   if(islower(s)){
      cout<<"a"<<endl;
   }
   else{
      cout<<"A"<<endl;
   }
}

Measured memory_bytes: 3624
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>

#define endl '\n'
#define ull unsigned long long
#define ll long long
#define ul unsigned long
#define ld long double
#define PI 3.14159265359

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int t = 1;
	// cin >> t;
	while (t--) {
		int n;
		cin >> n;
		int x, o = 0;
		while (n--) {
			cin >> x;
			if (x & 1) {
				o++;
			}
		}
		cout << (o & 1 ? "NO" : "YES");
	}
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,ans,sum=0,tmp=0;
  cin >> n;
  long long a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
    sum+=a[i];
  }
  for(int i=0;i<n-1;i++){
    tmp+=a[i];
    if(i==0){
      ans=abs(2*tmp-sum);
    }
    ans=min(ans,abs(2*tmp-sum));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
const int MAXN=(int)1e5+10;
const ll MOD=(ll)1e9+7;
int main()
{
	int n,m,ma=0;
	cin>>n>>m;
	int gg;
	for(int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		ma=max(x,ma);
		if(i==1)gg=x;
		else {
			gg=__gcd(gg,x);
		}
	}
	if(ma>=m&&m%gg==0)puts("POSSIBLE");
	else puts("IMPOSSIBLE");
	return 0;
}

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

using namespace std;

int main(){
    string in;
    int ans;
    cin>>in;ans=atoi(in.c_str());
    while(cin>>in,in[0]!='='){
        if(in[0]=='+'){
            cin>>in;ans +=atoi(in.c_str());
        }
        else if(in[0]=='-'){
            cin>>in;ans -=atoi(in.c_str());
        }
        else if(in[0]=='*'){
            cin>>in;ans *=atoi(in.c_str());
        }
        else if(in[0]=='/'){
            cin>>in;ans /=atoi(in.c_str());
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3204
def solve():
  ans = 0
  N = int(input())
  A = list(map(int, input().split()))
  for i in range(N):
    A[i] -= i+1
  B = sorted(A)
  p = B[N//2]
  for i in range(N):
    A[i] = abs(A[i]-p)
  ans = sum(A)
  return ans
print(solve())

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

void Build(ll tree[], ll A[], int start, int end, int node){
	if(start == end){
		tree[node] = A[start];
		return;
	}
	int mid = (start+end)/2;
	Build(tree, A, start, mid, 2*node+1);
	Build(tree, A, mid+1, end, 2*node+2);
	tree[node] = max(tree[2*node+1], tree[2*node+2]);
}

ll max(ll x, ll y){
	return (x>y)?x:y;
}

ll Query(ll tree[], int start, int end, int node, int l, int r){
	if(r < start || end < l){return 0;}
	if(l <= start && end <= r){return tree[node];}
	int mid = (start+end)/2;
	ll p1 = Query(tree, start, mid, 2*node+1, l, r);
	ll p2 = Query(tree, mid+1, end, 2*node+2, l, r);
	return max(p1, p2);
}

void Update(ll tree[], ll A[], int start, int end, int node, int idx, ll val){
	if(start == end){
		A[start] = val;
		tree[node] = val;
		return;
	}

	int mid = (start+end)/2;
	if(idx <= mid){Update(tree, A, start, mid, 2*node+1, idx, val);}
	else{Update(tree, A, mid+1, end, 2*node+2, idx, val);}
	tree[node] = max(tree[2*node+1], tree[2*node+2]);
}

void Print(int arr[], int size){
	cout << "Printing Array\n";
	for(int i=0 ; i<size ; i++){cout << arr[i] << " ";}
	cout << "\n";
}

int main(){
	int n;
	cin >> n;
	int ht[n];
	for(int i=0 ; i<n ; i++){
		cin >> ht[i];
	}

	ll a[n];
	for(int i=0 ; i<n ; i++){
		cin >> a[i];
	}

	ll maxTillNow[n+1] = {0};
	ll tree[2*n+3] = {0};
	ll sol = 0;
	for(int i=0 ; i<n ; i++){
		ll ans = Query(tree, 0, n, 0, 0, ht[i]-1) + a[i];
		//maxTillNow[ht[i]] = ans;
		Update(tree, maxTillNow, 0, n, 0, ht[i], ans);
		sol = max(sol, maxTillNow[ht[i]]);
	}
	cout << sol << "\n";
	return 0;
}

Measured memory_bytes: 7296
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#include <iomanip>
#define rep(i,x) for(ll i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}/*フィボナッチテンプレ
ll memo[50];
ll fibo(ll n) {
    if (memo[n] != 0)return memo[n];
    if (n <= 1)return memo[n] = n;
    else return memo[n] = fibo(n - 1) + fibo(n - 2);
}
*/

int main() {
    ll N;
    cin >> N;
    vector<ll> num(N);
    vector<ll> ans(N);
  rep(i,N)cin >> num[i];
    if (N % 2 == 0) {
        rep(i, N) {
            if (i % 2 == 0) {
                ans[N / 2 + i / 2] = num[i];
            }
            else ans[N / 2 - 1 - i / 2] = num[i];
        }
    }
    else {
        rep(i, N) {
            if (i % 2 == 0) {
                ans[N / 2 - i / 2] = num[i];
            }
            else ans[N / 2 + i / 2 + 1] = num[i];
        }
    }
    rep(i, N)cout << ans[i] << " ";
    cout << endl;
}

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

int main(){
    int N, M;
    cin >> N >> M;
    int A[M];
    for (int i=0; i<M; ++i){
        cin >> A[i];
        N -= A[i];
    }
    if (N >= 0) cout << N << endl;
    else cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3624
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container;

long P = 10^^9+7;

long pow(long x, long n) {
    long y = 1;
    while (n) {
        if (n%2 == 1) y = (y * x) % P;
        x = x^^2 % P;
        n /= 2;
    }
    return y;
}

void main()
{
    auto nk = readln.split.to!(long[]);
    auto N = nk[0];
    auto K = nk[1];
    writeln(pow(K, N));
}


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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

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

static const ll INF = 1e15;

static const ll mod = 1e9 + 7;

ll gcd(ll a, ll b) { while (b) a %= b, swap(a, b); return abs(a); }

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
    ll x;
    cin >> x;
	auto u = lcm(x, 360);
	cout << u / x << endl;
	return 0;
}
	

Measured memory_bytes: 3560
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;cin>>s;
  int n=s.size();
  int c=0; int b=1;
  int* r=new int[n+1]{};
  int* cc=new int[2019]{};
  cc[0]++;
  for(int i=n-1;i>=0;i--){
    r[i]=(r[i+1]+b*(s[i]-'0'))%2019;
    b=(b*10)%2019;
    c+=cc[r[i]];cc[r[i]]++;
  }
  cout << c << endl;
  return 0;
}  


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

using namespace std;

struct lhy{
	int x,y,next;
}edge[200020];

int n,x,y,root,tot,son[100010];
int l[100010],r[100010],Odd[100010],v[100010];

inline void add(int x,int y)
{
	edge[++tot].x=x;edge[tot].y=y;edge[tot].next=son[x];son[x]=tot;
}

void DFS(int x,int fa,int deep)
{
	l[x]=max(l[x],l[root]-deep);
	r[x]=min(r[x],r[root]+deep);
	for(int i=son[x];i;i=edge[i].next)
	{
		int y=edge[i].y;
		if(y==fa)continue;
		Odd[y]=Odd[x]^1;
		DFS(y,x,deep+1);
		l[x]=max(l[x],l[y]-1);
		r[x]=min(r[x],r[y]+1);
	}
}

void dfs(int x,int fa)
{
	for(int i=son[x];i;i=edge[i].next)
	{
		int y=edge[i].y;
		if(y==fa)continue;
		if(v[x]-1>=l[y]&&v[x]-1<=r[y])v[y]=v[x]-1;
		else if(v[x]+1<=r[y]&&v[x]+1>=l[y])v[y]=v[x]+1;
		else
		{
			puts("No");
			exit(0);
		}
		dfs(y,x);
	}
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		l[i]=-0x3f3f3f3f;
		r[i]=0x3f3f3f3f;
	}
	for(int i=1;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}
	int k;
	scanf("%d",&k);
	for(int i=1;i<=k;i++)
	{
		int x,v;
		scanf("%d%d",&x,&v);
		l[x]=r[x]=v;
		root=x;
	}
	Odd[root]=l[root]&1;
	DFS(root,0,0);
	for(int i=1;i<=n;i++)
		if(l[i]>r[i])
		{
			puts("No");
			return 0;
		}
	v[root]=l[root];
	dfs(root,0);
	for(int i=1;i<=n;i++)
		if(v[i]&1!=Odd[i])
		{
			puts("No");
			return 0;
		}
	puts("Yes");
	for(int i=1;i<=n;i++)
		printf("%d\n",v[i]);
}

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

int main(){
  int n = 0;
  cin >> n;
  vector <int> x(n);
  int i = 0;
  int ans = 2147483647;
  rep(i, n) cin >> x[i];
  for (int j = 1; j <= 100; j++)  
  {
    int now = 0;
    rep(i, n) now += (x[i] - j) * (x[i] - j);
    ans = min(ans, now);
  }
  cout << ans << endl;
}


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

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    for (auto& x : A) {
        cin >> x;
    }
    vector<int> B(N);
    map<int, int> m;
    for (int j = 0; j < N; ++j) {
        B[j] = j - A[j];
        ++m[B[j]];
    }
    long long ans = 0;
    for (int i = 0; i + 1 < N; ++i) {
        --m[B[i]];
        ans += m[A[i] + i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 21844
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
// #include <atcoder/all>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) for(int sz=0;sz<int(vec.size());sz++) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    if (s.back() == 's') {
        s.push_back('e'); s.push_back('s'); 
    } else s.push_back('s');
    cout << s << '\n'; 
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
  long long n;
  cin >> n;
  
  long long fx = 0;
  long long ans = 0;
  
  for(int i=1;i <= n;i++){
    fx = 0;
    long long int y = n/i;
    
    fx = y*(y+1)/2;
    //cout << fx << endl;
    ans += i*fx;
  }
  
  cout << ans << endl;
      
}



Measured memory_bytes: 3628
#include<iostream>

using namespace std;

int main()
{
    long long int a,b;
    cin>>a>>b;
    int m,flag;
    m=a+b;
    if (m%3==0) {
        flag=0;
    }
    else {
        if (a%3==0 || b%3==0) {
            flag=0;
        }
        else {
            flag=1;
        }
    }
    if (flag==0) {
        cout<<"Possible"<<endl;
    }
    else {
        cout<<"Impossible"<<endl;
    }
}


Measured memory_bytes: 256
//agc002_a.cpp
//Fri Nov  2 23:15:37 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	if ((a<=0 && b>=0) || (a>=0 && b<=0)){
		cout << "Zero" << endl;
	}else if (b<0){
		if ((b-a)%2 == 1){
			cout << "Positive" << endl;
		}else {
			cout << "Negative" << endl;
		}
	}else{
		cout << "Positive" << endl;
	}


}

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

int p[202], q[202], cnt;
long long n;

void solve(long long n){
    if (!n) return;
    if (~n & 1) 
        q[++q[0]] = cnt++, solve(n - 1);
    else
        p[++p[0]] = cnt++, solve(n >> 1);
}

int main(){
    scanf("%lld", &n), solve(n), printf("%d\n", cnt + 100);
    for (int i = 1; i <= q[0]; ++i) printf("%d ", cnt - q[i]);
    for (int i = p[0]; i; --i) printf("%d ", cnt - p[i]);
    for (int i = 1; i <= 100; ++i) printf("%d ", i);
    return 0;
}

Measured memory_bytes: 256
using System;
public class Class1
{
	public static void Main()
	{
		string line;
		int[] alphabet=new int[26];
		
		while((line=Console.ReadLine())!=null)
		{
		char[] cs=line.ToCharArray();
		
		for(int i=0;i<cs.Length;i++)
		{
			if(char.IsLetter(cs[i]))
			{
			if(char.IsUpper(cs[i]))
			{
				cs[i]=char.ToLower(cs[i]);
			}
		
			int num =cs[i]-(int)'a';
			alphabet[num]++;
			}
		}
		}
		for (int j=0;j<26;j++)
		{
			
			Console.WriteLine((char)((int)'a'+j)+" : "+alphabet[j]);
		
		}
	}
}

Measured memory_bytes: 9096
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
using IP = pair<int, int>;

const ll INF = 1LL << 62;
const int dx[4] = { 1,0,-1,0 };
const int sy[4] = { 0,1,0,-1 };

#define atcoder (int)1e9+7
#define Endl endl
#define mp make_pair
#define all(v) v.begin(),v.end()
#define pb push_back
#define pr(x) cout << x << endl
#define chmax(x) x = max(x,y)
#define chmin(x) x = min(x,y)
#define rep(i,n) for(int i= 0;i<n;i++)

ll gcd(ll a, ll b) {//最大公約数
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

ll lcm(ll a, ll b) {//最小公倍数
	return (a / gcd(a, b))*b;
}

int binary(ll a) {
	int cnt = 0;
	while (a) {
		a /= 2;
		cnt++;
	}

	return cnt - 1;
}

int main(){
	
	ll n, m;
	ll ans = 0;

	cin >> n >> m;

	if (n <= m/2) {
		ans += n;
		m -= 2 * n;
		ans += m / 4;
	}
	else {
		ans = m / 2;

	}
	pr(ans);

	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#include<bitset>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,M;
	int count[100001]={};
	scan(N);scan(M);
	rep(i,M){
		int a,b;
		scan(a);scan(b);
		count[a]++;
		count[b]++;
	}
	int flag=1;
	rep1(i,N){
		if(count[i]%2) flag=0;
	}
	if(flag) prin("YES");
	else prin("NO");
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end()) 
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef long long ll;

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 INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);


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

  ll h, n;
  cin >> h >> n;
  vector<ll> a(n);
  rep(i, n) {
    cin >> a[i];
  }

  ll sum = SUM(a);

  if (sum >= h) {
    puts("Yes");
  } else {
    puts("No");
  }

  return 0;
}


Measured memory_bytes: 1024
import sys
rr = lambda: sys.stdin.readline().strip()
ri = lambda: int(rr())
rs = lambda: [int(_) for _ in rr().split()]

from operator import itemgetter

N, M = rs()
data = [[i]+[int(_) for _ in input().split()] for i in range(M)]

data.sort(key=itemgetter(1, 2))
ans = [''] * M

P = -1
cnt = 0
for d in data:
    if P != d[1]:
        P = d[1]
        cnt = 1
    else:
        cnt += 1
    ans[d[0]] = str(P).zfill(6) + str(cnt).zfill(6)

for i in range(M):
    print(ans[i])

Measured memory_bytes: 31496
#include <bits/stdc++.h>
#define endl "\n"

using namespace std;

int main()
{
	unsigned int k;
	string s,o;
	cin >> k; cin >> s;
	if(s.length() > k) {
		for(unsigned int i=0;i<k;i++)
			o+=s[i];
		o+="...";
		cout<<o<<endl; return 0;
	}
	cout<<s<<endl;
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define MOD 1e9+7
#define sp ' '


using ll = long long;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

template<typename T>
void PrimeFactors(T n, std::map<T,T> &out)
{
    while (n % 2 == 0){
        ++out[2];
        n /= 2;
    }

    for (T i = 3; i*i <= n; i += 2){
        while (n%i == 0){
            ++out[i];
            n /= i;
        }
    }

    if (n > 2)
        ++out[n];
}
int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, p;
    cin >> n >> p;
    map<ll, ll> mp;
    PrimeFactors(p, mp);
    if(n >= 40){
        ppp(1);
        return 0;
    }
    if(n == 1){
        ppp(p);
        return 0;
    }
    ll ans = 1LL;
    for(auto m : mp){
        if(m.second >= n)
            ans *= pow(m.first,(m.second/n));
    }
    ppp(ans);
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	map<string, int> cnt;
	rep(i, 0, N) {
		string s; cin >> s;
		cnt[s]++;
	}

	int ma = -1;
	fore(p, cnt) chmax(ma, p.second);
	fore(p, cnt) if (p.second == ma) printf("%s\n", p.first.c_str());
}







Measured memory_bytes: 23808
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,cnt=0;
  cin >> n;
  ll a[n];
  map<ll,ll> mp;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=n-1;i>=0;i--){
    auto it = mp.upper_bound(a[i]);
    if(it==mp.end()){
      cnt++;
    }else{
      if(it->second==1) mp.erase(it);
      else it->second--;
    }
    mp[a[i]]++;
  }
  cout <<cnt << endl;
}


Measured memory_bytes: 7168
W, H, x, y, r = map(int, input().split(' '))
 
flag_x = (x + r <= W) and (x - r >= 0)
flag_y = (y + r <= H) and (y - r >= 0)
 
if flag_x and flag_y:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 7696
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    rep(i,n){
        ll x;
        cin>>x;
        if(x%2==0){
            if(x%3!=0&&x%5!=0){
                cout<<"DENIED"<<endl;
                return 0;
            }
        }
    }
    cout<<"APPROVED"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <ctime>
#include <vector>
#include <fstream>
#include <list>
#include <iomanip>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ms(s) memset(s, 0, sizeof(s))
const ll INF = 1e9;
inline ll read(){
	ll X = 0,w = 0 ;
	char ch = 0;
	while(!isdigit(ch)) {w |= ch == '-';ch = getchar();}
	while(isdigit(ch)) X = (X<<3) + (X<<1) + (ch ^ 48),ch = getchar();
	return w ? -X : X;
}

pair<ll,ll> dat[10005];
map<pair<ll,ll>,ll> mp;
int main() 
{
	ll n;
	cin>>n;
	for(ll i=0;i<n;i++)
	{
		cin>>dat[i].first>>dat[i].second;
	}
	sort(dat,dat+n);
	ll ans=0;
	for(ll i=0;i<n;i++)
	{
		for(ll j=i+1;j<n;j++)
		{
			mp[make_pair(dat[j].first-dat[i].first,dat[j].second-dat[i].second)]+=1;
			ans=max(ans,mp[make_pair(dat[j].first-dat[i].first,dat[j].second-dat[i].second)]);
		}
	}
	cout<<n-ans;
    return 0;
}

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

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

  int p[110];
  int bucket[110] = {false};
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    bucket[p[i]] = true;
  }

  int current = 9999;
  int ans;
  for (int i = 0; i <= 101; i++) {
    if (!bucket[i]) {
      if (abs(x - i) < current) {
        ans = i;
        current = abs(x - i);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3124
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

int main(void) {
	int num, i, r;
	cin >> num >> r;
	vector<int> d(num);
	rep(i, num)
		cin >> d[i];
	num -= r;
	rep(i, num) {
		if (d[i] < d[r])
			printf("Yes\n");
		else
			printf("No\n");
		r++;
	}
	return 0;
}

Measured memory_bytes: 4028
import java.util.Scanner;
import java.lang.Math;

public class Main{

    public static void main(String []args){
        
        Scanner in = new Scanner(System.in);
        String a = in.next();
        String b = in.next();
        int c = Integer.parseInt(a+b);
        
        if (Math.sqrt(c)%1 == 0){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
const lli INF = 1e9 + 100;
const lli INF64 = (1LL << 61) + 100;
const lli MOD = 1e9 + 7;
const lli MH1 = 1599614977, MH2 = 2034417103, MH3 = 1090250123, MH4 = 2024491871; 
lli bpow(lli baseee, lli exponenttt) {
	if(exponenttt < 0) return 0;
	lli res = 1;
	baseee %= MOD;
	while (exponenttt > 0) {
		if ((exponenttt & 1) == 1) res = (res*baseee) % MOD;
		baseee = (baseee*baseee) % MOD;
		exponenttt >>= 1;
	}
	return res;
}
lli multInverse(lli a) {//if_mod_is_prime
	return bpow(a, MOD - 2);
}
lli divm(lli a, lli b) {//if_mod_is_prime
	return (a * multInverse(b)) % MOD;
}
lli multm(lli a, lli b) {
	return (a * b) % MOD;
}
lli subm(lli a, lli b) {
	a += MOD;
	lli r = a - b;
	if(r >= MOD) return r - MOD;
	return r;
}
lli addm(lli a, lli b) {
	lli r = a + b;
	if(r >= MOD) return r - MOD;
	return r;
}
signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	lli xx;
	cin >> xx;
	cout << ((xx / 500) * 1000 + ((xx % 500) / 5) * 5) << "\n";
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

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

  int N = 0;
  std::cin >> N;

  int ans = 0;
  for (int i = 1; i <= N; i++) {
    if (i % 2 == 0) {
      continue;
    }
    int f = 0;
    for (int j = 1; j <= i; j++) {
      if (i % j == 0) {
        f++;
      }
    }
    if (f == 8) {
      ans++;
    }
  }

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 3140
#!/usr/bin/env python3
import sys
import collections

def solve(N: int, a: "List[int]"):
    counter = collections.Counter(a)
    aset = set(a)
    answer = 0
    for aa in aset:
        answer += (counter[aa]-aa) if counter[aa]>=aa else counter[aa]
    print(answer)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 27820
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> p;
int K,X,Y,i,j,n;
bool xflip,yflip,xyswap;
vector<p> def;
void pushdef(int x,int y) {
    if(xyswap)swap(x,y);
    if(xflip)x*=-1;
    if(yflip)y*=-1;
    def.push_back(p(x, y));
}
main(){
    cin>>K>>X>>Y;
    if(X<0)xflip=true,X*=-1;
    if(Y<0)yflip=true,Y*=-1;
    if(X>Y)xyswap=true,swap(X,Y);
    if(X+Y&1&&~K&1){
        cout<<-1<<endl;
        return 0;
    }
    if(X+Y<K&&X+Y&1){
        pushdef(X,-K+X);
        pushdef((K+X-Y)/2,K-(K+X-Y)/2);
        pushdef(-(K+X-Y)/2,K-(K+X-Y)/2);
    }else{
        int tarx,tary;
        if (X+Y<K||K&1&&((X+Y)/K&1)==(X+Y&1)){
            int U=X+Y,V=-X+Y;
            int u=U-U%K+K,v=V-K;
            tarx=(u-v)/2,tary=(u+v)/2;
        } else {
            int U=X+Y,V=-X+Y;
            int u=U-U%K,v=V-K;
            tarx=(u-v)/2,tary=(u+v)/2;
        }
        if((X+Y)%K!=0)pushdef(X-tarx,Y-tary),X=tarx,Y=tary;
        for(;i<X/K;i++)pushdef(K,0);
        for(;j<Y/K;j++)pushdef(0,K);
        if(X%K!=0)pushdef(X%K,Y%K);
    }
    cout<<def.size()<<" ";
    int x=0,y=0;
    for(n=0;n<def.size();n++)x+=def[n].first,y+=def[n].second,cout<<x<<" "<<y<<" ";
}


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

int main()
{
  int h, w, a, b;
  cin >> h >> w >> a >> b;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cout << ((i < b) == (j < a));
    }
    cout << endl;
  }
}


Measured memory_bytes: 1280