akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    s = input().strip() + "K"
    ans = 0
    pre = s[0]
    for i in range(1, N):
        if pre == s[i]:
            ans += 1
        else:
            pre = s[i]
    print(min(N-1, ans + K*2))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		//System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int n = 1;
		while(n != 0){
			n =scan.nextInt();
			if (n==0){
				break;
			}
			int[] score = new int[n];
			double heikin = 0.0;
			for(int i=0;i<n; i++){
				score[i] = scan.nextInt();
				heikin += score[i];
			}
			heikin /= n;
			double keisan = 0.0;
			for(int i=0; i<n; i++){
				keisan += (score[i] - heikin) * (score[i] - heikin);
			}
			keisan /= n;
			keisan = Math.sqrt(keisan);
			System.out.println(keisan);
		}
	}
}

Measured memory_bytes: 30888
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
#define REP(i, n)           for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)       for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF                 (ll)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef long long           ll;
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int main()
{
	ll N;
	cin >> N;

	ll ans = 0;
	REP(i, N + 1) {
		if (i % 3 == 0) continue;
		if (i % 5 == 0) continue;
		ans += i;
	}

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


Measured memory_bytes: 3636
n=int(input())
so=0
if n==2:
  print(2)
  so=1
elif n!=2 and n%2==0:
  n+=1
for j in range(n,n+2000,2):
  divisors = []
  for i in range(1, int(j**0.5)+1):
      if j % i == 0:
          divisors.append(i)
          if i != j // i:
              divisors.append(j//i)
  x=divisors
  t=len(x)
  if t==2 and so==0:
    print(x[1])
    break

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

using namespace std;

int main() {
	int a, b, c;
	int rec = 0, loz = 0;
	while (scanf("%d,%d,%d", &a, &b, &c) != EOF) {
		if (a * a + b * b == c * c) ++rec;
		else if (a == b && c > 0 && c < a + b) ++loz;
	}
	printf ("%d\n%d\n", rec, loz);
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n;
    n = Integer.parseInt(sc.next());
    List<String> L = new ArrayList<String>();
    String s,last = new String();
    boolean b = true;
    
    L.add(sc.next());
    for(int i=1; i<n; i++){
      last = L.get(L.size()-1); s = sc.next();
      if(L.contains(s)){b=false; System.out.println("No"); break;}
      else if(last.charAt(last.length()-1)!=s.charAt(0)){b=false; System.out.println("No"); break;}
      else{L.add(s);}
    }
    
    if(b){System.out.println("Yes");}
  }
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
    return string(1, val);
}

int main(){
    string s; cin >> s;

    int zero = 0;
    int one = 0;
    for(int i = 0; i < s.size(); ++i) {
        if(s[i] == '0') {
            zero++;
        } else {
            one++;
        }
    }

    cout << 2 * min(zero, one) << endl;
}

Measured memory_bytes: 512
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

def abc080_c():
    N = int(readline())  # 他店の数
    # 他店の営業パターン：店→日付→営業01
    F = np.array([list(map(int, readline().split())) for _ in range(N)], dtype=np.int32)
    # 他店と何回重なると利益がどうなるか：店→重複回数→利益
    P = np.array([list(map(int, readline().split())) for _ in range(N)], dtype=np.int32)
    ans = -10**12  # 最悪 100 * -10**7

    # bit全探索
    from itertools import product
    for mask in product(range(2), repeat=10):
        if mask.count(1) == 0: continue
        profit = 0
        for i in range(N):
            # 他店iの営業パターンと、自店の営業パターンmaskと、の要素積は、重複する営業日
            overlap = np.multiply(F[i,:], mask).sum()
            profit += P[i, overlap]
        ans = max(profit, ans)
    print(ans)

abc080_c()

Measured memory_bytes: 14440
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};


///////////////////////////


int main() {
	
	ll A[2];
	ll K;

	cin >> A[0] >> A[1] >> K;

	rep(i, K) {
		ll x = i % 2;
		ll y = (i + 1) % 2;

		A[y] = A[y] + A[x] / 2;
		A[x] /= 2;

	}

	cout << A[0] << " " << A[1];

	system("PAUSE");
}


Measured memory_bytes: 504
n = int(input())
a = [int(input()) for i in range(n)]
ans = 0
if a[0] != 0:
  print(-1)
  exit()
for i in range(1,n):
  if a[i]-1 == a[i-1]:
    pass
  else:
    if a[i]>a[i-1]+1:
      print(-1)
      exit()
    else:
      ans += a[i-1]
ans += a[n-1]
print(ans)

Measured memory_bytes: 11048
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String a = sc.next();
			if ('A' <= a.charAt(0) && a.charAt(0) <= 'Z') {
				System.out.println("A");
			} else {
				System.out.println("a");
			}
		}
	}
}


Measured memory_bytes: 35660
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <bitset>
#include <functional>
#include <set>
#include <map>
#include <array>

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define int long long int
const int MOD = 1000000007;
const int INF = 100100100;
const double EPS = 0.000000001;

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

bool pairCompare(const P& pair1, const P& pair2) {
    return pair1.second > pair2.second;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, A[100001];
  int dp[100001][2] = {};
  cin >> N;
  REP(i, N){
    cin >> A[i];
  }
  dp[0][0] = A[0];
  dp[0][1] = -A[0];
  REP(i, N-1){
    dp[i+1][0] = max(dp[i][0] + A[i+1], dp[i][1] - A[i+1]);
    dp[i+1][1] = max(dp[i][0] - A[i+1], dp[i][1] + A[i+1]);
  }
  int ans = dp[N-1][0];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>
#define   tax(p, x) ((p) * (100 + (x)) / 100)
#define untax(p, x) (((p) * 100 + 99) / (100 + (x)))

int solve(int x, int y, int s) {
  int max = 0;
  int p1, q1, r1, p2, q2, r2;
  for (p1 = 1; p1 < s; p1++) {      /* price of #1 without tax */
    q1 = tax(p1, x);                /* price of #1 with x% tax */
    q2 = s - q1;                    /* price of #2 with x% tax */
    p2 = untax(q2, x);              /* price of #2 without tax */
    if (p1 > p2) break;             /* w.l.o.g. p1 <= p2 */
    if (tax(p2, x) != q2) continue; /* there is no correct p2 for the q2 */
    r1 = tax(p1, y);                /* price of #1 with y% tax */
    r2 = tax(p2, y);                /* price of #2 with y% tax */
    if (max < r1 + r2) {
        max = r1 + r2;
    }
  }
  return max;
}

int main()
{
  int x, y, s;
  for (;;) {
    scanf("%d%d%d", &x, &y, &s);
    if (x == 0 && y == 0 && s == 0) break;
    printf("%d\n", solve(x, y, s));
  }
  return 0;
}

/*
 * ?¨?????????????q2???????¨?????????????p2????±?????????????:
 *   floor(p2 * (100 + x) / 100) = q2
 * ??§???????????§, ????????? r (????????? 0 <= r <= 99) ??¨????????¨
 *   p2 = (q2 * 100 + r) / (100 + x).
 * r=0?????¨??????p2????????????r=99?????¨??????p2?????????.
 * 0.0 <= r / (100 + x) < 1.0 ??????, ????¨?????????????????????´??°p2?????????1???????????§,
 *   p2 = ceil(q2 * 100 / (100 + x))
 * ?????????
 *   p2 = floor((q2 * 100 + 99) / (100 + x))
 * ??????????????????????????°?????? (????¨????????????°????????§??????????????????????????????).
 *
 * ??????, ????????????q2?????????p2????????¨???????????´????????????.
 * ????????°, q2=299???, ?¨????99%?????¨???, 150???->298???, 151???->300???.
 */

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int m,n,a,b,c,d,x,y,k;
    string s,t;
    cin>>k>>x;
    if(500*k>=x){cout<<"Yes";}
    else{cout<<"No";}
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, string> P;
typedef tuple<int, string, string> T;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

string s;

string solve() {
    if (s == "ABC") return "ARC";
    return "ABC";
}

void input() {
    cin >> s;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 3084
N = int(input())
lists = [str(i) for i in range(1,N+1)]
count = 0
for i in range(1,10):
    for j in range(i,10):
        s_cnt, t_cnt = 0, 0
        si, sj = str(i), str(j)
        for k in lists:
            if k[0] == si and k[-1] == sj:
                s_cnt += 1
            elif k[0] == sj and k[-1] == si:
                t_cnt += 1
        if i != j:
            count += s_cnt * t_cnt * 2
        elif i == j:
            count += s_cnt ** 2
print(count)

Measured memory_bytes: 15768
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<int,int>;

ll ketasu(ll a){
   ll num=1;
   while(a/10){
       num++;
       a/=10;
   }
   return num;
}

ll gcd(ll a,ll b){return b ? gcd(b,a%b) :a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

ll kosuu(ll a){
    ll sum=0;
    for(ll i=1;i*i<=a;i++){
        if(a%i==0){
            if(a!=1&&i*i!=a){
            sum+=2;
            }else{
             sum++;   
            }
        }
    }
    return sum;
}
ll ans=-1000000000;



int main()
{
 ll n,k;
 cin>>n>>k;
 vector<ll>p(n),c(n);
 rep(i,n)cin>>p[i];
 rep(i,n)cin>>c[i];
 rep(i,n)p[i]--;
 ll ans= -1e18;
 
rep(si,n){
    int x=si;
    ll tot=0;
    vector<int>s;
    while(1){
        x=p[x];
        s.push_back(c[x]);
        tot+=c[x];
        if(x==si)break;
    }
    ll l=s.size();
    ll now=0;
    ll t=0;
    rep(i,l){
        t+=s[i];
        if(i+1>k)break;
        ll now=t;
        if(0<tot){
          ll e=(k-(i+1))/l;
          now+=tot*e; 
        }
        ans=max(ans,now);
    }
}
cout<<ans<<endl;
return 0;
}



Measured memory_bytes: 3696
import numpy as np
H, W = map(int, input().split())
A = []
for _ in range(H):
    row = input()
    if row != "." * W:
        A.append(list(row))
A = np.array(A, dtype=str)
B = []
for c in range(W):
    if any(map(lambda c: c == "#", A[:, c])):
        B.append(A[:, c])
for row in np.asarray(B).T:
    print("".join(row))

Measured memory_bytes: 12504
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    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;
    }
}

// 二項係数計算
long long COM(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;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int X,A,B; cin >> X >> A >> B;
    cout << (X-A)%B << endl;
    return 0;
}


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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main()
{
  int A, B, C;
  cin >> A >> B >> C;
  if (A+B >= C)
  {
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
#define pll pair<ll,ll>
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
vector<ll> a,b;
int main(){
    ll n,m,k,t;
    cin>>n>>m>>k;
    ll pos=0,sum=0;
    rep(i,0,n){cin>>t;a.pb(t);}
    rep(i,0,m){cin>>t;b.pb(t);}
    a.pb(1e10),b.pb(1e10);
    while(sum<=k&&pos<n){
        if(a[pos]>k)break;
        sum+=a[pos];
        pos++;
    }
    if(sum>k){
        pos--;
        sum-=a[pos];
    }
    ll ans=pos;
    a[pos]=0;
    ll bpos=0;
    
    irep(i,pos,0){
        sum-=a[i];
        while(sum<=k&&bpos<m){
            sum+=b[bpos];
            bpos++;
        }
        if(sum>k){
            bpos--;
            sum-=b[bpos];
        }
        //cout<<i<<" "<<bpos<<endl;
        ans=max(ans,i+bpos);
    }
    cout<<ans;
}



Measured memory_bytes: 7924
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    bool ans = true;
    cin >> n;
    string w[n];
    for (string &i : w)
        cin >> i;
    for (int i = 0; i < n - 1; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            if (w[i] == w[j])
            {
                ans = false;
                break;
            }
        }
        if (w[i].at(w[i].size() - 1) != w[i + 1].at(0))
        {
            ans = false;
            break;
        }
    }
    if (ans)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
def abc112_b():
    n, limit_time = map(int, input().split())
    ans = 1001

    for _ in range(n):
        cost, time = map(int, input().split())

        if time <= limit_time and ans > cost:
            ans = cost

    return ans if ans != 1001 else "TLE"


def abc109_b():
    length = int(input())
    word_list = []

    for _ in range(length):
        word_list.append(input())

    for i in range(len(word_list) - 1):

        if word_list.count(word_list[i]) >= 2 or word_list[i][-1] != word_list[i+1][0]:
            return "No"

    return "Yes"


if __name__ == '__main__':
    print(abc109_b())

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=1000000007;
const long double PI=3.14159265358979;

ll ha[100001][3];
ll dp[100001][3];

int main() {
  ll N;
  cin>>N;
  for(int i=1;i<N+1;i++){
    for(int j=0;j<3;j++){
      cin>>ha[i][j];
    }
  }
  for(int i=1;i<N+1;i++){
    for(int j=0;j<3;j++){
      dp[i][j]=ha[i][j]+max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3]);
     // cout<<dp[i][j]<<" ";
    }
  }
  cout<<max({dp[N][0],dp[N][1],dp[N][2]});
}

Measured memory_bytes: 4992
#pragma warning (disable :4996)
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
const double PI = cos(-1.0);
const double eps = 1e-12;
#define For(i,n,m) for(int i=n;i<=m;++i)
#define clr(a,b) memset(a,b,sizeof(a))

string s;
ll cnt[2019];
int main() {
	ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
	cin >> s;
	cnt[0] = 1;
	ll p(1), now(0), ans(0);
	for (int i = s.size() - 1; i >= 0; --i) {
		now = (now + (s[i] - '0') * p) % 2019;
		ans += cnt[now], ++cnt[now];
		p = ((p << 3) + (p << 1)) % 2019;
	}
	cout << ans << "\n";
	return 0;
}




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

int main(){
    int N, L;
    cin >> N >> L;
    
    int eat = L;
    int sum = 0;
    for(int i = L+1; i < L + N; i++){
        sum += i;
    }
    int ans = abs(eat);
    int tmp = sum;
    int ans2 = sum;
    
    for(int i = L+1; i < L + N; i++){
        //cout << ans2 << " " << eat << " " << ans << "\n";
        sum--;
        eat = i;
        int diff = abs(eat);
        if(diff < ans){
            ans = diff;
            ans2 = sum;
        }
    }
    
    cout << ans2 << "\n";
    return 0;
} 


Measured memory_bytes: 256
code = r"""
# distutils: language=c++
# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
from libcpp cimport bool
from libcpp.vector cimport vector
cdef extern from "<atcoder/dsu>" namespace "atcoder" nogil:
    cdef cppclass dsu:
        dsu(int n)
        int merge(int a, int b)
        bool same(int a, int b)
        int leader(int a)
        int size(int a)
        vector[vector[int]] groups()
from cython.parallel cimport prange
from libc.stdio cimport getchar, putchar
cdef inline int read() nogil:
    cdef int b, c = 0
    while 1:
        b = getchar() - 48
        if b < 0: break
        c = c * 10 + b
    return c
cdef int i
cdef dsu *d = new dsu(read())
for i in prange(read(), nogil=1):
    if read():
        if d.same(read(), read()): putchar(49)
        else: putchar(48)
        putchar(10)
    else: d.merge(read(), read())
"""
import os, sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    open('solve.pyx', 'w').write(code)
    os.system('cythonize -i -3 -b solve.pyx')
import solve

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

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int (i)=(a);(i)<(b);++(i))
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cout<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
typedef vector<int> vi;
typedef vector<lint> vl;
typedef vector<char> vc;
typedef vector<vector<int>> vii;
typedef vector<vector<lint>> vll;
typedef vector<vector<char>> vcc;

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

class BFindSymmetries {
public:
    int N;
    vcc grid, cur;

    void input(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in>>N;
        grid = vcc(N, vc(N));
        cur = vcc(N, vc(N));
        REP(i, N) REP(j, N) in>>grid[i][j];
    }

    void solve(std::istream& in, std::ostream& out){
        input(in, out);
        int ans = 0;
        REP(i, N){
            REP(j, N) REP(k, N) cur[j][k] = grid[j][(k+i)%N];
            bool ok = true;
            REP(j, N) REP(k, N){
                if(cur[j][k]!=cur[k][j]) ok = false;
            }
            if(ok) ++ans;
        }
        out<<ans*N<<'\n';
    }
};


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


Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	private static final byte MASK_RIGHT = 0x0F;//右4bit数値化用マスク
	private static int[][] paper = new int[10][10];//都合の良い方眼紙

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 64);
		String sLine;
		while ((sLine = reader.readLine()) != null) {
			droppingInk(sLine.charAt(0) & MASK_RIGHT, sLine.charAt(2) & MASK_RIGHT, sLine.charAt(4) & MASK_RIGHT);
		}
		calcResult();
	}

	/**
	 *都合の良い滴下
	 */
	private static void droppingInk(int x, int y, int size) {
		sinking(x, y - 1);
		sinking(x - 1, y);
		sinking(x, y);
		sinking(x + 1, y);
		sinking(x, y + 1);
		if (size == 1) {
			return;
		}

		sinking(x - 1, y - 1);
		sinking(x + 1, y - 1);
		sinking(x - 1, y + 1);
		sinking(x + 1, y + 1);
		if (size == 2) {
			return;
		}

		sinking(x, y - 2);
		sinking(x - 2, y);
		sinking(x + 2, y);
		sinking(x, y + 2);
	}

	/**
	 * 床は汚さないようにする
	 */
	private static void sinking(int x, int y) {
		if (x >= 0 && x < 10 && y >= 0 && y < 10) {
			paper[x][y]++;
		}
	}

	/**
	 *紙の染みを数え、損害を報告する
	 */
	private static void calcResult() {
		int white = 0;//綺麗な部分
		int max = 0;//一番ひどい汚れ
		for (int[] row : paper) {
			for (int colum : row) {
				if (colum == 0) {
					white++;
				} else if (colum > max) {
					max = colum;
				}
			}
		}
		System.out.println(white);
		System.out.println(max);
	}
}

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

public class Main {

    public static void main(String[] args) throws Exception {
//        int tc = scan.nextInt();
//        for (int i = 0; i < tc; i++) {
            solve();
//        }
        out.close();
    }

    private static void solve() {
        int k = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();
        int l = (int) Math.ceil(a / (float) k);
        int r = (int) Math.floor(b / (float) k);
        if (l <= r) {
            out.println("OK");
        } else {
            out.println("NG");
        }
    }


    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

    public static MyScanner scan = new MyScanner();

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
//--------------------------------------------------------

}

Measured memory_bytes: 32808
/*
ID: thanhvq1
LANG: C++14
PROB: namenum
*/

#pragma GCC optimize ("O2")
#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;
//#define int long long
#define double long double
#define vec vector
#define vi vector<int>
#define vvi vector<vector<int>>
#define FZ(n) memset((n),0,sizeof())
#define FMO(n) memset((n),-1,sizeof(n))
#define unset unordered_set
#define ii pair<int, int>
#define vii vector<ii>
#define F first
#define S second
#define PB push_back
#define ALL(x) begin(x),end(x)
#define SZ(x) ((int)(x).size())
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first, l.second+r.second};
}
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;

void FILEIO() {  freopen("in.txt", "r", stdin);  freopen("out.txt", "w", stdout); }
//void FILEIO() {  freopen("namenum.in", "r", stdin);  freopen("namenum.out", "w", stdout); }
void input() {   }

// global parameters here:

void solve() {
	int n, a, b; cin >> n >> a >> b;
	cout << min(n*a, b) << endl;
}


signed main() {
  ios_base::sync_with_stdio(false); cin.tie();
//  FILEIO();
//auto beginProgram = chrono::steady_clock::now();

// int t, test=0; cin >> t;
//  while(t--)
  {
		solve();
  }

  //auto endProgram = chrono::steady_clock::now();

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
total = 0
for i in range(n):
    d = min(b[i], a[i])
    b[i] -= d
    a[i] -= d
    total += d

    d = min(b[i], a[i+1])
    b[i] -= d
    a[i+1] -= d
    total += d
print(total)


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

using namespace std;
using ll = long long;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll n, k;
  cin >> n >> k;
  ll ans = 2e18;
  set<ll> st;
  if (n % k == 0) {
    cout << 0 << '\n';
    return 0;
  }
  while (!st.count(n)) {
    st.insert(n);
    n = k - n % k;
    ans = min(ans, n);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;++i)
#define ALL(x) x.begin(),x.end()

using namespace std;
typedef long long ll;

template<typename T>
T gcd(T a, T b) {
	if (a % b == 0) {
		return(b);
	}
	else {
		return(gcd(b, a % b));
	}
}

template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}


int main(void) {
	string s, t;
	cin >> s >> t;
	rep(i, s.length()) {
		if (s[i] != t[i]) {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
}

/*

*/


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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;


int main(){

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

    vector<ll> x(n);
    vector<ll> y(n);
    vector<ll> z(n);

    rep(i, n){
        ll a,b,c;
        cin >> a >> b >> c;

        x[i] = a;
        y[i] = b;
        z[i] = c;
    }

    ll ans = 0;

    for(int i = -1; i <= 1; i = i + 2){
        for(int j = -1; j <= 1; j = j + 2){
            for(int k = -1; k <= 1; k = k + 2){

                vector<pair<ll,int>> tmpv;
                rep(l, n){
                    ll tmp = i * x[l] + j * y[l] + k * z[l];

                    tmpv.pback(mpair(tmp, l));
                }

                sort(ALL(tmpv));
                reverse(ALL(tmpv));

                ll xsum = 0;
                ll ysum = 0;
                ll zsum = 0;

                rep(l, m){
                    int index = tmpv[l].second;

                    xsum += x[index];
                    ysum += y[index];
                    zsum += z[index];
                }

                ans = max(ans, abs(xsum) + abs(ysum) + abs(zsum));

            }
        }
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(ll i=1;i<=(n);i++)
int main(){
  ll n;cin>>n;
  bool flag=false;
  rep(i,20) if(100*i<=n && n<=105*i) flag=true;
  if(n>=2100) flag=true;
  if(flag) cout<<1<<endl;
  else cout<<0<<endl;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define en '\n'
#define fs first
#define sd second

long double sig(long double x){
    if(x > 0){
        return 1;
    } else if( x == 0){
        return 0;
    } else{
        return -1;
    }
}

bool eq(long double a, long double b){
    static double eps = 1e-12;
    return abs(a-b)<eps;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long double x;
    cin >> x;
    bool have_res = false;
    long double a = 0, ap;
    long double b, bp;
    ll r1, r2;
    while(!have_res){
        ap = pow(a, 5);
        bp = ap-x;
        b = sig(bp)*pow(abs(bp), 0.2);
        if(eq(b, ld(ll(b)))){
            have_res = true;
            r1 = a;
            r2 = b;
        }else{
            ++a;
        }
    }
    //cout << sig(x)*pow(abs(x), 0.2);
    cout << r1 << ' ' << r2 << endl;
}

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

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}
  
int main() {
  ll n;
  cin >> n;
  ll count = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    while (a%2==0) {
      a/=2;
      count++;
    }
  }
  printf("%lld\n", count);
} 


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

signed main()
{
  string a, b;
  cin >> a >> b;
  int n = a.size(), m = b.size();

  vector<vector<int>> suma(n + 1, vector<int>(26));
  vector<vector<int>> sumb(m + 1, vector<int>(26));

  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < 26; j++)
    {
      if (a[i] - 'a' == j)
        suma[i + 1][j]++;
      suma[i + 1][j] += suma[i][j];
    }
  }
  for (int i = 0; i < m; i++)
  {
    for (int j = 0; j < 26; j++)
    {
      if (b[i] - 'a' == j)
        sumb[i + 1][j]++;
      sumb[i + 1][j] += sumb[i][j];
    }
  }

  for (int len = min(n, m); len >= 0; len--)
  {
    set<vector<int>> st;
    for (int i = 0; i < n; i++)
    {
      if (i + len > n)
        break;
      vector<int> v(26);
      for (int k = 0; k < 26; k++)
      {
        v[k] = suma[i + len][k] - suma[i][k];
      }
      st.emplace(v);
    }
    for (int i = 0; i < m; i++)
    {
      if (i + len > m)
        break;
      vector<int> v(26);
      for (int k = 0; k < 26; k++)
      {
        v[k] = sumb[i + len][k] - sumb[i][k];
      }
      if (st.count(v))
      {
        cout << len << endl;
        return 0;
      }
    }
  }
  cout << -1 << endl;
  return 0;
}



Measured memory_bytes: 4716
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include <functional>

using namespace std;

int main() {
	int n;
	cin >> n;
	int k;
	cin >> k;
	int h[100000];
	for (int i = 0;i < n;i++) {
		cin >> h[i];
	}
	sort(h, h + n, greater<int>());
	int b[100000];
	for (int i = 0;i < n - k+1;i++) {
		b[i] = h[i] - h[k - 1 + i];
	
	}
	sort(b, b + (n - k+1));
	cout << b[0];
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

typedef unsigned long long ULLONG;
typedef long long LLONG;

static const LLONG MOD_NUM = 1000000007;

template <class _T> static _T tp_abs(const _T& a) {
	//	usage:  tp_abs<type name>(a);
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static void ABC079C_TrainTicket();

#if 1
int main()
{
	ABC079C_TrainTicket();
	fflush(stdout);
	return 0;
}
#endif

static void ABC079C_TrainTicket()
{
	int A, B, C, D;
	int tmp;
	get1int(tmp);
	D = tmp % 10;
	tmp /= 10;
	C = tmp % 10;
	tmp /= 10;
	B = tmp % 10;
	tmp /= 10;
	A = tmp % 10;

	if ((A + B + C + D) == 7) {
		printf("%d+%d+%d+%d=7", A, B, C, D);
		return;
	}
	if ((A + B + C - D) == 7) {
		printf("%d+%d+%d-%d=7", A, B, C, D);
		return;
	}
	if ((A + B - C + D) == 7) {
		printf("%d+%d-%d+%d=7", A, B, C, D);
		return;
	}
	if ((A - B + C + D) == 7) {
		printf("%d-%d+%d+%d=7", A, B, C, D);
		return;
	}
	if ((A - B - C - D) == 7) {
		printf("%d-%d-%d-%d=7", A, B, C, D);
		return;
	}
	if ((A - B + C - D) == 7) {
		printf("%d-%d+%d-%d=7", A, B, C, D);
		return;
	}
	if ((A - B - C + D) == 7) {
		printf("%d-%d-%d+%d=7", A, B, C, D);
		return;
	}
	if ((A + B - C - D) == 7) {
		printf("%d+%d-%d-%d=7", A, B, C, D);
		return;
	}
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    vector <pair <int,int>> d(n);
    for(int i=0;i<n;i++)
    {
        cin>>d[i].first>>d[i].second;
    }
    int flag = 0;
    string ans = "No";
    for(int i=0;i<n;i++)
    {
        if(d[i].first == d[i].second)
        {
            flag++;
        }
        else
        {
            flag = 0;
        }
        if(flag == 3)
            ans = "Yes";
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int m = sc.nextInt();

			int result = 1;
			for (int i = 0; i < m; i++) {
				result *= 2;
			}
			result *= (1900 * m + 100 * (n - m));


			System.out.println(result);

		}
	}
}


Measured memory_bytes: 22100
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		Console.WriteLine("{0}",(s[0]-1)/s[1]+1);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 13268
N,M=(int(i) for i in input().split())
L=sorted([[int(i) for i in input().split()] for i in range(N)])
ans=0
num=0
while M>0:
  if M>L[num][1]:
    M-=L[num][1]
    ans+=L[num][0]*L[num][1]
    num+=1
  else:
    ans+=L[num][0]*M
    M=0
print(ans)

Measured memory_bytes: 22376
Imports System

Module Program
    Sub Main(args As String())

        Dim sInputA As String() = Console.ReadLine().Split(" ")
        Dim sInputB As String() = Console.ReadLine().Split(" ")
        Dim sInputT As Long = Console.ReadLine()
        Dim iPositionA As Long = Long.Parse(sInputA(0))
        Dim iSpeedA As Long = Long.Parse(sInputA(1))
        Dim iPositionB As Long = Long.Parse(sInputB(0))
        Dim iSpeedB As Long = Long.Parse(sInputB(1))

        Dim Result As String = "NO"

        If iSpeedA < iSpeedB Then
            Result = "NO"
        ElseIf Math.Abs(iPositionA - iPositionB) <= sInputT * Math.Abs(iSpeedA - iSpeedB) Then
            Result = "YES"
        Else
            Result = "NO"
        End If

        Console.WriteLine(Result)

    End Sub
End Module


Measured memory_bytes: 28416
#include <cstdio>
#include <string>
#include <memory>
#include <array>

template<typename T>
class Data;
template<typename T>
using Data_ptr = std::unique_ptr<Data<T>>;

template<typename T>
class Data {

public:
    Data(T value) :
        value{ value },
        nextData{},
        prevData{} {
    }

    void insert(T value) {
        if (this->value == value) { return; }

        if (this->value < value) {
            if (!nextData) {
                nextData.reset(new Data<T>{ value });
                return;
            }
            return nextData->insert(value);
        }

        if (!prevData) {
            prevData.reset(new Data<T>{ value });
            return;
        }
        return prevData->insert(value);
    }

    bool find(T value) const {
        if (this->value == value) {
            return true;
        }
        if (this->value < value) {
            if (nextData) {
                return nextData->find(value);
            }
        } else {
            if (prevData) {
                return prevData->find(value);
            }
        }

        return false;
    }

private:
    T value;
    Data_ptr<T> nextData;
    Data_ptr<T> prevData;

};

class Dictionary {

    static constexpr int SIZE = 4;

public:
    Dictionary() :
        list{
            {
                Data_ptr<std::string>{ new Data<std::string>{ "" } },
                Data_ptr<std::string>{ new Data<std::string>{ "" } },
                Data_ptr<std::string>{ new Data<std::string>{ "" } },
                Data_ptr<std::string>{ new Data<std::string>{ "" } }
            }
        } {
    }

    bool find(std::string word) {
        const auto & findList = getList(word.front());
        return findList->find(word);
    }

    void insert(std::string word) {
        auto & findList = getList(word.front());
        return findList->insert(word);
    }

private:
    int getIndex(char firstWord) {
        switch (firstWord) {
        case 'A':
            return 0;
            break;
        case 'C':
            return 1;
            break;
        case 'G':
            return 2;
            break;
        case 'T':
            return 3;
            break;
        }
    }

    Data_ptr<std::string> & getList(char firstWord) {
        const int id = getIndex(firstWord);
        return list.at(id);
    }

    std::array<Data_ptr<std::string>, SIZE> list;

};

int main () {

    int n;
    std::scanf("%d", &n);

    Dictionary dictionary;
    while (n--) {
        constexpr int COMMAND_SIZE = 7;
        char command[COMMAND_SIZE];
        constexpr int WORD_SIZE = 13;
        char word[WORD_SIZE];
        std::scanf("%s %s", &command, &word);
        if (command[0] == 'i') { // insert
            dictionary.insert(word);
        } else if (command[0] == 'f') { // find
            if (dictionary.find(word)) {
                std::puts("yes");
            } else {
                std::puts("no");
            }
        }
    }

    return 0;

}

Measured memory_bytes: 24264
s = input()

cnt = 0
for c in s:
    if c.isupper():
        cnt = cnt + 1

if cnt != 2:
    print("WA")
    exit()

if not s[0] == "A":
    print("WA")
    exit()

if s[2:len(s)-1].count("C") == 1:
    print("AC")
else:
    print("WA")

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

#define int long long
#define pb push_back
#define f first
#define s second
#define all(container) container.begin(),container.end()

#define fast ios::sync_with_stdio(0); cin.tie(0)

int32_t main(){
  
    fast;

    string s; cin >> s;

    for(int i=0;i<s.size()-1;i++){
        if(s[i]==s[i+1]){
            cout << i+1 << " " << i+2;
            return 0;
        }
    }

    for(int i=0;i<s.size()-2;i++){
        if(s[i]==s[i+2]){
            cout << i+1 << " " << i+3;
            return 0;
        }
    }

    cout << -1 << " " << -1;
 
    return 0;
} 

Measured memory_bytes: 512
n = int(input())

g = [[0 for _ in range(n)] for _ in range(n)]

for i in range(n):
    [*s] = map(int, input().split(' '))
    for k in range(s[1]):
        g[i][s[2 + k] - 1] = 1

for i in range(n):
    for j in range(n):
        if j != 0:
            print(' ', end='')
        print(g[i][j], end='')
    print()



Measured memory_bytes: 7092
#include <iostream>
#include <fstream>
#include <string>
#include <vector>

using namespace std;

int main() {
	int a, b;

	cin >> a >> b;

	if ((a*b) % 2 == 0)
	{
		cout << "Even" << endl;
	}
	else
	{
		cout << "Odd" << endl;
	}

	return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    int t[n];
    int all = 0;
    for( int i = 0; i < n; ++i ) {
        cin >> t[i];
        all += t[i];

    }

    int fp = t[0];
    int mn = abs( fp - abs( all - fp ) );
    for( int i = 1; i < n; ++i ) {
        fp += t[i];
        mn = min( abs( fp - abs( all - fp ) ), mn );

    }
    cout << mn << endl;;


    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main()
{
    int n, y;
    cin >> n >> y;
    rep(i, n + 1)
    {
        rep(j, n + 1 - i)
        {
            int y_tmp = y;
            y_tmp -= i * 10000;
            y_tmp -= j * 5000;
            if (y_tmp >= 0 && i + j + (y_tmp / 1000) == n)
            {
                cout << i << " " << j << " " << (y_tmp / 1000) << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * d.cc: D - Redistribution
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 2000;
const int MOD = 1000000007;

/* typedef */

typedef long long ll;

/* global variables */

int dp[MAX_N + 1];

/* subroutines */

/* main */

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

  dp[0] = 1;
  for (int i = 1; i <= s; i++)
    for (int j = 3; j <= i; j++)
      dp[i] = (dp[i] + dp[i - j]) % MOD;

  printf("%d\n", dp[s]);
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  long long sum=0;
  int count = 0;
  
  vector<long long> a(N);
  for (int i=0; i<N ;i++){
    cin >> a.at(i);
    
    if(a.at(i)<0){
      a.at(i) = a.at(i)*(-1);
      count ++ ;
    }
    
    sum = sum + a.at(i);
  }
  
  sort(a.begin(),a.end());
  
  if(a.at(0)!=0 && count%2==1){
    cout << sum - 2*a.at(0) << endl;
  }
  else{
    cout << sum << endl;
  }
  
  
}

Measured memory_bytes: 4052
int n,k,i,c,p,r;
int main() {
  scanf("%d%d\n", &n, &k); k = -2 * k;
  while(i++ < n)if((c = getchar_unlocked()) != p)k++, p=c;
  printf("%d",n - (k < 1 ? 1 : k));
}
  

Measured memory_bytes: 128