akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define chmax(x,y) x = max(x,y)

 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
typedef vector<set<int>> VSI;
const int MOD = 1e9+7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int lcm(int a, int b)
{
   return a * b / gcd(a, b);
}
struct UnionFind {
    VI d;
    UnionFind(int n = 0): d(n,-1) {}
    int find(int x) {
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x,int y) {
        x = find(x); y = find(y);
        if(x == y) return false;
        if(d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x,int y) { return find(x) == find(y); }
    int size(int x) { return -d[find(x)]; }
};
int deg[100005];
VI to[100005];

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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=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 {
    mint res(*this);
    return res/=a;
  }
};

mint f(int n) {
    if(n == 0) return 1;
    mint x = f(n/2);
    x *= x;
    if(n%2 == 1) x *= 2;
    return x;
}

mint choose(int n,int a) {
    mint x = 1, y = 1;
    rep(i,a) {
        x *= n-i;
        y *= i+1;
    }
    return x/y;
}

int main() {
    int n,m;
    cin >> n >> m;
    if(n==m) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 2560
#include<stdio.h>
int main(void)
{
  int i,j,n,q,S[100000],T[100000],C=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&S[i]);
          for(j=0;j<i;j++)
    {
      if(S[i]==S[j])
        {
          i--;
          n--;
        }
    }
    }
  scanf("%d",&q);
      for(i=0;i<q;i++)
    {
      scanf("%d",&T[i]);
              for(j=0;j<i;j++)
        {
          if(T[i]==T[j])
            {
              i--;
              q--;
            }
        }
    }
      for(i=0;i<n;i++)
        {
          for(j=0;j<q;j++)
            {
              if(S[i]==T[j])
                {
              C++;
                }
            }
        }

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



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
int main() {
     int a,b,c,d;
     cin >> a >> b >> c >> d;
     int L = a + b;
     int R = c + d;
     if(L > R) cout << "Left" << endl;
     else if (R > L) cout << "Right" << endl;
     else cout << "Balanced" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
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 (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int m;
cin>>m;
cout<<24-m+24<<endl;
//system("pause");
return 0;
}

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

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
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; }

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) do{}while(0)
#endif




const ll MAX = 1000001;
int a[MAX];
ll n;


int main(){
	cin >> n;
	rep(i,n){
		int t;
		cin >> t;
		a[t]++;
	}
	
	ll ct = 0;
	for ( int i = 1; i < MAX; i++ ){
		if ( a[i] ){
			if ( a[i] == 1 )
				ct++;
			for ( int t = i; t < MAX; t += i ){
				a[t] = 0;
			}
		}
	}
	
	cout << ct << endl;
	
	return 0;
}




Measured memory_bytes: 7500
// tsukasa_diary's programing contest code template
#include <bits/stdc++.h>
using namespace std;
// define
#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()
// typedef
typedef long long lint;
typedef double Double;
typedef pair<int, int> pii;
//
typedef vector< int > Array;
typedef vector< Array > Matrix;
typedef vector< Double > DArray;
typedef vector< DArray > DMatrix;
typedef vector< string > SArray;
typedef vector< pii > PArray;
// popcount
inline int POPCNT(int _x) { return __builtin_popcount(_x); }
inline int POPCNT(lint _x) { return __builtin_popcountll(_x); }
// inf
const int iINF = 1L << 30;
const lint lINF = 1LL << 60;
// eps
Double EPS = 1e-9;
// in range
inline bool in_range(int _v, int _mx, int _mi) { return _mi <= _v && _v < _mx; }
inline bool in_range(Double _v, Double _mi, Double _mx) { return -EPS < _v - _mi && _v - _mx < EPS; }
inline bool in_range(int _x, int _y, int _W, int _H) { return 0 <= _x && _x < _W && 0 <= _y && _y < _H; }
// neighbor clockwise
const int DX[4] = {0,1,0,-1}, DY[4] = {-1,0,1,0};
const int DX_[8] = {0,1,1,1,0,-1,-1,-1}, DY_[8] = {-1,-1,0,1,1,1,0,-1};
// variable update
inline void modAdd(int& _a, int _b, int _m) { _a = (_a + _b) % _m; }
inline void modAdd(lint& _a, lint _b, lint _m) { _a = (_a + _b) % _m; }
inline void minUpdate(int& _a, int _b) { _a = min(_a, _b); }
inline void minUpdate(lint& _a, lint _b) { _a = min(_a, _b); }
inline void maxUpdate(int& _a, int _b) { _a = max(_a, _b); }
inline void maxUpdate(lint& _a, lint _b) { _a = max(_a, _b); }

int n, k, a[100010];

void solve() {
	for_(i,1,n) a[i] += a[i - 1];
	int ans = a[k - 1];
	for_(i,k,n) maxUpdate(ans, a[i] - a[i - k]);
	cout << ans << endl;
}

int main() {
	while (cin >> n >> k, n) {
		for_(i,0,n) cin >> a[i];
		solve();
	}
	return 0;
}

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

public class Program
{
    public static void Main(string[] args)
    {
        var line = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var vals = Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();
        var dp = new double[line[0]];
        dp[0] = 0;
        for (int i = 1; i < line[0]; i++)
        {
            dp[i] = Math.Pow(2, 1024);
        }
        for (int i = 0; i < line[0]; i++)
        {
            for (int j = 1; j <= line[1]; j++)
            {
                if (i + j >= line[0])
                {
                    continue;
                }
                dp[i + j] = chmin(dp[i + j], dp[i] + Math.Abs(vals[i] - vals[i + j]));
            }
        }
        Console.WriteLine(dp.Last());
    }

    public static double chmin(double x, double y)
    {
        return x > y ? y : x;
    }
}

Measured memory_bytes: 21728
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

dish = [a,b,c,d,e]
time = [0,0,0,0,0]
reg = 0
mini = 10

for l in range(5):
  num = dish[l]%10
  if num == 0:
    time[l] = dish[l]
  else:
    time[l] = int(((dish[l]-dish[l]%10)/10+1)*10)
    
  if num != 0 and num < mini:
    mini = num
    reg = l
        
if reg ==0:
  print(a+time[1]+time[2]+time[3]+time[4])
elif reg == 1:
  print(time[0]+b+time[2]+time[3]+time[4])
elif reg == 2:
  print(time[0]+time[1]+c+time[3]+time[4])
elif reg == 3:
  print(time[0]+time[1]+time[2]+d+time[4])
elif reg == 4:
  print(time[0]+time[1]+time[2]+time[3]+e)

Measured memory_bytes: 3064
from collections import defaultdict


def prime_factorize(n):
    ret = defaultdict(int)
    while n % 2 == 0:
        n //= 2
        ret[2] += 1
    d = 3
    while d * d <= n:
        while n % d == 0:
            n //= d
            ret[d] += 1
        d += 2
    if n > 1:
        ret[n] += 1
    return dict(ret)


n = int(input())
pf = prime_factorize(n)
ans = 0
for c in pf.values():
    i = 1
    while i <= c:
        c -= i
        i += 1
        ans += 1
print(ans)


Measured memory_bytes: 9464
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
#include<list>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  int i,n;
  cin >> n;
  vector<int> p(n);
  for(i=0;i<n;i++){
    cin >> p[i];
  }
  int ans=0,min=100000000;
  for(i=0;i<n;i++){
    if(min>p[i]){
      ans++;
      min=p[i];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4040
#include <stdio.h>

int main(){
    int n;
    int i;
    int a[100];

    scanf("%d",&n);

    for(i = 0; i < n; i++){
        scanf("%d",&a[i]);
    }

    for(i = n-1; i >= 0; i--){
        printf("%d",a[i]);
        if(i != 0){
            printf(" ");
        }else{
            printf("\n");
        }
    }

    return 0;
}



Measured memory_bytes: 2044
import Data.List

a = "aiueo"

enc1 :: String -> String
enc1 [] = []
enc1 (x0:[]) = []
enc1 (x0:x1:xs) =
  if x0 `elem` a
  then x1:enc1 (x1:xs)
  else enc1 (x1:xs)

encode :: Int -> String -> String
encode _ [] = []
encode n x@(x0:xs) =
  let e = x0:(enc1 x)
      e' = if length e <= n
           then e
           else take n e
  in
    e'

judge []     = True
judge (x:[]) = True
judge (x1:x2:xs)
  | x1 == x2  = False
  | otherwise = judge (x2:xs)

try :: Int -> Int -> [String] -> Int
try n m s
  | n > m    = -1
  | otherwise = 
    if judge $ sort $ map (encode n) s
    then n
    else try (n+1) m s

ans :: [String] -> [Int]
ans [] = []
ans ("0":_) = []
ans (n:ss) =
  let n' = read n :: Int
      i  = take n' ss
      m  = maximum $ map length i
      c  = try 0 m i
  in
    c:(ans $ drop n' ss)
      
main = do
  c <- getContents
  let i = lines c
      o = ans i
  mapM_ print o

Measured memory_bytes: 5448
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String s = br.readLine();
        String t = br.readLine();
        int ans = 0;
        
        if(s.charAt(0) == t.charAt(0)) ans++;
        if(s.charAt(1) == t.charAt(1)) ans++;
        if(s.charAt(2) == t.charAt(2)) ans++;
        
        out.println(ans);
        out.close();
        
    }
}

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

using namespace std;

int main()
{
    int n, m;
    int x[64] = {0};
    bool mood[64] = {0};
    
    scanf("%d %d", &n, &m);
    
    for (int i = 1; i <= m; i++){
        int p;
        scanf("%d", &p);
        
        while (p--){
            int y;
            scanf("%d", &y);
            x[y] = i;
        }
    }
    
    scanf("%d", &m);
    
    for (int i = 0; i < m; i++){
        int a, b;
        scanf("%d %d", &a, &b);
        if (x[a] == x[b]) mood[a] = mood[b] = 1;
    }
    
    int sum = 0;
    
    for (int i = 1; i <= n; i++) sum += mood[i];
    
    printf("%d\n", sum);
    
    return (0);
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
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;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll s;
  	ci(s);
  if(s==1000000000000000000){
    cout<<0<<" "<<0<<" "<<1000000000<<" "<<0<<" "<<0<<" "<<1000000000<<endl;
  }
  
  else{
  ll n=sqrt(s)/1+1;
  
  FOR(i,0,3*n){
    if(n*n-i==s){
      cout<<0<<" "<<0<<" "<<1<<" "<<n<<" "<<n<<" "<<i<<endl;
    break;
    }
  }
}
}


Measured memory_bytes: 256
using Microsoft.Win32.SafeHandles;
using System;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var personCount = int.Parse(Console.ReadLine());
            var input = new int[personCount][][];
            for (int i = 0; i < personCount; i++)
            {
                input[i] = ReadPersonSaying();
            }

            int maxPattern = (int)Math.Pow(2, personCount);

            int max = 0;
            for (int i = 1; i < maxPattern; i++)
            {
                var bitArray = i.ToBitArray(personCount);
                if (CheckContradiction(bitArray, input))
                {
                    var honest = bitArray.Count(n => n == 1);
                    if (max < honest) { max = honest; }
                }
            }

            Console.WriteLine(max);
        }

        static bool CheckContradiction(int[] bitArray, int[][][] input)
        {
            bool result = true;

            for (var i = 0; i < bitArray.Length; i++)
            {
                if (bitArray[i] == 1)
                {
                    foreach (var x in input[i])
                    {
                        if (bitArray[x[0] - 1] != x[1])
                        {
                            result = false;
                        }
                    }
                }
            }

            return result;
        }

        static int[][] ReadPersonSaying()
        {
            var count = int.Parse(Console.ReadLine());
            var result = new int[count][];
            for (int i = 0; i < count; i++)
            {
                result[i] = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();
            }
            return result;
        }

    }

    static class Util
    {
        /// <summary>
        /// 指定の桁のビットを取得します。
        /// </summary>
        /// <param name="num"></param>
        /// <param name="count">取得する桁。</param>
        /// <returns></returns>
        public static int GetBit(this int num, int count)
        {
            int mask = (int)Math.Pow(2, count - 1);
            return (num & mask) == 0 ? 0 : 1;
        }

        /// <summary>
        /// <c>int</c>を2進数ビット配列に変換します。
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public static int[] ToBitArray(this int num, int keta)
        {
            var array = new int[keta];
            for (int i = 0; i < keta; i++)
            {
                array[i] = num.GetBit(i + 1);
            }
            return array;
        }

        /// <summary>
        /// <c>int</c>を2進数ビット配列に変換します。
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public static int[] ToBitArray(this int num) => ToBitArray(sizeof(int) * 8);

    }
}


Measured memory_bytes: 15572
def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    f, s = 0, 0
    for i in range(N):
        if A[i] >= f:
            f, s = A[i], f
        elif A[i] > s:
            s = A[i]

    if f == s:
        for i in range(N):
            print(f)
    else:
        for i in range(N):
            if A[i] == f:
                print(s)
            else:
                print(f)


if __name__ == '__main__':
    main()


Measured memory_bytes: 68696
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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;}

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN4(a,b,c,d);
  int all = b - b/c - b/d + b/lcm(c,d);
  a--;
  int divn = a - a/c - a/d + a/lcm(c,d);
  OUT(all-divn);
}

Measured memory_bytes: 256
class FMC:
    rank_list = [1,2,3,4,5,6,7,8,9,10,11,12,13]
    def __init__(self):
        self.S = []
        self.H = []
        self.C = []
        self.D = []
        self.found_list = []

    def input_card(self, pic, rank):
        if pic == "S":
            self.S.append(rank)
        if pic == "H":
            self.H.append(rank)
        if pic == "C":
            self.C.append(rank)
        if pic == "D":
            self.D.append(rank)

    def finding_rank(self, pic):
        if pic == "S":
            check_list = self.S
        if pic == "H":
            check_list = self.H
        if pic == "C":
            check_list = self.C
        if pic == "D":
            check_list = self.D
        for i in self.rank_list:
            if i not in check_list:
                self.found_list.append([pic, i])

    def finding_missing_cards(self):
        self.finding_rank("S")
        self.finding_rank("H")
        self.finding_rank("C")
        self.finding_rank("D")
        for i in range(len(self.found_list)):
            print(self.found_list[i][0], end=" ")
            print(self.found_list[i][1])

fmc = FMC()

n = input()
n = int(n)

for i in range(n):
    card = input().split()
    pic = card[0]
    rank = card[1]
    rank = int(rank)
    fmc.input_card(pic, rank)

fmc.finding_missing_cards()

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

int main()
{
  int k, s, count = 0;
  cin >> k >> s;
  for (int i = 0; i <= k; i++) {
    for (int j = 0; j <= k; j++) {
      int t = s - i - j;
      if (t >= 0 && t <= k) count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
use std::io;
use std::io::{BufRead, Write};

fn solve<R: BufRead, W: Write>(mut input: R, mut output: W) {
    let mut buf = String::new();
    input.read_line(&mut buf).unwrap();
    let primes = [2, 7, 17, 37, 47, 67, 97, 107, 127, 137, 157, 167, 197, 227, 257, 277, 307, 317, 337, 347, 367, 397, 457, 467, 487, 547, 557, 577, 587, 607, 617, 647, 677, 727, 757, 787, 797, 827, 857, 877, 887, 907, 937, 947, 967, 977, 997, 1087, 1097, 1117, 1187, 1217, 1237, 1277, 1297];
    let n: usize = buf.trim_right().parse().unwrap();
    writeln!(
        output,
        "{}",
        primes[..n].iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(" ")
    ).unwrap();
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    solve(stdin.lock(), stdout.lock());
}

#[cfg(test)]
mod tests {
    fn test(input: &str, output: &str) {
        let mut v: Vec<u8> = Vec::new();
        ::solve(input.as_bytes(), &mut v);
        assert_eq!(String::from_utf8(v).unwrap(), output);
    }

    #[test]
    fn case1() {
        test(
            "5
",
            "3 5 7 11 13
",
        );
    }

    #[test]
    fn case2() {
        test(
            "6
",
            "2 3 5 7 11 13
",
        );
    }

    #[test]
    fn case3() {
        test(
            "8
",
            "2 3 5 7 11 13 17 19
",
        );
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <iomanip>

using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)

int main() {
 	int n;
 	int cur_min = 1000000;
 	int p;
 	int ans = 0;

 	cin >> n;

 	for (int i = 0; i < n; i++) {
 		cin >> p;
 		if (p < cur_min) {
 			ans++;
 			cur_min = p;
 		}
 	}
 	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 888
#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cassert>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<queue>	
#include<limits>
#include<ctime>
#include<stack>	
#include<bits/stdc++.h>
#include<string>
#include<stdlib.h>
#include<stdio.h>
	
typedef long long ll;
using namespace std;
const ll x=1000000007;
int mod(ll a){
	return a%x;
}

int main(){
	ll n,m;
	cin>>n>>m;
	ll a[m],b[m],c[n];
	for(int i=0;i<n;i++){
		c[i]=0;
	}
	for(int i=0;i<m;i++){
		cin>>a[i]>>b[i];
		c[a[i]-1]++;
		c[b[i]-1]++;
	}
	for(int i=0;i<n;i++){
		cout<<c[i]<<endl;
	}
}


Measured memory_bytes: 3564
#include<iostream>
#include<bitset>
#include<algorithm>
using namespace std;
bitset<1<<10>T[10];
int N,M;
bool tr=false;
bitset<1<<10>f[1<<10];
int A[1<<10][1<<10];
main()
{
	cin>>N>>M;
	if(N<M)
	{
		tr=true;
		swap(N,M);
	}
	for(int i=0;i<N;i++)
	{
		for(int j=0;j<1<<N;j++)
		{
			T[i][j]=j>>i&1;
		}
	}
	for(int i=0;i<1<<M;i++)
	{
		for(int j=0;j<N;j++)
		{
			if(i>>j&1)f[i]^=T[j];
		}
	}
	for(int i=1;i<1<<N;i++)for(int j=1;j<1<<M;j++)
	{
		A[i][j]=f[j][i]^f[j-1][i]^f[j][i-1]^f[j-1][i-1];
	}
	if(tr)
	{
		for(int i=1;i<1<<M;i++)
		{
			for(int j=1;j<1<<N;j++)cout<<A[j][i];
			cout<<endl;
		}
	}
	else
	{
		for(int i=1;i<1<<N;i++)
		{
			for(int j=1;j<1<<M;j++)cout<<A[i][j];
			cout<<endl;
		}
	}
}


Measured memory_bytes: 5504
///
// File:  a.go
// Author: ymiyamoto
//
// Created on Sat Apr 28 21:02:42 2018
//
package main

import (
	"fmt"
)

var N int
var A []int

func main() {
	fmt.Scan(&N)

	A = make([]int, N)
	for i := range A {
		fmt.Scan(&A[i])
		if i > 0 {
			A[i] += A[i-1]
		}
	}
	count := 0
	m := map[int]int{}
	for i := len(A) - 1; i >= 0; i-- {
		a := A[i]
		if a == 0 {
			count++
		}
		count += m[a]
		m[a]++
	}

	fmt.Println(count)
}


Measured memory_bytes: 13440
#include <bits/stdc++.h>
using namespace std;
void main_sub(void);
int main(int argc, char* argv[]) {
    cout << std::fixed << std::setprecision(10);
    main_sub();
    return 0;
}
// int を int64_t にする
// g++ に -DUSE_STRICT_INT をつけるか、
// 下のコメントアウトを外すと無効化
// #define USE_STRICT_INT
using i64 = int64_t;
#ifndef USE_STRICT_INT
#define int i64
#endif
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF = (1 << 30);
constexpr i64 INFL = (1LL << 62);
constexpr i64 MOD = 1000000007;

void main_sub(void) {
    int l;
    cin >> l;
    cout << (double)l*l*l / 27 << endl;

    return;
}


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

int main(){
	int X;
	bool prime;
	cin >> X;
	while(true){
		prime = true;
		for(int a = 2; a < X; a++){
			if(X % a == 0){
				prime = false;
				break;
			}
		}
		if(prime){
			cout << X;
			return 0;
		}else{
			X++;
		}
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		int L = s / 100;
		int R = s % 100;
		if (1 <= L && L <= 12) {
			if (1 <= R && R <= 12)
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if (1 <= R && R <= 12)
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
		sc.close();
	}
}

Measured memory_bytes: 21716
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def anti_division(n,a,b):
    anti_a = n // a
    anti_b = n // b
    anti_ab = n // lcm(a,b)
    return n - anti_a - anti_b + anti_ab


a,b,c,d = map(int, input().split())
ans = anti_division(b,c,d) - anti_division(a-1,c,d)
print(ans)


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

string S;

int month(string S) {
	if(S[0]=='0' && S[1]!='0') return 1;
	if(S[0]=='1' && S[1]<='2') return 1;
	return 0;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S;
	x=month(S.substr(0,2));
	y=month(S.substr(2,2));
	
	if(x&&y) {
		cout<<"AMBIGUOUS"<<endl;
	}
	else if(x) {
		cout<<"MMYY"<<endl;
	}
	else if(y) {
		cout<<"YYMM"<<endl;
	}
	else {
		cout<<"NA"<<endl;
	}
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

int main(){
	int t, n, s, f;
	while(scanf("%d%d", &t, &n) == 2){
		for(int i = 0; i < n; ++i){
			scanf("%d%d", &s, &f);
			t -= f - s;
		}
		printf(t > 0 ? "%d\n" : "OK\n", t);
	}
}

Measured memory_bytes: 1028
N, A, B = map(int, input().split())
 
sum = 0
for i in range(1, N+1):
  if i < 10:
    if A <= i and i <= B:
        sum += i
  elif i < 100:
    temp = int(i/10) + i%10
    if A <= temp and temp <= B:
      sum += i
  elif i < 1000:
    temp = int(i/100) + int(i%100/10) + i%100%10
    if A <= temp and temp <= B:
      sum += i
  elif i < 10000:
    temp = int(i/1000) + int(i%1000/100) + int(i%1000%100/10) + i%1000%100%10
    if A <= temp and temp <= B:
      sum += i
  else:
    temp = int(i/10000)
    if A <= temp and temp <= B:
      sum += i
      
print(sum)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include <string>

using namespace std;


int main() {

	char input;
	char output;

	cin >> input;

	if (input == 'T')
		output = 'A';
	else if (input == 'A')
		output = 'T';
	else if (input == 'C')
		output = 'G';
	else if (input == 'G')
		output = 'C';

	cout << output << endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll INF = 1000000009;
ll MOD = 1000000007;


void solve(){

    ll n,m;
    cin >> n >> m;
    if(m%2==0){
        rep(i,m/2){
            cout << n-i << " " << n-m+i << endl;
            cout << 1+i << " " << m-i << endl;
        }
    }
    else{
        cout << n << " " << n-m << endl;
        for(ll i=0; i<m/2; i++){
            cout << 1+i << " " << m-i << endl;
            cout << n-i-1 << " " << n-m+i+1 << endl;
        }
    }

    

}

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


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

int main() {
  int64_t Li,Li_1,Li_2;
  int N;
  Li_1 = 1;
  Li_2 = 2;
  Li = Li_1;
  
  cin >> N;
  
  if(N > 1){
  	for(int i = 1; i < N; i++){
      Li = Li_1 + Li_2;
      Li_2 = Li_1;
      Li_1 = Li;
    }
  }
  
  cout << Li << endl;
  return 0;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
using pqueg = priority_queue<int, vector<int>, greater<int>>;
using pquel = priority_queue<int, vector<int>, less<int>>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
int lcm(int a, int b){
  return a / __gcd(a, b) * b;
}
int r_int(int a, int b){
  return rand() % b + a;
}
const lint mod=1e9+7;

int n, m;
lint x;
vector<vector<lint>> book;

lint price(int index, vector<lint> now, lint& min_price){
  // 全理解度がxを越えていれば最少金額を更新
  bool ok = true;
  FOR(i,1,m+1) if(now[i] < x) ok = false;
  if(ok){
  //if(*min(now.begin()+1, now.end()) >= x){
    min_price = min(now[0], min_price);
  }

  // 次の本を買う場合と買わない場合を探索
  index++;
  if(index != n){
    price(index, now, min_price);
    REP(i,m+1) now[i] += book[index][i];
    price(index, now, min_price);
  }
  return min_price;
}


int main()
{
  cin >> n >> m >> x;
  book.assign(n, vector<lint>(m+1));
  REP(i,n) REP(j,m+1) cin >> book[i][j];

  // 全部買ってもxに届かないものがあれば-1を出力する
  lint min_price = 1200001;
  // 動的計画法（買うか買わないか）
  price(-1, vector<lint>(m+1, 0), min_price);

  cout << (min_price != 1200001 ? min_price : -1) << "\n";
  return 0;
}


Measured memory_bytes: 3636
/**
 *　　　　　　　　┏┓　　　┏┓+ +
 *　　　　　　　┏┛┻━━━┛┻┓ + +
 *　　　　　　　┃　　　　　　　┃
 *　　　　　　　┃　　　━　　　┃ ++ + + +
 *　　　　　　 ████━████ ┃+
 *　　　　　　　┃　　　　　　　┃ +
 *　　　　　　　┃　　　┻　　　┃
 *　　　　　　　┃　　　　　　　┃ + +
 *　　　　　　　┗━┓　　　┏━┛
 *　　　　　　　　　┃　　　┃
 *　　　　　　　　　┃　　　┃ + + + +
 *　　　　　　　　　┃　　　┃　　　　Code is far away from bug with the animal protecting
 *　　　　　　　　　┃　　　┃ + 　　　　神兽保佑,代码无bug
 *　　　　　　　　　┃　　　┃
 *　　　　　　　　　┃　　　┃　　+
 *　　　　　　　　　┃　 　　┗━━━┓ + +
 *　　　　　　　　　┃ 　　　　　　　┣┓
 *　　　　　　　　　┃ 　　　　　　　┏┛
 *　　　　　　　　　┗┓┓┏━┳┓┏┛ + + + +
 *　　　　　　　　　　┃┫┫　┃┫┫
 *　　　　　　　　　　┗┻┛　┗┻┛+ + + +
 */
/*--------- Hongjie ----------*/
// #include<bits/stdc++.h>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<deque>
#include<cmath>
#include<cstdio>
#include<bitset>
#include<string>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

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

const int INF  = 0x3f3f3f3f;
const int MAXN = 1e5+7;
int a[10] = {0,9,0,900,0,90000};

int solve(int n) {
        int ans = 0;
        if(n>9) {
                ans+=9;
                if(n<999 && n>99) {
                        ans += n-99;
                        return ans;
                }
                else if(n<=99)       return ans;
        }
        else    return n;
        ans += 900;
        if(n<99999 && n>9999) {
                ans += n-9999;
                return ans;
        }
        else if(n<=9999)        return ans;
        return ans+90000;
}

int main(){
    //    freopen("../in.txt","r",stdin);
    //    freopen("../out.txt","w",stdout);
        ios::sync_with_stdio(0);
        cin.tie(0);
        int n;
        while(cin>>n) {
                cout<<solve(n)<<endl;
        }
        return 0;
}


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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

int main(){
	string kata;
	int i,j;
	cin>>kata;
	cout<<"2018";
	for(i=4;i<kata.length();i++){
		printf("%c",kata[i]);
	}
	printf("\n");
	return 0;
};

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
long long int gcd(long long int x, long long int y){
  return y!=0 ? gcd(y, x%y) : x;
}
long long int lcm(long long int x, long long int y){
  return x*y/gcd(x, y);
}
long long int factorial(long long int x){
  return x==0 ? 1 : x*factorial(x-1);
}
int main(){
  long long i, j, n, sum=0;
  cin >> n;
  int l[2*n];
  for(i=0; i<2*n; i++)
    cin >> l[i];
  sort(l, l+2*n);
  for(i=0; i<2*n; i+=2)
    sum+=l[i];
  cout << sum;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000

int parent(int i){ return i / 2; }   //綺麗に上から//
int left(int i){ return 2 * i; }     //1,2,3...と//
int right(int i){ return 2 * i + 1; }//表記される様にする下準備//


int main(){
  int H, i, A[MAX+1];

  scanf("%d", &H);
  for(i=1;i<=H;i++)scanf("%d",&A[i]);

  for(i=1;i<=H;i++){
    printf("node %d: key = %d, ",i,A[i]);//上から順に左から右へと番号が振られるので//
    if(parent(i) >= 1 )printf("parent key = %d, ",A[parent(i)]);//番号に沿って//
    if(left(i) <= H )printf("left key = %d, ",A[left(i)]);//A[i]を代入する//
    if(right(i) <= H )printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2044
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

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 > >;

int use[305][305] = {};
bool possible = true;

template< typename T >
void warshall_floyd(Matrix< T > &g, T INF) {
  for(int k = 0; k < g.size(); k++) {
    for(int i = 0; i < g.size(); i++) {
      for(int j = 0; j < g.size(); j++) {
        if(g[i][k] == INF || g[k][j] == INF) continue;
        //g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
        if(g[i][j] > g[i][k]+g[k][j]) possible = false;
        else if(g[i][j] == g[i][k] + g[k][j]) {
            if(k != i && k != j){
                dump(i)
                dump(j)
                use[i][j] = 0;
                use[j][i] = 0;
            }
        }
      }
    }
  }
}

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    REP(i,305) REP(j,305) use[i][j] = 1;

    Matrix<LL> mat(N,vector<LL>(N,LINF));
    //REP(i,N) mat[i][i] = 0;
    REP(i,N) REP(j,N) cin >> mat[i][j];
    warshall_floyd(mat, LINF);

    if(!possible)
    {
        cout << -1 << endl;
        return 0;
    }

    LL ans = 0;

    //REP(i,N) REP(j,N) dump(use[i][j])

    REP(i,N)
    {
        FOR(j,i+1,N)
        {
            if(use[i][j] == 1) {
                //dump(i)
                //dump(j)
                ans += mat[i][j];
            }
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define TRAV(i, a) for(auto & i : (a))
#define SZ(x) ((int)(x).size())
#define PR std::pair
#define MP std::make_pair
#define X first
#define Y second
typedef long long ll;
typedef std::pair<int, int> PII;
typedef std::vector<int> VI;

int dist[505][505];
int last[505][505];
int tick;
int n;
int alive[505][505];
std::vector<PII> dirs{MP(0, 1), MP(1, 0), MP(-1, 0), MP(0, -1)};

bool bounds(PII p){
	return p.X >= 0 && p.X < n && p.Y >= 0 && p.Y < n;
}

PII operator +(PII a, PII b){
	return MP(a.X+b.X, a.Y+b.Y);
}

int main(){
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(0);
	std::cin >> n;
	FOR(i, n) FOR(j, n) dist[i][j] = std::min(i, std::min(j, std::min(n-1-i, n-1-j)));
	FOR(i, n) FOR(j, n) alive[i][j] = 1;
	ll ans = 0;
	tick = 5;

	FOR(i, n*n){
		int a;
		std::cin >> a;
		a--;
		int x = a/n;
		int y = a%n;
		alive[x][y] = 0;
		ans += dist[x][y];
		auto start = MP(x, y);

		std::queue<PII> que;
		for(auto dir : dirs){
			auto pos = dir+start;
			if(bounds(pos)) que.push(pos);
		}

		while(SZ(que)){
			auto v = que.front();
			que.pop();
			
			int old = dist[v.X][v.Y];
			int was = 0;

			for(auto dir : dirs){
				auto pos = dir+v;
				if(!bounds(pos)) continue;
				if(dist[pos.X][pos.Y]+alive[pos.X][pos.Y] < old) was = 1;
			}

			if(was){
				dist[v.X][v.Y]--;
				for(auto dir : dirs){
					auto pos = dir+v;
					if(!bounds(pos)) continue;
					que.push(pos);
				}
			}
		}

		tick++;

	}
	std::cout << ans;

	return 0;
}

Measured memory_bytes: 5612
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <numeric>
#include <utility>
#include <iomanip>

using namespace std;
using int64 = long long;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

int main() {
    int64 x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    
    if (x/d >= k) {
        cout << x - d*k << endl;
        return 0;
    }

    k -= x/d;
    x -= d*(x/d);

    if (k % 2)
        cout << abs(x - d) << endl;
    else
        cout << x << endl;
}


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

int main(){
    int n;
    cin >> n;
    vector<int>a(3*n);
    for(int i=0;i<3*n;i++)cin >> a[i];
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    long long ans=0;
    for(int i=0;i<2*n;i++){
        if(i % 2 == 0)continue;
        else ans += a[i];
    }
    cout << ans << endl;
 }


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
    LL n;
    cin >> n;
    string ns = to_string(n+1);
    if (ns.size() == 1) {
        cout << n << endl;
    }
    else if (ns[0] == '1') {
        cout << (ns.size() - 1) * 9 << endl;
    }
    else {
        cout << (ns.size() - 1) * 9 + (ns[0] - '1') << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 1000000000
#define LLINF 100000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N;
ll x[200100],y[200100];
P p[200100];
ll A[200100],B[200100];
ll ans = 0ll;
int main(){
	cin >> N;
	ll mi = LLINF,ma = -LLINF;
	ll a = -LLINF, b= LLINF;
	for(int i=0;i<N;i++){
		cin >> x[i] >> y[i];
		mi = min(mi,x[i]);
		mi = min(mi,y[i]);
		ma = max(ma,x[i]);
		ma = max(ma,y[i]);
		if(x[i]>y[i])swap(x[i],y[i]);
		p[i].fi = x[i];
		p[i].sec= y[i];
		a = max(a,x[i]);
		b = min(b,y[i]);
	}
	ans = (a-mi)*(ma-b);
	sort(p,p+N);
	A[0]=B[0]=p[0].sec;
	for(int i=1;i<N;i++){
		A[i]=min(A[i-1],p[i].sec);
		B[i]=max(B[i-1],p[i].sec);
	}
	for(int i=0;i<N-1;i++){
		ll ret = (max(p[N-1].fi,B[i])-min(p[i+1].fi,A[i]))*(ma-mi);
		ans = min(ans,ret);
	}
	ans = min(ans,(p[N-1].fi-p[0].fi)*(ma-mi));
	ans = min(ans,(B[N-1]-A[N-1])*(ma-mi));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9728
#include <iostream>
#include <cmath>
#define ll long long
using namespace std;

int n;
int a[100];

void solve() {
  int num = 1;
  for (int i = 0; i < n; i++) {
    if (a[i] % 2 == 0) {
      num *= 2;
    }
  }
  cout << pow(3, n) - num << endl;
}

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

  solve();
  return 0;
}


Measured memory_bytes: 888
#pragma region
#pragma GCC target("avx2")
#pragma GCC optimize("03")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define endl "\n"
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORR(x,arr) for(auto& x:arr)
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define VPII vector<PII>
#define VPLL vector<PLL>
#define FI first 
#define SE second
#define ALL(x) (x).begin(), (x).end()
constexpr int INF=1<<30; constexpr ll LINF=1LL<<60; constexpr ll mod=1e9+7; constexpr int NIL = -1;
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
#pragma endregion
//-------------------
ll d, g;
vector<int> p(11);
vector<int> c(11);

int main(){
    cin.tie(0); ios::sync_with_stdio(false); //cout << fixed << setprecision(15);
    cin >> d >> g;
    FOR(i,1,d) cin >> p[i] >> c[i];
    int ans = INF;
    FOR(i,0,pow(2,d)-1) {
        ll cur = g;
        vector<bool> used(d, false);
        vector<int> pc(11);
        copy(p.begin(), p.end(), pc.begin());
        int res = 0;
        FOR(j,0,d-1) {
            if((i>>j)&1) {
                cur -= (p[j+1]*(j+1)*100+c[j+1]);
                used[j+1] = true;
                res += p[j+1];
            }
        }
        for(int j=d; j>=1; j--) {
            if(cur <= 0) break;
            if(!used[j] and (pc[j]-1)*j*100<=cur) {
                cur -= (pc[j]-1)*j*100;
                res += pc[j]-1;
                continue;
            }
            if(!used[j] and (pc[j]-1)*j*100>cur) {
                res += ceil((float)cur/j/100);
                cur -= ceil((float)cur/j/100)*j*100; 
            }
        }
        // cout << res << endl;
        if(cur <= 0) chmin(ans, res);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n, m;
    cin >> n >> m;
    int p;
    string s;
    vector<bool> a(n, false);
    vector<int> w(n, 0);
    REP(i, m) {
        cin >> p >> s;
        p--;
        if (s == "AC") {
            a[p] = true;
        } else {
            if (!a[p]) w[p]++;
        }
    }
    int x = 0;
    int y = 0;
    REP(i, n) {
        if (a[i]) x++;
        if (a[i]) y += w[i];
    }
    cout << x << " " << y << EOL;
}


Measured memory_bytes: 640