akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

#define MAX 200000

#define NIL -1

struct node {
  int parent;
  int left;
  int right;
};


typedef struct node Node;
 
Node T[MAX];

int D[MAX],H[MAX];

int n;


void printTree(int u){ 

  int i, c;
  
  printf("node %d: ",u); 
  printf("parent = %d, ", T[u].parent);
  printf("sibling = %d, ", getSibling(u));
  printf("degree = %d, ", getDegree(u));
  printf("depth = %d, ", D[u]);
  printf("height = %d, ", H[u]);
   
 
  if(T[u].parent == NIL)
    { 
      printf("root");
    }
  else if(getDegree(u) == 0)
    { 
      printf("leaf");
    }
  else { 
    printf("internal node");
  }
  printf("\n");
}
 
 
void setDepth(int u, int d){ 

  if(u==NIL) return; 
 
  D[u] = d;
  
  if(T[u].left!=NIL)
    {
      setDepth(T[u].left, d+1); 
    }
  
  if(T[u].right!=NIL)
    {
      setDepth(T[u].right, d+1); 
    }
}

int setHeight(int u){ 

  int l_height=0, r_height=0;
 
  if(T[u].left != NIL)
    {
      l_height = setHeight(T[u].left) + 1;
    }
  
  if(T[u].right != NIL)
    {
      r_height = setHeight(T[u].right) + 1;
    }

  if(l_height > r_height)
    {
      H[u] = l_height;
    }
  else{
    H[u] = r_height;
  }
  return H[u];
}

int getSibling(int u) {

  if(T[u].parent == NIL)
    {
      return NIL;
    }

  if(T[T[u].parent].left != u && T[T[u].parent].left != NIL)
    {
      return T[T[u].parent].left;
    }
  
  if(T[T[u].parent].right != u && T[T[u].parent].right != NIL)
    {
      return T[T[u].parent].right;
    }
  return NIL;
}
 
int getDegree(int u) {

  int cnt=0;
  
  if(T[u].left != NIL)
    {
      cnt++;
    }
  
  if(T[u].right != NIL)
    {
      cnt++;
    }
  return cnt;
}



int main(){
  int i,j,key,left,right;
  int root = 0;
   
  scanf("%d",&n);
   
  for(i = 0;i < n;i ++)
    { 
      T[i].parent = NIL;
      T[i].left = NIL;
      T[i].right = NIL;
    }
  
  for(i = 0;i < n;i ++)
    {
      scanf("%d", &key);
      scanf("%d%d",&left, &right);
      T[key].left = left;
      T[key].right = right;
 
      if(left != NIL)
	{
	  T[left].parent = key;
	}
    
      if(right != NIL)
	{
	  T[right].parent = key;
	}
    }
  
  for(i = 0;i < n;i ++)
    {
      if(T[i].parent == NIL)
	{
	  root = i;
	}
    }
 
  setDepth(root, 0);
   
  setHeight(root);
 
  for(i = 0;i < n;i ++)
    {
      printTree(i);
    }
 
  return 0;
}

Measured memory_bytes: 616
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;
const int MOD = 1e9+7;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//C++17以上
template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main(){
    string s,t;cin >> s >> t;
    int ans = 0;
    rep(i,3){
        if(s[i] == t[i])ans++;
    }
    cout << ans << endl;
    return 0;
}

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

result_dict = {
    'AC': 0,
    'WA': 0,
    'TLE': 0,
    'RE': 0
}

for _ in range(N):
    result = input()

    result_dict[result] = result_dict[result] + 1

for k, v in result_dict.items():
    print('{} x {}'.format(k, v))

Measured memory_bytes: 9184
#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()
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<string> vs;
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
const ll MOD = 1000000007;

unordered_map<ll, ll> counts;

void prime_factorize(ll N){
    for(ll i = 2; i * i <= N; i++){
        if (N % i != 0) continue;
        while (N % i == 0){
            counts[i]++;
            N /= i;
        }
    }
    if (N != 1) counts[N]++;
}

int main() {
    ll N;
    cin >> N;
    rep2(i, 2, N + 1){
        prime_factorize(i);
    }
    ll ans = 1;
    for(auto c: counts){
        ans *= c.second + 1;
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
/**
 *      purpose : KEYENCE Programming Contest 2019 B
 *      author  : kyomukyomupurin
 *      created : 2019-01-13 21:02:19
**/

#include <bits/stdc++.h>
using namespace std;
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define fi first
#define se second

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s; cin >> s;
    int sizes = s.size();

    if (s == "keyence") {
        print("YES"); return 0;
    }

    for (int i = 0; i < sizes; ++i){
        for (int j = i; j < sizes; ++j){
            string t = s;
            t.erase(t.begin() + i, t.begin() + j);
            if (t == "keyence") {
                print("YES"); return 0;
            }
        }
    }
    print("NO");
    
    return 0;
}

Measured memory_bytes: 256
n = int(input())
i = list(map(int, input().split()))

f = 1
for k in range(1, n):
  if f == 0:
    continue
  
  if k == 0:
    continue
  
  if i[k-1] < i[k]:
    i[k] = i[k] - 1
  elif i[k-1] == i[k]:
    i[k] = i[k]
  else:
    f = 0
      
if f == 0:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 14224
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    int d[101];
    for(int i=0; i<N; i++) scanf("%d", &d[i]);
    set<int> val;
    for(int i=0; i<N; i++){
        val.insert(d[i]);
    }

    cout << val.size() << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

S = input()
K = int(input())

if len(S) == 1:
    print(K//2)
    sys.exit()
if len(S) == 2:
    if S[0] == S[1]:
        print(K)
    else:
        print('0')
    sys.exit()

olds = S[0]
l = 1
c = 0
first = 1
for i in range(1,len(S)):

    if olds == S[i]:
        l += 1
    else:
        if first:
            firstL = l
            first = 0
        c += l//2
        l = 1
    olds = S[i]
    
    if i == len(S)-1:
        if first:
            print(len(S)*K//2)
            sys.exit()
        lastL = l
        c += l//2

if S[0] == S[-1] and firstL%2 == 1 and lastL%2 == 1:
    print((c+1)*K-1)
else:
    print(c*K)


Measured memory_bytes: 3064
#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()
typedef long long ll;
static const int INF (1<<30);

int main() {
  int N; cin >> N;
  vector<string> s(N);
  rep(i, N) cin >> s[i];

  rep(i, N) sort(all(s[i]));

  sort(all(s));

  ll ans = 0LL;
  ll cnt = 1LL;
  for (int i = 1; i < N; i++) {
    if (s[i] == s[i-1]) {
      ans += cnt;
      cnt++;
    } else {
      cnt = 1LL;
    }
  }
  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 7296
def main():
    S = input()

    l = len(S)

    if S[0] != "A":
        print("WA")
        return

    i = S.find("C")

    if 1<i and i<l-1:
        pass
    else:
        print("WA")
        return

    sl = list(S)
    sl.pop(i)
    sl.pop(0)

    s = "".join(sl)

    if s.islower():
        print("AC")
        return
    else:

        print("WA")
        return

if __name__ == "__main__":
    main()

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



int main() {
	int h, w;
	cin >> h >> w;
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0; i<n; i++){
		cin >> a.at(i);
	}
	int grid[h][w];

	int x=0;
	int y=0;
	for(int i=0; i<n; i++){
		for(int j=0; j<a.at(i); j++){
			grid[x][y] = i+1;
			if(x % 2 == 0){
				if(y == w-1){
					x++;
				}else{
					y++;
				}
			}else{
				if(y == 0){
					x++;
				}else{
					y--;
				}
			}
		}
	}
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			cout << grid[i][j] << " ";
		}
		cout << endl;
	}
}

Measured memory_bytes: 384
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define pb push_back
#define mp make_pair
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;



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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

ll dfs(Graph& g, ll v, Array& c) {
	bool flag = true;
	for (auto e : g[v]) {
		if (c[e.to] == -1) {
			c[e.to] = !c[v];
			if (!dfs(g, e.to, c)) flag = false;
		}
		else {
			if (c[e.to] == c[v]) flag = false;
		}
	}

	return flag;
}

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

	ll n,m;
	cin >> n >> m;
	Graph g(n);
	REP(i, m) {
		ll a, b;
		cin >> a >> b;
		a--; b--;
		add_edge(g, a, b, 1, true, 1);
	}

	Array c(n, -1);
	c[0] = 0;
	if (dfs(g, 0, c)) {
		//2部グラフ
		ll con = 0;
		REP(i, n) if (c[i] == 0)con++;
		cout << con * (n - con) - m << endl;
	}
	else {
		//閉路がある場合
		cout << n * (n - 1) / 2 - m << endl;
	}

	return 0;
}


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

public class Main {


    public static void main(String args[] ) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String Origin = br.readLine();
        String Serch = br.readLine();

        String[] origin = Origin.split("");
        String[] serch = Serch.split("");
        int plusi = PlusI(serch);

        int Origin_length = origin.length;
       // System.out.println( SameString(serch) );
        for(int i = 0 ; i < Origin_length; ){


           int equal_point = Origin.indexOf(Serch , i);

           if(equal_point>-1){
        	   System.out.println(equal_point);
        	   i = equal_point+plusi;
           }
           else{
        	    break;
           }

        }


    }


    public static int PlusI(  String[] Serch ){


    	for(int j = 0; j < Serch.length; j++ ){

    	    if( Serch[j].equals(Serch[0]) && 0 < j){
    	    	return j;
    	    }

    	}


        return Serch.length;


    }


    public static boolean SearchWord(String[] Origin , String[] Serch , int i){


    	boolean SerchCheck = false;
    	for(int j = i , k = 0; k < Serch.length; j++ , k++){

    	    if( Serch[k].equals(Origin[j]) ){
    	    	SerchCheck = true;
    	    }
    	    else{
    	    	return false;
    	    }



    	}


    	return SerchCheck;

    }


    public static boolean SameString(String[] Serch ){


    	boolean SerchCheck = false;
    	for(int i = 0 ; i < Serch.length; i++){

    	    if( Serch[0].equals(Serch[i]) ){
    	    	SerchCheck = true;
    	    }
    	    else{
    	    	return false;
    	    }



    	}


    	return SerchCheck;

    }



}

Measured memory_bytes: 24872
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

int f_dir[2][4] = {{-1, 0, 1, 0}, {0, 1, 0, -1}}; //↑→↓←
int e_dir[2][8] = {{-1, -1, -1, 0, 0, 1, 1, 1}, {-1, 0, 1, -1, 1, -1, 0, 1}};
bool is_in_field(int y, int x, int h, int w){
  return (y >= 0 && y < h && x >= 0 && x < w);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  ll n; string s;
  cin >> n >> s;
  vector<ll> rgb(3, 0);
  for(int i = 0; i < n; i++){
    if(s[i] == 'R') rgb[0]++;
    else if(s[i] == 'G') rgb[1]++;
    else rgb[2]++;
  }

  ll all = (n)*(n-1)*(n-2)/6;

  for(ll i = 1; i <= n; i++){
    all -= max(n-i*2, 1LL*0);
  }

  all -= 1LL*(n)*(n-1)*(n-2)/6 - 1LL*(rgb[0])*(rgb[1])*(rgb[2]);

  for(ll i = 1; i <= n; i++){
    for(ll j = 0; j+i*2 <n; j++){
      if(s[j] == s[j+i] || s[j] == s[j+2*i] || s[j+i] == s[j+i*2]) all++;
    }
  }
  cout << all << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 3680
import qualified Data.IntMap as M

main = do
  li <- getLine
  let [n,m] = map read $ words li
  li <- getLine
  let as = map read $ words li
  co <- getContents
  let bcs = map readbc $ lines co
  let ans = compute n m as bcs
  print ans

readbc :: String -> (Int,Int)
readbc s = let [b,c] = map read $ words s in (b,c)

{-
なるべく全体を大きくしたいのだから、
asのうち、なるべく小さいものでci未満のものを、ciに書き換える。を繰り返す。
-}

compute :: Int -> Int -> [Int] -> [(Int,Int)] -> Int
compute n m as bcs = sum $ map (uncurry (*)) $ M.assocs amm
  where
    am0 = M.fromListWith (+) [ (a,1) | a <-as ]
    amm = foldl step am0 bcs
    step am (b,c) -- b個までc円に書き換え可能
      | c <= k = am -- 書き換えると安くなるので打ち切り
      | True = case compare a b of
        GT -> M.insertWith (+) c b $ M.insertWith (+) k (a-b) am1 -- 余った
        EQ -> M.insertWith (+) c b am1 -- ちょうど足りた
        LT -> step (M.insertWith (+) c a am1) (b-a, c)
      where
        ((k,a),am1) = M.deleteFindMin am -- k円のものはa個


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

using namespace std;

const int maxn = 1e5 + 42;
vector<pair<int, int>> g[maxn];

int used[maxn];
int pos[maxn];

void dfs(int v) {
    if(used[v]) {
        return;
    }
    used[v] = 1;
    for(auto it: g[v]) {
        int u = it.first;
        int c = it.second;
        pos[u] = pos[v] + c;
        dfs(u);
    }
}

int main() {
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    int l[m], r[m], d[m];
    for(int i = 0; i < m; i++) {
        cin >> l[i] >> r[i] >> d[i];
        l[i]--, r[i]--;
        g[l[i]].push_back({r[i], d[i]});
        g[r[i]].push_back({l[i], -d[i]});
    }
    for(int i = 0; i < n; i++) {
        dfs(i);
    }
    for(int i = 0; i < m; i++) {
        if(pos[l[i]] + d[i] != pos[r[i]]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 13824
/**
*    author:  yamako
*    created: 05.08.2020 23:02:17
**/

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;

struct Node {
    int key;
    Node *right, *left, *parent;
};

Node *root, *NIL;

Node * find(Node *u, int k) {
    while (u != NIL && k != u->key) {
        if (k < u->key) u = u->left;
        else u = u->right;
    }
    return u;
}

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while (x != NIL) {
        y = x;
        if (z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }

    z->parent = y;
    if (y == NIL) {
        root = z;
    } else {
        if (z->key < y->key) {
            y->left = z;
        } else {
            y->right = z;
        }
    }
}

void inorder(Node *u) {
    if (u == NIL) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u) {
    if (u == NIL) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main() {
    int n, i, x;
    string com;

    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        cin >> com;
        if (com[0] == 'f') {
            scanf("%d", &x);
            Node *t = find(root, x);
            if (t != NIL) printf("yes\n");
            else printf("no\n");
        } else if (com == "insert") {
            scanf("%d", &x);
            insert(x);
        } else if (com == "print") {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}


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

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

    long res=0, c=0;
    for(int i=n-1; i>=0; --i) {
        auto x=(a[i]+c)%b[i];
        if (x) {
            res+=b[i]-x;
            c+=b[i]-x;
        }
    }
    cout<<res<<endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
#define endl '\n'
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 222222


double dp[3333][3333];


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

  
  cin >> n;
  dp[0][0] = 1;
  rep(i, n) {
    double prob;
    cin >> prob;
    rep(j, 3332) {
      dp[i + 1][j + 1] += dp[i][j] * prob;
      dp[i + 1][j] += dp[i][j] * (1 - prob);
    }
  }
  double d = 0;
  FOR(i, (n + 2) / 2, 3333) d += dp[n][i];
  cout.precision(10);
  cout << fixed << d << endl;


  return 0;
}

Measured memory_bytes: 80128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll i=0; i<(n); i++)
typedef vector<ll> vl;
typedef vector<vector<ll>> matrix;//matrix A(n, vl(m)); //n*m行列
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sortup(V) sort(V.begin(), V.end())
#define sortdown(V) sort(V.rbegin(), V.rend())
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;}
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007 //998244353


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

    // solution comes here

    ll N;
    cin >> N;
    matrix A(2, vl(N));
    rep(i, 2)rep(j, N) cin >> A[i][j];

    rep(i, N) if(i) A[0][i] += A[0][i-1];
    rep(i, N) if(i) A[1][N-1-i] += A[1][N-i];

    ll ans=0;
    rep(i, N) chmax(ans, A[0][i]+A[1][i]);
    cout << ans << nl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (n % 2 == 1) {
        cout << "No" << endl;
        return 0;
    }
    for (int i = 0; i < n / 2; i++) {
        if (s[i] != s[n / 2 + i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        int m = sc.NextInt();
        Tuple<long, long>[] members = new Tuple<long, long>[n];
        Tuple<long, long>[] points = new Tuple<long, long>[m];

        for (int i = 0; i < n; i++)
        {
            members[i] = Tuple.Create(sc.NextLong(), sc.NextLong());
        }

        for (int i = 0; i < m; i++)
        {
            points[i] = Tuple.Create(sc.NextLong(), sc.NextLong());
        }

        for (int i = 0; i < n; i++)
        {
            var member = members[i];
            long minDist = long.MaxValue;
            int minPoint = 0;
            for (int j = 0; j < m; j++)
            {
                var point = points[j];
                long dist = Math.Abs(member.Item1 - point.Item1) + Math.Abs(member.Item2 - point.Item2);
                if (dist < minDist)
                {
                    minDist = dist;
                    minPoint = j + 1;
                }
            }
            Console.WriteLine(minPoint);
        }
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13268
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<deque>
using namespace std;

int main(){
    int ans=0;
    char s[5],t[5];
    scanf("%s",s);
    scanf("%s",t);
    for(int i=0;i<3;i++){
        if(s[i]==t[i]){
            ans++;
        }
    }
    printf("%d",ans);
}

Measured memory_bytes: 888
s = input()

a = int(s[:2])
b = int(s[2:])

if (a == 00 or a > 12) and b <= 12 and b >= 1:
  print("YYMM")
elif a <= 12 and a >= 1 and (b == 00 or b > 12):
  print("MMYY")
elif a <= 12 and a >= 1 and b <= 12 and b >= 1:
  print("AMBIGUOUS")
else:
  print("NA")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define rep2(i,a,b) for (ll i = (a); i < (b); ++i)

#define INF (1<<18)


int main() {
    ll h;
    cin>>h;

    ll cnt = 0;

    while(h > 0){
        h /= 2;
        cnt++;
    }

    cout<<setprecision(30)<<pow(2, cnt) - 1<<endl;
    return 0;
}

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

int main(){
  int n, k; cin >> n >> k;
  vector<long long> h(n);
  for(int i = 0; i < n; i++){
    cin >> h.at(i);
  }
  long long ans = 1001001001001001;
  for(int i = 0; i < (1<<n); i++){
    long long sum = 0, tmp = 0;
    int can_see = 0;
    for(int j = 0; j < n; j++){
      if(tmp < h.at(j)){
        tmp = h.at(j);
        can_see++;
      }
      else{
        if(i & (1 << j)){
          sum += tmp - h.at(j) + 1;
          tmp++;
          can_see++;
        }
      }
      if(can_see >=k) ans = min(ans, sum);
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 3564
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

ll modadd(ll x, ll y) {
    return ((x + y) % mod + mod) % mod;
}

ll modminus(ll x, ll y) {
    return (x - y + mod) % mod;
}

ll multiply(ll x, ll y) {
    return (x % mod) * (y % mod) % mod;
}

ll dp[2][10000];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, P;
    cin >> N >> P;
    mod = P;
    string S;
    cin >> S;
    ll ans = 0;
    if (P == 2 || P == 5) {
        REP(i, 0, S.size()) {
            ll num = S[i] - '0';
            if (num % P == 0) {
                ans += i + 1;
            }
        } 
    } else {
        // REP(i, 0, S.size()) {
        //     ll num = S[i] - '0';
        //     swap(dp[0], dp[1]);
        //     dp[0][0]++;
        //     fill(dp[1], dp[1] + P, 0);
        //     REP(j, 0, P) {
        //         dp[1][((j * 10) + num) % P] = dp[1][((j * 10) + num) % P] + dp[0][j];
        //     }
        //     ans += dp[1][0];
        //     // REP(j, 0, P) {
        //     //     cout << dp[1][j] << " ";
        //     // }
        //     // cout << endl;
        // }
        reverse(S.begin(), S.end());
        ll ten = 1;
        map<ll, ll> mp;
        ll now = 0;
        REP(i, 0, S.size()) {
            ll num = S[i] - '0';
            now = modadd(now, multiply(num, ten));
            if (now == 0) {
                ans++;
            }
            ans += mp[now];
            mp[now]++;
            ten = multiply(ten, 10);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1044
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	int s;
	cin>>s;
	switch(s){
		case 22:ce("Christmas Eve Eve Eve")break;
		case 23:ce("Christmas Eve Eve")break;
		case 24:ce("Christmas Eve")break;
		case 25:ce("Christmas")break;
		
	}
	
}


Measured memory_bytes: 256
# -*- coding:utf-8 -*-
a,b,c = map(int,input().split())
if a <= b and a <= c:
    if b <= c:
        print(a,b,c)
    elif b >= c:
        print(a,c,b)
elif b <= a and b <= c:
    if a <= c:
        print(b,a,c)
    elif a >= c:
        print(b,c,a)
elif c <= a and c <= b:
    if a <= b:
        print(c,a,b)
    elif a >= b:
        print(c,b,a)

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

int main() {
	int n;
	cin >> n;
	do {
		n -= 1000;
		if (n <= 0) {
			n += 1000;
			break;
		}
	} while (n >=0);
	cout << 1000 - n << endl;
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <cstring>

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))

#define INF (int)1e9+7

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

using namespace std;

typedef long long ll;

int main(){
    int cur;
    string ans;

    string s;
    cin >> s;

    for(int i = 0; i < (1 << 3); i++){
        
        ans = s[0];
        cur = (s[0] - '0');

        for(int j = 1; j < 4; j++){
            if( (1 << j-1) & i ){
                ans += "+";
                ans += s[j];
                cur += (s[j] - '0');
            }
            else {
                ans += "-";
                ans += s[j];
                cur -= (s[j] - '0');
            }
        }
        if(cur == 7){
            cout << ans << "=7" << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(void){
  int n,m,c;cin>>n>>m>>c;
  int b[m],a[n][m];
  int cnt=0;
  rep(i,m)cin>>b[i];
  rep(i,n){
    int sol=0;
    rep(j,m){
      cin>>a[i][j];
      sol+=a[i][j]*b[j];
    }
    if(sol+c>0)cnt++;
  }
  cout<<cnt<<endl;
}

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

int main(){
  int N;
  double ans=0;
  cin >> N;
  double x[N+1];
  char u[3*N+1];
  for(int i=1; i<=N; ++i) cin >> x[i] >> u[3*i-2] >> u[3*i-1] >> u[3*i];
  for(int i=1; i<=N; ++i){
    if((u[3*i-2]=='B')&&(u[3*i-1]=='T')&&(u[3*i]=='C')) x[i] *= 380000;
    ans += x[i];
  }
  cout << fixed << setprecision(10) << ans << endl;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,1,0,0,1,-1,1,-1};
const int dx[] = {0,0,-1,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}
const string Dir = "UDLR^v<>";
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll t;
  cin >> t;
  rep(z,t){
    if(z) cout << endl;
    ll h,w,x,y,dir;
    cin >> h >> w;
    vector<vector<char>> v(h,vector<char>(w));
    rep(i,h){
      rep(j,w){
        cin >> v[i][j];
        if(v[i][j] == '^'){
          dir = 0;
          x = j,y = i;
        }
        if(v[i][j] == 'v'){
          dir = 1;
          x = j,y = i;
        }
        if(v[i][j] == '<'){
          dir = 2;
          x = j,y = i;
        }
        if(v[i][j] == '>'){
          dir = 3;
          x = j,y = i;
        }
      }
    }
    ll n;
    cin >> n;
    string s;
    cin >> s;
    rep(i,n){
      if(s[i] != 'S'){
        rep(j,4){
          if(s[i] == Dir[j]){
            dir = j;
            break;
          }
        }
        ll nx = x + dx[dir],ny = y+dy[dir];
        if(value(nx,ny,w,h)){
          if(v[ny][nx] == '.'){
            v[y][x] = '.';
            x = nx,y = ny;
            v[ny][nx] = Dir[dir+4];
          }
          else{
            v[y][x] = Dir[dir+4];
          }
        }
        else{
          v[y][x] = Dir[dir+4];
        }
      }
      else{
        ll nx = x,ny = y;
        while(1){
          nx += dx[dir],ny += dy[dir];
          if(!value(nx,ny,w,h)) break;
          if(v[ny][nx] == '*'){
            v[ny][nx] = '.';
            break;
          }
          if(v[ny][nx] == '#'){
            break;
          }
        }
      }
    }
    rep(k,h){
      rep(j,w){
        cout << v[k][j] ;
      }
      cout << endl;
    }
  }
  return 0;
}

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

int main(){
  ll n,a,i;
  cin >> n;
  a=-1;
  for(i=1;i<10;i++){
    if((n%i==0)&(n/i<10)&(n/i>0)){
      a=0;
    }
  }
  if(a==0) cout << "Yes" <<endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
ab = input().split()
a = int(ab[0])
b = ab[1]
import math
s = a*int(b[0])
ad = None
if len(b) > 2:
  tmp = str(a*int(b[2]))
  if len(str(tmp)) > 1:
    s+=int(str(a*int(b[2]))[:-1])
  ad = int(str(a*int(b[2]))[-1])
if len(b) > 3:
  tmp = str(a*int(b[3]))
  if len(str(tmp)) > 2:
    s+=int(str(a*int(b[3]))[:-2])
  if len(str(a*int(b[3]))) > 1 and ad:
    ad += int(str(a*int(b[3]))[-2])
    if ad > 9:
      s += int(str(ad)[:-1])
  

print(s)

Measured memory_bytes: 9132
# -*- coding: utf-8 -*-
A, B, C, D = map(int, input().split())

i = 0
while A > 0 and C > 0:
  i += 1
  if i % 2 == 1:
    # 高橋くんの攻撃
    C -= B
  else:
    # 青木くんの攻撃
    A -= D

if C <= 0:
  print("Yes")
else:
  print("No")

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

using namespace std;

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

	for (int i = 1; i <= N - 1; i++) {
		cin >> B[i];
	}

	int ans = B[1] + B[N - 1];

	for (int i = 0; i <= N - 2; i++) {
		ans += min(B[i], B[i + 1]);
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
 
int main(){
  int a, b;
  
  std::cin >> a >> b;
  
  if( (a*b)%2 == 0)
  {
    std::cout << "Even" << std::endl;
  }
  else
  {
  	std::cout << "Odd" << std::endl;
  }
  
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef pair<string,int> p;

struct data{
    string s;
    int n,id;
};

bool cmp(data x,data y){
    if(x.s==y.s){
        return x.n>y.n;
    }else{
        return x.s<y.s;
    }
}
int main()
{
    vector<data> v;
    int t;
    cin >> t;
    data x;
    for(int i=1;i<=t;i++){
        cin >> x.s >> x.n;
        x.id=i;
        v.push_back(x);
    }
    sort(v.begin(),v.end(),cmp);
    for(int i=0;i<v.size();i++){
        cout << v[i].id << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>//stayCalmNeverSettle
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define endl "\n"
using namespace std;
typedef long long ll;

void solve(){
    int n;
    cin >> n;
    int r = n/1000;
    if(n%1000!=0){
        r++;
    }
    cout << (r*1000)-n << endl;
}   
    
int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
    //     freopen("output.txt","w",stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int N = reader.nextInt();
		int K = reader.nextInt();
		int ans = 1;
		for (int i = 0; i<N;i++) {
			if (ans < K) {
				ans *= 2;
			} else {
				ans += K;
			}
		}

		System.out.print(ans);
		reader.close();
	}
}





Measured memory_bytes: 21844
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

enum {
	x,
	y,
};

void kochCurve(int n, double p1[], double p2[])
{
	if (n == 0) return;
	double s[2], t[2], ts[2], u[2];
	s[x] = (2 * p1[x] + p2[x]) / 3;
	s[y] = (2 * p1[y] + p2[y]) / 3;
	t[x] = (p1[x] + 2 * p2[x]) / 3;
	t[y] = (p1[y] + 2 *p2[y]) / 3;
	ts[x] = t[x] - s[x];
	ts[y] = t[y] - s[y];
	u[x] = s[x] + ts[x] * cos(M_PI / 180 * 60) - ts[y] * sin(M_PI / 180 * 60);
	u[y] = s[y] + ts[x] * sin(M_PI / 180 * 60) + ts[y] * cos(M_PI / 180 * 60);
	kochCurve(n - 1, p1, s);
	cout << s[x] << " " << s[y] << endl;
	kochCurve(n - 1, s, u);
	cout << u[x] << " " << u[y] << endl;
	kochCurve(n - 1, u, t);
	cout << t[x] << " " << t[y] << endl;
	kochCurve(n - 1, t, p2);
}

int main() {
	int n;
	cin >> n;
	double p1[2] = { 0, 0 };
	double p2[2] = { 100, 0 };
	cout << fixed << setprecision(8);
	cout << p1[x] << " " << p1[y] << endl;
	kochCurve(n, p1, p2);
	cout << p2[x] << " " << p2[y] << endl;
	return 0;
}


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

#define ll long long int
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pb push_back
#define el '\n'
#define N 1000000007
#define re return
#define PI 3.14159265
#define take(a,n) for(int i=0;i<(n);i++) cin>>(a)[i]
#define out(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" ";
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int (i)=0;i<(n);(i)++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
using namespace std;


ll poww(ll a,ll b)
{
  ll ans=1;
  for(int i=1;i<=b;i++)
  {
    ans*=a;
  }
  return ans;
}


int max(int a,int b,int c)
{
  if(a>=b && a>=c) return a;
  if(b>=a && b>=c) return b;
  return c;
}

ll ncr(int n,int r)
{
  ll ans=1;
  forup(i,r)
  {
    ans=(ans*(n-i)/(i+1))%N;
  }
  re ans;
}

int main()
{
  int a,b;
  cin>>a>>b;
  int ans=0;
  int x=1;
  while(x<b)
  {
    x+=a-1;
    ans++;
  }
  cout<<ans;
}


Measured memory_bytes: 256
# abc148_a.py
# https://atcoder.jp/contests/abc148/tasks/abc148_a

# A - Round One /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点: 100点

# 問題文
# 高橋君はペーパークイズを解いています。高橋君はすらすらと解いていき、残すは最終問題のみとなりました。
# この問題は、答えが 1,2,3のいずれかである 3択問題です。
# 高橋君は超能力によって、Aと Bが誤答であることがわかりました。
# この問題の答えを出力してください。

# 制約
#     A,Bは 1,2,3のいずれか
#     Aと Bは異なる

# 入力
# 入力は以下の形式で標準入力から与えられる。
# A
# B

# 出力
# 答えを出力せよ。

# 入力例 1
# 3
# 1

# 出力例 1
# 2

# 1,2,3のうち、3 でも 1 でもないのは 2です。

# 入力例 2
# 1
# 2

# 出力例 2
# 3


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    A = int(lines[0])
    B = int(lines[1])
    # N, M = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    result = 6 - A - B

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['3', '1']
        lines_export = [2]
    if pattern == 2:
        lines_input = ['1', '2']
        lines_export = [3]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


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

map<int, ll> f;

int main(){
	ll x;
	cin >> x;

	for(int i=-119; i<=119; i++){
		f[i] = (ll)i*i*i*i*i;
	}

	for(int a=-118; a<=119; a++){
		for(int b=-119; b<=118; b++){
			if(f[a] - f[b] == x){
				cout << a << " " << b << endl;
				return 0;
			}
		}
	}

	return 0;
}


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

int main(){
    int n, k, in;
    cin >> n >> k;
    int ans = 0;
    rep(i, n){
        cin >> in;
        if(in >= k) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            int w = Integer.parseInt(in.next());

            // 出力
            for (int i = 0; i < S.length(); i = i + w) {
                out.print(S.charAt(i));
            }

        }

    }
}



Measured memory_bytes: 21460
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int dp[55][55];
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
string ma[55];
int main()
{
	int h,w,bl=0,inf=1001001;
	cin>>h>>w;
	rep(i,h) cin>>ma[i];
	rep(i,55) rep(j,55) dp[i][j]=inf;dp[0][0]=0;
	rep(l,5000) rep(i,h) rep(j,w) rep(k,4){
		int x=i+dx[k],y=j+dy[k];
		if(x<0 || y<0 || x>=h || y>=w) continue;
		if(ma[i][j]=='#' || ma[x][y]=='#') continue;
		dp[x][y]=min(dp[i][j]+1,dp[x][y]);
	}
	if(dp[h-1][w-1]>=inf) cout<<-1<<endl;
	else{
		rep(i,h) rep(j,w){
			if(ma[i][j]=='#') bl++;
		}
		cout<<h*w-1-dp[h-1][w-1]-bl<<endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=2e5;

int main(){
	int N;
	cin>>N;
	int c[MAX+1];
	rep1(k,N){
		int x;
		cin>>x;
		c[x]=k;
	}
	int inc=0,now=0,mx=0;
	rep1(i,N){
		if(now<c[i]){
			inc++;
			now=c[i];
			mx=max(mx,inc);
		}
		else{
			inc=1;
			now=c[i];
		}
	}
	cout<<N-mx;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

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; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


class C {
	int n, y;
	const int bills[3]{ 10000, 5000, 1000 };
public:
	C()
	{
		cin >> n >> y;
		y /= 1000;
	}

	void solve()
	{

		REPC(a, n)
		{
			int target{ y - 10 * a };
			if (target < 0)
				break;

			int canUse{ n - a };
			int makeMin{ canUse }, makeMax{ 5 * canUse };
			
			if (target < makeMin || target > makeMax)
				continue;

			if ((target - makeMin) % 4)
				continue;

			int b = (target - makeMin) / 4;
			int c = n - a - b;

			cout << a << " " << b << " " << c << endl;
			return;
		}

		cout << "-1 -1 -1" << endl;
	}
};


int main()
{
	C solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,h,w;
    cin>>n>>h>>w;
    int ans=0;
    for(int i=0;i<n;++i)
    {
        ll x,y;
        cin>>x>>y;
        if(x>=h && y>=w) ans++;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256