akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=(n-1);(i)>=(0);(i)--)
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

vl pow_;
void pow_ini(ll n) {
	pow_.clear();
	pow_.push_back(n);
	rep(j, 62) {
		ll nxt = pow_[j] * pow_[j];
		nxt %= mod;
		pow_.push_back(nxt);
	}
	return;
}

ll pow1(ll k) {
	ll ans = 1;
	rep(ntmp, 62) {
		if ((k >> ntmp) % 2 == 1) {
			ans *= pow_[ntmp];
			ans %= mod;
		}
	}
	return ans;
}

ll nCm(ll n, ll m) {
	ll ans = 1;
	rep(p, m) {
		ans *= n - p;
		ans %= mod;
		pow_ini(p + 1);
		ans *= pow1(mod - 2);
		ans %= mod;
	}
	return ans;
}

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

	ll ans;
	pow_ini(2);
	ans = pow1(N);
	ans--;
	ans += mod;

	ans -= nCm(N, a);
	ans += mod;
	ans -= nCm(N, b);
	ans += mod;
	ans %= mod;

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

Measured memory_bytes: 256
from collections import Counter
lim=10**9+7
N=int(input())
A=[int(i) for i in input().split()]
if N % 2 == 0:
    if Counter(A) == {2*i+1:2 for i in range(N//2)}:
        print(pow(2,(N//2),lim))
    else:
        print(0)
else:
    if Counter(A) == {2*i if i>0 else 0:2 if i>0 else 1 for i in range((N+1)//2)}:
        print(pow(2,(N-1)//2,lim))
    else:
        print(0)
    

Measured memory_bytes: 59244
def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    b_list = list(map(int, input().split()))

    count = 0
    for i in range(n):
        # print("-"*50)
        # print("A: {} A+1: {} B: {}".format(a_list[i], a_list[i+1], b_list[i]))
        if a_list[i] >= b_list[i]:
            a_list[i] -= b_list[i]
            count += b_list[i]
            b_list[i] = 0
        else:
            b_list[i] -= a_list[i]
            count += a_list[i]
            a_list[i] = 0

        # print("A: {} A+1: {} B: {}".format(a_list[i], a_list[i + 1], b_list[i]))

        if a_list[i+1] >= b_list[i]:
            a_list[i+1] -= b_list[i]
            count += b_list[i]
            b_list[i] = 0
        else:
            b_list[i] -= a_list[i+1]
            count += a_list[i+1]
            a_list[i+1] = 0

        # print("A: {} A+1: {} B: {}".format(a_list[i], a_list[i + 1], b_list[i]))

    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 19004
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
-- end of templete


main = do
    replicateM 2 (replicateM 10 getInt) >>= putStrLn . sjoin . map (sum . drop 7 . sort)

Measured memory_bytes: 3780
// atcoder/abc157/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, m;
  while (cin >> n >> m) {
    string t(n, '@');
    bool f = true;
    for (int i = 0; i < m; ++i) {
      char c;
      int j;
      cin >> j >> c;
      --j;
      if (t[j] == '@') t[j] = c;
      else f = f && (t[j] == c);
    }
    if (!f) {
      cout << -1 << endl;
      continue;
    }

    int x = -1;
    char buff[100];
    for (int i = 0; i < 1000; ++i) {
      sprintf(buff, "%d", i);
      string s(buff);
      bool f = (s.size() == t.size());
      for (int j = 0; f && j < t.size(); ++j) {
        if (t[j] == '@') continue;
        f = f && (t[j] == s[j]);
      }
      if (f) {
        x = i;
        break;
      }
    }
    cout << x << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int main() {
  int N;
  scanf("%d", &N);

  int res=0;
  for (int i=0; i<N; ++i) {
    int l, r;
    scanf("%d %d", &l, &r);
    res += r - l;
  }
  
  printf("%d\n", res+N);
  return 0;
}

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

using namespace std;

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

    vector<double> vt(n);
    for (int i = 0; i < n; ++i) {
        cin >> vt[i];
    }

    sort(vt.begin(), vt.end());
    double ans = vt[0];
    for (int i = 1; i < n; ++i) {
        ans = (ans + vt[i]) / 2;
    }

    cout << fixed << setprecision(10);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//matrix chain multiplication
#include<iostream>
#include<cstdio>
#include<cstdlib> //malloc
using namespace std;
#define INF 1000000001
int DP[100][100];
int *p;
int rec(int r, int c) { //what to record on DP, r番目の行列からc番目の行列まで掛け算
    int Min = INF;
    for (int i = 0; i < c - r; i++) { //どこで区切るか
        Min = min(Min, DP[r][r+i] + DP[r+i+1][c] + p[r-1]*p[r+i]*p[c]);
        //3項目は2つのDPをつなぐ計算量
    }
    return Min;
}
int main() {
    int N;
    cin >> N;
    for (int i = 1; i <= N; i++) { //matrix starts index 1, p[] starts index 0
        for (int j = 1; j <= N; j++) {
            DP[i][j] = 0;
        }
    }
    p = (int *)malloc(sizeof(int) *(N+1) ); //main()外でp使うから面倒だけど
    //N+1 -> 0 start, 最後の行列の列 p[N]
    for (int i = 0; i < N; i++) {
        cin >> p[i]; cin >> p[i+1]; //start p[2]
    }
    for (int i = 1; i < N; i++) DP[i][i+1] = p[i-1]*p[i]*p[i+1]; //2つの積
    
    int y;
    for (int k = 0; k <= N - 2; k++) {
        for (int x = 1; x <= N - 2; x++) {
            y = x+(2+k);
            if (x <= N && y <= N) DP[x][y] = rec(x, y);
        }
    }
    
    cout << DP[1][N] << endl; //最初の行列から最後の行列まで
    return 0;
}





Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int mod = 1000000000+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

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 & 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, a, b;
    cin >> n >> a >> b;
    mint ans = f(n);
    ans -= 1;
    ans -= choose(n, a);
    ans -= choose(n, b);
    cout << ans.x << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int a[1000000], b[1000000], maxid, maxn, n;
int main() {
	cin >> n; maxn = 0; maxid = 100000;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		if (maxn < b[i]) {
			maxn = b[i];
			maxid = a[i];
		}
		else if (maxn == b[i]) {
			maxid = min(maxid, a[i]);
		}
	}
	cout << maxid << ' ' << maxn << endl;
}

Measured memory_bytes: 3208
def Swap(a,b):
    if a > b:
        a,b = b,a
    return a,b


def main():
    while True:
        a, b= map(int, input().split())
        if a == 0 and b == 0:
            break
        else:
            a,b = Swap(a,b)
            print("%d %d" %(a,b))

if __name__ == "__main__":
    main()


Measured memory_bytes: 5620
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
  double A;
  double y = 0;
  double x;
   cin >> N;
  
  for (int i = 0; i < N; i++) {
    cin >> A;
    y = y + 1/A;
 //   cout << y << endl;
  }

  x = 1/y;
  cout << x << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n;
	ll x[n], y[n];
	map< tuple<ll, ll, int>, int > mp;
	for( int i = 0; i < n; ++i ) cin >> x[i] >> y[i];
	for( int i = 0; i < n; ++i ){
		for( int j = i+1; j < n; ++j ){
			int s;
			if( (x[i]-x[j])*(y[i]-y[j]) > 0 ) s = 1;
			else s = -1;
			auto t = make_tuple( abs(x[i]-x[j]), abs(y[i]-y[j]), s );	
			++mp[t];
		}
	}
	int ans = 0;
	for( auto m : mp ){
		ans = max(ans, m.second);
	}
	cout << n-ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;


int main()
{
	int A,B,C,Max,Min;
	scanf("%d%d%d",&A,&B,&C);
	Max=max(A,max(B,C));
	Min=min(A,min(B,C));
	printf("%d\n",Max-Min);
	return 0;
}

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

namespace AtCoder
{

    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var N = GetInt();
            var H = GetIntArray();
            var max = 0;
            var ans = 0;
            for(int i = 0; i < N; i++)
            {
                if (max <= H[i])
                {
                    ans++;
                    max = H[i];
                }
            }

            Console.Write(ans);
        }



        static public string GetStr() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
    }
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(3 * n);
    rep (i, 3 * n) cin >> a[i];
    sort(a.begin(), a.end());
    ll ans = 0;
    int j = 3 * n - 2;
    rep (i, n) {
        ans += a[j];
        j -= 2;
    }
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 2560
program B2019
  implicit none
  integer N, red, blue, i 
  character(100) s
  character(1) R, spl
  R = 'R'
  read(*, *) N
  read(*, *) s
  s = trim(s)
  red = 0
  blue = 0
  do i = 1, N
    spl = s(i:i)
    if (spl == R) then
      red = red + 1
    else
      blue = blue + 1
    end if
  end do

  if (red>blue) then
    write(*, '(A)') 'Yes'
  else
    write(*, '(A)') 'No'
  end if
end program B2019

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[30],b[30],c[30];
int main(){
    int n,sum;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    for(int i=1;i<=n;i++){
        scanf("%d",&b[i]);
    }
    for(int i=1;i<n;i++){
        scanf("%d",&c[i]);
    }
    for(int i=1;i<=n;i++){
        sum+=b[a[i]];
        if(a[i]-1==a[i-1]&&a[i-1]!=0){
            sum+=c[a[i]-1];
        }
    }
    printf("%d\n",sum);
}

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


Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  string s; cin >> s;
  ll ans = 0, l = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'W') {
      ans += i - l;
      l++;
    }
  }
  outl(ans);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 1336
#include <iostream>

using namespace std;

int lcs(string X, string Y) {
  X = ' ' + X;
  Y = ' ' + Y;
  int memo[1010][1010];
  int maxl = 0;

  // 初期化
  for (int i = 0; i < X.size(); i++) memo[i][0] = 0;
  for (int j = 0; j < Y.size(); j++) memo[0][j] = 0;

  for (int i = 1; i < X.size(); i++) {
    for (int j = 1; j < Y.size(); j++) {
      if (X[i] == Y[j]) {
        //cout << "count up!" << endl;
        memo[i][j] = memo[i-1][j-1] + 1;
      } else {
        memo[i][j] = max(memo[i-1][j], memo[i][j-1]);
      }
      maxl = max(maxl, memo[i][j]);
    }
  }
  return maxl;
}

int main() {
  int q; cin >> q;
  for (int i = 0; i < q; i++) {
    string X, Y; cin >> X >> Y;
    cout << lcs(X, Y) << endl;
  }
}



Measured memory_bytes: 7156
n = int(input())
aa = list(map(int, input().split()))
total = sum(aa)

q = int(input())
from collections import Counter
dic = Counter(aa)
for i in range(q):
    b, c = map(int, input().split())
    nb = dic.pop(b,0)
    total += nb * (c-b)
    print(total)
    dic[c] = dic.get(c,0) + nb

Measured memory_bytes: 23944
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE

Int N;
vector<Int> A;

Int used[100010], mem[100010];
Int dfs(Int pos){
  if(A[pos] == 1) return 0;
  if(pos > N) return 0;
  if(pos == N) return 1;
  if(used[pos]++) return mem[pos];
  
  Int a = dfs(pos + 1);
  Int b = dfs(pos + 2);
  Int res = (a + b) % mod;
  return mem[pos] = res;
}

signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int M;
  cin>>N>>M;
  A.resize(N, 0);
  
  for(Int i=0;i<M;i++){
    Int a;
    cin>>a;
    A[a] = 1;
  }

  Int ans = dfs(0);
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 5760
/*
	Name:
	Author: xiaruize
	Date:
*/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second
#define INF 1e9
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
int dp[1000005][2];
int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	string s;
    
    cin >> s;
    s +='0';
    reverse(s.begin(),s.end());
	s += '0';
	for(int i=0; i<s.size(); ++i)  
	   s[i] -= '0';
    dp[0][1] = INF;
	for(int i=1; i<=s.size()-1; ++i){
      dp[i][0]=min(dp[i-1][0]+s[i],dp[i-1][1]+s[i]+1);
      dp[i][1]=min(dp[i-1][0]+10-s[i],dp[i-1][1]+9-s[i]);
    }
    cout<<dp[s.size()-1][0]<<endl;
    return 0;
}

Measured memory_bytes: 9116
#include<stdio.h>
#include<stdlib.h>
int main()
{
  int m;
  scanf("%d",&m);
  int arr[m],ct=0;
  for(int i=0;i<m;i++)
  {
    scanf("%d",&arr[i]);
    if(i%2==0)
    {
      if(arr[i]%2!=0)
        ct++;
    }
  }
  printf("%d",ct);
  
}

Measured memory_bytes: 1724
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>
#include<limits>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1e9 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

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

  cout<<(n*(n-1)+m*(m-1))/2<<endl;

}


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

int main(){
  int n;
  long long k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++)
  {
    int ai;
    cin >> ai;
    a[i] = ai-1;
  }

  vector<int> seen(n,-1);
  int step = 0;
  int now = 0;
  bool ok = false;
  while(k>0){
    if(seen[now]==-1 || ok){
      seen[now] = step;
      now = a[now];
      step++;
      k--;
    }
    else{
      int diff = step - seen[now];
      // cout << "diff=" << diff << endl;
      // cout << "seennow =" << seen[now] << endl;
      if(diff==1) break;
      k%=diff;
      ok = true;
      // cout << "k=" << k << endl;
    }
  }
  // for (int i = 0; i < n; i++)
  // {
  //   cout << seen[i] << endl;
  // }
  
  
  cout << now+1 << endl;  
}

Measured memory_bytes: 4844
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <bitset>
#include <iomanip>

using namespace std;

bool vecEqual(const vector<int>& v1, const vector<int>& v2) {
    bool eq = true;
    for (int i = 0; i < v1.size(); ++i) {
        if (v1[i] != v2[i]) {
            eq = false;
            break;
        }
    }
    return eq;
}

int main() {
    int N;
    cin >> N;
    vector<int> P(N, 0);
    vector<int> Q(N, 0);
    vector<int> perm(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> P[i];
    }
    for (int i = 0; i < N; ++i) {
        cin >> Q[i];
        perm[i] = i + 1;
    }

    int counter = 0;
    int orderP = 0;
    int orderQ = 0;
    do {
        ++counter;
        if (vecEqual(perm, P)) {
            orderP = counter;
        }
        if (vecEqual(perm, Q)) {
            orderQ = counter;
        }
        if (orderP > 0 && orderQ > 0) {
            break;
        }
    } while (next_permutation(perm.begin(), perm.end()));

    cout << abs(orderP - orderQ) << endl;
    //cout << setprecision(15) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>

 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define LLIandI pair<long long int , int>
#define ll long long


bool d[10002][20002];//[i][j]=i番目の遷移で座標j-8000
int main(void){
   char s[10000];
   scanf("%s",s);
   int x,y;
   scanf("%d %d",&x,&y);
   int sx=-1,sy=0;int vec=0;
   int cnt=0;
   vector<int> ud;
   vector<int> rl;
   int N=strlen(s);
   //prepare
   rep(i,N){
       if(s[i]=='F'){
           cnt++;
       }else{
           if(vec%2==0){
               if(sx>-1)rl.pb(cnt);
               else sx=cnt;
           }else ud.pb(cnt);
           cnt=0;vec++;
       }
       if(i==N-1&&cnt>0){
           if(vec%2==0){
               if(sx>-1)rl.pb(cnt);
               else sx=cnt;
           }else ud.pb(cnt);
       }
   }
   //solve
   
   rep(i,ud.size()+2)rep(j,20000){d[i][j]=false;}
   //updown
   d[0][sy+10000]=true;
   rep(i,ud.size()){
       rep(j,20000){
           if(j+ud[i]>-1&&j+ud[i]<20000&&d[i][j]==true){d[i+1][j+ud[i]]=true;}
           if(j-ud[i]>-1&&j-ud[i]<20000&&d[i][j]==true){d[i+1][j-ud[i]]=true;}
       }
   }
    if(d[ud.size()][y+10000]==false){printf("No\n");return 0;}
   rep(i,rl.size()+2)rep(j,20000){d[i][j]=false;}
   //rightleft
   d[0][sx+10000]=true;
   rep(i,rl.size()){
       rep(j,20000){
          if(j+rl[i]>-1&&j+rl[i]<20000&&d[i][j]==true)d[i+1][j+rl[i]]=true;
          if(j-rl[i]>-1&&j-rl[i]<20000&&d[i][j]==true)d[i+1][j-rl[i]]=true;
       }
   }
   if(d[rl.size()][x+10000]==false){printf("No\n");return 0;}
   printf("Yes\n");return 0;
}


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

using namespace std;

int main()
{
  int h, w;
  cin >> h >> w;
  int n;
  cin >> n;
  vector<int> vs;
  for (int i = 1; i <= n; i++)
  {
	int v;
	cin >> v;
	for (int j = 0; j < v; j++)
	{
	  vs.push_back(i);
	}
  }
  for (int j = 0; j < h; j++)
  {
	for (int i = 0; i < w; i++)
	{
	  int index = (j % 2 == 0 ? j * w + i : j * w + (w - 1 - i));
	  if (i > 0) cout << " ";
	  cout << vs[index];
	}
	cout << endl;
  }
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<cmath>
using namespace std;

typedef pair<int, int> P;
typedef long long ll;
const int INF = 100000000;

ll gcd( ll a, ll b ){//最大公約数
    ll tmp;
    if( a < b ) { tmp = a; a = b; b = tmp; }
    if( b < 1 ) return -1;

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

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


//入力
int n;
int a[200010];

int main(){

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

    int cnt = 0;

    for(int i = 1; i <= n; i++){
        if(a[i] == cnt + 1){
            cnt++;
        }
    }

    if(cnt == 0) cout << -1 << endl;
    else{
        cout << n - cnt << endl;
    }

    return 0;
}

Measured memory_bytes: 1024
package main

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

func out(x ...interface{}) {
	fmt.Print(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

func main() {
	sc.Split(bufio.ScanWords)
	sx, sy, tx, ty := getInt(), getInt(), getInt(), getInt()

	// (sx, sy) to (tx, ty)
	for y := sy; y < ty; y++ {
		out("U")
	}
	for x := sx; x < tx; x++ {
		out("R")
	}
	// (tx, ty) to (sx, sy)
	for y := sy; y < ty; y++ {
		out("D")
	}
	for x := sx; x < tx; x++ {
		out("L")
	}

	// (sx, sy) to (tx, ty) 2
	out("L")
	for y := sy; y <= ty; y++ {
		out("U")
	}
	for x := sx; x <= tx; x++ {
		out("R")
	}
	out("D")

	// (tx, ty) to (sx, sy) 2
	out("R")
	for y := sy; y <= ty; y++ {
		out("D")
	}
	for x := sx; x <= tx; x++ {
		out("L")
	}
	out("U\n")

}


Measured memory_bytes: 896
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b)
        cout<<c<<endl;
    else if(a==c)
        cout<<b<<endl;
    else if(c==b)
        cout<<a<<endl;
    return 0;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include<math.h>

int main() {

	int N,flag;
	int x[101], y[101], h[101];
	int H = 0;
	scanf("%d", &N);
	int i, j, k , c;
	for (i = 0; i < N; i++) {
		scanf("%d %d %d", &x[i], &y[i] , &h[i]);
	}
	for (i = 0; i < 101; i++) {
		for (j = 0; j < 101; j++) {
			flag = 0;
			for (k = 0; k < N; k++) {
				if (h[k] != 0) {
					if (flag == 0) {
						H = h[k] + abs(x[k] - i) + abs(y[k] - j);
						flag = 1;
					}else {
						if (H != h[k] + abs(x[k] - i) + abs(y[k] - j)) {
							flag = 2;
							break;
						}
					}
				}
			}
			for (k = 0; k < N; k++) {
				if (h[k] == 0) {
					if (h[k] < H - abs(x[k] - i) - abs(y[k] - j)) {
						flag = 2;
					}
				}
			}
			if (flag == 1) {
				printf("%d %d %d\n", i, j, H);
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#define ll long long
#define N 510
using namespace std;
ll l[N][N],r[N][N],f[N][N],g[N][N],dp[N][N];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<i;j++) scanf("%lld",&l[j][i]);
		for(int j=i+1;j<=n;j++) scanf("%lld",&r[i][j]);
	}
	for(int i=0;i<=n+1;i++)
		for(int j=i;j<=n+1;j++)
		{
			f[i][j]=i?f[i-1][j]:0;
			for(int k=j;k<=n+1;k++) f[i][j]+=l[i][k];
		}
	for(int i=n+1;i>=0;i--)
		for(int j=i;j<=n+1;j++)
		{
			g[i][j]=g[i+1][j];
			for(int k=i;k<=j;k++) g[i][j]+=r[i][k];
		}
	memset(dp,60,sizeof(dp));
	dp[0][0]=0;
	for(int i=1;i<=n+1;i++)
		for(int j=0;j<n;j++)
			for(int k=0;k<=j;k++)
			dp[i][j]=min(dp[i][j],dp[j][k]+f[j][i+1]-f[k][i+1]+g[j+1][i]);
	ll ans=1e16;
	for(int i=0;i<=n;i++)
		ans=min(ans,dp[n+1][i]);
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 10368
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
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; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

int main(){
  ll A,B,C,X[107];
  ll N,M;
  string S;
  cin >> N;
  Rep(i,1,10){
    if(N%i==0&&N/i<10){
      cYes;
      return 0;
    }
  }
  cNo;
}

Measured memory_bytes: 256
def f(s: str):
    n = len(s)

    m = {
        "0": "",
        "1": "+"
    }
    ans = 0
    for bit in range(0, 1<<(n-1)):
        bits = "{:b}".format(bit).zfill(n-1)
        # print(bits)

        ss = s[0]
        for op, x in zip(bits, s[1:]):
            ss += m[op] + x
        ans += sum(map(int, ss.split("+")))
    return ans


print(f(input()))


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

    // start
    char y[4] = {'Y', 'A', 'K', 'I'};
    rep(i, 4)
    {
        char s;
        cin >> s;
        if (s != y[i])
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
N,K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
cumu = [0]
for i in A:
    cumu.append(cumu[-1]+i)
cand = []

# i<j O(N^2)
for i in range(N):
    for j in range(N+1):
        if(i>=j): continue
        cand.append(cumu[j]-cumu[i])

# 10**18~=2**60
ans = 0
for i in range(61,-1,-1):
    li = []
    for j in cand:
        if((j>>i&1)==1):
            li.append(j)
    if(len(li)>=K):
        ans += 1<<i
        cand = li
print(ans)

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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long> VLL;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/

int main(){
    int n;cin>>n;
    VLL a(n);
    rep(i,n)cin>>a[i];
    sort(ALL(a));
    cout<<a[n-1]-a[0]<<endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author TM
 */


#include <bits/stdc++.h>

using namespace std;

class DHandstand2 {
public:
  void get(int64_t n, pair<int64_t, int64_t> &p) {
    int64_t first = 0;
    int64_t last = 0;
    string s = to_string(n);
    first = s[0] - '0';
    last = s[s.size() - 1] - '0';

    p.first = first;
    p.second = last;
  }

  void solve(std::istream &cin, std::ostream &cout) {
    int n;
    cin >> n;
    vector<vector<int>> vec(10, vector<int>(10, 0));
    for (int num = 1; num < n + 1; ++num) {
      pair<int64_t, int64_t> p;
      get(num, p);
      vec[p.first][p.second] += 1;
    }
    int64_t ans = 0;
    for (int num = 1; num < n + 1; ++num) {
      pair<int64_t, int64_t> p;
      get(num, p);
      ans += vec[p.second][p.first];
    }
    cout << ans << endl;
  }
};


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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;

  long long a[N];
  for (int i = 0; i < N; ++i)
    cin >> a[i];

  long long b[N];
  for (int i = 0; i < N; ++i)
    cin >> b[i];

  long long diff_total = 0;
  vector<long long> diff(N);
  bool changed[N];
  for (int i = 0; i < N; ++i) {
    diff_total += a[i] - b[i];
    diff[i] = a[i] - b[i];
    changed[i] = false;
  }

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

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

  int last_provider = N - 1;
  int cursor = 0;
  while (true) {
    if (diff[cursor] >= 0)
      break;
    if (abs(diff[last_provider]) > abs(diff[cursor])) {
      diff[last_provider] += diff[cursor];
      diff[cursor] = 0;
      changed[cursor] = true;
      changed[last_provider] = true;
      ++cursor;
    } else {
      diff[cursor] += diff[last_provider];
      diff[last_provider] = 0;
      changed[cursor] = true;
      changed[last_provider] = true;
      if (diff[cursor] == 0)
        ++cursor;
      --last_provider;
    }
  }

  int ret = 0;
  for (int i = 0; i < N; ++i)
    if (changed[i])
      ++ret;

  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;
using P = pair<int, int>;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w, n;
    cin >> h >> w >> n;
    vector<int> a(n), b(n);
    vector<ll> ans(10, 0);
    map<P, ll> cnt;
    for(int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        for(int j = 0; j < 3; j++) {
            for(int k = 0; k < 3; k++) {
                int na = a[i] - j;
                int nb = b[i] - k;
                if(0 <= na && na < h - 2 && 0 <= nb && nb < w - 2) {
                    cnt[P(na, nb)]++;
                }
            }
        }
    }
    ll sum = 0;
    for(const auto &p : cnt) {
        ans[p.second]++;
        sum++;
    }
    ans[0] = (ll)(h - 2) * (w - 2) - sum;
    for(int i = 0; i < 10; i++) {
        cout << ans[i] << endl;
    }
}

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

l = [0]*4
for i in range(N):
  S = input()
  if S == "AC":
    l[0] += 1
  elif S == "WA":
    l[1] += 1
  elif S == "TLE":
    l[2] += 1
  elif S == "RE":
    l[3] += 1
    
print("AC x", l[0])
print("WA x", l[1])
print("TLE x", l[2])
print("RE x", l[3])

Measured memory_bytes: 9208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll mod=1e9+7;

int main() {
  int x,y,z,k;
  cin >> x >> y >> z >> k;
  vector<ll> a(x);
  vector<ll> b(y);
  vector<ll> c(z);
  for(ll i=0;i<x;i++) {
    cin >> a[i];
  }
  for(ll i=0;i<y;i++) {
    cin >> b[i];
  }
  for(ll i=0;i<z;i++) {
    cin >> c[i];
  }
  vector<ll> s(y*z);
  for(ll i=0;i<y;i++) {
    for(ll j=0;j<z;j++) {
      s[i*z+j]=b[i]+c[j];
    }
  }
  sort(s.rbegin(),s.rend());
  vector<ll> ss(min(3000,y*z)*x);
  for(ll i=0;i<min(3000,y*z);i++) {
    for(ll j=0;j<x;j++) {
      ss[i*x+j]=s[i]+a[j];
    }
  }
  sort(ss.rbegin(),ss.rend());
  for(ll i=0;i<k;i++) {
    cout << ss[i] << endl;
  }
}

Measured memory_bytes: 31616
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const LL INF=1<<17;

P dp[102][50501];
P pmax(P p,P q){
    if(p.fs>q.fs) return p;
    else if(p.fs==q.fs) return (p.sc<q.sc?p:q);
    else return q;
}


int main(){
    int N;
    while(cin >> N){
        if(!N) return 0;
        int p[N];
        for(int i=0;i<N;i++){
            cin >> p[i];
        }
        for(int i=0;i<=N;i++){
            for(int j=0;j<50001;j++){
                if(j==0) dp[i][j]=mp(0,0);
                else dp[i][j]=mp(-1,INF);
            }
        }
        for(int i=0;i<N;i++){
            for(int j=0;j<50001;j++){
                if(dp[i][j].fs==-1){
                    continue;
                }
                P d=dp[i][j];
                dp[i+1][j]=pmax(dp[i+1][j],d);
                d.sc+=p[i];
                int res=(1000-p[i]%1000)%1000;
                dp[i+1][j+res]=pmax(dp[i+1][j+res],d);
                if(res>=500){
                    d.fs++;
                    res-=500;
                    dp[i+1][j+res]=pmax(dp[i+1][j+res],d);
                }
                else{
                    d.fs++;
                    res=500-res;
                    if(res<=j) dp[i+1][j-res]=pmax(dp[i+1][j-res],d);
                }
            }
        }
        P ans=mp(0,LINF);
        for(int i=0;i<=50000;i++){
            ans=pmax(ans,dp[N][i]);
        }
        cout << ans.fs << " " << ans.sc << endl;
    }
    return 0;
}


Measured memory_bytes: 43324
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a == 1)
            a = 14;
        if (b == 1)
            b = 14;
        if (a > b)
            System.out.println("Alice");
        else if (a == b)
            System.out.println("Draw");
        else
            System.out.println("Bob");
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor_ct.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/pending/disjoint_sets.hpp>
#include <boost/icl/interval_map.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/bellman_ford_shortest_paths.hpp>
#include <boost/graph/kruskal_min_spanning_tree.hpp>
#include <boost/graph/graph_utility.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
using namespace std;
using namespace boost::math;

int main() {
	int A, B;
  string s;

	cin >> A >> s;

	cout << (A >= 3200 ? s : "red") << endl;

	return 0;
}


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s;
    cin >> s;
    
    if(s == "Sunny"){
        cout << "Cloudy\n";
    }
    else if(s == "Rainy"){
        cout << "Sunny\n";
    }
    else{
        cout << "Rainy\n";
    }
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m=0,k=0,number;
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>number;
    if(number%2==0){
      m++;
      if(number%3==0||number%5==0) k++;}}
  if(m==k) cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
  return 0;}

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

ll N;

vector<ll> primeFactorization(ll n) {
    vector<ll> ret;
    ll a = 2;
    while (n >= a * a) {
        if (n % a == 0) {
            ret.push_back(a);
            n /= a;
        } 
        else a++;
    }
    ret.push_back(n);
    return ret;
}

int main() {
    cin >> N;

    if (N == 1) cout << 0 << endl;
    else {
        vector<ll> vec = primeFactorization(N);

        map<ll, ll> mp;
        for (int i = 0; i < vec.size(); i++) {
            mp[vec[i]]++;
        }

        ll ans = 0;
        for (auto itr = mp.begin(); itr != mp.end(); itr++) {
            ll val = itr->second;
            ll i = 1;
            while (i * (i-1) <= 2 * val) {
                i++;
            }
            //cout << val << ":" << i << endl;
            ans += i-2;
        }

        cout << ans << endl;
    }

    return 0; 
}


Measured memory_bytes: 3592
#define _CRT_NONSTDC_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define NL << endl
#define REP(i,n) for(int (i) = 0; i < (n); ++(i))
#define IN(n) cin >> (n)
#define INR(n) for(auto&& e:(n)) cin >> e
#define Yes cout << "Yes" NL
#define No cout << "No" NL

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr int INTMAX = numeric_limits<int>::max();
constexpr int INTMIN = numeric_limits<int>::min();
constexpr ll LLMAX = numeric_limits<long long>::max();
constexpr ll LLMIN = numeric_limits<long long>::min();
constexpr int MOD = 1000000007;


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

using namespace std;


signed main() {
	int n;
	int t;

	cin >> n >> t;
	int s = 0;
	int e = 0;
	bool f = false;
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		if(f && e < x) {
			ans += e - s;
			s = x;
			e = s + t;
		} else if (f && e >= x) {
			e = x + t;
		} else {
			f = true;
			s = x;
			e = x + t;
		}
	}
	ans += e - s;

	cout << ans NL;


	return 0;

}



Measured memory_bytes: 256
K = int(input())
l = [1, 2, 3, 4, 5, 6, 7, 8, 9]
count = 9
if K > 9:
    for i in l:
        r = i % 10
        if r == 0:
            l.append(10*i + r)
            l.append(10*i + r+1)
            count += 2
            if count > K:
                break
                
        elif r == 9:
            l.append(10*i + r-1)
            l.append(10*i + r)
            count += 2
            if count > K:
                break
                
        else:
            l.append(10*i + r-1)
            l.append(10*i + r)
            l.append(10*i + r+1)
            count += 3
            if count > K:
                break
print(l[K-1])

Measured memory_bytes: 45296
def solve():
  n,k=map(int,input().split())
  H=list(map(int,input().split()))
  A=[0]*n
  for i in range(1,n):
    A[i]=min(A[i-j]+abs(H[i]-H[i-j]) for j in range(1,min(i+1,k+1)))
  return A[n-1]
print(solve())


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

int main()
{
    string A,B,C;
    cin >> A >> B >> C;

    if(A[A.size()-1]==B[0] && B[B.size()-1]==C[0]) cout << "YES";
    else cout << "NO";

    cout << endl;
    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

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

	for(int i=k;i<n;i++)
	{
		cout << (a[i-k]<a[i] ? "Yes":"No") << endl;

	}




}

Measured memory_bytes: 4048