akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;

int gcd(int x, int y);

const int INF = 1001001001;

/*struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }*/


int main() {
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    int ans;
    if (k == 0) {
        ans = a - b;
    }
    else if (k == 1) {
        ans = b - a;
    }
    else if (k % 2 == 0) {
        ans = a - b;
    }
    else {
        ans = b - a;
    }

    cout << ans << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, end) for (long long int i=0; i<end; i++)
#define repp(i, begin, end) for (long long int i=begin; i<end; i+)
#define srt(x) sort((x).begin(), (x).end());
#define rsrt(x) sort((x).rbegin(), (x).rend());
#define deb(x) cout<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;
#define vdeb(x) {cout<<#x<<" = { "; rep(i, x.size()) cout<<x[i]<<' '; cout <<'}'<<" (L"<<__LINE__<<")"<<endl;}
using namespace std;
using ll = long long int;
using vi = vector<int>;
using vivi = vector<vi>;
using vll = vector<long long int>;
using vllvll = vector<vll>;
using vs = vector<string>;
ll sm(vll x) {ll sum=0; rep(i, x.size()) sum+=x[i]; return sum;}
//=======================================================================================================

int main()
{
    ll a, b;
    cin >> a >> b;
    ll pl, sb, pr;
    pl = a + b;
    sb = a - b;
    pr = a * b;
    ll max = -100000000;
    if(pl>max) max = pl;
    if(sb>max) max = sb;
    if(pr>max) max = pr;
    cout << max << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		//ALDS1_1_A(); 
		ALDS1_2_A();
	}
	public static void ALDS1_1_A() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		for(int i = 1; i < n; i++) {
			for(int j = 0; j < n; j++) {
				if(j == n - 1) {
					System.out.print(a[j]);
				}else {
					System.out.print(a[j] + " ");
				}
			}
			System.out.println();
			int temp = a[i];
			int j = i - 1;
			while(j >= 0 && temp < a[j]) {
				a[j + 1] = a[j];
				j--;
			}
			a[j + 1] = temp;
		}

		for(int j = 0; j < n; j++) {
			if(j == n - 1) {
				System.out.print(a[j]);
			}else {
				System.out.print(a[j] + " ");
			}
		}
		System.out.println();
	}

	public static void ALDS1_2_A() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int countAns = 0;
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++) {
			int j;
			for(j = n - 2; j >= i; j--) {
				if(a[j + 1] < a[j]) {
					int temp = a[j + 1];
					a[j + 1] = a[j];
					a[j] = temp;
					countAns++;
				}
			}
			/*
			for(int ans: a) {
				System.out.print(ans + " ");
			}
			System.out.println();
			while(j >= 0 && a[j + 1] < a[j]) {
				int temp = a[j + 1];
				a[j + 1] = a[j];
				a[j] = temp;
				countAns++;
				j--;
			}
			*/
		}

		for(int i = 0; i < n; i++) {
			System.out.print(a[i]);
			if(i != n - 1)
				System.out.print(" ");
		}
		System.out.println();
		System.out.println(countAns);
	}
}



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

int main () {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll t=1;
    while (t--) {
        int n;
        cin >> n;
        vector<pair<int, int>>nums;
        for(int i=0; i<n; ++i) {
            int a, b;
            cin>>a>>b;
            nums.push_back({a,b});
        }
        bool flag=false;
        int cnt=0;

        for(int i=0; i<n; ++i) {
            if(nums[i].first==nums[i].second) {
                cnt++;
            } else if (cnt>2){
                break ;
            } else {
                cnt=0;
            }
        }
        if (cnt>2)   cout << "Yes\n";
        else cout <<"No\n";
    }
    return 0;
}


Measured memory_bytes: 3592
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <tuple>

//#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

int main() {
  int N, C, V;
  cin >> N;
  vector<int> value(N, 0);

  for (int i = 0; i < N; i++){
    cin >> V;
    value[i] = V;
  }
  for (int i = 0; i < N; i++){
    cin >> C;
    value[i] = value[i] - C;
  }
  int max_cost=0;
  for (int i = 0; i < N; i++){
    if (value[i] > 0) max_cost += value[i];
  }
  cout << max_cost << endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> Pii;
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1000000000
#define rep(i,a,b) for(int i =(a);i<(b);i++)
#define first fs
#define second ss
inline int Scan() {
    int x=0;int f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

template<typename T, typename U>
static inline void amin(T &x, U y)
{
    if (y < x)
        x = y;
}

// call by reference is used in x
template<typename T, typename U>
static inline void amax(T &x, U y)
{
    if (x < y)
        x = y;
}
//////////////////////////////////////end of template//////////////////////////////////////

int main(){

 int n;
 cin >> n;
 
 int a[n];
 rep(i,0,n) cin >> a[i];
 int ans = INT_MIN;
 int ca = 0;
 rep(i,0,n-1){
	  
	 if( a[i] >= a[i+1]) ca++;
	 else{
		 amax(ans,ca);
		 ca = 0;
	 } 
 }
 amax(ans,ca);
 
 cout << ans << endl;

}




Measured memory_bytes: 640
import sys
def input():
	return sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())
adj = [[] for _ in range(n)]
eff = [0 for _ in range(n)]
edges = []
visited = [False for _ in range(n)]
is_reversed = [0 for _ in range(m)]

for i in range(m):
	a, b = map(int, input().split())
	adj[a-1].append([b-1, i])
	adj[b-1].append([a-1, i])
	edges.append([a, b])
	eff[a-1] ^= 1

if m%2 == 1:
	print(-1)
	sys.exit()

def dfs(x, e):
	for v, i in adj[x]:
		if not visited[v]:
			visited[v] = True
			dfs(v, i)
	if e == -1:
		return
	else:
		if eff[x] == 1:
			is_reversed[e] ^= 1
			eff[x] ^= 1
			eff[(edges[e][0]-1) * (edges[e][1]-1) // x] ^= 1
		return

visited[0] = True
dfs(0, -1)
for i in range(m):
	if is_reversed[i]:
		print(*edges[i][::-1])
	else:
		print(*edges[i])

Measured memory_bytes: 150528
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#define MOD 1000000007
#define mkp make_pair
typedef long long ll;
using namespace std;

int N,M;
vector<int> K;
vector<int> S[11];
vector<int> P;

int main(){
  cin>>N>>M;
  K.resize(M);
  P.resize(M);
  for(int i=0;i<M;i++){
    cin>>K[i];
    for(int j=0;j<K[i];j++){
      int s;
      cin>>s;
      s--;
      S[i].push_back(s);
    }
  }

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

  ll ans=0;
  for(int bit=0;bit<(1<<N);bit++){
    bool ok=true;
    for(int i=0;i<M;i++){
      int num=0;
      for(int j=0;j<K[i];j++){
        if((1<<S[i][j])&bit) num++;
      }
      if(num%2!=P[i]){
        ok=false;
        break;
      }
    }
    if(ok) ans++;
  }

  cout<<ans<<endl;

  return 0;
}


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

A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

cnt = 0
j=-1

for i in A:
    cnt += B[i-1]
    if i==j+1:cnt+=C[j-1]
    j=i

print(cnt)

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

struct UnionFind {
	const int V;
	// par[x] := xのroot
	vector<int> par;
	// sz[x] := xを含む集合のサイズ
	vector<int> sz;
	UnionFind(const int V) :
		V(V),
		par(vector<int>(V)),
		sz(vector<int>(V, 1))
		{
			for(int i = 0; i < V; ++i) par[i] = i;
		}
	bool unite(int x, int y) {
		x = root(x), y = root(y);
		if(same(x, y)) return false;
		if(y < x) swap(x, y);
		par[y] = x;
		sz[x] += sz[y];
		return true;
	}
	int root(int x) {
		if(par[x] == x) return x;
		return (par[x] = root(par[x]));
	}
	bool same(int x, int y) {
		return (root(x) == root(y));
	}
	int size(int x) {
		return sz[root(x)];
	}
};

int main() {
	int n, m; cin >> n >> m;
	vector<int> l[n];
	for(int i = 0; i < n; ++i) {
		int k; cin >> k;
		while(k--) {
			int ll; cin >> ll;
			--ll;
			l[i].push_back(ll);
		}
	}
	UnionFind uf(m);
	for(int i = 0; i < n; ++i) {
		for(int j = 1; j < (int)l[i].size(); ++j) {
			uf.unite(l[i][j - 1], l[i][j]);
		}
	}
	set<int> ans;
	for(int i = 0; i < n; ++i) {
		ans.insert(uf.root(l[i].front()));
	}
	if(ans.size() == 1) {
		cout << "YES" << '\n';
	} else {
		cout << "NO" << '\n';	
	}
	return 0;
}


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

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

const int MAX { 200010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

ll solve(int N, const vector<ll>& xs)
{
    return 0;
}

int main()
{
    ios::sync_with_stdio(false);

    int r;
    cin >> r;

    cout << r*r << '\n';

    return 0;
}


Measured memory_bytes: 256
while True:
  table = input().split()
  
  a = int(table[0])
  op = table[1]
  b = int(table[2])
  
  if op =='?':
    break
  if op == '+':
    print("%d" % (a + b))
  elif op == '-':
    print("%d" % (a - b))
  elif op == '/':
    print("%d" % (a / b))
  else:
    print("%d" % (a * b))


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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;

constexpr int MOD = 1000000007;

struct Point {
    double x, y;
    Point(double x = 0, double y = 0) : x(x), y(y) {}
    Point(const Point& p) : x(p.x), y(p.y) {}

    Point operator+(const Point& p) const { return Point(x + p.x, y + p.y); }
    Point operator-(const Point& p) const { return Point(x + p.x, y + p.y); }
    Point operator*(double k) const { return Point(k * x, k * y); }
    Point operator/(double k) const { return Point(x / k, y / k); }

    bool operator<(const Point& p) const { return x != p.x ? x < p.x : y < p.y; }
    bool operator==(const Point& p) const { return fabs(x - p.x) < 1e-10 && fabs(y - p.y) < 1e-10; }

    static double norm(const Point& p) { return sqrt(p.x * p.x + p.y * p.y); }
    static double dot(const Point& p1, const Point& p2) { return p1.x * p2.x + p1.y * p2.y; }
    static double cross(const Point& p1, const Point& p2) { return p1.x * p2.y - p1.y * p2.x; }
};
typedef Point Vector;

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

    int q;
    cin >> q;

    rep(i, 0, q) {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        Vector v1(x2 - x1, y2 - y1);
        cin >> x1 >> y1 >> x2 >> y2;
        Vector v2(x2 - x1, y2 - y1);
        double d = Vector::dot(v1, v2);
        double c = Vector::cross(v1, v2);
        if (d == 0) {
            cout << 1 << endl;
        } else if (c == 0) {
            cout << 2 << endl;
        } else {
            cout << 0 << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3220
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
s, = [int(num) for num in lines.pop(0).split(" ")]
count = 2
ss = set([s])
while True:
    if s % 2 == 0:
        next = s // 2
    else:
        next = 3 * s + 1
    if next in ss:
        break
    else:
        ss.add(next)
        s = next
        count += 1
print(count)


Measured memory_bytes: 9116
#include <iostream>
using namespace std;
typedef long long ll;
ll dp[200001][3][2],n,a;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        dp[i+1][0][1]=dp[i][0][0]+a;
        dp[i+1][1][1]=dp[i][1][0]+a;
        dp[i+1][2][1]=dp[i][2][0]+a;
        dp[i+1][0][0]=dp[i][0][1];
        dp[i+1][1][0]=max(dp[i][0][0],dp[i][1][1]);
        dp[i+1][2][0]=max(dp[i][1][0],dp[i][2][1]);
    }
    if(n%2==0)cout<<max(dp[n][0][0],dp[n][1][1]);
    if(n%2==1)cout<<max(dp[n][1][0],dp[n][2][1]);
}


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

int main() {
  enum Status { UP, DOWN };
  int N;
  cin >> N;

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

  int pos = 0;
  int ans = 0;

  Status status;

  while (pos < N) {
    int start = A[pos];
    ++pos;
    while (pos < N && start == A[pos]) ++pos;

    if (pos < N) {
      if (A[pos] > start) status = UP;
      else status = DOWN;

      ++pos;
      while (pos < N &&
             ((status == UP && A[pos-1] <= A[pos]) ||
              (status == DOWN && A[pos-1] >= A[pos]))) {
        ++pos;
      }
    }
    ++ans;
  }

  cout << ans << endl;

  return 0;
}


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

int main(void){
    string o;
    cin >> o;

    string e;
    cin >> e;

    int m = o.size();
    int n = e.size();

    //m = nのとき
    if(m == n){
        for(int i = 0; i < 2 * m; i++){
            if(i % 2 == 0){
            cout << o.at(i / 2);
            }
            else{
            cout << e.at(i / 2);
            }
        }
    cout << "" << endl;
    return 0;
    }
    else if( m > n){
        for(int i = 0; i < 2 * n; i++){
            if(i % 2 == 0){
            cout << o.at(i / 2);
            }
            else{
            cout << e.at(i / 2);
            }
        }
    cout << o.at(m-1) << endl;
    return 0;
    }
    else{
         for(int i = 0; i < 2 * m; i++){
            if(i % 2 == 0){
            cout << o.at(i / 2);
            }
            else{
            cout << e.at(i / 2);
            }
        }
    cout << o.at(n-1) << endl;
    return 0;
    }
}

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

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA();
            //SolveB();
            //SolveC();
            //SolveD();
        }
        private const long MOD = 1000000007;

        static void SolveA()
        {
            var o = ReadAndParseIntArr();
            int n = o[0];
            int m = o[1];
            int ans = (n - 1) * (m - 1);
            Console.WriteLine(ans);
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 11092
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = s_inpl()   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import math
import copy
from collections import defaultdict, Counter
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
from bisect import bisect_left, bisect_right
# import numpy as np

def s_inpl(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
INF = float("inf")

N, T = s_inpl()
t = inpl()

ans = 0
for i in range(N-1):
    ans += min(T, t[i+1] - t[i])

print(ans+T)


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

vector<ll> A,sum;
ll N;

bool ok(ll X,ll K){
  ll idx=lower_bound(all(A),X)-A.begin();
  ll tot=sum[idx]+(N-idx)*X;
  return tot>=X*K;
}

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

  cin>>N;
  A.resize(N);
  sum.resize(N+1);
  rep(i,N){
    ll a;
    cin>>a;
    a--;
    A[a]++;
  }
  sort(all(A));
  rep(i,N)sum[i+1]=sum[i]+A[i];

  repl(K,1,N+1){
    ll lb=-1,ub=N+1;
    while(ub-lb>1){
      ll mid=(ub+lb)/2;
      if(ok(mid,K))lb=mid;
      else ub=mid;
    }
    cout<<lb<<"\n";
  }
  return 0;
}


Measured memory_bytes: 5632
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    string ans = a + b >= c ? "Yes" : "No";
    cout << ans << endl;
    return 0;
}

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

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

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

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

    int max = *max_element(A.begin(), A.end());
    int target;
    vector<bool> dp(max, true);

    for (int i=0; i<N; i++){
        target = A[i];
        if (dp[target-1]==false){
            continue;
        }else if (dp[target-1]==true){
            for (int k=2; k<max/target+1; k++){
                dp[target * k - 1] = false;
            }
        }
        if ((i < N-1) & (A[i]==A[i+1])){
            dp[target-1] = false;
        }
    }

    int count = 0;
    for (int i=0; i<N; i++){
        target = A[i];
        if (dp[target-1] == true){
            count += 1;
        }
    }
    cout << count << endl;
}

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

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

    vector<bool> dp(N, true);

    for (int i=0; i<N; i++){
        if (dp[i] == false){
            continue;
        }else if(i < N-1 && A[i] == A[i+1]){
            dp[i] = false;
            dp[i+1] = false;
            continue;
        }
        for (int j=0; i+j+1<N; j++){
            if (A[i+j+1] % A[i] == 0){
                dp[i+j+1] = false;
            }
        }
    }

    int count = 0;
    for (int i=0; i<N; i++){
        if (dp[i] == true){
            count += 1;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3644
#include<stdio.h>

int main(void){
  int y,m,d;
  int date;

  while(scanf("%d %d %d",&y,&m,&d)!=EOF){
    date=y*10000+m*100+d;

    if(date<18680908){ printf("pre-meiji\n"); }
    else{
      if(18680908<=date && date<=19120729){ printf("meiji "); y-=1868-1; }
      else if(19120730<=date && date<=19261224){ printf("taisho "); y-=1912-1; }
      else if(19261225<=date && date<=19890107){ printf("showa "); y-=1926-1; }
      else{ printf("heisei "); y-=1989-1; }
      printf("%d %d %d\n",y,m,d);
    }
  }

  return 0;
}



Measured memory_bytes: 2036
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, n) for(ll i=0;i<n;i++)
#define r(i, n) for(ll i=n-1;i>=0;i--)
#define forr(i, x, y) for(ll i=x;i<y;i++)
int main()
{
    ll n; cin>>n;
    string a,b;
    cin>>a>>b;
    f(i,n){
        cout<<a[i]<<b[i];
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define mod 1000000007
#define N 500043
#define mp(a,b) make_pair(a,b)
#define loop(a,b) for(int i=a;i<b;i++)
#define test int t; cin >> t; while(t--)
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,w;
    cin >> n >> w;
    vector<ll>weight(n),value(n);
    ll dp[n+1][w+1];
    memset(dp,0,sizeof dp);
    for(int i=0;i<n;i++)
        cin >> weight[i] >> value[i];
    for(int i=1;i<=n;i++){
        for(int j=1;j<=w;j++){
            dp[i][j]=dp[i-1][j];
            if(j-weight[i-1]>=0)
                dp[i][j]=max(dp[i][j],dp[i-1][j-weight[i-1]]+value[i-1]);
        }
    }
    cout << dp[n][w] << endl;
}


Measured memory_bytes: 82368
import numpy as np

D = int(input())
c = list(map(int, input().split()))
c = np.array(c)
S = np.zeros([D, 26], dtype=int)
for i in range(D):
  S[i, :] = list(map(int, input().split()))

T = []
last = np.zeros(26)

for i in range(D):
  score = S[i, :] + (i-last)*np.array(c)
  argmax = score.argmax()
  t = argmax+1
  last[t-1] = i
  print(t)

Measured memory_bytes: 27184
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<pair<int, int> > ans(m);
    vector<vector<pair<int, int> > > yi(n);
    REP(i,m){
        int p,y;
        cin >> p >> y;
        yi[p-1].pb(make_pair(y,i));
    }
    REP(i,n){
        sort(ALL(yi[i]));
        int s = (int)yi[i].size();
        REP(j,s){
            ans[yi[i][j].se] = make_pair(i,j);
        }
    }
    REP(i,m){
        printf("%06d%06d\n",ans[i].fi+1,ans[i].se+1);
    }
    return 0;
}

Measured memory_bytes: 7808
#include<bits/stdc++.h> 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define int long long
#define swap(x,y) (x^=y^=x^=y)

#define debug1(a) cerr<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

using namespace std;
 
#define mod 1000000007
long long modexpo(long long x, long long p){
    int res = 1;x = x%mod;
    while(p){
        if(p%2)res = res * x;
        p >>= 1;
        x = x*x % mod;
        res %= mod;
    }
    return res;
}

struct compare{
    bool operator() (const pair<int,int> a, const pair<int,int> b) const{
        return a.first < b.first;
    }
};

int32_t main(){
    IOS
    int n;
    cin >> n;
    int arr[n], sum = 0;
    for(int i = 0; i < n; i++){
        cin >> arr[i];
        sum += arr[i];
        sum %= mod;
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        sum -= arr[i];
        sum %= mod;
        if(sum < 0){
            sum += mod;
        }
        int temp = sum * (arr[i]);
        temp %= mod;
        ans += temp;
        ans %= mod;
    }
    cout << ans << endl;
} 

Measured memory_bytes: 5140
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()

    val mp = mutableMapOf<String, Int>()
    var max = 1
    for (i in 1..n) {
        val s = readLine()!!
        if (mp[s] != null) {
            val cnt = mp[s]!! + 1
            mp[s] = cnt
            if (cnt > max) max = cnt
        }
        else mp[s] = 1
    }

    mp.filter{it.value == max}.toSortedMap().forEach {
        println(it.key)
    }

}


Measured memory_bytes: 104652
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;
int n;

void koch(int time, double lx, double ly, double rx, double ry){
	
		double sx = lx + (rx - lx) / 3;
		double sy = ly + (ry - ly) / 3;
		double ux = sx + (sx - lx) * 1 / 2 - (sy - ly) * sqrt(3)/ 2;
		double uy = sy + (sx - lx) * sqrt(3)/ 2 + (sy - ly) * 1 / 2;
		double tx = lx + (rx - lx) * 2 / 3;
		double ty = ly + (ry - ly) * 2 / 3;
		if(time == n){
		cout << lx << " " << ly << endl;
		cout << sx << " " << sy << endl;
		cout << ux << " " << uy << endl;
		cout << tx << " " << ty << endl;
		}
		else{
			koch(time + 1, lx, ly, sx, sy);
			koch(time + 1, sx, sy, ux, uy);
			koch(time + 1, ux, uy, tx, ty);
			koch(time + 1, tx, ty, rx, ry);
		}
}



int main(){
	cin >> n;
	cout  <<fixed <<setprecision(8);
	double lx = 0;
	double ly = 0;
	double rx = 100;
	double ry = 0;
	if(n == 0){
		cout << lx << " " << ly << endl;
	}
	else{
		koch(1, lx, ly, rx, ry);
	}
	cout << rx << " " << ry << endl;
	return 0;
}

Measured memory_bytes: 1252
n,x = (int(i) for i in input().split())
a = list(int(i) for i in input().split())
ct = 0
for i in range(n-1):
  if a[i]+a[i+1] > x:
    ct += a[i]+a[i+1]-x
    a[i+1] -= a[i]+a[i+1]-x
    if a[i+1]<0:
      a[i+1] =0

print(ct)

Measured memory_bytes: 14544
// {{{
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#if __cplusplus >= 201103
#include <numeric>
#endif
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()

//#if __cplusplus >= 201103
typedef long long ll;
//#endif
typedef pair<int, int> P;
typedef pair<int, P> IP;

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

const int INF = 100000000;
//#if __cplusplus >= 201103
const ll LINF = 10000000000000000ll;
//#endif
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
// }}}

set<int> s;

void init()
{
}

void solve()
{
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    REP(i, n){
        int val;
        cin >> val;
        set<int>::iterator it = s.find(val);
        if(it == s.end()) s.insert(val);
        else s.erase(it);
    }
    cout << s.size() << endl;
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 4992
// Bismillahir Rahmanir Rahim  //
// Tanbir Ahmed  << RibNat >>  //
// University of Barisal       //

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define     fast            ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     in1(X)          scanf("%lli",&(X))
#define     ins(S)          scanf("%s",(S))
#define     out(X)          printf("%lli",(X))
#define     outs(S)         printf("%s",(S))
#define     printnl         printf("\n")
#define     End             return 0
#define     ll              long long int
#define     Pair            pair<ll,ll>
#define     F               first
#define     S               second
#define     all(v)          v.begin(),v.end()
#define     mem(a,v)        memset(a,v,sizeof(a))
#define     Max             1000000000000000014
#define     Min             -1000000000000000014
#define     mod             1000000007
#define     range           100007

#define     pb              push_back
#define     Vector          vector<ll>
#define     mp              make_pair
#define     PI              3.1415926535897
#define     min_heap        priority_queue <ll, vector<ll>, greater<ll> >
#define     ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>  //*(x.find_by_order(k)),x.order_of_key(k)

/*************** #Template FUNCTIONS# **************/

 ll pc;void PrintCase(){printf("Case %lli: ",++pc);}
// ll GCD(ll a,ll b){if(a<0) a*=-1;if(b<0) b*=-1;if(a<b)swap(a,b);if(b==1) return 1;if(!b) return a;if(!(a%b)) return b;else return GCD(b,a%b);}
//  ll LCM(ll a,ll b){ll x=GCD(a,b);return (a/x)*b;}
// ll bigmod(ll n,ll p){if(p==0) return 1;if(p==1)return (n+mod)%mod;if(p%2)return (bigmod(n,p-1)*n+mod)%mod;else{ll x=bigmod(n,p/2);return (x*x+mod)%mod;}}
// ll power(ll n,ll p){if(p==0) return 1;if(p==1)return n;if(p%2)return power(n,p-1)*n;else{ll x=power(n,p/2);return x*x;}}
// ll modinverse(ll n){return bigmod(n,mod-2)%mod;}
// ll Check(ll n,ll i){return (n&(1LL<<i));}
// ll Set(ll n,ll i){return (n|(1LL<<i));}
// ll status[(ll)range/64+5];Vector primes;void sieve(){for(ll i=3;i<=sqrt(range);i+=2){if(Check(status[i/64],i%64)==0){for(ll j=i*i;j<range;j+=2*i){status[j/64]=Set(status[j/64],j%64);}}}primes.pb(2);for(ll i=3;i<range;i+=2)if(Check(status[i/64],i%64)==0)primes.pb(i);}

// ll dx[] = {-2, -1, 1, 2,  2,  1, -1, -2};
// ll dy[] = { 1,  2, 2, 1, -1, -2, -2, -1};

// ll X[]= {0,0,1,-1,1,1,-1,-1};
// ll Y[]= {1,-1,0,0,1,-1,1,-1};

/********************** START **********************/

int main()
{
    double x,f;
    cin>>x;
    f=2*x*PI;
    printf("%0.15f",f);
}



/*******      ALHAMDULILLAH     *********/  
/*******      Happy Coding      *********/


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

int main() {
    int a,b;
    cin >> a >> b;
    if (a > b) cout << "a > b" << endl;
    else if (a < b) cout << "a < b" << endl;
    else cout << "a == b" << endl;
    return 0;
}



Measured memory_bytes: 3068
def havediv( target, elm):
    s = target / elm
    if target == s*elm:
        return True
    else:
        return False


if __name__ == "__main__":
        v = map( int, raw_input().split())
        ct = 0
        i = v[0]
        while i <= v[1]:
            if havediv( v[2], i):
                ct += 1
            i += 1
        print ct

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

int w,h;
int field[102][102];
int sx,sy;
int gx,gy;
int n;
int color;
bool ans;

void DFS(int x,int y)
{
	if(x == gx && y == gy){
		ans = true;
		return;
	}
	if(field[y][x] == -1)
		return;
	field[y][x] = -1;
	if(color == field[y][x-1])
		DFS(x-1,y);
	if(color == field[y][x+1])
		DFS(x+1,y);
	if(color == field[y-1][x])
		DFS(x,y-1);
	if(color == field[y+1][x])
		DFS(x,y+1);
}
int main()
{
	while(cin >> w >> h){
		if(!w&&!h)
			break;
		ans = false;
		memset(field,-1,sizeof(field));
		cin >> sx >> sy;
		cin >> gx >> gy;
		cin >> n;
		for(int i=0;i<n;i++){
			int c,d,x,y;
			cin >> c >> d >> x >> y;
			if(d == 1){
				for(int i=0;i<4;i++){
					for(int j=0;j<2;j++){
						field[y+i][x+j] = c;
					}
				}
			}
			else if(d == 0){
				for(int i=0;i<2;i++){
					for(int j=0;j<4;j++){
						field[y+i][x+j] = c;
					}
				}
			}
		}
		color = field[sy][sx];
		DFS(sx,sy);
		if(ans)
			cout << "OK" << endl;
		else
			cout << "NG" << endl;
	}
	return 0;
}

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

int main() {
    int a, b, c, d, left, right;
    cin >> a >> b >> c >> d;
    left = a + b;
    right = c + d;
    if (left > right) {
        cout << "Left" << endl;
    } else if (left == right) {
        cout << "Balanced" << endl;
    } else {
        cout << "Right" << endl;
    }
    return 0;
}

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

using namespace std;

int main(){
    vector<int> primes = {11, 31, 41, 61, 71, 101, 131, 151, 181, 191, 211, 241, 251, 271, 281, 311, 331, 401, 421, 431, 461, 491, 521, 541, 571, 601, 631, 641, 661, 691, 701, 751, 761, 811, 821, 881, 911, 941, 971, 991, 1021, 1031, 1051, 1061, 1091, 1151, 1171, 1181, 1201, 1231, 1291, 1301, 1321, 1361, 1381};
    int n;
    cin >> n;
    for_each(primes.begin(), primes.begin() + n, [](int i){cout << i << " ";});
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
n = 0
f = False
for _ in range(N):
    D1, D2 = list(map(int, input().split()))
    if D1 == D2:
        n += 1
    else:
        n = 0
    if n >= 3:
        f = True
print('Yes' if f else 'No')

Measured memory_bytes: 62308
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
typedef long long ll;
using namespace std;

int main(){
    int a,b;
    cin>>a;
    vector<pair<string,pair<int,int>>> v(a);
    for(int i=0;i<a;i++){
        cin>>v[i].first>>b;
        v[i].second={-b,i+1};
    }
    sort(v.begin(),v.end());
    for(auto i:v) cout<<i.second.second<<'\n';
}

Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn divisors(n: u64) -> Vec<u64> {
  let mut divs: Vec<u64> = Vec::new();
  for i in 1..(n as f64).sqrt() as u64 + 1 {
    if n % i == 0 {
      divs.push(i);
      if i != (n / i) {
        divs.push(n/i);
      }
    }
  }
  divs.sort();
  divs
}


fn main() {
    let n: u64 = input();
    let divs: Vec<u64> = divisors(n);
    if divs.len() % 2 == 0 {
        println!("{}", divs[divs.len() / 2 - 1] + divs[divs.len() / 2] - 2);
    } else {
        println!("{}", divs[divs.len() / 2] * 2 - 2);
    }

}


Measured memory_bytes: 4352
#include <iostream>
#include<bits/stdc++.h>
#include<string>
#include <string.h>
using namespace std;
int main()
{string s;
cin>>s;
string t;
cin>>t;
int l=s.length();
int m=t.length();
string sub =t.substr(0,m-1);
if(s==sub)
    cout<<"Yes";
else
cout<<"No";


}


Measured memory_bytes: 3592
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	int a, b, c, d;
	cin >> a >> b >> c >> d;

	int dist1 = abs(a - b);
	int dist2 = abs(b - c);
	int dist3 = abs(a - c);

	if (dist1 <= d && dist2 <= d)
	{
		cout << "Yes";
	}
	else if (dist3 <= d)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}

	return 0;
}


Measured memory_bytes: 3512
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
int n,a[100111];
int main()
{
	geti(n);
	for(int i=1;i<=n;i++)geti(a[i]);
	sort(a+1,a+n+1);
	ll sum=0;
	int last=1;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>2*sum)
		{
			last=i;
		}
		sum+=a[i];
	}
	putsi(n-last+1);
	return 0;
}

Measured memory_bytes: 768
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int n, k;
int a[101];
int result[100001][2] = {};


bool canFirstWin(int stones, bool isFirstTurn)
{

	if(result[stones][isFirstTurn] != 0) return result[stones][isFirstTurn] == 1;
	else if(stones == 0) return !isFirstTurn;
	if(isFirstTurn) result[stones][isFirstTurn] = -1;
	else result[stones][isFirstTurn] = 1;
	for(int i = 0; i < n; i++){
		if(stones < a[i]) continue;
		if(isFirstTurn && canFirstWin(stones - a[i], !isFirstTurn)) result[stones][isFirstTurn] = 1;
		if(!isFirstTurn && !canFirstWin(stones - a[i], !isFirstTurn)) result[stones][isFirstTurn] = -1;
	}
	return result[stones][isFirstTurn] == 1;
}

int main()
{
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	if(canFirstWin(k, true)) cout << "First" << endl;
	else cout << "Second" << endl;
}

Measured memory_bytes: 8832
#include<bits/stdc++.h>
# define ll long long
# define mo 1000000009
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	if(n<m)
	{
		for(int i=0;i<m;i++)
		cout<<n;
	}
	else
	{
		for(int i=0;i<n;i++)
		cout<<m;
	}
	return 0;
}

Measured memory_bytes: 256
#N <= 1.08 * X < N + 1
import math as m
N = int(input())

k = N / 1.08
k = round(k)

if m.floor(k * 1.08) == N:
    print(k)
elif m.floor((k-1) * 1.08) == N:
    print(k-1)
elif m.floor((k+1) * 1.08) == N:
    print(k+1)
elif m.floor((k-2) * 1.08) == N:
    print(k-2)
elif m.floor((k+2) * 1.08) == N:
    print(k+2)
else:
    print(':(')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
using lint = long long;

int D, G;
vector<int> p, c;

int main()
{
    cin >> D >> G;
    G /= 100;
    p.resize(D);
    c.resize(D);
    REP(i, D)
    {
        cin >> p[i] >> c[i];
        c[i] /= 100;
    }

    int res = 1000;
    REP(S, 1<<D) { // S : 全部解くやつ
        int pts = 0;
        int num = 0;
        REP(i, D) if ((S >> i) & 1) {
            pts += c[i] + p[i] * (i + 1);
            num += p[i];
        }
        int rem = G - pts;
        if (rem <= 0)
        {
            res = min(res, num);
            continue;
        }
        IREP(i, D) if (!((S >> i) & 1)) {
            if (rem > (i + 1) * p[i]) continue;
            else res = min(res, num + (rem + i) / (i+1));
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
def main():
    N, M = map(int, input().split())
    d = {}
    for _ in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        if a in d:
            d[a].append(b)
        else:
            d[a] = [b]
        if b in d:
            d[b].append(a)
        else:
            d[b] = [a]
    v = set()
    v.add(0)
    l = [0] * N
    c = set()
    c.add(0)
    r = 0
    while len(v) < N:
        n = set()
        for i in c:
            for j in d[i]:
                if j not in v:
                    l[j] = i
                    v.add(j)
                    n.add(j)
        c = n
    print('Yes')
    for i in range(1,N):
        print(l[i] + 1)
main()


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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#define all(x) (x).begin(),(x).end()

const int MOD = 1e9 + 7;

void solve(){

}
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    string ans;
    if (a+b == c || b + c == a || c + a == b){
        ans = "Yes";
    } else {
        ans = "No";
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;


void solve(int n) {
    vector<vector<int>> v(n, vector<int>(n, 0));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            scanf("%1d", &v[i][j]);
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int cnt = 0;
        for (int j = 0; j < n; ++j) {
            if(v[i][j]) cnt++;
            else cnt = 0;
            ans = max(ans, cnt);
        }
    }
    for (int i = 0; i < n; ++i) {
        int cnt = 0;
        for (int j = 0; j < n; ++j) {
            if(v[j][i]) cnt++;
            else cnt = 0;
            ans = max(ans, cnt);
        }
    }
    auto dp = v;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if(i && j && dp[i][j]) dp[i][j] += dp[i-1][j-1];
            ans = max(ans, dp[i][j]);
        }
    }
    dp = v;
    for (int i = 0; i < n; ++i) {
        for (int j = n-1; j >= 0; --j) {
            if(i && j != n-1 && dp[i][j]) dp[i][j] += dp[i-1][j+1];
            ans = max(ans, dp[i][j]);
        }
    }
    cout << ans << "\n";
}

int main() {
    int n;
    while(cin >> n, n){
        solve(n);
    }
    return 0;
}


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

using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;

#define out(a) cout << a << endl
#define out1(a) cout << a
#define in(a) cin >> a
#define in2(a, b) cin >> a >> b
#define in3(a, b, c) cin >> a >> b >> c
#define rep(i, N) for (ll i = 0; i < (ll)N; i++)
#define rep1(i, N) for (ll i = 1; i <= (ll)N; i++)
#define repi(i, j, N) for (ll j = (ll)i + 1; j < (ll)N; j++)
#define all(v) v.begin(), v.end()

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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;
constexpr ll mod = 1e9 + 7;

void solve();

int main()
{
    solve();
}

void solve()
{
    string s, t;
    in2(s, t);
    int flag = 1;
    rep(i, s.size())
    {
        if (s[i] != t[i])
        {
            flag = 0;
            break;
        }
    }
    if (flag)
    {
        out("Yes");
    }
    else
    {
        out("No");
    }
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
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 long long ll;
typedef pair<ll,ll> pint;
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b==0){
        return a;
    }
    else{
        return gcd(b,a%b);
    }
}

int main(){
    ll u,v,n;cin>>n>>u>>v;
    vector<vector<ll>> E(n);
    vector<ll> T(n,INF);
    vector<ll> A(n,INF);
    T[u-1]=0;
    A[v-1]=0;
    rep(i,n){
        ll a,b;cin>>a>>b;
        E[a-1].push_back(b-1);
        E[b-1].push_back(a-1);
    }
    queue<pair<ll,pair<ll,ll>> > que;
    que.push(make_pair(0LL,make_pair(u-1LL,-1LL)));
    while(! que.empty()){
        auto q = que.front();que.pop();
        ll dis = q.first;
        ll now = q.second.first;
        ll old = q.second.second;
        if (T[now]<dis) continue;
        T[now] = dis;
        rep(i,E[now].size()){
            if(old!=E[now][i]){
                que.push({dis+1,{E[now][i],now}});
            }
        }
    }
    //queue<pair<ll,pair<ll,ll>> > que;
    que.push(make_pair(0LL,make_pair(v-1LL,-1LL)));
    while(! que.empty()){
        auto q = que.front();que.pop();
        ll dis = q.first;
        ll now = q.second.first;
        ll old = q.second.second;
        if (A[now]<dis) continue;
        A[now] = dis;
        rep(i,E[now].size()){
            if(old!=E[now][i]){
                que.push({dis+1,{E[now][i],now}});
            }
        }
    }
    ll ans = 0;
    rep(i,n){
        //cout<<T[i];
        if(T[i]<=A[i]){
            chmax(ans,A[i]);
        }
    }
    cout<<ans-1<<endl;
}


Measured memory_bytes: 8308