akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
const static int tx[] = {0,1,1,1,0,-1,-1,-1};
const static int ty[] = {-1,-1,0,1,1,1,0,-1};
 
static const double EPS = 1e-8;

class Edge{
public:
  int _to;
  int _capacity;
  int _reverse;
  int _id;
  Edge(int to,int capacity,int reverse) :
    _to(to), _capacity(capacity), _reverse(reverse) {}
  Edge(int to,int capacity,int reverse,int id) :
    _to(to), _capacity(capacity), _reverse(reverse),_id(id) {}
};

class FordFulkerson {
private:
  int _n;
  bool *_used;
  vector<Edge>* _edges;
  void fill_used(){
    fill(_used,_used + (_n+1) ,false);
  }
public:
  FordFulkerson(int n){
    _n = n;
    _edges = new vector<Edge>[n+1];
    _used = new bool[n+1]();
  }

  void add_edge(int from,int to,int capacity,int id){
    _edges[from].push_back(Edge(to,capacity,_edges[to].size(),id));
    _edges[to].push_back(Edge(from,capacity,_edges[from].size()-1,-id));
  }

  int dfs(int current,int sink,int flow){
    if(current == sink) return flow;
    _used[current] = true;
    for(int i=0;i<_edges[current].size();i++){
      Edge& e = _edges[current][i];
      int to = e._to;
      if(_used[to] || e._capacity <= 0) continue;

      int d = dfs(to,sink,min(flow,e._capacity));
      if(d <= 0) continue;
      
      e._capacity -= d;
      _edges[to][e._reverse]._capacity += d;
      return d;
    }
    
    return 0;
  }

  int compute_max_flow(int source,int sink){
    int res = 0;
    while(true){
      fill_used();
      int tmp = dfs(source,sink,INF);
      if(tmp == 0) break;
      res += tmp;
    }
    return res;
  }

  set<int> compute_reverse(){
    set<int> res;
    for(int from = 1; from <= _n; from++){
      for(int i = 0; i < _edges[from].size();i++){
        Edge& e = _edges[from][i];
        if(_edges[e._to][e._reverse]._capacity > 1
           && e._id < 0){
          res.insert(-1 * e._id);
        }
      }
    }
    return res;
  }
};

int main(){
  int num_of_crossings;
  int num_of_roads;
  while(~scanf("%d %d",
               &num_of_crossings,
               &num_of_roads)){
    
    FordFulkerson fordfulkerson(num_of_crossings);

    vector<P> roads;
    for(int road_i = 1; road_i <= num_of_roads; road_i++){
      int from,to;
      scanf("%d %d",&from,&to);
      fordfulkerson.add_edge(from,to,1,road_i);
      roads.push_back(P(from,to));
    }

    int source,sink;
    scanf("%d %d",&source,&sink);
    cout << fordfulkerson.compute_max_flow(source,sink) << endl;
    
    set<int> res = fordfulkerson.compute_reverse();
    cout << res.size() << endl;
    for(set<int>::iterator it = res.begin(); it != res.end(); it++){
      cout << *it << endl;
    }
  }
}

Measured memory_bytes: 1292
from scipy import misc

def cnk(n,k):
    return misc.comb(n,k,exact=True)


# import scipy.special
# def cnk(n,k):
#     return int(scipy.special.comb(n,k))

def calculate(n,k):
    # 1. 在n+1个缝隙上，选择i个地方 Cn+1,i

    # 2. 在i个地方，放入k个球 C(k-1),(i-1)

    for i in range(1,k+1):

        a1 = cnk(n-k+1,i)
        a2 = cnk(k-1,i-1)
        print((a1 * a2) % (1000000000+7))


S = input().split(" ")

N = int(S[0])
K = int(S[1])

calculate(N,K)

Measured memory_bytes: 14348
#include <bits/stdc++.h>
#define endl '\n';

typedef long long ll;

using namespace std;

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

    int n, k, x, y;
    int ans;

    cin >> n >> k >> x >> y;

    if (n >= k) {
        ans = k * x + (n - k) * y;
    } else {
        ans = n * x;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#文字の入力
A1 = input()
#文字列の長さ
mojisu = len(A1)
n = 1	
i = 0	#入れ替える回数カウント

#判定
while round(mojisu/2) >= n:
  if A1[n-1] != A1[mojisu-n]:
    i += 1
  n += 1

#出力
print(i)

Measured memory_bytes: 2940
#include <iostream>
#include <vector>

using namespace std;

int main(){

    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N - 1);
    for(int i = 0; i < N; i++) cin >> A.at(i);
    for(int i = 0; i < N; i++) cin >> B.at(i);
    for(int i = 0; i < N - 1; i++) cin >> C.at(i);

    int ans = 0, prev_index = A.front();
    for(int i = 0; i < N; i++){
        ans += B.at(A.at(i) - 1);
        if(prev_index + 1 == A.at(i)) ans += C.at(prev_index - 1);
        prev_index = A.at(i);
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
  string s,t; cin >> s >> t;
  int n = s.size();
  int m = t.size();
  bool ans = true;
  if(n != m-1)ans = false;
  for(int i = 0; i < n; i++){
    if(s[i]==t[i])continue;
    else ans = false;
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}
  

Measured memory_bytes: 3584
import std.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.regex;
import std.c.string;

void main() {
    int n;
    bool[7][7][7][7][3][3][366] cache;
    while (readf("%d\n", &n), n) {
        int[][] fs = new int[][n];
        foreach (i; 0 .. n) {
            fs[i] = readln.chomp.split(ctRegex!r" +").map!(to!int).array;
        }
        /*
        foreach (d; 0 .. n) {
            foreach (i; 0 .. 4) {
                fs[d][i * 4 .. i * 4 + 4].writeln;
            }
            writeln;
        }
        writeln;
        */
        memset(cast(bool*)cache, 0, cache.sizeof);
        bool dfs(int d, int y, int x, int p, int q, int r, int s) {
            assert(0 <= y && y <= 2 && 0 <= x && x <= 2);
            //[d, y, x, p, q, r, s].writeln;
            if (cache[d][y][x][p][q][r][s]) return false;
            cache[d][y][x][p][q][r][s] = true;
            int[][] F = new int[][](4, 4);
            foreach (i, f; fs[d - 1]) {
                F[i / 4][i % 4] = f;
            }
            foreach (i; 0 .. 2) {
                foreach (j; 0 .. 2) {
                    if (F[y + i][x + j]) {
                        return false;
                    }
                }
            }
            if (y == 0 && x == 0) p = -1;
            if (y == 0 && x == 2) q = -1;
            if (y == 2 && x == 0) r = -1;
            if (y == 2 && x == 2) s = -1;
            p++; q++; r++; s++;
            if (p >= 7 || q >= 7 || r >= 7 || s >= 7) return false;
            if (d == n) {
                //writeln(y, " ", x, " ", corners);
                return true;
            }
            // y固定
            for (int dx = -2; dx <= 2; dx++) {
                int nx = x + dx;
                if (nx < 0 || nx > 2) continue;
                if (dfs(d + 1, y, x + dx, p, q, r, s)) {
                    return true;
                }
            }
            // x固定
            for (int dy = -2; dy <= 2; dy++) {
                int ny = y + dy;
                if (ny < 0 || ny > 2) continue;
                if (dfs(d + 1, ny, x, p, q, r, s)) {
                    return true;
                }
            }
            return false;
        }
        writeln(dfs(1, 1, 1, 0, 0, 0, 0) ? 1 : 0);
    }
}

Measured memory_bytes: 10248
#include<iostream>
using namespace std;
const int N = 2e5+7;
char s[N];
int main()
{
    int n;
    cin>>n;
    int ans=0;
    for(int i=1; i<=n; i++)
        cin>>s[i];
    int i,j;
    i=1;
    j=n;
    while(j>i)
    {
        if(s[i]=='W'&&s[j]=='R')
        {
            i++;
            j--;
            ans++;
        }
        else if(s[i]=='W'&&s[j]=='W')
            j--;
        else if(s[i]=='R')
            i++;
    }
    cout<<ans<<endl;
    return 0;

}


Measured memory_bytes: 3692
def mpow(a,n,mod):
  if n == 0:
    return 1
  elif n == 1:
    return a
  elif n%2==0:
    return (pow(a,n//2,mod))**2%mod
  else:
    return a*pow(a,n-1,mod)%mod
def mfac(l,r,mod):
  ans = l
  for i in reversed(range(r,l)):
    ans *= i
    ans %= mod
  return ans
def mcomb(n,k,mod):
  A = mfac(n,n-k+1,mod)
  B = mfac(k,1,mod)
  B = mpow(B,mod-2,mod)
  return A*B%mod

def main():
  mod = 10**9+7
  n,a,b = map(int,input().split(" "))
  ans = mpow(2,n,mod)-1-mcomb(n,a,mod)-mcomb(n,b,mod)
  ans %= mod
  print(ans)

if __name__ == "__main__":
  main()

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

typedef long long ll;

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

    ll n,h,w;
    cin >> n >> h >> w;
    cout << (n-h+1)*(n-w+1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>


void printArray(int A[], int N) {
  int i;

  printf("%d", A[0]);
  for(i=1; i<N; i++)
    printf(" %d", A[i]);
  putchar('\n');

}


void insertionSort(int A[], int N) {
  int i;

  printArray(A, N);
    
  for(i=1; i<N; i++) {
    int v = A[i];
    int j = i-1;

    while (j>=0 && A[j] > v) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    printArray(A, N);
  }
 
}

int main(int argc, char *argv[]) {
  int N;
  int A[1000];
  int i;
  
  scanf("%d", &N);

  for (i=0; i<N; i++)
    scanf("%d", &A[i]);
  
  insertionSort(A,N);

  return 0;

}

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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long> VLL;
#define inf (int)(1e9)
#define INF 1.1529215e+18
#define MAXX 999999
#define EPS (1e-7)
#define MOD ((ll)1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/
/*--------------------------------------------*/
ll gcd(ll a,ll b){
    while(b!=0) {
        int t=b;
        b=a%b;
        a=t;
    }
    return a;
}
int main(){
    int N,X;cin>>N>>X;
    V x(N);rep(i,N)cin>>x[i];
    int tmp=abs(x[0]-X);
    REP(i,N-1){
        tmp=gcd(tmp,abs(x[i]-X));
    }
    cout<<tmp<<endl;
}


Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
	int candy;
	int i;
	int student;
	
	while (scanf("%d", &candy) != EOF){
		student = candy % 39;
		if (student == 0){
			printf("3C39\n");
		}
		else if (student < 10){
			printf("3C0%d\n", student);
		}
		else {
			printf("3C%d\n", student);
		}
	}
	
	return (0);
}

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

int main() {

  int N;
  cin >> N;

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

  int M;
  cin >> M;

  vector<int> P(M);
  vector<int> X(M);
  for (int i = 0; i < M; i++) {
    cin >> P[i] >> X[i];
  }

  for (int i = 0; i < M; i++) {
    int answer = sum - T[P[i] - 1] + X[i];
    cout << answer << endl;
  }

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define PIGRECO 3.141592653589793

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c> {i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
	~debug() { cerr << endl; }
	eni( != ) cerr << boolalpha << i; ris;
}
eni( == ) ris << range(begin(i), end(i));
}
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
///////////////////////////////////////////////////////////////////////////
//////////////////// DO NOT TOUCH BEFORE THIS LINE ////////////////////////
///////////////////////////////////////////////////////////////////////////


#define int long long

int power(int x, unsigned int y, int mod) // binary exponentiation with modulo
{
	int res = 1;

	x = x % mod;

	if (y == 0 && mod > 1) {
		return 1;
	}


	if (x == 0)
		return 0;

	while (y > 0)
	{

		if (y & 1)
			res = (res * x) % mod;


		y = y >> 1;
		x = (x * x) % mod;
	}
	return res;
}



signed main() {

	ios::sync_with_stdio(false);

	cin.tie(0);


	int n;
	cin >> n;

	string s;
	cin >> s;





	int cnt = 0;

	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == '1')
			cnt++;

	}


	if (n == 1) {

		if (s[0] == '1') {
			cout << 0 << endl;
		}
		else cout << 1 << endl;

		return 0;


	}



	long long val_piu = 0;
	long long val_meno = 0;


	reverse(s.begin(), s.end());

	for (int i = 0; i < n; i++) {
		if (s[i] == '1') {

			val_piu = val_piu + power(2, i, cnt + 1);

			if (cnt > 1)
				val_meno = val_meno + power(2, i, cnt - 1);




		}
	}




	long long temp;



	for (int i = n - 1; i >= 0; i--) {
		int ans = 1;
		temp = 0;




		if (s[i] == '1') {

			if (cnt > 1) {
				temp = (val_meno - (power(2, i, cnt - 1))) % (cnt - 1);
			}

			else {
				cout << 0 << endl;
				continue;
			}


		}

		else {




			temp = (val_piu + (power(2, i, cnt + 1))) % (cnt + 1);




		}


		while (temp) {
			temp = temp % (__builtin_popcountll(temp));
			ans++;

		}

		cout << ans << endl;


	}














}






















Measured memory_bytes: 3792
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
using namespace std;

#define ll long long

#define debug_message 0
#define debug if (debug_message)

#define sz(x) (int)x.size()

int i,t,j;
int r,c,a,b,mp[1005][1005];
int rcnt[1005],ccnt[1005];
bool ok;

int main() {
	scanf("%d%d%d%d",&r,&c,&a,&b);

	for (i=1; i<=b; ++i){
		for (t=1; t<=a; ++t){
			mp[i][t]=1;
		}
	}
	
	for (i=b+1; i<=r; ++i){
		for (t=a+1; t<=c; ++t){
			mp[i][t]=1;
		}
	}

//	//check
//	ok=1;
//	for (i=1; i<=r && ok; ++i) {
//		for (t=1; t<=c && ok; ++t) {
//			if ((rcnt[i]==a || c-rcnt[i]==a) &&
//			        (ccnt[t]==b && r-ccnt[t]==b)) continue;
//			        
//			else {
//				ok=0;
//				break;
//			}
//		}
//	}
//
//	if (ok==0) printf("-1\n");
//	else {
		for (i=1; i<=r; ++i) {
			for (t=1; t<=c; ++t) {
				printf("%d",mp[i][t]);
			}
			printf("\n");
		}
//	}

	return 0;
}
/*
0011
0011
0011
0011

1100
1100
0011
0011
============
0110
0110
0011
0011

1110
0011
0011
0011
*/

Measured memory_bytes: 7760
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
typedef long long int ll; 
typedef long double ld; 

#define MAX 3000
#define mod 1000000007

ll add(ll a,ll b)
{
	return (mod+(a+b)%mod)%mod;
}


int main()
{
	
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
	
	ll n, k;
	cin>>n>>k;
	
	ll sum = 0;
	
	ll arr[n];
	
	for(ll i=0;i<n;i++)cin>>arr[i];
	
	sort(arr, arr+n);
	
	for(ll i=0;i<k;i++)sum += arr[i];
	
	cout<<sum<<endl;
	
}















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

int main()
{
    int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin>>k;

    cout<<a[k-1]<<endl;

    return 0;
}


Measured memory_bytes: 256
using System;

namespace AtCoder.ABC114
{
    public class A
    {
        public static void Solve()
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            string output;

            switch (n)
            {
                case 7:
                    output = "YES";
                    break;
                case 5:
                    output = "YES";
                    break;
                case 3:
                    output = "YES";
                    break;
                default:
                    output = "NO";
                    break;
            }
            
            Console.WriteLine(output);
        }    
    }
}

namespace AtCoder {
    class Program
    {
        static void Main(string[] args)
        {
            ABC114.A.Solve();
        }
    }
}


Measured memory_bytes: 11092
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 998244353;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
ll dp[3001][3001];
int main(void) {
	int n, s;
	cin >> n >> s;
	vector<int> a(n);
	rep(i, 0, n)cin >> a[i];
	dp[0][0] = mpower(2, n);
	ll inv2 = mpower(2, mod - 2);
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j <= s; ++j) {
			dp[i + 1][j] += dp[i][j];
			dp[i + 1][j] %= mod;
			if (j >= a[i])dp[i + 1][j] += dp[i][j - a[i]] * inv2;
			dp[i + 1][j] %= mod;
		}
	}
	printf("%lld\n", dp[n][s]);
	return 0;
}

Measured memory_bytes: 74032
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {

	int X,N; cin >> X >> N;

	vector<int> p(101,0);
	for (int i = 0; i < N; i++) {
		int a; cin >> a;
		p[a] = 1;
	}

	//large
	int BIG = 0;
	int idx = X;
	while(1) {
		if (idx > 100) {
			BIG = 101;
			break;
		} else if (p[idx] == 0) {
			BIG = idx;
			break;	
		}
		idx++;
	}

	//small
	int SML = 0;
	idx = X;
	while(1) {
		if (idx < 0) {
			SML = -1;
		}else if (p[idx] == 0) {
			SML = idx;
			break;
		}
		idx--;
	}

	if (abs(X - SML) <= abs(X - BIG)) {
		cout << SML << endl;	
	}else {
		cout << BIG << endl;	
	}




	return 0;
}


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

using namespace std;

int main(void){
    
    int n,a,b;
    cin >> n >> a >> b;
    
    int result = 0;
    
    for(int i = 1;i <= n;i++){
        int c = i;
        int d = 0;
        do{
            d += c % 10;
            c /= 10;
            
        }while(c > 0);
        
        if(d >= a && d <= b){
            result += i;
        }
    }
    
    cout << result << endl;
    
}


Measured memory_bytes: 256
/*
2020-04-20
atcoder ABC
C - Sum of gcd of Tuples (Easy)
*/

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

int gcd(int x, int y) {
    int a = max(x, y);
    int b = min(x, y);
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a - b);
    }
}

int main() {
    //変数定義, 入力処理
    // vector<vector<int>> data(3, vector<int>(4)); //二次元配列
    int K;
    long long ans = 0;
    cin >> K;
    //処理
    rep(i, K) {
        rep(j, K) {
            rep(k, K) {
                ans += gcd(gcd(i + 1, j + 1), k + 1);
            }
        }
    }
    //出力処理
    cout <<  ans << endl;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long int ull;
typedef pair<ll,ll> pii;
typedef tuple<ll,ll,ll> tii;
typedef vector<ll> vi;
typedef vector<pii> vii;
typedef map<ll,ll> mi;
typedef map<pii,ll> mii;


#define endl "\n"
#define pb push_back
#define sq(a) (a)*(a)
#define rep(i,a,b) for(int i = a; i < b; i++)
#define mod 1000000007
#define PI 3.141592653589793238

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

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

ll exp(ll x,ll n)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%mod;
        x=(x*x)%mod;
        n=n/2;
    }
    return result;
}





int32_t main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    
    IOS

    int n,m;
    cin>>n>>m;
    int h[n];
    vector<int> v[n];
    for(int i=0;i<n;i++) 
    	cin>>h[i];

    for(int i=0;i<m;i++)
    {
    	int x,y;
    	cin>>x>>y;
    	x--;y--;
    	v[x].pb(y);
    	v[y].pb(x);
    }

    int ans=0;

    for(int i=0;i<n;i++)
    {
    	bool temp=true;
    	for(auto x:v[i])
    	{
    		if(h[i]<=h[x])
    		{
    			temp=false;
    			break;
    		}
    	}
    	if(temp)
    		ans++;
    }

    cout<<ans<<endl;




    
    return 0;
}

Measured memory_bytes: 9184
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#define ll long long
#define MAX 1000003
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define all(a) (a).begin(),(a).end()
#define input(a) for(int i=0;i<n;i++) cin>>a[i];
using namespace std;
int main(){
	IOS;
	int n,k,q;
	cin>>n>>k>>q;
	vector<int> players(n+1,0);
	vector<int> a(q);
	//input(a);
	for(int i=0;i<q;i++){
		cin>>a[i];
	}
	for(int i=0;i<q;i++){
		players[a[i]]++;
	}	

	for(int i=1;i<=n;i++){
		if(k-(q-players[i])>0){
			cout<<"Yes\n";	
		}
		else cout<<"No\n";
	}
return 0;
}

Measured memory_bytes: 1408
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <typeinfo>
#include <math.h>
#include <iomanip>
#include <limits>

using namespace std;
using ll = long long;
const ll res = 1000000007;

int main() {
	int k, n;
	cin >> k >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];

	ll ans = a[n - 1] - a[0];
	
	for (int i = 1; i < n; i++)
		ans = min(ans, k - (a[i] - a[i - 1]));
	cout << ans << endl;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int s;
	set<int> m;
	cin>>s;
	m.insert(s);
	for(int i=2;i<=10000000;i++)
	{
		if(s%2==0)
		{
			s=s/2;
		}
		else
		{
			s=3*s+1;
		}
		if(m.find(s)!=m.end())
		{
			cout<<i<<endl;
			return 0;
		}
		m.insert(s);
	}
}


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

int main() {
	int N;
	cin >> N;
	deque<bool> a;
	do {
		a.push_front(N % -2);
		if (N % -2 == -1) N -= 2;
	} while (N /= -2);
	for (bool& i : a) cout << i;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int i,n,v[50],c[50],y[50],x,z;
	cin>>n;
	x=0;
	z=0;
	for(i=0;i<n;i++){
		cin>>v[i];
	}
	for(i=0;i<n;i++){
		cin>>c[i];
	}
	for(i=0;i<n;i++){
		y[i]=v[i]-c[i];
	}
	for(i=0;i<n;i++){
		x=x+y[i];
		if(x>=z){
			z=x;
		}
		else{
			x=x-y[i];
		}
	}
	cout<<z<<endl;
	
	return 0;
}


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

int main(){
  constexpr int Nalp= 26;
  string bufS;
  cin >> bufS;
  const size_t Nlen= bufS.size();

  size_t ans= INT_MAX;
  for(int i=0; i<Nalp; i++){
    string S= bufS;
    char c= 'a'+ i;
    size_t cnt= 0;
    while(S != string(Nlen-cnt, c)){
      string Snext;
      bool exist= false;
      for(size_t l=0; l+1 < Nlen-cnt; l++){
        if(S.at(l)==c || S.at(l+1)==c){
          Snext.push_back(c);
          exist= true;
        }
        else{
          Snext.push_back(S.at(l));
        }
      }
      if(!exist){ break; }

      S= Snext;
      cnt++;
    }

    if(S==string(Nlen-cnt, c)){
      ans= min(ans, cnt);
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3620
//raja1999
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);
map <int,int >mapi;
int a[100005];
int main(){
	std::ios::sync_with_stdio(false);
	int n,i,c=0;
	ll res=1;
	cin>>n;
	rep(i,n)
	{
		cin>>a[i];
		mapi[a[i]]++;
	}	
	sort(a,a+n);
	fd(i,n-1,0)
	{
		if(mapi[a[i]]>=2)
		{
			res*=a[i];
			mapi[a[i]]-=2;
			c++;
			i--;
		}
		if(c==2){
			cout<<res<<endl;
			return 0;
		}
	}
	cout<<0<<endl;
} 


Measured memory_bytes: 5376
/*input
123 456
*/
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define watch(x) cout << (#x) << " is " << (x) << endl
#define N 100002

using namespace std;
int main()
{
	fastio
	ll T=1,n,m;string str;
	// cin>>T;
	// cin.ignore(); put after cin, just b4 a getline(cin, s) to avoid getline() directly getting \n
	while(T--)
	{
		ll p=0,q=0,tmp=0,sum=0,count=0; //tmp variable
		int flag=0;
		
		cin >> p >> q;
		cout << (p*q)/__gcd(p,q) << endl;
		
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int w,h,x,y,r;
	scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
	if(x+r>w||y+r>h||x-r<0||y-r<0){
		printf("No\n");
	}else{
		printf("Yes\n");
	}
    return 0;
}


Measured memory_bytes: 2096
#include <iostream>
/*
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <iomanip>
#include <numeric>
*/

using namespace std;

typedef long long LL;

void insertionSort(int A[], int N){

   int v,j,k;

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

	 v = A[i];
	 j = i - 1;
	 while (j >= 0 && A[j] > v){
	   A[j+1] = A[j];
	   j--;
	 }
	 A[j+1] = v;

	 for(k=0;k<N;k++){
		cout << A[k] << ((k == N-1) ? "\n" : " " );
	 }

   }
}

int main(int argc, const char * argv[]) {

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



	int N,i;
	int X[100];

	cin >> N;

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

	for(i=0;i<N;i++){
		cout << X[i] << ((i == N-1) ? "\n" : " " );
	}

	insertionSort(X,N);

	return 0;
}


Measured memory_bytes: 3176
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;
int MOD = 1000000007;

signed main(){
    int n;
    string a,b,c;
    cin >> n >> a >> b >> c;
    // cout << min(a,b) << " ";

    int cnt = 0;
    rep(i,n){
        if(a[i] == b[i]&& a[i] == c[i]){

        }else if(a[i] != b[i]&& a[i] != c[i] && b[i] != c[i])cnt += 2;
        else cnt++;
    }
    cout << cnt << endl;


    
    return 0;   
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://ddcc2019-final.contest.atcoder.jp/tasks/ddcc2019_final_a
// rm -r -f test;oj dl http://arc060.contest.atcoder.jp/tasks/arc060_a

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
int main()
{
	int f = 0;
	int a[5];
	char s[5];
	scanf("%s",s);
	a[0] = s[0] - '0';
	a[1] = s[1] - '0';
	a[2] = s[2] - '0';
	a[3] = s[3] - '0';
	int ans = 0;
	rep(i,0,1 << 3){
		f = i;
		ans = a[0];
		rep(j,0,3){
			if(f & (1 << j))
			ans += a[j + 1];
			else ans -= a[j + 1];	
		}
		if(ans == 7){
			printf("%d%c%d%c%d%c%d=7\n",a[0],f & 1 ? '+' : '-',
			a[1],f & 2 ? '+' : '-', 
			a[2],f & 4 ? '+' : '-',
			a[3]
			);
			return 0;
		}
	}
	return 0;
}

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

using namespace std;

void dfs(int u, const vector<vector<int>> &g, vector<int> &vis, 
              vector<int> &top_sort) {
    vis[u] = 1;
    for (int v : g[u]) {
        if (!vis[v]) {
            dfs(v, g, vis, top_sort);
        }
    }
    top_sort.push_back(u);
}

int main() {
    std::ios::sync_with_stdio(false); 
    cin.tie(nullptr);
    
    int N, M;
    cin >> N >> M;
    vector<vector<int>> g(N), rev_g(N);
    for (int i = 0; i < M; ++i) {
        int x, y;
        cin >> x >> y;
        g[x - 1].push_back(y - 1);
        rev_g[y - 1].push_back(x - 1);
    }

    vector<int> top_sort, vis(N, 0);
    for (int u = 0; u < N; ++u) {
        if (!vis[u]) {
            dfs(u, rev_g, vis, top_sort);
        }
    }
    reverse(begin(top_sort), end(top_sort));
    vector<int> dp(N, 0);
    for (int u : top_sort) {
        for (int v : g[u]) {
            dp[u] = max(dp[u], dp[v] + 1);
        }
    }
    cout << *max_element(begin(dp), end(dp)) << "\n";

    return 0;
}

Measured memory_bytes: 18556
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i, n) {
    string ss;
    cin >> ss;
    s.at(i) = ss;
  }
  int m;
  cin >> m;
  vector<string> t(m);
  rep(i, m) {
    string tt;
    cin >> tt;
    t.at(i) = tt;
  }
  map<string, int> data;
  rep(i, n) {
    if (data.count(s.at(i))) {
      data.at(s.at(i))++;
    }
    else {
      data[s.at(i)] = 1;
    }
  }
  rep(i, m) {
    if (data.count(t.at(i))) {
      data.at(t.at(i))--;
    }
    else {
      data[t.at(i)] = -1;
    }
  }
  int max = -10000;
  for (pair<string, int> p : data) {
    string key = p.first;
    int value = p.second;
    //cout << key << value << endl;
    if (value > max) {
      max = value;
    }
  }
  if (max >= 0) { 
    cout << max << endl;
  }
  if (max < 0) {
    cout << 0 << endl;
  }
}


Measured memory_bytes: 3596
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int bpm(int x, unsigned int y) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (unsigned int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}

class BBounding {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    int N, x;
    cin >> N >> x;
    int D   = 0;
    int ans = 1;
    rep(i, N) {
      int L;
      cin >> L;
      D += L;
      if (D <= x) ans++;
    }
    cout << ans << endl;
  }
};


signed main() {
  BBounding solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  int n,k,num;
  bool flag;
  string s;
  cin >> n >> k;
  int d[10]={0};
  for(int i=0;i<k;i++){
    cin >> num;
    d[num]++;
  }
  while(true){
    s = to_string(n);
    flag=false;
    for(int i=0;i<s.size();i++){
      if(d[s[i]-'0']==1){
        flag = true;
        break;
      }
    }
    if(flag==false){
      cout << s << endl;
      break;
    }else{
      n++;
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pfi(a) printf("%d",a);
#define pfl(a) printf("%lld",a);
#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pb push_back
#define F first
#define S second
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vpp vector<pair<long long,long long>>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define d0(x) cout<<(x)<<" "
#define c1(x) cin>>(x)
#define c2(x,y) cin>>(x)>>(y)
#define c3(x,y,z) cin>>(x)>>(y)>>(z)
#define c4(w,x,y,z) cin>>(w)>>(x)>>(y)>>(z)
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define fo(i,a,b) for(int i=a;i<b;i++)
#define alld(c) (c).rbegin(),(c).rend()
#define alli(c) (c).begin(),(c).end()
#define ll long long
const int M=1e9+7;




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

	int v2=(a+d-1)/d;
	int v1=(c+b-1)/b;

	//d2(v1,v2);

	if(v2>=v1)
		d1("Yes");
	else
		d1("No");
	return(0);
}

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

int main () {
  int x;
  cin >> x;
  cout << ((x == 3 || x == 5 || x == 7) ? "YES" : "NO" ) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
char a[105][105];
int main(){
    int n,m;
    while(scanf("%d %d",&n,&m)==2){
        for(int i=0;i<n;i++){
            scanf("%s",&a[i]);
        }
        for(int j=0;j<m+2;j++)
            printf("#");
        printf("\n");
        for(int i=0;i<n;i++){
            printf("#");
            printf("%s",a[i]);
            printf("#\n");
        }
        for(int j=0;j<m+2;j++)
            printf("#");
        printf("\n");
    }
return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int S=in.nextInt();
        
        int m=S/60; S%=60;
        int h=m/60; m%=60;
        System.out.printf("%d:%d:%d\n",h,m,S);
    }
}


Measured memory_bytes: 26248
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))

diff = 10000

for i in range(N):
    if(diff >= abs(A-(T-H[i]*0.006))):
        diff = abs(A-(T-H[i]*0.006))
        ans=i

print(ans+1)


Measured memory_bytes: 38504
import numpy as np
import numba


@numba.njit('i4[:](i4, i4[:], i4[:, :], i4[:])')
def solve(dd, c_arr, s_arr, t_arr):
    last_d = np.zeros(26, dtype=np.int32) - 1
    score = 0
    score_arr = np.zeros(dd, dtype=np.int32)
    for d in range(dd):
        score += s_arr[d, t_arr[d] - 1]
        last_d[t_arr[d] - 1] = d
        score -= (c_arr * (d - last_d)).sum()
        score_arr[d] = score
    return score_arr


def main():
    d = np.int32(input())
    c_arr = np.array(list(map(int, input().split()))).astype(np.int32)
    s_arr = np.array([list(map(int, input().split())) for _ in range(d)]).astype(np.int32)
    t_arr = np.array([int(input()) for _ in range(d)]).astype(np.int32)
    res = solve(d, c_arr, s_arr, t_arr)
    for r in res:
        print(r)


if __name__ == "__main__":
    main()


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

using namespace std;

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

int main(){
    int i;
    //入力
    int a;
    int b;
    cin>>a;
    cin>>b;

    //処理

    //出力
    if((a==1||a==2)&&(b==1||b==2))cout<<3<<endl;
    else if((a==1||a==3)&&(b==1||b==3))cout<<2<<endl;
    else cout<<1<<endl;
    

}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)

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

def f(i, v):
    if i == n:
        return any(x % 2 == 0 for x in v)

    ans = 0
    for d in (-1, 0, 1):
        v_ = v[:]
        v_.append(A[i]+d)
        ans += f(i+1, v_)

    return ans

print(f(0, []))

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main ()
{
	int n,m,k,a[100];
	cin >> n >> m >> k;

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

	int x = 0,y = 0;
	for (int i = k; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			if (a[j] == i)
			{
				x += 1;
			}
		}
	}
	for (int i = 0; i < k; i++)
	{
		for (int j = 0; j < m; j++)
		{
			if (a[j] == i)
			{
				y += 1;
			}
		}
	}

	cout << min(x,y) << endl;
}


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

//#define DEBUG

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

int main() {

    int N, M;
    cin >> N >> M;

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

    double limit = sumA/(4*M);
    for (int i = 0; i < N; i++){
            PRINT(A[i])
        if(A[i] >= limit){
            M--;
            PRINT(M)
            PRINT(A[i])
        }
    }

    if(M <= 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    d = {}
    for i in range(0,10):
        for j in range(0,10):
            d[i*10+j] = 0
    
    for i in range(N+1):
        s = str(i)
        d[int(s[0])*10+int(s[-1])] += 1
    
    ans = 0
    for i in range(1,10):
        for j in range(1,10):
            ans += d[i*10+j] *d[j*10+i]

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9192
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[5],i;
    for(i=0;i<5;i++)
        cin>>a[i];
    for(i=0;i<5;i++){
        if(a[i]==0)
            cout<<i+1<<endl;
    }
    return 0;
}


Measured memory_bytes: 3580
# include <stdio.h>

int main(){
    int n, m, perg[111], drink, newt, a = 0;

    scanf("%d", &n);

    for(int i = 0; i < n; ++i){
        scanf("%d", &perg[i]);
        //timee += perg[i];
    }
    scanf("%d", &m);

    for(int i = 0; i<m; ++i){
        int timee = 0;
        scanf("%d %d", &drink, &newt);

        a = perg[drink-1];
        perg[drink-1] = newt;
        for(int j = 0; j< n; ++j){
            timee += perg[j];
        }
        printf("%d\n", timee);
        perg[drink-1] = a;

    }


    return 0;
}

Measured memory_bytes: 128
N = int(input())
h = list(map(int, input().split()))
total = 0
for i in range(1,len(h)):
  #print(i)
  if h[i-1] > h[i]:
    total += (h[i-1] - h[i])
    h[i] += (h[i-1] - h[i])
    #print(h[i-1],h[i])
print(total)


Measured memory_bytes: 32216
#include<stdio.h>

int main( void ) 
{
	int i,j;
	int heights[11];
	
	for( i=0; i<10; i++ ) {
		scanf( "%d", &heights[i] );
		for( j=0; j<=i; j++ ) {
			if( heights[j] <= heights[i] ) {
				heights[10] = heights[j]; 			
				heights[j] = heights[i];
				heights[i] = heights[10]; 				
			}
		}
	}
	for( i=0; i<3; i++ ) {
		printf( "%d\n", heights[i] );
	}

	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  int aa = a%10;
  int bb = b%10;
  int cc = c%10;
  int dd = d%10;
  int ee = e%10;
  int mins=100;
  if(aa!=0){
    mins=min(aa,mins);
  }
  if(bb!=0){
    mins=min(mins,bb);
  }
  if(cc!=0){
    mins=min(cc,mins);
  }
  if(dd!=0){
    mins=min(mins,dd);
  }
  if(ee!=0){
    mins=min(mins,ee);
  }
  if(aa==0&&bb==0&&cc==0&&dd==0&&ee==0){
    mins = 10;
  }
  int as,bs,cs,ds,es;
  if(a%10==0){
    as = a/10;
  } else {
    as = a/10+1;
  }
  if(b%10==0){
    bs = b/10;
  } else {
    bs = b/10+1;
  }
  if(c%10==0){
    cs = c/10;
  } else {
    cs = c/10+1;
  }
  if(d%10==0){
    ds = d/10;
  } else {
    ds = d/10+1;
  }
  if(e%10==0){
    es = e/10;
  } else {
    es = e/10+1;
  }
  cout << 10*(as+bs+cs+ds+es)-10+mins << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,N) for(i=0;i<N;i++)
#define N 5
#define INF 1e9
typedef long long ll;
ll L;

ll cost(ll num, int s){
  ll cost;
  if( s == 0 || s == 4){
    cost = num;
  }else if ( s == 1 || s == 3 ){
    if (num == 0) cost = 2;
    else if(num % 2 == 0) cost = 0;
    else cost = 1;
  }else{
    if(num % 2 == 0) cost = 1;
    else cost = 0;
  }
  return cost;
}

int main(void){
  cin >> L;
  int i,j,k;
  vector<ll> A(L);
  FOR(i,L) cin >> A[i];

  ll dp[L+1][N];

  FOR(i,L) FOR(j,N) dp[i+1][j] = INF;
  FOR(j,N) dp[0][j] = 0;


  FOR(i,L){
    FOR(j,N){
      for(k = j; k < N; k++){
        dp[i+1][k] = min(dp[i+1][k], dp[i][j] + cost(A[i],k));
      }
    }
  }

  ll res = INF;
  FOR(j,N) res = min(res,dp[L][j]);
  cout << res << endl;
  return 0;
}

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

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}


int main(int argc, char const* argv[])
{
    int n;
    cin >> n;
    if (n % 10 == 9 || n / 10 == 9) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
	char a[5], b[5];

	while (1){
		int hit = 0, blow = 0;

		scanf("%s %s", a, b);
		
		if (a[0] == '0' && b[0] == '0'){
			break;
		}

		for (int i = 0; i < 4; i++){
			for (int j = 0; j < 4; j++){
				if (a[i] == b[j]){
					if (i == j){
						hit++;
					}
					else {
						blow++;
					}
				}
			}
		}

		cout << hit << " " << blow << endl;
	}

	return (0);
}

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

//#define int long long
typedef long long ll;
#define double long double
#define vec vector
#define pb push_back
#define unset unordered_set
#define ii pair<int, int>
#define X first
#define Y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
typedef vector<int> vi;
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first,l.second+r.second};
} 
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
#define min(a, b) (((a)<(b))?(a):(b))
#define max(a, b) (((a)>(b))?(a):(b))

ll powMod(ll a, ll m) { // a^m % MOD
	a %= MOD;
	long long res = 1;
	while (m > 0) {
		if (m & 1)
			res = res * a % MOD;
		a = a * a % MOD;
		m >>= 1;
	}
	return res;
}

const int maxV = 10; // we need inv(3) only
ll inv[maxV];
ll inverse(int q) { // q<maxV; WORKs only with MOD prime!
	inv[1] = 1LL;
	for(int i = 2; i < maxV; ++i)
	    inv[i] = (MOD - (MOD/i) * inv[MOD%i] % MOD) % MOD;
	return inv[q];
}




//#undef int
int main() {
//#define int long long
	ios_base::sync_with_stdio(false); cin.tie();
	//auto beginProgram = chrono::steady_clock::now();
//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);

	int n; cin >> n;
	string s; cin >> s;
	int k; cin >> k;
	for(int i=0; i<(int)s.length(); ++i) 
		if(s[i] != s[k-1])
			s[i] = '*';
	cout << s << endl;
	
  //auto endProgram = chrono::steady_clock::now();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
const int oo=1e5;
ll n,a[oo],b[oo],c[oo];
ll dpt[oo][3];
int dp(ll i,ll p){
	if(dpt[i][p]!=-1){
		return dpt[i][p];
	}
	if(i==n-1){
		// cout<<"Something"<<endl;
		// exit(0);
		if(p==0)
			return max(b[i],c[i]);
		if(p==1)
			return max(a[i],c[i]);
		if(p==2)
			return max(b[i],a[i]);
	}
	if(p==0){
		dpt[i][p]=max(b[i]+dp(i+1,1),c[i]+dp(i+1,2));
		return dpt[i][p];
	}
	if(p==1){
		dpt[i][p]=max(a[i]+dp(i+1,0),c[i]+dp(i+1,2));
		return dpt[i][p];
	}
	if(p==2){
		dpt[i][p]=max(b[i]+dp(i+1,1),a[i]+dp(i+1,0));
		return dpt[i][p];
	}
}
int main(){
	
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n;
    memset(dpt,-1,sizeof(dpt));
    for (int i = 0; i < n; ++i)
    {
    	cin>>a[i]>>b[i]>>c[i];
    }
    //cout<<n<<endl;
    cout<<max(max(dp(0,0),dp(0,1)),dp(0,2))<<endl;
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
    using namespace std;
    int main(){
    int A,B,c;
    bool right = false;
    cin >> A >> B;
    for (int i = 1; i <= 1000 ; i++){
      if ( int(i * 0.08) == A && B == int(i*0.1)){
        c = i;
        right = true;
        break;}
      else {continue;} 
    }
    if (right) {
      cout << c << endl;}
    else {cout << -1 << endl;}
    }

Measured memory_bytes: 256