akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
    public static void main(String[] args) throws IOException {
        try (PrintWriter writer = new PrintWriter(System.out); InputReader reader = new InputReader(System.in)) {
            int[] nmx = reader.readIntsSplitByDelimiter(" ");
            int[] costIndexs = reader.readIntsSplitByDelimiter(" ");

            int costToRight = 0;
            int costToLeft = 0;
            for (int costIndex : costIndexs) {
                if (costIndex < nmx[2]) {
                    costToRight++;
                } else {
                    costToLeft++;
                }
            }

            if (costToRight < costToLeft) {
                System.out.println(costToRight);
            } else {
                System.out.println(costToLeft);
            }
        }
    }
}

class InputReader implements Closeable, AutoCloseable {
    private final BufferedReader br;

    InputReader(InputStream inputStream) {
        this.br = new BufferedReader(new InputStreamReader(inputStream));
    }

    String readLine() throws IOException {
        return this.br.readLine();
    }

    int readInt() throws IOException {
        return Integer.parseInt(this.br.readLine());
    }

    long readLong() throws IOException {
        return Long.parseLong(this.br.readLine());
    }

    String[] readStringsSplitByDelimiter(String delimiter) throws IOException {
        return this.br.readLine().split(delimiter);
    }

    int[] readIntsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.br.readLine().split(delimiter);

        int stringsLength = strings.length;
        int[] ints = new int[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            ints[i] = Integer.parseInt(strings[i]);
        }

        return ints;
    }

    long[] readLongsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.br.readLine().split(delimiter);

        int stringsLength = strings.length;
        long[] longs = new long[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            longs[i] = Long.parseLong(strings[i]);
        }

        return longs;
    }

    @Override
    public void close() throws IOException {
        br.close();
    }
}

Measured memory_bytes: 22612
N = int(input())
A = sorted(int(input()) for _ in range(N))
if N % 2:
    B1 = A[:N // 2]
    C1 = A[N // 2:]
    c1 = 2 * sum(C1) - C1[0] - C1[1]
    b1 = 2 * sum(B1)
    B2 = A[:N // 2 + 1]
    C2 = A[N // 2 + 1:]
    c2 = 2 * sum(C2)
    b2 = 2 * sum(B2) - B2[-1] - B2[-2]
    print(max(c1 - b1, c2 - b2))
else:
    B = A[:N // 2]
    C = A[N // 2:]
    c = 2 * sum(C) - C[0]
    b = 2 * sum(B) - B[-1]
    print(c - b)


Measured memory_bytes: 8544
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    a = LI()
    print(["First","Second"][((n&1)&(1^sum(a)&1))|((1^n&1)&(1^sum(a)&1)&(1^min(a)&1))])
    return

#Solve
if __name__ == "__main__":
    solve()



Measured memory_bytes: 29716
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N, K; cin >> N >> K;
    vector<int> P(N), C(N);
    rep(i,N) {
        int j; cin >> j; j--;
        P[i] = j;
    }
    rep(i,N) {
        cin >> C.at(i);
    }
    vector<vector<int>> G;
    vector<ll> MON;

    ll max = -9999999999;
    rep(i,N) {
        int cur = P[i];
        bool found = false;
        rep(j, G.size()) {
            vector<int>& H = G[j];
            auto x = find(H.begin(), H.end(), cur);
            if (x != H.end()) {
                found = true;
                break;
            }
        }
        if (found) continue;
        vector<int> L;
        L.push_back(cur);
        ll money = 0;
        while (1) {
            money += C[cur];
            cur = P[cur];
            if (cur == P[i]) break;
            L.push_back(cur);
        }
        G.push_back(L);
        MON.push_back(money);
    }

    rep(i,N) {
        rep(j, G.size()) {
            vector<int>& H = G[j];
            auto x = find(H.begin(), H.end(), P[i]);
            if (x != H.end()) {
                ll score = 0;
                ll ma = -9999999999;
                if (MON[j] < 0) {
                    rep(k, H.size()) {
                        score += C[*x];
                        if (ma < score) ma = score;
                        x = next(x);
                        if (x == H.end()) x = H.begin();
                    }
                } else {
                    ll s1 = MON[j] * (K / H.size());
                    rep(k, K % H.size()) {
                        s1 += C[*x];
                        if (ma < s1) ma = s1;
                        x = next(x);
                        if (x == H.end()) x = H.begin();
                    }
                    ll s2 = MON[j] * (K / H.size() - 1);
                    x = find(H.begin(), H.end(), P[i]);
                    rep(k, H.size()) {
                        s2 += C[*x];
                        if (ma < s2) ma = s2;
                        x = next(x);
                        if (x == H.end()) x = H.begin();
                    } 
                }
                if (max < ma) max = ma;
                break;
            }
        }
    }
    cout << max << endl;
}


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

using namespace std;
using ll = long long;

int main() {
  int N, W;
  cin >> N >> W;
  vector<ll> w(N + 1);
  vector<ll> v(N + 1);
  rep(i, N) cin >> w[i + 1] >> v[i + 1];
  vector<vector<ll> > dp(N + 1, vector<ll>(W + 1, 0));
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= W; j++) {
      if (w[i] <= j) {
        dp[i][j] = dp[i - 1][j - w[i]] + v[i];
      }
      dp[i][j] = max(dp[i - 1][j], dp[i][j]);
    }
  }
  // rep(i, N + 1) {
  // rep(j, W + 1) { cout << dp[i][j] << ", "; }
  // cout << endl;
  // }
  cout << dp[N][W] << endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  if ( n/10%111 == 0 ){
    cout << "Yes" << endl;
  }
  else if ( n%1000%111 == 0 ) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
n,m = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(m)]
for i in range(10001):
    if len(str(i)) != n:
        continue
    for j in l:
        if str(i)[j[0]-1] != str(j[1]):
            break
    else:
        print(i)
        exit()
else:
    print(-1)

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

int GCD(int a,int b)
{
    while (b != 0) {
        int rest = a % b;
        a = b;
        b = rest;
    }
    return a;
}

int LCM(int a, int b)
{
    return a / GCD(a, b) * b;
}

int main()
{
    for (int a, b; cin >> a >> b;)
        cout << GCD(a, b) << " " << LCM(a, b) << endl;

    return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

int main(){
	ll a,b;
	cin>>a>>b;
	cout << (a+b)%24 << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		char[] list = sc.next().toCharArray();
		boolean ch = false, bch=false, bbch=false;
		int Count = 0;
		for(int i = 0; i < N - 2; i++) {
			if(list[i] == 'A' && list[i+1] == 'B' && list[i+2] == 'C') {
				Count++;
			}
		}
		System.out.println(Count);
	}
}

Measured memory_bytes: 23636
import sys
input = sys.stdin.buffer.readline

def init_prime(n_max: int):
    """ https://qiita.com/fantm21/items/5e270dce9f4f1d963c1e
    # returns prime list [2..n_max]
    """
    if n_max <= 1: return []
    if n_max == 2: return [2,]
    prime = [2,]
    _app_p = prime.append
    n_rt = int(n_max**.5)
    data = list(range(3, n_max+1, 2))
    while data:
        p = data[0]
        if p > n_rt:
            return prime + data
        _app_p(p)
        data = [e for e in data if e%p]


def main():
    N = int(input())
    vP = init_prime(N+50000)
    #print("... " if len(vP)>16 else "", end="")
    #print(*vP[-16:])
    #print("counts: ", len(vP))
    for p in vP:
        if p >= N:
            print(p)
            return


if __name__ == "__main__":
    main()


Measured memory_bytes: 6424
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        hs: [i64; n],
    }
    let sum = hs
        .windows(2)
        .map(|x| std::cmp::max(0, x[1] - x[0]))
        .sum::<i64>();
    let ans = sum + hs[0];
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>
#include <utility>
#include <climits>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;
constexpr auto mod = 1000000007;
constexpr auto INF = ULLONG_MAX;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }
template <typename T> inline T max_value(vector<T>& x) { return *max_element(x.begin(), x.end()); }
template <typename T> inline T min_value(vector<T>& x) { return *min_element(x.begin(), x.end()); }
template <typename T> inline T sum_value(vector<T>& x) { return accumulate(x.begin(), x.end(), 0); }

int main() {
  ull n, k;
  cin >> n >> k;
  string s;
  cin >> s;

  s[k-1] = tolower(s[k-1]);

  cout << s << endl;


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i=int(a); i<int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
typedef long long ll;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define y0 snowy0
#define y1 snowy1
#define next snownext
#define prev snowprevc

template<class T> bool chmax(T& a, const T& b) { if (a<b) { a=b; return 1; } return 0; } 
template<class T> bool chmin(T& a, const T& b) { if (b<a) { a=b; return 1; } return 0; } 
template<class T = int> T in() { T x; cin >> x; return x; }

#ifdef LOCAL
  #define db cout << "L" << __LINE__ << ": "
  #define dv(v) << #v << "->" << v << " "
  #define de << endl
#else
  #define db
  #define dv(v)
  #define de
#endif

int cs[1000][1000];
set<pair<int, int>> vert;
set<pair<int, int>> hori;
int N;
int C;

void update_coaster(int x, int y) {
  int nx = N-x-1;
  int ny = N-y-1;
  if (vert.count(mp(x, y)) || vert.count(mp(nx, y))) {
    vert.erase(mp(x, y));
    vert.erase(mp(nx, y));
  } else {
    vert.insert(mp(x, y));
    vert.insert(mp(nx, y));
  }
  if (hori.count(mp(x, y)) || hori.count(mp(x, ny))) {
    hori.erase(mp(x, y));
    hori.erase(mp(x, ny));
  } else {
    hori.insert(mp(x, y));
    hori.insert(mp(x, ny));
  }
}

void init_coaster() {
  rep(y, N/2) {
    rep(x, N) {
      int nx = N-x-1;
      int ny = N-y-1;
      if (cs[y][x] != cs[ny][x]) {
        hori.insert(mp(x, y));
        hori.insert(mp(x, ny));
      }
    }
  }
  rep(y, N) {
    rep(x, N/2) {
      int nx = N-x-1;
      int ny = N-y-1;
      if (cs[y][x] != cs[y][nx]) {
        vert.insert(mp(x, y));
        vert.insert(mp(nx, y));
      }
    }
  }
}

bool is_mirror() {
  return vert.empty() && hori.empty();
}

int main() {
  C = in();
  N = in();
  rep(y, N) {
    rep(x, N) {
      char c = in<char>();
      cs[y][x] = c - '0';
    }
  }

  int ans = 0;
  init_coaster();
  if (is_mirror()) ans++;
  rep(i, C-1) {
    int D = in();
    rep(j, D) {
      int y = in()-1;
      int x = in()-1;
      update_coaster(x, y);
    }
    if (is_mirror()) ans++;
  }
  cout << ans << endl;
}




Measured memory_bytes: 47380
#include<stdio.h>
#define MAX 505000
#define INF 2000000000
int L[MAX/2],R[MAX/2],c=0;
void merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  n1=mid-left;
  n2=right-mid;
  for(i=0;i<n1;i++) L[i]=A[left+i];
  for(i=0;i<n2;i++) R[i]=A[mid+i];
  L[n1]=INF;
  R[n2]=INF;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
    }
    else{
      A[k]=R[j];
      j++;
    }
    c++;
  }
}

void mergeSort(int A[],int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2 ;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
} 
int main(){
  int i,n,S[MAX];
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&S[i]);
  mergeSort(S,0,n);
  for(i=0;i<n;i++){
    if(i) printf(" ");
    printf("%d",S[i]);
  }
  printf("\n");
  printf("%d\n",c);
  return 0;
}



Measured memory_bytes: 5624
N = int(input())
job = [list(map(int, input().split())) for _ in range(N)]
job.sort(key=lambda x: x[1])
time = 0
FLG = True

for need, limit in job:
    time += need
    if time > limit:
        FLG = False
        break

if FLG:
    print("Yes")
else:
    print("No")


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

int main(){
  int D;
  cin >> D ;
  if(D == 25)
    cout <<"Christmas" << endl ;
  if (D == 24)
    cout <<"Christmas Eve" << endl;
  if(D == 23)
    cout <<"Christmas Eve Eve" <<endl;
  if (D == 22)
    cout << "Christmas Eve Eve Eve" <<endl;
}

Measured memory_bytes: 256
from fractions import gcd
A,B=map(int,input().split())
G=gcd(A,B)
a=1
for i in range(2,10**6+1):
    t=0
    while 1:
        if G%i==0:
            G//=i
            t+=1
        else:
            break
    if t:
        a+=1
if G>10**6:
    a+=1
print(a)

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

int main() {
    string input;
    getline(cin,input);
    int i=0;
    while(i<input.length()){
        if(input[i]>64 && input[i]<=90 )
        input[i]+=32;
        else if (input[i]>96 && input[i]<=122)
            input[i]=input[i]-32;
        i++;
    }
    cout << input <<endl;
}


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

const int INF = (1LL << 31) - 1;

struct segtree {
	int H, W, H_, W_;
	int dat[9000000];
	segtree() {}
	segtree(vector<vector<int>> &f) {
		init(f);
	}
	int x(int i, int j) {
		return i * W_ + j;
	}

	void init(vector<vector<int>> &f) {
		H = W = 1;
		while(H < (int)f.size()) H <<= 1;
		while(W < (int)f[0].size()) W <<= 1;
		H_ = 2 * H - 1, W_ = 2 * W - 1;
		for(int i = 0; i < (int)f.size(); i++)
			for(int j = 0; j < (int)f[0].size(); j++)
				dat[x(i + H - 1, j + W - 1)] = f[i][j];
		for(int i = 2 * H - 2; i > H - 2; i--)
			for(int j = W - 2; j >= 0; j--)
				dat[x(i, j)] = min(dat[x(i, 2 * j + 1)], dat[x(i, 2 * j + 2)]);
		for(int i = H - 2; i >= 0; i--)
			for(int j = 0; j < 2 * W - 1; j++)
				dat[x(i, j)] = min(dat[x(2 * i + 1, j)], dat[x(2 * i + 2, j)]);
	}
	int query(int li, int lj, int ri, int rj) { return query_h(li, lj, ri, rj, 0, H, 0); }
	int query_h(int li, int lj, int ri, int rj, int si, int ti, int k) {
		if(ri <= si || ti <= li) return INF;
		if(li <= si && ti <= ri) return query_w(lj, rj, 0, W, k, 0);
		const int mi = (si + ti) / 2;
		return min(query_h(li, lj, ri, rj, si, mi, 2 * k + 1), query_h(li, lj, ri, rj, mi, ti, 2 * k + 2));
	}
	int query_w(int lj, int rj, int sj, int tj, int i, int k) {
		if(rj <= sj || tj <= lj) return INF;
		if(lj <= sj && tj <= rj) return dat[x(i, k)];
		const int mj = (sj + tj) / 2;
		return min(query_w(lj, rj, sj, mj, i, 2 * k + 1), query_w(lj, rj, mj, tj, i, 2 * k + 2));
	}
};

vector<vector<int>> f;
segtree st;

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

	int r, c, q;
	while(cin >> r >> c >> q, r | c | q) {
		f.assign(r, vector<int>(c, 0));
		for(int i = 0; i < r; i++) {
			for(int j = 0; j < c; j++) {
				cin >> f[i][j];
			}
		}

		st.init(f);
		while(q--) {
			int r1, c1, r2, c2;
			cin >> r1 >> c1 >> r2 >> c2;
			cout << st.query(r1, c1, r2 + 1, c2 + 1) << endl;
		}
	}
}

Measured memory_bytes: 65284
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
using namespace std;
#define FAST   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll          long long
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define mii         map<int,int>
#define vi          vector<int>
#define vll         vector<long long>
#define all(a)      (a).begin(),(a).end()
#define clz(a)      __builtin_clz(a) // count leading zeroes
#define ctz(a)      __builtin_ctz(a) // count trailing zeroes
#define popc(a)     __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul         1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define SIZE        1000005
#define F           first
#define S           second
#define debug(x)    cerr << #x << " = " << x << endl;
#define mod         998244353

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " = " << arg1<<" |";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define endl        '\n'
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

ll dp[3005]={0};
void solve()
{
   int r,g,b,n; cin>>r>>g>>b>>n;
   int a[3];
   a[0]=r,a[1]=g,a[2]=b;
   dp[0]=1;
   rep(i,0,3)
   {
     rep(j,1,n+1)
     {
        if(j>=a[i]) dp[j]+=dp[j-a[i]];
     }
   }
   cout<<dp[n];
} 
int main()
{   
   FAST;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; t=1;
    while(t--){
       solve();
    }
    return 0;
}

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

int main(int argc, char *argv[])
{
    string input;
    int num;
    int *num_cnt = new int[26]();
    while (getline(cin, input))
    {
        for (int i = 0; i < input.size(); i++)
        {
            if ('A' <= input[i] && input[i] <= 'Z')
            {
                num = input[i] - 'A';
                num_cnt[num]++;
            }
            else if ('a' <= input[i] && input[i] <= 'z')
            {
                num = input[i] - 'a';
                num_cnt[num]++;
            }
        }
    }
    for (int i = 0; i < 26; i++)
    {
        cout << (char)('a' + i) << " : " << num_cnt[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3096
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
      int N;
      String S;
      Scanner sc = new Scanner(System.in);
      N = sc.nextInt(); //入力文字数
      S = sc.next(); //入力文字列
      
//      System.out.println(N);
//      System.out.println(S);
      
      String[] stringArray;   //String型の配列stringArrayを宣言
      stringArray = new String[N];  //N個のstring型データを持つ配列stringArrayを生成
      
//        System.out.println("===========================================");

      //(1)初期値i=0、iがN以下の間forループ内を実行 配列に数値を入れる
      for(int i = 0; i < N; i++) {
        stringArray[i] =  S.substring(i,i+1); //i番目からi+1番目の前まで(つまりi番目を入れること)
//        System.out.println("|"+stringArray[i]+"|");
      }
//        System.out.println("===========================================");
      
      int counter=0; //切れ目の数
      String x; //ひとつ前の文字
      x=" ";
      
      //(1)初期値i=0、iがN以下の間forループ内を実行
      for(int i = 0; i < N; i++) {
//          System.out.println("iは" + i + "です。");
        if( stringArray[i].equals(x) ) {
//          System.out.println("ひとしい");
        } else {
          counter = counter+1 ;
          x = stringArray[i];
//          System.out.println("xは" + x + "です。");
//          System.out.println(counter);
//          System.out.println(stringArray[i]);
        }
      }

      System.out.println(counter);

    }
}//mainの終わり



Measured memory_bytes: 29652
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	swap(b, c);
	if (a < c) {
		if (a <= b && b <= c) {
			cout << "Yes";
		}
		else cout << "No";
	}
	else {
		if (c < b && b < a) {
			cout << "Yes";
		}
		else cout << "No";
	}
}


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

typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e18+7;

#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define pb push_back

struct edge{ll to,cost;};
ll N; 
vector<edge> G[100005];
ll d[100005];
void dijkstra(ll s){
	priority_queue<P,vector<P>,greater<P> > que;
	fill(d,d+N,mod);
	d[s]=0;
	que.push(P(0,s));
	while(!que.empty()){
		P p=que.top(); que.pop();
		ll v=p.second;
		if(d[v]<p.first) continue;
		for(ll i=0; i<G[v].size(); i++){
			edge e=G[v][i];
			if(d[e.to]>d[v]+e.cost){
				d[e.to]=d[v]+e.cost;
				que.push(P(d[e.to],e.to));
			}
		}
	}
}

ll Q,K;

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>N;

rep(i,N-1){
	ll a,b,c; 
	cin>>a>>b>>c;
	a--; b--;
	G[a].pb((edge){b,c});
	G[b].pb((edge){a,c});
}

cin>>Q>>K;
dijkstra(K-1);

rep(i,Q){
	ll x,y;
	cin>>x>>y; x--; y--;
	cout<<d[x]+d[y]<<endl;
}


}
	


Measured memory_bytes: 11120
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var AB = ReadSplitInt();
            Println(AB[1] % AB[0] == 0 ? AB[0] + AB[1] : AB[1] - AB[0]);
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a * b / Gcd(a, b);

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 11348
#include <cmath>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
	int n, t;
	int maxx = -1, minx = 1005;
	scanf("%d", &n);
	while(n--){
		scanf("%d", &t);
		if(t > maxx)	maxx = t;
		if(t < minx)	minx = t;
	}
	printf("%d\n", maxx - minx);
	return 0;
}

Measured memory_bytes: 256
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
ulong bignum = 1_000_000_007;
alias SugarWater = Tuple!(long, "swater", long, "sugar");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long n, m;
    scan(n, m);
    long left, right = n;
    foreach (i; iota(m))
    {
        long l, r;
        scan(l, r);
        left = max(l, left);
        right = min(r, right);
    }
    auto pass = right - left + 1;
    writeln(pass > 0 ? pass : 0);
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  map<string,int> m;
  cout << setprecision(15);
  int N;cin >> N;
  string s,t;
  rep(i,N){
    cin >> s;
    if(m.count(s)) ++m[s];
    else m[s] = 1;
  }
  cin >> N;
  rep(i,N){
    cin >> t;
    if(m.count(t)) --m[t];
    else m[t] = -1;
  }
  int maximum = 0;
  for(auto itr = m.begin(),m_end = m.end(); itr!= m_end; ++itr){
    maximum = max(maximum, itr->second);
  }
  cout << maximum << endl;
  return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
//usage
//input! {
//  h: i32;
//  v: [i32; n]
//  x: [[i32; n]; m]
//  f: chars <- Vec<char>
//}

fn main() {
    input! {
        n: usize,
        p: [i64; n]
    }
    let mut ans = 1;
    let mut min_bound = p[0];

    for i in 1..n {
        ans += if p[i] <= min_bound {
            min_bound = p[i];
            1
        } else { 0 };
    }
    println!("{}", ans);
}

Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,t,x,y,i,ans=0;
  cin>>n>>t;
  cin>>x;
  for(i=0;i<n-1;i++){
    cin>>y;
	if(y-x>t){
      ans+=t;
    }else{
      ans+=y-x;
    }
    x=y;
  }
  
  cout<<ans+t<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        Integer X = input.nextInt();
        Integer Y = input.nextInt();
        Integer Z = input.nextInt();

        System.out.println(Z + " " + X + " " + Y);
    }
}

Measured memory_bytes: 21844
import java.util.*;	
public class Main {
	public static void main(String[] args) {
					Scanner in =new Scanner(System.in);
					while(in.hasNext()){
						int[] a=new int[4];
						int[] b=new int[4];
						for(int i=0;i<4;i++)a[i]=in.nextInt();				
						for(int i=0;i<4;i++)b[i]=in.nextInt();
						int hits=0,blows=0;
						for(int i=0;i<4;i++){
							if(a[i]==b[i])
								hits++;
						}
						for(int i=0;i<4;i++){
							for(int j=0;j<4;j++)
							{
								if(b[j]==a[i]){
									blows++;
								}
							}
						}
						blows=blows-hits;
						System.out.println(hits+" "+blows);
					}
					in.close();
			}
	}


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

int N;
static vector<int> V[200000];
static int Dis[200000] = {};

void DFS(int v, int p, int d) {
	Dis[v] = d;
	for (int i : V[v]) {
		if (i != p) DFS(i, v, d + 1);
	}
}

int main() {
	cin >> N;
	for (int i = 0; i < N - 1; i++) {
		int A, B;
		cin >> A >> B;
		A--, B--;
		V[A].push_back(B);
		V[B].push_back(A);
	}
	DFS(0, -1, 0);
	int MAX = 0, Far = 0;
	for (int i = 0; i < N; i++) {
		if (Dis[i] > MAX) {
			MAX = Dis[i];
			Far = i;
		}
	}
	for (int i = 0; i < N; i++) {
		Dis[i] = 0;
	}
	DFS(Far, -1, 0);
	MAX = 0;
	for (int i = 0; i < N; i++) {
		MAX = max(MAX, Dis[i]);
	}
	if (MAX % 3 == 1) cout << "Second";
	else cout << "First";
	return 0;
}

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

int main(){
   int n,q;cin>>n>>q;
   string name;
   int time;
   int ans=0;
   queue<pair<string,int>> que;
   for(int i=0;i<n;i++){
       cin>>name>>time;
       que.push(make_pair(name,time));
   }
   while(!que.empty()){
       name=que.front().first;
       time=que.front().second;que.pop();
       if(time>q){
           ans+=q;
           que.push(make_pair(name,time-q));
       }
       else{
           ans+=time;
           cout<<name<<' '<<ans<<endl;
       }
   }
}


Measured memory_bytes: 6388
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

int main(){
    vector<int> s(3);
    rep(i,0,3) cin>>s[i];
    sort(all(s));
    if(s[0]+s[1]==s[2]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int A,B,C;
cin >> A >> B >> C;
int cnt = 0;
for (int i = 1;i <= B;i++) {
  cnt += i*A;
  if (i*A >= C && i*A % B == C ||cnt % B == C) {
    cout << "YES" << endl;
    return 0;
  } 
}
cout << "NO" << endl;

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

int main()
{
  std::string S, T;
  std::cin >> S;
  std::cin >> T;
  int cnt = 0;
  for (int i=0; i<3; i++) cnt += (S[i] == T[i]) ? 1 : 0;
  std::cout << cnt << std::endl;
  return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)

int main() {
	int n,ans=0,mx=0;
	cin>>n;
	vector<int>h(n);
	rep(i,n)cin>>h[i];
	rep(i,n){
	    if(h[i]>=mx){
	        ans++;
	        mx=h[i];
	    }
	}
	cout<<ans;
	return 0;
}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    vector<int> s(n + 1, 0);
    REP(i, n) {
        cin >> a[i];
        a[i]--;
        s[i + 1] = (s[i] + a[i]) % k;
    }

    ll ans = 0;
    map<int, int> m;
    deque<int> q;
    REP(i, n + 1) {
        ans += m[s[i]];
        m[s[i]]++;
        q.push_back(s[i]);
        while (sz(q) >= k) {
            int x = q.front();
            q.pop_front();
            m[x]--;
        }
    }
    cout << ans << EOL;
}


Measured memory_bytes: 12036
#include <iostream>

using namespace std;

void solve() {
  int N;
  cin >> N;

  int prev = 0;
  int ans = 0;
  int steps = 0;
  while (N--) {
    int h; cin >> h;
    if (prev >= h) {
      ans = max(ans, ++steps);
    } else {
      steps = 0;
    }

    prev = h;
  }

  cout << ans << endl;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int Maxn = 2000 + 100;
bitset <Maxn * Maxn> bit;
int N;
int main()
{
#ifdef hk_cnyali
	freopen("C.in", "r", stdin);
	freopen("C.out", "w", stdout);
#endif
	scanf("%d", &N);
	int Sum = 0;
	bit[0] = 1;
	for (int i = 1; i <= N; ++i)
	{
		int x;
		scanf("%d", &x);
		Sum += x;
		bit |= bit << x;
	}
	for (int i = (Sum + 1) / 2;;++i)
		if (bit[i])
		{printf("%d\n", i); return 0;}
	return 0;
}

Measured memory_bytes: 1920
def main():
    MOD = 10**9 + 7
    K = input()
    D = int(input())
    N = len(K)
    dp = [[[0]*D for j in range(2)] for i in range(N+1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(2):
            for k in range(D):
                lim = (9 if j else int(K[i]))
                for d in range(lim + 1):
                    # print(i, j, lim, d, j or d < lim)
                    dp[i+1][j or d < lim][(k + d) % D] += dp[i][j][k]
                    dp[i+1][j or d < lim][(k + d) % D] %= MOD
    print((dp[N][0][0]+dp[N][1][0]-1) % MOD)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61660
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

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

signed main() {
    int n;
    cin>>n;
    vector<string> s(n);
    vector<int> t(n);
    REP(i,n){
        cin>>s[i]>>t[i];
    }
    string x;
    cin>>x;

    int sum = 0;
    bool flg = false;
    REP(i,n){
        if(flg){
            sum += t[i];
        }

        if(x == s[i]){
            flg = true;
        }
    }
    cout<<sum<<endl;
    // cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 200005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	cin>>n;
	ll ar[n+1]; set<ll> st;
	for(i=1;i<=n;i++){
		cin>>ar[i];
		st.insert(ar[i]);
	}
	if(st.size()!=n){
		cout<<"NO";
	}
	else cout<<"YES";
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

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

void solve() {
  int n;
  cin >> n;
  vi32 a(1 << n);
  cin >> a;
  using P = pair<int, int>;
  auto merge = [](P a, P b) {
    if (a < b) swap(a, b);
    return P(a.first, max(a.second, b.first));
  };
  vector<P> v(1 << n);
  rep(i, 1 << n) v[i] = P(a[i], 0);
  rep(i, n) rep(s, 1 << n) {
    if (s >> i & 1) {
      v[s] = merge(v[s], v[s ^ (1 << i)]);
    }
  }
  int ans = 0;
  reps(i, (1 << n) - 1) {
    int fi, se;
    tie(fi, se) = v[i];
    amax(ans, fi + se);
    cout << ans << '\n';
  }
}


Measured memory_bytes: 6144
#include<stdio.h>
int main(void){
  int a, b;
  scanf("%d %d", &a, &b);

  int count, i;

  for(i=0; i<2; i++){
    if(a>b){
        count += a;
        a--;
    }
    else{
      count +=b;
      b--;
    }
  }

  printf("%d",count);

  return 0;

}


Measured memory_bytes: 128
#include <stdio.h>

int main()
{
  char a[3];
  scanf("%c%c%c",&a[0],&a[2],&a[1]);
  if (a[0] == '7' || a[1] == '7' || a[2] == '7')
    printf("Yes\n");
  else
    printf("No\n");
  
}

Measured memory_bytes: 1588
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<algorithm>
using namespace std;
int cnt[100001];
int main()
{
	int n;
	scanf("%d",&n);
	int ok=0;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&cnt[i]);
		if(cnt[i]%2)ok=1;
	}
	if(ok)printf("first\n");
	else printf("second\n");
	return 0;
}

Measured memory_bytes: 640