akhauriyash/Code-Regression huggingface dataset:
// 問題の URL を書いておく
// 

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <bitset>
#include <numeric>
using namespace std;

//#define ENABLE_PRINT

template<typename T>
T Input()
{
    T v;
    cin >> v;
    return v;
}

template<typename T>
vector<T> InputVector(int n)
{
    vector<T> v(n);
    for(int i = 0; i < n; ++i)
    {
        cin >> v[i];
    }
    return v;
}

template<typename T>
void InputArray(T* begin, int n)
{
    for(int i = 0; i < n; ++i)
    {
        cin >> begin[i];
    }
}

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

int main(int argc, const char* argv[])
{
    int n;
    cin >> n;
    int mod = n % 10;
    switch(mod)
    {
        case 0:
        case 1:
        case 6:
        case 8:
            cout << "pon" << endl;
            break;
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout << "hon" << endl;
            break;
        case 3:
            cout << "bon" << endl;
    }
    return 0;
}


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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define pb push_back
#define ins insert
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)9e18);
const int ninf=((int)-9e18);
const int mod=1000000007;

using namespace std;

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);


    int n;
    cin>>n;
    int ans=0;
    loop(i,1,n+1)
    {
        int c=0;
        string a=to_string(i);
        c=a.size();

        if(c%2)
            ans++;
    }

    cout<<ans;


    return 0;
}


Measured memory_bytes: 3740
N=int(input())
S=[input() for _ in range(N)]
S.sort()
S.append('0')
dp=[0]*5
for i in range(N+1):
  if i==N:
    continue
  if S[i]==S[i+1]:
    continue
  if S[i][0]=='M':
    dp[0]+=1
  elif S[i][0]=='A':
    dp[1]+=1
  elif S[i][0]=='R':
    dp[2]+=1
  elif S[i][0]=='C':
    dp[3]+=1
  elif S[i][0]=='H':
    dp[4]+=1
ans=0
for i in range(3):
  for j in range(i+1,4):
    for k in range(j+1,5):
      ans+=dp[i]*dp[j]*dp[k]
print(ans)

Measured memory_bytes: 16304
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int ans = 1;
    for (int i = 0;i < 3;i++){
        if (s[i] == s[i+1]){
            ans = 0;
            break;
        }
    }
    if (ans == 1){
        cout << "Good" << endl;
    }
    else {
        cout << "Bad" << endl;
    }
}


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

n = int(input())

nums = sorted(list(map(int, input().split())))

ans = 1
for i in range(n):
    ans *= nums[i]

    if ans == 0:
        print(0)
        exit()

    if ans > 10 ** 18:
        print(-1)
        exit()

print(ans)


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

#define int long long

const int maxn = 101, maxw = 1e5 + 5;
int dp[maxn][maxw], v[maxn], w[maxn];

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, W;
	cin >> n >> W;
	for (int i = 0; i < n; i ++)
		cin >> w[i] >> v[i];
	for (int i = 1; i <= n; i ++){
		for (int j = 0; j < w[i - 1]; j ++)
			dp[i][j] = dp[i - 1][j];
		for (int j = w[i - 1]; j <= W; j ++){
			dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i - 1]] + v[i - 1]);
		}
	}
	cout << *max_element(dp[n], dp[n] + W + 1);
}


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

int main() {
    int n, m;
    std::cin >> n;
    std::vector<int> vec;
    for (int i = 0; i < n; i++) {
        int x;
        std::cin >> x;
        vec.push_back(x);
    }
    std::cin >> m;
    int moves[m];
    for (int i = 0; i < m; i++) {
        std::cin >> moves[i];
    }
    for (int i = 0; i < m; i++) {
        int t = moves[i] - 1;
        if (std::find(vec.begin(), vec.end(), vec[t]+1) == vec.end() && vec[t] != 2019) {
            vec[t] += 1;
        }
    }
    for (int i = 0; i < n; i++) {
        std::cout << vec[i] << std::endl;
    }
}



Measured memory_bytes: 3160
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    string s, ans;
    cin >> s;
    if(s == "Sunny"){
        ans = "Cloudy";
    }else if(s == "Cloudy"){
        ans = "Rainy";
    }else{
        ans = "Sunny";
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
bool dp1[5555][5555],dp2[5555][5555];
int main()
{
	int num, gen;
	scanf("%d%d", &num, &gen);
	vector<int>v;
	for (int i = 0; i < num; i++)
	{
		int z;
		scanf("%d", &z);
		if (z >= gen)continue;
		v.push_back(z);
	}
	dp1[0][0] = dp2[v.size()][0] = true;
	for (int i = 0; i < v.size(); i++)
	{
		for (int j = 0; j <= gen; j++)
		{
			if (dp1[i][j])
			{
				dp1[i + 1][j] = true;
				if (j + v[i] <= gen)dp1[i + 1][j + v[i]] = true;
			}
		}
	}
	for (int i = v.size() - 1; i >= 0; i--)
	{
		for (int j = 0; j <= gen; j++)
		{
			if (dp2[i + 1][j])
			{
				dp2[i][j] = true;
				if (j + v[i] <= gen)dp2[i][j + v[i]] = true;
			}
		}
	}
	int cnt = 0;
	for (int i = 0; i < v.size(); i++)
	{
		int rui[5555];
		fill(rui, rui + 5555, 0);
		for (int j = 0; j <= gen; j++)rui[j + 1] = rui[j] + dp1[i][j];
		bool f = true;
		for (int j = 0; j <= gen; j++)
		{
			if (dp2[i + 1][j])
			{
				if (rui[gen - j] - rui[max(0, gen - v[i] - j)] != 0)f = false;
			}
		}
		if (f)cnt++;
	}
	printf("%d\n", cnt);
}

Measured memory_bytes: 57600
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


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

	int N, x; cin >> N >> x;
	if (x == 1 || x == 2 * N - 1) cout << "No" << endl;
	else {
		cout << "Yes" << endl;

		vector<int> V(2 * N);
		for (int i = 1; i <= 2 * N - 1; i++) V[i] = 0;

		if (x == 2) {
			V[N] = x;
			V[N + 1] = 1;
			for (int i = 1; i <= N - 1; i++) V[i] = i + 2;
			for (int i = N + 2; i <= 2 * N - 1; i++) V[i] = i;
		}
		else {
			V[N] = x;
			V[N + 1] = x + 1;
			V[N - 1] = x - 1;
			V[N + 2] = x - 2;
			queue<int> Q;
			for (int i = 1; i <= x - 3; i++) Q.push(i);
			for (int i = x + 2; i <= 2 * N - 1; i++) Q.push(i);
			for (int i = 1; i <= 2 * N - 1; i++) {
				if (V[i] == 0) {
					V[i] = Q.front();
					Q.pop();
				}
			}

		}
		for (int i = 1; i <= 2 * N - 1; i++) cout << V[i] << endl;
	}



	return 0;
}

Measured memory_bytes: 2396
A,B,C,D,E,F = map(int,input().split())
Ans = [0,100*A,0]
def Con(water,sugar):
    return 100*(sugar)/(water+sugar)
def limit(water):
    return water*E//100
for NumA in range(1,F//(100*A)+2):
    for NumB in range(0,F//(100*B)+1):
        water = 100*(A*NumA+B*NumB)
        lim1 = limit(water)
        lim2 = F-water
        lim = min(lim1,lim2)
        for i in range(lim//D+1):
            sugar = D*i
            sugar += ((lim-sugar)//C)*C
            Con1 = Con(water,sugar)
            if Ans[0] < Con1:
                Ans = [Con1,water,sugar]
print(Ans[1]+Ans[2],Ans[2])

Measured memory_bytes: 9184
#include <stdio.h>
#define N 100000
 
typedef struct{
  char name[10];
  int time;
} Data;
 
int main(){
  int n, q, i, count = 0, head = 0, tail;
  Data Q[N];
 
  scanf("%d%d", &n, &q);
  tail = n;
 
  for(i = 0; i < n; i++){
    scanf("%s%d", Q[i].name, &Q[i].time);
  } 
 
  while(head != tail){
    if(Q[head].time > q){
      Q[head].time -= q;
      Q[tail] = Q[head];
      tail++;
      count += q;
    }
    else{
      count += Q[head].time;
      printf("%s %d\n", Q[head].name, count);
    }
    head++;
    if(head >= N) head = 0;
    if(tail >= N) tail = 0;
  }
 
  return 0;
}

Measured memory_bytes: 2164
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(int)(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////
const ll inf = 1LL<<60;
const ll mod = 1000000007;

struct mint {
  ll x;
  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;
  }
  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; }
  bool operator==(const mint a) const { return x == a.x; }
  bool operator!=(const mint a) const { return x != a.x; }
  friend ostream &operator<<(ostream &os, const mint &p) { return os << p.x; }
  friend istream &operator>>(istream &is, mint &a) {
    ll t;
    is >> t;
    a = mint(t);
    return (is);
  }
};

template<typename T>
struct Comb {
  vector<T> fact, finv, inv;
  Comb(int n) : fact(n, 1), finv(n, 1), inv(n, 1) { init(n); }
  void init(int n) {
    fact.assign(n, 1), finv.assign(n, 1), inv.assign(n, 1);
    for (ll i=2; i<n; i++) {
      fact[i] = fact[i-1] * i % mod;
      inv[i] = mod - inv[mod%i] * (mod/i) % mod;
      finv[i] = finv[i-1] * inv[i] % mod;
    }
  }
  T nck(int n, int k) {
    if (n<k || n<0 || k<0) return 0;
    return fact[n] * (finv[k] * finv[n-k] % mod) % mod;
  }
  T nhk(int n, int k) { return nck(n+k-1, k); }
  T npk(int n, int k) {
    if (n<k || n<0 || k<0) return 0;
    return fact[n] * finv[n-k] % mod;
  }
};

int main()
{
  ll x,y; cin>>x>>y;
  Comb<ll> c(2000010);

  mint ans = 0;
  for (ll i=0; i<=x; i++) {
    ll nx = x-i;
    ll ny = y-2*i;
    if (nx != 2*ny) continue;
    ans += c.nhk(ny+1, i);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 50216
using System.Text;
using System.Numerics;
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        if (n == 1) { Console.Write("8\n2\n"); goto exit; }
        printB(n);
        print(n);
        exit:;
    }
    static void print (int n)
    {
        var sb = new StringBuilder();
        for (int i = 0; i < n; i++) sb.Append(string.Format("{0}\n", i + 2));
        Console.Write(sb);
    }
    static void printB (int n)
    {
        BigInteger ans = 1;
        for (int i = 2; i <= n + 1; i++) ans *= i;
        Console.WriteLine(ans + 2);
    }
}


Measured memory_bytes: 18120
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
using ll = long long;



int main() {
	int r;
	cin >> r;
	if (r < 1200) cout << "ABC" << endl;
	else if (r < 2800) cout << "ARC" << endl;
	else cout << "AGC" << endl;

	return 0;
}


Measured memory_bytes: 256
max = 1_000_000

is_prime = [false, false] + [true]*(max - 1)

l_max = Math.sqrt(max).floor + 1
2.upto(l_max).each do |i|
  next unless is_prime[i]
  (i*i).step(by: i, to: max) do |j|
    is_prime[j] = false
  end
end

count = 0
prime_count = []
1.upto(max) do |i|
  count += 1 if is_prime[i]
  prime_count[i] = count
end

while n = gets.to_i
  break if n == 0
  puts prime_count[n]
end

Measured memory_bytes: 32156
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		long H = sc.nextLong();
		long W = sc.nextLong();

		if(H != 1 && W != 1) {
			System.out.println((H * W) / 2 + (H * W) % 2);
		} else {
			System.out.println(1);
		}
	}
}


Measured memory_bytes: 22868
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <bitset>
#include <stack>
#include <deque>
using namespace std;
typedef pair<int, int> pii;
typedef long long LL;
const int MAXN = 1234;
const int INF = 5678;
vector<int> G[MAXN];
int dp[MAXN][2][INF], tmp[2][INF], X[MAXN], ans[MAXN];
bool visit[MAXN];

bool dfs(int cur) {
     visit[cur] = 1;
     dp[cur][0][0] = dp[cur][1][0] = 1;
     int sum = 0;
     for (auto chd : G[cur]) {
         if (!visit[chd]) {
            if (!dfs(chd)) return false;
            memset(tmp, 0, sizeof(tmp));
            for (int i = 0; i < INF; i++) {
                if (i >= X[chd] && (dp[cur][0][i - X[chd]] || dp[cur][1][i - X[chd]]))
                   tmp[0][i] = 1;
                if (i >= ans[chd] && (dp[cur][0][i - ans[chd]] || dp[cur][1][i - ans[chd]]))
                   tmp[1][i] = 1;
            }
            for (int i = 0; i < 2; i++)
                for (int j = 0; j < INF; j++)
                    dp[cur][i][j] = tmp[i][j];
            sum += (X[chd] + ans[chd]);
         }
     }
     int MAX[2] = {-1, -1};
     for (int i = 0; i < 2; i++)
         for (int j = X[cur]; j >= 0; j--) {
             if (dp[cur][i][j]) {
                MAX[i] = j;
                break;
             }
         }
     if (MAX[0] == -1 && MAX[1] == -1) return false;
     ans[cur] = sum - max(MAX[0], MAX[1]);
     //printf("cur = %d ans[cur] = %d MAX0 = %d MAX1 = %d\n", cur, ans[cur], MAX[0], MAX[1]);
     return true;
}

int main() {
    int N;
    scanf("%d", &N);
    for (int i = 2; i <= N; i++) {
        int par;
        scanf("%d", &par);
        G[par].push_back(i);
    }
    for (int i = 1; i <= N; i++)
        scanf("%d", &X[i]);
    if (!dfs(1)) puts("IMPOSSIBLE");
    else puts("POSSIBLE");
    return 0;
}


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

int main() {
    int k; cin >> k;
    int cnt = 0;
    int sev = 0;
    rep(i, k) {
        sev = (sev * 10 + 7) % k;
        cnt += 1;
        if (sev % k == 0) {
            cout << cnt << endl;
            return 0;
        } 
    }
    cout << -1 << endl;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

string s;

int ans = 0;

int main(void) {
  // Here your code !
  cin >> s;

  for (int i = 0; i < s.size(); ++i) {
    for (int j = i; j < s.size(); ++j) {
      bool flg = false;

      for (int l = i; l <= j; ++l) {
        if (s[l] != 'A' && s[l] != 'C' && s[l] != 'G' && s[l] != 'T') {
          flg = true;
          break;
        }
      }

      if (flg) break;

      ans = max(ans, j - i + 1);
    }
  }

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

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int N;
int memo[100009];

int dp(int n){
  if(n==0){return 0;}
  else if(memo[n]!=0){return memo[n];}
  else{
    int ans=n;
    for(int i=1;i<=n;i*=6){ans=min(ans,dp(n-i)+1);}
    for(int i=9;i<=n;i*=9){ans=min(ans,dp(n-i)+1);}
    return memo[n]=ans;
  }
}

int main(){
  cin >> N;
  cout << dp(N) << endl;
}

Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

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

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int n;
	cin>>n;
	vector<pair<pair<string,int>,int> > x(n);
	for(int i = 0; i < n; i++){
		cin>>x[i].first.first >> x[i].first.second;
		x[i].first.second *= -1;
		x[i].second = i+1;
	}
	sort(all(x));
	for(int i = 0; i < n; i++){
		cout << x[i].second << endl;
	}



	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

// greatest common divisor and least common multiple
// gcd is calculated by Euclidean Algorithm
// lcm = m * n / gcd(m,n)
template <typename T = int>
T gcd(T a, T b) {
    if (a < b)
        return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

int main() {
    int t;
    cin >> t;
    vl a(t), b(t), c(t), d(t);
    for (int i = 0; i < t; ++i) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    for (int i = 0; i < t; ++i) {
        if (d[i] < b[i]) {
            cout << "No"
                 << "\n";
            continue;
        }
        if (a[i] < b[i]) {
            cout << "No"
                 << "\n";
            continue;
        }
        if (b[i] <= d[i] && c[i] >= b[i]) {
            cout << "Yes"
                 << "\n";
            continue;
        }
        a[i] %= b[i];
        ll gcdbd = gcd(b[i], d[i]);
        ll maxi = a[i] + (b[i] - 1 - a[i]) / (gcdbd) * gcdbd;
        if (maxi > c[i]) {
            cout << "No"
                 << "\n";
        } else {
            cout << "Yes"
                 << "\n";
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int n, m;
  scanf("%d%d", &n, &m);
  int ans[50] = {0};
  
  for(int i = 0; i < m; i++){
    int a, b;
    scanf("%d%d", &a, &b);
    ans[a - 1]++;
    ans[b - 1]++;
  }
  
  for(int i = 0; i < n; i++){
    printf("%d\n", ans[i]);
  }
  
  return 0;
}

Measured memory_bytes: 128
//----------ACCIDENTAL COMPETITIVE PROGRAMMER---------------------

#include<bits/stdc++.h>

/*
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
using namespace std;

#define LL long long
#define LD long double
#define PB push_back
#define MP make_pair


const LL MOD = (1e9) + 7 ;
const LD EPS = 0.0000001 ;

const int N = 100000 + 50000;

vector<int> graph[N];

bool done[N];

void dfs(int node)
{
	done[node] = true;
	for (auto to : graph[node]){
		if (done[to])
			continue;
		dfs(to);
	}
}

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

    int n, m; cin >> n >> m;

    for (int i = 1; i <= n; i++){
    	done[i] = false;
    }

    for (int i = 0; i < m; i++){
    	int u, v, w; cin >> u >> v >> w;
    	graph[u].PB(v);
    	graph[v].PB(u);
    }

    int ans = 0;
    for (int i = 1; i <= n; i++){
    	if (done[i])
    		continue;
    	ans++;
    	dfs(i);
    }

    cout << ans << endl;

	return 0;
}

Measured memory_bytes: 10112
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>

using namespace std;

int main() {
	int n,r = 0;
	cin >> n;
	for(int i = 1;i <= n;i += 2) {
		int w = 0;
		for(int j = 1;j <= i;j++) {
			if(i % j == 0) w++;
		}
		if(w == 8)r++;
	}
	cout << r << endl;
}


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

ll H, W;

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

    ll ans = 1.0e11;
    for (ll i = 1; i < H; i++) {
        ll S1 = i * W;
        ll w_a = W/2;
        ll S2_a = (H - i) * w_a;
        ll S3_a = (H - i) * (W - w_a);

        ll S_max_a = max(S1, max(S2_a, S3_a));
        ll S_min_a = min(S1, min(S2_a, S3_a));

        ans = min(ans, S_max_a - S_min_a);

        ll h_b = (H-i)/2;
        ll S2_b = h_b * W;
        ll S3_b = (H - i - h_b) * W;

        ll S_max_b = max(S1, max(S2_b, S3_b));
        ll S_min_b = min(S1, min(S2_b, S3_b));

        ans = min(ans, S_max_b - S_min_b);
    }

    for (ll i = 1; i < W; i++) {
        ll S1 = i * H;
        ll h_a = H/2;
        ll S2_a = (W - i) * h_a;
        ll S3_a = (W - i) * (H - h_a);

        ll S_max_a = max(S1, max(S2_a, S3_a));
        ll S_min_a = min(S1, min(S2_a, S3_a));

        ans = min(ans, S_max_a - S_min_a);

        ll w_b = (W-i)/2;
        ll S2_b = w_b * H;
        ll S3_b = (W - i - w_b) * H;

        ll S_max_b = max(S1, max(S2_b, S3_b));
        ll S_min_b = min(S1, min(S2_b, S3_b));

        ans = min(ans, S_max_b - S_min_b);
    }

    cout << ans << endl;
    

    return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
	int n,m;
	cin >> n >> m;
	
	vector<int> cnt(m, 0);
	
	for(int i=0; i < n; i++) {
		int amt;
		cin >> amt;
		
		for(int j = 0; j < amt; j++) {
			int val;
			cin >> val;
			cnt[val-1]++;
		}
	}
	
	int no = 0;
	for(int i = 0; i < m; i++) {
		if(cnt[i] == n) {
			no++;
		}
	}
	
	cout << no;
	return 0;
}

Measured memory_bytes: 256
#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 each(itr,v) for(auto itr:v)
#define pb push_back
#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_popcount

#define inf 1e16

struct Segtree {
  vector<ll> seg, lazy;
  int size;
  Segtree() {}
  Segtree(int n) {
    init(n);
  }
  void init(int n) {
    size = 1;
    while (size < n) size *= 2;
    seg.resize(size * 2);
    lazy.resize(size * 2);
  }
  void push(int k, int l, int r) {
    seg[k] += lazy[k];
    if (r - l > 1) {
      lazy[k * 2 + 1] += lazy[k]/2;
      lazy[k * 2 + 2] += lazy[k]/2;
    }
    lazy[k] = 0;
  }
  void update(int a, int b, ll v, int k, int l, int r) {
    push(k, l, r);
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      lazy[k] += v*(r-l);
      push(k, l, r);
    } else {
      update(a, b, v, k * 2 + 1, l, (l + r) / 2);
      update(a, b, v, k * 2 + 2, (l + r) / 2, r);
      seg[k] = seg[k * 2 + 1]+seg[k * 2 + 2];
    }
  }
  void update(int a,int b,ll v){
    update(a,b,v,0,0,size);
  }
  ll query(int a, int b, int k, int l, int r) {
    push(k, l, r);
    if (r <= a || b <= l) return 0;
    if (a <= l && r <= b) return seg[k];
    ll vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    ll vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return vl+vr;
  }
  ll query(int a,int b){
    return query(a,b,0,0,size);
  }
};


int main(){
	cin.sync_with_stdio(false);
  int n,q;
  cin>>n>>q;
  Segtree sgt(n);
  rep(i,q){
    int t;
    cin>>t;
    if(!t){
      int a,b,c;
      cin>>a>>b>>c;
      a--;
      sgt.update(a,b,c);
    }else{
      int a,b;
      cin>>a>>b;
      a--;
      cout<<sgt.query(a,b)<<endl;
    }
  }
	return 0;
}

Measured memory_bytes: 7076
#include "bits/stdc++.h"
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long
int n,k;
vector<LL> h;

int main(){
  cin>>n>>k;
  LL tmp;
  REP(i,n){
    cin>>tmp;
    h.push_back(tmp);
  }
  sort(h.begin(),h.end());
  LL ret = 10000000000000000;
  for(int i=0;i<h.size()-k+1;i++){
    ret = min(ret,h[k+i-1]-h[i]);
  }
  cout<<ret<<endl;
  return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
	int h, w;
	string s[100];
	cin >> h >> w;
	for (int i = 0; i < h; i++)
		cin >> s[i];
	for (int i = 0; i < h; i++)
		cout << s[i] << endl << s[i] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

Measured memory_bytes: 256
#include <stdio.h>

int
main(
    void
)
{
    int k, i, score = 0;
    double n, prob = 1, sum = 0;
    scanf("%lf%d", &n, &k);

    for ( i = 1; i <= n; i++ )
    {
        prob = (double) (1 / n);
        score = i;
        while ( score <= (k - 1) )
        {
            prob *= 0.5;
            score *= 2;
        }
        sum += prob;
    }
    printf("%.9lf\n", sum);
    return 0;
}

Measured memory_bytes: 128
//Keep Working Hard
  // I__Like__Food  

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define tracel5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)

const int N = 1e5 + 5;


int32_t main()
{



    IOS


    int n;
    cin >> n;

    int arr[n+1];

    map<int,int> mp;
    for(int i = 1; i <= n; i++)
    {
    	cin >> arr[i];
    	mp[arr[i]]++;
    }

    int ans = 0;

    for(int i = 0; i < N; i++)
    {
    	int count = 0;
    	if(mp.find(i) != mp.end())count+=mp[i];
    	if(mp.find(i-1) != mp.end())count+=mp[i-1];
    	if(mp.find(i+1) != mp.end())count+=mp[i+1];

    	ans = max(ans,count);
    }

    cout << ans;




    return 0;
}




Measured memory_bytes: 4992
import java.util.*;
import java.util.ArrayList;
public class Main{
    public static void main(String[]args){  
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();
    int d=b-a;
    int e=c-b;
    if(d==e){
        System.out.println("YES");
    }else{
        System.out.println("NO");
    }
    
    }
}

Measured memory_bytes: 23764
#include "bits/stdc++.h"
using namespace std;
#ifdef ONLINE_JUDGE
#define trace(...)
#endif

using LL = long long;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin >> n;
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i].first;
		a[i].second = i + 1;
	}
	sort(a.begin(), a.end());
	for (auto& e: a) cout << e.second << ' ';
	cout << endl;
	return 0;
}


Measured memory_bytes: 1664
n = int(input())
a = list(map(int, input().split()))

cnt = 1
mono = 0
for i in range(1, n):
  d = a[i] - a[i - 1]
  if d * mono < 0:
    cnt += 1
    mono = 0
  elif d != 0:
    mono = d
print(cnt)

Measured memory_bytes: 14252
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a1 = sum(A)

for i in range(N):
  b = B[i]
  if A[i] >= b:
    A[i] -= b
  else:
    if A[i+1]+A[i] >= b:
      A[i+1] = A[i+1]+A[i]-b
      A[i] = 0
    else:
      A[i], A[i+1] = 0, 0
      
a2 = sum(A)
print(a1-a2)

Measured memory_bytes: 24236
import heapq
import math
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
logof2=[0]*N
mi=0
buf=0
#print(A)
for i in range(N):
    A[i]=-A[i]  #heapqは実装上最初値しか取り出さないので、数列を-1倍し、最小値が最大に当たるようにする
heapq.heapify(A)#priority_que化
for i in range(M):
    buf=heapq.heappop(A)    #最大値を取り出すことに相当
    buf=buf/2            #切り捨て(floor)の挙動は負数の時おかしくなるので一旦正値に変換して計算し
    heapq.heappush(A,buf)   #
    #print(A)
for i in range(N):
    mi=mi+math.floor(-1*A[i])  #残った要素ごとの足し算に相当する

print(mi)


Measured memory_bytes: 14532
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}
mt19937 _mt(chrono::steady_clock::now().time_since_epoch().count());
ll getrnd(ll l,ll r){return uniform_int_distribution<ll>(l,r-1)(_mt);}
/*
#define _cTime (chrono::system_clock::now())
#define progress (chrono::duration_cast<chrono::milliseconds>(_cTime-_sTime).count())
#define reset _sTime=_cTime
auto reset;
*/

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m,k,in,ans=0;;
	cin>>n>>m;
	vi v(m);
	rep(i,n){
		cin>>k;
		rep(j,k){
			cin>>in;
			v[in-1]++;
		}
	}
	rep(i,m){
		if(v[i]==n)ans++;
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define  __  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

double ans=0.0;

int main()
{
    __;

    int n,k,p;

    cin>>n>>k;

    for(int i=1;i<=n;i++)
    {
        p=i;

        int cnt=0;

        while(p<k)
        {
            p+=p;
            cnt++;
        }
        ans+=(1/(n * pow(2,cnt)));
    }

    printf("%.12f",ans);

    return 0;
}


Measured memory_bytes: 256
K, N = map(int, input().split())
A = list(map(int, input().split()))
D = [-1] * N
for i in range(N-1):
    D[i] = A[i + 1] - A[i]
D[N-1] = K - A[N-1] + A[0]
print(sum(D) - max(D))

Measured memory_bytes: 77388
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
using namespace std;


int main() {
	long long N, n[6];
	long long ans = 0;
	long long tmp = 0;
	cin >> N >> n[0] >> n[1] >> n[2] >> n[3] >> n[4];
	long long min = n[0];
	for (int i = 1; i <= 4; i++) {
		if (min > n[i]) min = n[i];
	}
	if (N%min == 0) {
		ans = (N / min) + 4;
	}
	else {
	ans = (N / min) + 5;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
using namespace std;

using INT = long long;
using UINT = unsigned long long;

int main()
{
	INT n, m;
	cin >> n >> m;

	vector <INT> a(m, 1), a2(m, 0);
	for (size_t i = 0; i < n; i++)
	{
		INT k;
		cin >> k;
		for (size_t j = 0; j < k; j++)
		{
			INT am;
			cin >> am;
			a2[am-1] = 1;
		}
		for (size_t j = 0; j < m; j++)
		{
			a[j] &= a2[j];
			a2[j] = 0;
		}
	}
	cout << count_if(a.begin(), a.end(), [](INT s) {return s == 1; }) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
 
int main(){
    int N;
    string S,T;
    cin >> N >> S >> T;
    rep(i,N){
        cout << S.at(i) << T.at(i) ;
    }
    cout << endl;

}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char **argv){
	int i,n;
	
	i = 0;
	for(;;){
		scanf("%d",&n);
		// Check Finish
		if( n == 0 ){
			break;
		}
		// Print Test Case
		i++;
		printf("Case %d: %d\n",i,n);
	}
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
using namespace std;
int main()
{
    int k,a,b;
    bool counter=0;
    cin>>k>>a>>b;
    for(int i=a/k;i*k<=b;++i)
    {
        if(k*i>=a && k*i<=b){counter=1;break;}
    }
    if(counter)cout<<"OK";
    else cout<<"NG";
    cout<<"\n";
}

Measured memory_bytes: 3108
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

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

	string s;
	cin >> s;

	int ans = 0;
	rep(i, s.length()) {
		if (s[i] == 'R') {
			++ans;
		}
	}

	if (ans == 2) {
		if (s[1] != 'R') {
			ans = 1;
		}
	}

	cout << ans << "\n";

	return 0;
}


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

int main() {
    int N;
    int K;
    cin >> N >> K;
    vector<int> high(N + 1, 0);
    for (int i = 1; i < N + 1; i++) {
        cin >> high[i];
    }
    vector<int> dp(N + 1, 0);
    for (int i = 2; i < 2 + K; i++) {
        dp[i] = abs(high[i] - high[1]);
    }
    for (int i = K + 2; i < N + 1; i++) {
        int cost = 1e9 + 5;
        for (int j = 1; j < K + 1; j++) {
            int temp = abs(high[i] - high[i - j]) + dp[i - j];
            cost = min(cost, temp);
        }
        dp[i] = cost;
    }
    cout << dp[N] << endl;
}

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

int main()
{
	int n,k,a;
	a = 1;
	cin >> n;
	cin >> k;

	for (int i = 0; i < n; ++i) {
		if (k > a) {
			a += a;
		} else {
			a += k;
		}
	}

	cout << a;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;

void solve() {
  string s;
  cin >> s;
  int ret = 0;
  for(int i = 0; i < s.size(); i++) ret += s[i] == '1';
  cout << ret << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
}


Measured memory_bytes: 256
def main():
    N = "0" + input()
    N = list(map(int, N[::-1]))
    ans = 0
    up = 0
    for i, n in enumerate(N):
        d = n + up
        # くりあがりアリ
        if d > 5 or (i < len(N) - 1 and d == 5 and N[i + 1] >= 5):
            ans += 10 - d  # 0枚の支払い（後に回す）、10-d枚のおつり
            up = 1
        # くりあがりナシ
        else:
            ans += d  # d枚の支払い、0枚のおつり
            up = 0
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 20412
/* BISMILLAHIR RAHMANIR RAHIM */
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;
    int dp[n];
    vector<int>ar(n);
    for(int i=0; i<n; i++)
        cin>>ar[i];

    dp[0]=0;
  //  dp[1]=abs(ar[1]-ar[0]);

    for(int i=1; i<=n-1; i++)
    {
        if(i-2>=0)
            dp[i]=min(dp[i-1]+abs(ar[i]-ar[i-1]),dp[i-2]+abs(ar[i]-ar[i-2]));
      else
             dp[i]=abs(ar[i]-ar[i-1]);

    }
    cout<<dp[n-1];
    return 0;
}


Measured memory_bytes: 3984
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main()
{
        //input->compute->output//

        int n;
        cin >> n;

        cout << "ABC"<<n << endl;

        return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
//#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;

int po(int n){
    int a=1;
    if (n<0) return 0;
    for (int i=0;i<n;i++) a*=10;
    return a;
}

long int f(int n,int i, int j){
    long int ans=0;
    int d=1,m=n;
    while(m/10){
        m=m/10;
        d++;
    }
    for (int i=2;i<=d-1;i++){
        ans+=po(i-2);
    }
    if (i==j && i<=n) ans++;
    if (i<m) ans+=po(d-2);
    if (i==m && d>=2){
        int s=(n-m*po(d-1))/10,t=n%10;
        ans+=s+1;
        if (t<j) ans--;
    }
    return ans;
}

int main(){
    int N;
    cin>>N;
    long int ans=0;
    for (int i=1;i<10;i++){
        for (int j=1;j<10;j++){
            ans+=f(N,i,j)*f(N,j,i);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(ll i=n;i>=0;i--)
#define rep_a(i,a,n) for(ll i=a;i<n;i++)
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
const long long mod = 1000000007;
const long long INF = mod*mod;
int ansi = 1;
int solve()
{
	ll n,k;
	cin>>n>>k;
	ll rem1 = (n%k);
	ll rem2 = k-rem1;
	cout<<min(rem1,rem2)<<endl;
	return 0;
}
int main()
{
	/* #ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#else
	#endif */
	solve();
	/* #ifndef ONLINE_JUDGE
	cout<<"\nTime Elapsed: "<<1.0*clock()/ CLOCKS_PER_SEC<<" Sec\n";
	#endif */
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	string a, b, c;
	cin >> a >> b >> c;
	cout << a[0] << b[0] << c[0] << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define MOD 1000000007
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define nrep(i,a,b) for(ll i=a;i>=b;i--)

using namespace std;
int main()
{
	fast;
	ll n,k,q;
	cin>>n>>k>>q;
	ll ar[n+1];
	rep(i,1,n+1)
	{
		ar[i]=k;
	}
	map<ll,ll> m;
	while(q--)
	{
		ll ele;
		cin>>ele;
		m[ele]++;
	}
	map<ll,ll>::iterator it;
	ll sum=0;
	for(it=m.begin();it!=m.end();it++)
	{
		sum+=it->second;
	}
	rep(i,1,n+1)
	{
		ar[i]-=sum;
	}
	for(it=m.begin();it!=m.end();it++)
	{
		ar[it->first]+=it->second;
	}
	rep(i,1,n+1)
	{
		if(ar[i]>0)
		{
			cout<<"Yes\n";
		}
		else
		{
			cout<<"No\n";
		}
	}
}

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

using namespace std;

int main(){
    int N;
    cin>>N;
    vector<int> v(N);

    for (int i = 0; i < N; i++)
    {
        int tmp;
        cin>>tmp;
        v[tmp-1]=i+1;
    }
    
    for (auto &&x : v)
    {
        cout<<x<<endl;
    }
    
}

Measured memory_bytes: 1152
battle_times, restriction = [int(n) for n in input().rstrip().split()]

win_points = [int(n) for n in input().rstrip().split()]
#r,s,p
opp_hand_my_point = {'s':win_points[0], 'p':win_points[1], 'r':win_points[2]}

opp_hand_patterns = input().rstrip()
total = 0

for i in range(restriction):
    pre_opp_hand = opp_hand_patterns[i]
    total+=opp_hand_my_point[pre_opp_hand]

    for _ in range(battle_times):
        i+=restriction
        if i>=battle_times:
            break
        if pre_opp_hand==opp_hand_patterns[i]:
            pre_opp_hand='-1'#今回はあいこor負けだが次は勝てる
        else:
            total+=opp_hand_my_point[opp_hand_patterns[i]]
            pre_opp_hand = opp_hand_patterns[i]
print(total)

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

int main() {
  int N; cin >> N; map<string,int> mapS; int countMax =0;
  for (int i =0; i<N; i++) {string s; cin >> s; mapS.count(s)? mapS.at(s)++ : mapS[s] = 1;}
  for (auto x : mapS) countMax = max(x.second,countMax);
  for (auto x : mapS) if (x.second == countMax) cout << x.first << endl;
}

Measured memory_bytes: 19160
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<algorithm>

#define ll long long
#define sz 2000005

using namespace std;

ll n,t,arr[sz];

int main()
{
    scanf("%lld %lld",&n,&t);

    for(ll i=0; i<n; i++)
    {
        scanf("%lld",&arr[i]);
    }

    ll ss=arr[0],res=0;

    for(ll i=1;i<n;i++)
    {
        ll sum=ss+t;

        if(sum>=arr[i])
            res+=arr[i]-arr[i-1];

        else
            res+=t;

        ss=arr[i];
    }

    printf("%lld\n",res+t);

    return (0);
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int N,i;
    
    int a[100010],b[100010],c[100010];
    int s[100010][4];
    cin >>  N;
    
    for(i=1;i<=N;i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    s[1][1]=a[1],s[1][2]=b[1],s[1][3]=c[1];
    
    for(i=2;i<=N;i++){
        s[i][1]=max(s[i-1][2]+a[i],s[i-1][3]+a[i]);
        s[i][2]=max(s[i-1][3]+b[i],s[i-1][1]+b[i]);
        s[i][3]=max(s[i-1][1]+c[i],s[i-1][2]+c[i]);
    }
    cout << max({s[N][1],s[N][2],s[N][3]}) << endl;
}


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

using namespace std;

#define ll long long

int main (){

    int a,b,i;

    vector<int>v1,v2;

    cin>>a>>b;

    for(i=0; i<b; i++){

        v1.push_back(a);

    }

    for(i=0; i<a; i++){

        v2.push_back(b);

    }

    if(a < b){

        for(i=0; i<b; i++) cout<<v1[i];

        cout<<endl;

    }

    else {

        for(i=0; i<a; i++) cout<<v2[i];

        cout<<endl;

    }

    return 0;

}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`


		`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */

	n := nextInt()
	a := make([]Person, n)
	ans := make([]string, n)

	for i := 0; i < n; i++ {
		a[i] = Person{i + 1, nextInt()}
	}
	sort.Sort(PSort(a))

	for i := 0; i < n; i++ {
		ans[i] = a[i].String()
	}

	//fmt.Fprintln(out, "[DEBUG]", d)
	fmt.Fprintln(out, strings.Join(ans, " "))
}

type Person struct {
	no   int
	rank int
}

func (p Person) String() string {
	return strconv.Itoa(p.no)
}

type PSort []Person

func (a PSort) Len() int           { return len(a) }
func (a PSort) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a PSort) Less(i, j int) bool { return a[i].rank < a[j].rank }

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}


Measured memory_bytes: 7936