akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

const int MOD = 1e9 + 7;
long long fact[500005] = {1};

int power(int a, int n)
{
	long long ret = 1;
	while (n) {
		if (n & 1) ret = ret * a % MOD;
		a = 1LL * a * a % MOD;
		n >>= 1;
	}
	return ret;
}

long long comb(int n, int m)
{
	long long ret = fact[n] * power(fact[m], MOD - 2) % MOD;
	ret = ret * power(fact[n - m], MOD - 2) % MOD;
	return ret;
}

int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= max(n, m); i++) {
		fact[i] = fact[i - 1] * i % MOD;
	}
	long long a = comb(m, n) * fact[n] % MOD;
	long long b = a;
	for (int i = 1; i <= n; i++) {
		long long t = comb(n, i) * comb(m - i, n - i) % MOD;
		t = t * fact[n - i] % MOD;
		if (i & 1) {
			b -= t;
			if (b < 0) b += MOD;
		} else {
			b += t;
			b %= MOD;
		}
	}
	long long ans = a * b % MOD;
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 5540
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
	int n, tmp = 100000;
	cin >> n;
	for (int i = 0; i < n; i++) {
		tmp *= 1.05;
		if (tmp % 1000) {
			tmp -= tmp % 1000;
			tmp += 1000;
		}
	}
	cout << tmp << endl;
	return 0;
}


Measured memory_bytes: 2984
#include <iostream>
using namespace std;
int n;
int x;
int l[1000];
int main(){
    cin >> n >> x;
    for(int i=0;i<n;i++){
        cin >> l[i];
    }
    int ans = 1;
    int sum = 0;
    for(int i=0;i<n;i++){
        sum += l[i];
        if(sum <= x){
            ans ++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;
  std::vector<i64> P, Q;
  tools::read(P, N);
  tools::read(Q, N);

  std::vector<i64> X;
  X.reserve(N);
  for (i64 i = 1; i <= N; ++i) {
    X.push_back(i);
  }

  i64 a = 0, b = 0;
  i64 order = 0;
  do {
    ++order;
    if (X == P) {
      a = order;
    }
    if (X == Q) {
      b = order;
    }
  } while (std::next_permutation(X.begin(), X.end()));

  std::cout << std::abs(b - a) << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define vi vector<int>
#define all(a) a.begin(),a.end()
typedef pair<int,int> P;
const long long mod=1000000007;
const long long inf=1ll<<61;

int a[100006],b[100006];
P ab[100006];

signed main(){
    int n,m;cin>>n>>m;
    rep(i,n){
        cin>>a[i]>>b[i];
        ab[i]=P(a[i],b[i]);
    }
    sort(ab,ab+n);
    int ans=0,rs=0;
    rep(i,n){
        if(rs+ab[i].second<m){
            ans+=ab[i].first*ab[i].second;
            rs+=ab[i].second;
        }
        else{
            ans+=ab[i].first*(m-rs);
            break;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6712
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i =(b)-1;i>=(a);--i)
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
typedef vector<int> vi;
const int mod = 998244353;
const int maxn = 2e6 + 10;
ll a[maxn];
ll b[maxn];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	rep(i,1,n+1)cin >> a[i] >> b[i];
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	if(n & 1){
		cout << b[n/2+1] - a[n/2+1] + 1;
	}
	else{
		cout << (b[n/2+1] + b[n/2]-a[n/2+1]-a[n/2])+1;
	}
	return 0;
}


Measured memory_bytes: 6788
#include<stdio.h>

int a[100001];

int main()
{
	int n,i;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	scanf("%d",&a[i]);
	long long sum=0;
	for (i=1;i<=n;i++)
	if (i%2==1) sum+=a[i];
	else sum-=a[i];
	int cur=sum/2;
	printf("%d",cur*2);
	for (i=1;i<n;i++) {
		cur=a[i]-cur;
		printf(" %d",cur*2);
	}
	printf("\n");
	return 0;
}
	

Measured memory_bytes: 1664
#include <stdio.h>
#include <stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
 
Node root;
 
Node treeMinimum(Node x){
  while (x->left != NIL){
    x = x->left;
  }
  return x;
}

Node treeSearch(Node u, int k){
  while(u != NULL){
    if(k == u->key) return u;
    else if(k <= u->key){
      u = u->left;
    } else {
      u = u->right;
    }
  }
  return NULL;
 
}
 
Node treeSuccessor(Node x){
  Node y;
  
  if(x->right != NIL)
    return treeMinimum(x->right);
  
  y = x->parent;
  
  while( y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  
  return y;
}
 
void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  
  if( z->left == NIL || z->right == NIL )
    y=z;
  else
    y=treeSuccessor(z);
  
  if(y->left!=NIL)
    x=y->left;
  else
    x=y->right;
  
  
  if(x!=NIL)
    x->parent=y->parent;
  
  if(y->parent==NIL)
    root=x; 
  
  else if(y==y->parent->left)
    y->parent->left=x;
  
  else
    y->parent->right=x;
  
  if(y!=z)
    z->key=y->key;

}
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct 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){
    inorder(u->left);
    printf(" %d",u->key);  
    inorder(u->right);
  }
}
 
void preorder(Node u){
  if(u != NIL){
    printf(" %d",u->key); 
    preorder(u->left);
    preorder(u->right);
  }
}
 
 
int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
 
  return 0;
}

Measured memory_bytes: 19364
#include <iostream>

using namespace std;

int N;
unsigned long memo[50] = {};

unsigned long fibo(unsigned n)
{
	if (n <= 1) return 1;
	if (memo[n] == 0) {
		memo[n] = fibo(n - 1) + fibo(n - 2);
	}
	return memo[n];
}

int main()
{
	cin >> N;

	cout << fibo(N) << endl;

	return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <assert.h>
#include <vector>
#include <algorithm>

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

  int32_t N;
  std::cin >> N;
  std::vector<std::vector<int32_t>> sum_array(2, std::vector<int32_t> (N, 0));
  for (auto& colums : sum_array) {
    int32_t sum_colums = 0;
    for (auto& i  : colums) {
      int32_t val;
      std::cin >> val;
      sum_colums += val;
      i = sum_colums;
    }
  }

  int32_t max_score = sum_array[0][0] + sum_array[1][N-1];
  for (int32_t i = 1; i < N; i++) {
    max_score = std::max(max_score, sum_array[0][i] + sum_array[1][N-1] - sum_array[1][i-1]);
  }
  std::cout << max_score << std::endl;
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull; 
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define SQ(a) (a)*(a)

template <class T, class U> ostream& operator<< (ostream &out, pair<T,U> c) { out << "(" << c.first << " "; out << c.second << ")"; return out; }
template <class T> ostream& operator<< (ostream &out, vector<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
template <class T> ostream& operator<< (ostream &out, set<T> c) { for (auto it = c.begin(); it != c.end(); ++it) { if (it != c.begin()) out << " "; out << *it; } return out; }
const double PI  = 3.141592653589793238463;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m, s = 0;
    cin >> n >> m;
    vi v(n);
    FOR(i,0,n){
        cin >> v[i];
        s += v[i];
    }
    sort(v.begin(),v.end());
    cout << n + (m-s)/v[0] << endl;
}   

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

int main(void)
{
  int N, M;
  int a[51];
  int b[51];
  int c[51];
  int d[51];

  scanf("%d %d", &N, &M);
  for(int i = 0; i < N; i++){
    scanf("%d %d", &a[i], &b[i]);
  }
  for(int i = 0; i < M; i++){
    scanf("%d %d", &c[i], &d[i]);
  }

  for (int i = 0; i < N; i++) {
    int distanceMin = 1e9;    
    int distanceMinIdx = -1;
    for (int j = 0; j < M; j++) {
      int distance = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if (distance < distanceMin) {
        distanceMin = distance;
        distanceMinIdx = j;
      }
    }
    printf("%d\n", distanceMinIdx + 1);  
  }

  return 0;
}



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

#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define FOR(i, n, m) for(ll (i) = (n); (i) < (m); ++(i))

constexpr int INF = 1e9;
//constexpr ll INF = 1LL<<61;

constexpr ll mod = 1e9+7;

ll cal(int x){
  return x*x*x*x*x;
}

int main(){
  ll X;
  cin >> X;
  int n = 3000;
  vector<ll> L(2*n);
  FOR(i, -n, n){
    L[i+n] = (ll)i*i*i*i*i;
  }
  REP(i, n){
    ll x = X+L[i];
    auto it = lower_bound(L.begin(), L.end(), x);
    if(it == L.end()) continue;
    if(*it != x) continue;
    int a = (int)(it-L.begin()) - n, b = i-n;
    cout << a << " " << b << endl;
    return 0;
  }
  assert(false);
  return 0;
}


Measured memory_bytes: 3680
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def local_input():# {{{
    from pcm.utils import set_stdin
    import sys
    from pathlib import Path
    parentdir = Path(os.path.dirname(__file__)).parent
    inputfile = parentdir.joinpath('test/sample-1.in')
    if len(sys.argv) == 1:
        set_stdin(inputfile)
# }}}

def solve():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))
    
    b = sorted(a, reverse = True)
    
    for i in range(n):
        if a[i] == b[0]:
            print(b[1])
        else:
            print(b[0])


    return 0

if __name__ == "__main__":# {{{
    try:
        local_input()
        def dump(*args):
            names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
            print(', '.join(names.get(id(arg),'???')+' => '+repr(arg) for arg in args), file=sys.stderr)
    except:
        def dump(*args):
            pass

    solve()

# vim: set foldmethod=marker:}}}


Measured memory_bytes: 119508
import collections
MOD = int(1e9 + 7)
n = int(input())
dic = {}
f = [0] * (n + 1)
f[0] = 1
for i in range(n):
	x = int(input())
	if x not in dic:
		f[i + 1] = f[i]
	elif dic[x] == i - 1:
		f[i + 1] = f[i]
	else:
		f[i + 1] = (f[i] + f[dic[x] + 1]) % MOD
	dic[x] = i

print(f[-1] % MOD)

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

int main()
{
  int H, W;
  while(true) {
    cin >> H >> W;
    if (H == 0 && W == 0) {
      break;
    }
    for(int j = 0; j < W; j++) {
        cout << '#';
    }
    cout <<  endl;
    for(int i = 1; i < H-1; i++) {
      cout << '#';
      for(int j = 1; j < W-1; j++) {
        cout << '.';
      }
      cout << '#' << endl;
    }
    for(int j = 0; j < W; j++) {
      cout << '#';
    }
    cout << endl << endl;
  }
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int a, b, c;
    cin >> a >> b >> c;
    int d, e, f;
    cin >> d >> e >> f;
    set<int> waters;
    for(auto i = 0;i*a*100 <= f; i++) {
        for(auto j = 0; (i*a+j*b)*100 <=f; j++) waters.insert((i*a+j*b) * 100);
    }
    waters.erase(0);
    vector<int> waterv(waters.begin(),waters.end());
    
    vector<int> sugar;
    for(auto w:waterv) sugar.push_back(w/100*e);
    //REP(i,sugar.size()) cerr << sugar[i] << endl;
    int maxc = 0;
    int ans = 100 * a;
    int anss = 0;
    REP(i,waterv.size()) {
        for(auto j = 0;j*c <= sugar[i];j++) {
            for (auto k = 0; j*c+ k*d <=sugar[i]; k++) {
                int ms = 0;
                if (waterv[i] + j*c+ k*d <= f) ms = j*c+ k*d;
                int cons = ms * 100000 / (waterv[i] + ms);
                if (maxc < cons) {
                    maxc = cons;
                    ans = waterv[i] + ms;
                    anss = ms;
                }
            }
        }
        //cerr << ans << " " << anss << endl;
    }

    cout << ans << " " << anss << endl;

    return 0;
}

Measured memory_bytes: 256
a,b,c=map(int,input().split())
if a==b==c and a%2==0 and b%2==0 and c%2==0:
    print(-1)
else:
    res=0
    while(a%2==0 and b%2==0 and c%2==0):
        a,b,c=(b+c)//2,(a+c)//2,(a+b)//2
        res+=1
    print(res)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int MAX = 2e5;

ll n;
vector<int> G[MAX];

vector<int> p, post;
vector<ll> siz;
int idx = 0;

void dfs(int u) {
  for (int v: G[u]) {
    if (v == 0 || p[v] != -1) continue;
    p[v] = u;
    dfs(v);
    post[idx++] = v;
  }
}

void getsize() {
  rep(i, n) {
    int u = post[i];
    if (u != 0) siz[p[u]] += siz[u];
  }
}

vector<ll> fact2(MAX + 1);
void getfact2() {
  fact2[0] = 1;
  FOR(i, 1, MAX + 1) {
    fact2[i] = fact2[i - 1] * 2 % mod;
  }
}

ll extgcd(ll a, ll b, ll& x, ll& y) {
  ll d = a;
  if (b != 0) {
    d = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  }
  else {
    x = 1, y = 0;
  }
  return d;
}

ll mod_inverse(ll a, ll mod) {
  ll x, y;
  extgcd(a, mod, x, y);
  return (mod + x % mod) % mod;
}


int main() {
  cin >> n;
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    G[a - 1].push_back(b - 1);
    G[b - 1].push_back(a - 1);
  }

  p.resize(n, -1);
  post.resize(n);
  siz.resize(n, 1);
  dfs(0);
  getsize();
  getfact2();
  ll ans = fact2[n - 1] * n - 1;
  rep(u, n) {
    for (int v: G[u]) {
      if (v == p[u]) {
        ans = (ans - fact2[n - siz[u]] + mod) % mod;
      }
      else {
        ans = (ans - (fact2[siz[v]] - 1) + mod) % mod;
      }
    }
  }
  ans = (ans * mod_inverse(fact2[n], mod)) % mod;
  cout << ans << endl;
  


  


  


  
  return 0;
}

Measured memory_bytes: 22528
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){

	int sn;
	int i;
	int j,k;
	int flg;
	char in_a[82];
	char in_b[82];
	char str_a[82];
	char str_b[82];
	char str_sum[82];
	char c;
	char cs[3];
	char *p;
	int a,b,carry;

	scanf("%d",&sn);

	for(i=1;i<=sn;i++){

		scanf("%81s%*[^\n]",in_a);
		scanf("%81s%*[^\n]",in_b);

		flg=0;
		//chk a
		if(strlen(in_a)>80)flg=1;
		if(strlen(in_b)>80)flg=1;


		if(!flg){
			sprintf(str_a,"%81s",in_a);
			sprintf(str_b,"%81s",in_b);
//printf("in_a  %s\nstr_a  %s\nin_b  %s\nstr_b  %s\n",in_a,str_a,in_b,str_b);
//printf("in_a  %d\nstr_a  %d\nin_b  %d\nstr_b  %d\n",strlen(in_a),strlen(str_a),strlen(in_b),strlen(str_b));
			carry=0;
			for(j=80;j>0;j--){
				cs[0]=str_a[j];
				cs[1]='\0';
				a=atoi(cs);
				cs[0]=str_b[j];
				cs[1]='\0';
				b=atoi(cs);
				sprintf(cs,"%02d",a+b+carry);
				if(cs[0]=='0')carry=0;
				if(cs[0]=='1')carry=1;
				str_sum[j]=cs[1];
			}
			str_sum[0]='0';
			str_sum[81]='\0';
			if(carry){
				flg=1;
				str_sum[0]='1';
			}
			p=str_sum;
			while(*p=='0'&&p!=&str_sum[80])p++;
			//printf("%81s\n%81s\n%81s\n",str_a,str_b,str_sum);
		}
		flg?printf("overflow\n"):printf("%s\n",p);
	}

	return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T>
inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T>
inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T>
T GCD(T a, T b) { if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	long ans = 0.0;
	vector<long> a(n + 1), b(n);

	for (int i = 0; i <= n; ++i) cin >> a[i];
	for (int i = 0; i <= n - 1; ++i) cin >> b[i];

	for (int i = 0; i <= n - 1; ++i) {
		if (b[i] == 0) continue;
		else if (b[i] <= a[i]) {
			ans += b[i];
		}
		else if (b[i] <= a[i] + a[i + 1]) {
			ans += b[i];
			b[i] -= a[i];
			a[i + 1] -= b[i];
		}
		else {
			ans += a[i] + a[i + 1];
			a[i + 1] = 0;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 4844
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#define loop(n) for(int i = 0; i < n; i++)
#define FOR(x,y,z) for(int x = y; x < z; x++)
#define INF 999999999;
#define VEC vector<int>
#define in push_back
#define ans(x) cout<<x<<endl
#define ll long long int 

using namespace std;

int main()
{
	int n, k, x, y;
	cin >> n >> k >> x >> y;
	if (n <= k)ans(x*n);
	else ans(x*k + y*(n - k));
}

Measured memory_bytes: 256
N = int(input())
H = list(map(str, input().split()))
S = H[0]
T = H[1]
#print(S)
#print(T)
L=S[0]+T[0]
for i in range(1,N):
    L=L+S[i]
    L=L+T[i]
print(L)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
typedef __int128_t lll;
using namespace std;

int main(int argc, char const *argv[]) {
  string s;std::cin >> s;
  if(s.size()%2) std::cout << "No" << '\n';
  else{
    ll n = s.size();
    bool f = true;
    for(int i=0;i<n/2;i++){
      if(s[2*i]!='h'||s[2*i+1]!='i') f = false;
    }
    std::cout << (f?"Yes":"No") << '\n';
  }
  return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
using P = pair<int, int>;

const int H_MAX = 21;
const int W_MAX = 21;

string S[H_MAX];
P d[4] = {make_pair(0, 1), make_pair(0, -1), make_pair(1, 0), make_pair(-1, 0)};
int root[H_MAX][W_MAX];

int main(){
    int h, w;
    cin >> h >> w;
    for(int i = 0; i < h; i++){
        cin >> S[i];
    }
    int ans = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if (S[i][j] == '#')continue;
            for(int s = 0; s < h; s++){
                for(int t = 0; t < w; t++)root[s][t] = -1;
            }
            root[i][j] = 0;
            int newans = 0;
            queue<P> Q;
            Q.push(make_pair(i, j));
            while(!Q.empty()){
                int nowh = Q.front().first;
                int noww = Q.front().second;
                newans = root[nowh][noww];
                Q.pop();
                for(int s = 0; s < 4; s++){
                    int nexth = nowh + d[s].first;
                    int nextw = noww + d[s].second;
                    if (nexth < 0 || h <= nexth)continue;
                    if (nextw < 0 || w <= nextw)continue;
                    if (S[nexth][nextw] == '#')continue;
                    if (root[nexth][nextw] != -1)continue;
                    root[nexth][nextw] = root[nowh][noww] + 1;
                    Q.push(make_pair(nexth, nextw));
                }
            }
            ans = max(ans, newans);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import std.stdio;

void main(){
	string s;
	while(1){
		int[char] p[3];
		for(int i=0;i<3;i++)p[i]['A'] = 0, p[i]['B'] = 0;
		for(int i=0;i<3;i++){
			s = readln();
			if(s == "0\n")return;
			for(int j=1;j<s.length;j++){
				p[i][s[j]]++;
			}
			p[i][(p[i]['A']>p[i]['B']?'A':'B')]++;
		}
		for(int i=0;i<3;i++)
			writeln(p[i]['A'], " ", p[i]['B']);
	}
}

Measured memory_bytes: 960
N = int(input())
S = [0]*N
for i in range(N):
  S[i] = int(input())
tp = sum(S)
S.sort()
if tp%10!=0:
  print(tp)
  exit()
for s in S:
  if s%10!=0:
    print(tp-s)
    exit()
print(0)

Measured memory_bytes: 3060
number = gets.to_i
heights = gets.split.map(&:to_i)

answer = 0

until heights.all? { |height| height.zero? } do
  min = nil
  max = nil
  0.upto(number - 1) do |i|
    next if heights[i].zero? && min.nil?

    min = i if min.nil?

    if min && heights[i].zero?
      answer += 1
      min = nil
      break
    end

    heights[i] -= 1

    answer += 1 if i == (number - 1)
  end
end

puts answer


Measured memory_bytes: 14316
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> h(n);
  for(int i=0;i<n;i++)cin>>h[i];
  vector<bool> ok(n,true);
  
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    if(h[a-1]>h[b-1])ok[b-1]=false;
    else if(h[a-1]<h[b-1])ok[a-1]=false;
    else {
      ok[a-1]=false;
      ok[b-1]=false;
    }
  }
  
  int sum=0;
  for(int i=0;i<n;i++){
    if(ok[i])sum++;
  }
  
  cout<<sum<<endl;
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    string s; cin >> s;

    ll sum1 = 0;

    //0101...
    for (ll i = 0; i < s.size(); ++i) {
        if (i % 2 == 0) {
            //偶数
            if (s[i] != '0') {
                ++sum1;
            }
        } else {
            //奇数
            if (s[i] != '1') {
                ++sum1;
            }
        }
    }

    ll sum2 = 0;

    //1010...
    for (ll i = 0; i < s.size(); ++i) {
        if (i % 2 == 0) {
            //偶数
            if (s[i] != '1') {
                ++sum2;
            }
        } else {
            //奇数
            if (s[i] != '0') {
                ++sum2;
            }
        }
    }

    cout << min(sum1, sum2) << endl;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <math.h>
#define PI 3.14159265358979323846264338

int main(){
    int a,b,h,m;

    scanf("%d %d %d %d", &a, &b, &h, &m);

    long double arg;
    long double c;

    arg = PI * ((long double)(h * 60 + m) / 2 - (long double)m * 6) / 180;
    c = sqrtl(a * a + b * b - 2 * a * b * cosl(arg));

    printf("%20.20Lf", c);
    }

Measured memory_bytes: 2576
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    string s;
    std::cin >> s;
    bool used[4] = {false,false,false,false};
    for (int i = 0; i < s.length(); i++) {
        if(s[i] == 'N'){
            used[0] = true;
        }else if( s[i] == 'S' ){
            used[1] = true;
        }else if( s[i] == 'W' ){
            used[2] = true;
        }else if( s[i] == 'E' ){
            used[3] = true;
        }
    }
    
    if(used[0] != used[1] || used[2] != used[3]){
        std::cout << "No" << std::endl;
    }else{
        std::cout << "Yes" << std::endl;
    }
    
}


Measured memory_bytes: 256
using System;
using System.Linq;

class ITP1_10C
{
    static void Main()
    {
        int a = int.Parse(Console.ReadLine());
            double[] x = new double[a];
            double[] y = new double[a];
            double[] z = new double[4];
            string str1 = Console.ReadLine();
            string str2 = Console.ReadLine();
            for (int i = 0; i < a; i++)
            {
                x[i] = int.Parse(str1.Split()[i]);
                y[i] = int.Parse(str2.Split()[i]);
            }
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < a; j++)
                {
                    z[i] += Math.Abs(Math.Pow((x[j] - y[j]), (double)i));
                }
            }
            double b, c=0;
            for (int i = 0; i < a; i++)
            {
                 b= Math.Abs(x[i] - y[i]);
                if (b > c)
                {
                     c = b;
                }
            }
            Console.WriteLine(z[1]);
            Console.WriteLine(Math.Sqrt(z[2]));
            Console.WriteLine(Math.Pow((z[3]),1.0/3));
            Console.WriteLine(c);
    }
}

Measured memory_bytes: 20004
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

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

    int cnt = 0; bool ok = false;
    REP(i, 0, N) {
        int d1, d2; cin >> d1 >> d2;
        if (d1 == d2) {
            cnt++;
        } else {
            cnt = 0;
        }
        if (cnt >= 3) ok = true;
    }
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3640
K,T = [int(i) for i in input().split()]
li = [int(i) for i in input().split()]

max_cake = max(li)
without_cake = sum(li) - max_cake

if (max_cake - without_cake - 1 < 0) :
    print(0)
else :
    print(max_cake - without_cake - 1)

Measured memory_bytes: 2940
#include "bits/stdc++.h"
#include <random>
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define SQR(X)  ( (X)*(X) )
#define CUBE(X) ( (X)*(X)*(X) )
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;
 
 
void reader(int &a){scanf("%d",&a);}
void reader(double &a){scanf("%lf",&a);}
void reader(char a[]){scanf("%s",a);}
void reader(ll &a){scanf("%lld",&a);}
void reader(ull &a){scanf("%llu",&a);}
// void reader(string& a){cin >> a;};
template<class T,class U> void reader(T& t,U& u){reader(t); reader(u);}
template<class T,class U,class V> void reader(T& t,U& u,V& v){reader(t); reader(u); reader(v);}
 
void writer(int a,char c) {printf("%d",a); putchar(c);}
void writer(ll a,char c) {printf("%lld",a); putchar(c);}
void writer(double a,char c) {printf("%.20lf",a); putchar(c);}
void writer(char a[]) {printf("%s",a);};
void writer(char a[],char c) {printf("%s",a);putchar(c);};
void writer(char a,char c) {putchar(a); putchar(c);};
template<class T>void writerLn(T t){writer(t,'\n');}
template<class T,class U>void writerLn(T t,U u){writer(t,' ');writer(u,'\n');}
template<class T,class U,class V> void writerLn(T t,U u,V v){writer(t,' ');writer(u,' ');writer(v,'\n');}
template<class T> void writerArr(T x[], int n){int i;if(!n){putchar('\n');return;}rep(i,n-1) writer(x[i],' ');writer(x[n-1],'\n');}
template<class T> void writerVec(vector<T> x){int n=x.size();int i;if(!n){putchar('\n');return;}rep(i,n-1) writer(x[i],' ');writer(x[n-1],'\n');}
 
vector<std::string> split(const std::string &str, char sep){std::vector<std::string> v;std::stringstream ss(str);std::string buffer;while(std::getline(ss,buffer,sep)){v.push_back(buffer);}return v;}
 
// #define int ll
bool test = 1;
int dx[] = { 0,0,1,-1 };
int dy[] = { 1,-1,0,0 };

//..................
ull mod = (int)1e9 + 7;
signed main(){
  int i,j,k,l;
  string s;
  while(1) {
	int N,K;
	vector<int> connect[100];
	int l[100];
	cin >> N;
	if(N == 0) return 0;
	rep(i,N) {
	  int M;
	  cin >> M;
	  rep(j,M) {
		int p;
		cin >> p;
		connect[i].push_back(p);
	  }
	}
	cin >> K;
	rep(i,K) cin >> l[i];
	int ans = -1;
	rep(i,N) {
	  bool correct = true;
	  rep(j,K) {

		rep(k,connect[i].size()) {
		  if(connect[i][k] == l[j]) break;
		}
		if(k == connect[i].size()) correct = false;
	  }
	  if(ans != -1 && correct) {
		ans = -1;
		break;
	  }
	  else if(ans == -1 && correct) ans = i;
	}
	if(ans == -1) cout << -1 << endl;
	else cout << ans+1 << endl;
  }
  return 0;
}

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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  string s;cin>>s;
  if(s[0]==s[2])cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include "stdio.h"
int main(int argc, char const *argv[])
{
	int n,i,j,k,shuffle_n,count,sum,length;
	char input[201];
	char tmp[201];
	char output[400][201];
	for(i=0;;i++){
		scanf("%s",input);
		if(input[0] == '-' && input[1] == '\0'){
			count = i;
			break;
		}
		length = 0;
		for(j=0;;j++){
			if(input[j] == '\0'){
				length = j;
				break;
			}
		}
		scanf("%d",&n);
		for(j=0;j<n;j++){
			scanf("%d",&shuffle_n);
			for(k=0;k<shuffle_n;k++){
				tmp[k] = input[k];
			}
			for(k=0;k<(length-shuffle_n);k++){
				input[k] = input[shuffle_n+k];
			}
			for(k=0;k<shuffle_n;k++){
				input[length-shuffle_n+k] = tmp[k];
			}
		}
		for(j=0;j<length;j++)
			output[i][j] = input[j];
	}
	for(i=0;i<count;i++){
		printf("%s\n",output[i]);
	}
return 0;
}


Measured memory_bytes: 592
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/





int xx1, yy1, x2, y2;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> xx1 >> yy1 >> x2 >> y2;
    
    int dx = x2 - xx1, dy = y2 - yy1;
    int x = x2, y = y2;

    rep(i, 0, 2) {
        int _dx = -dy;
        int _dy = dx;
        dx = _dx;
        dy = _dy;

        x = x + dx;
        y = y + dy;

        printf("%d %d", x, y);
        if (i == 0) printf(" ");
        else printf("\n");
    }
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	int n;
	cin >> n;

	ll mx = 0;
	ll mn = 1e10;

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

		mx = max(a, mx);
		mn = min(a, mn);
	}

	cout << mx - mn << endl;	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int alphabetCount = 26;          // a to z = 26 
	string  S;
	string answer = "None";
	
	bool existFlag[26];         
	for (int i = 0; i < alphabetCount; i++) {
		existFlag[i] = false;
	}

	cin >> S;
			
	for (int j = 0; j < S.size()  ; j++) {
		existFlag[S.at(j) - 'a'] = true;
	}
	
	for (int i = 0; i < alphabetCount; i++) {
		if (existFlag[i] == false ) {
			answer =  (char) ( i + 'a' ) ;
			break;
		}	
	}
	
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define STARTUP {(cin.tie(0));\
 (ios::sync_with_stdio(false));}

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define VECCIN(vec) const int size = (vec).size(); REP(i,size) cin>>(vec)[i];

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    STARTUP;

    string N;
    cin >> N;
    YESNO(N[0] == '9' || N[1] == '9', "Yes", "No");
    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 Q = sc.nextInt();
		long[] A = new long[Q];
		long[] B = new long[Q];
		for (int i = 0; i < Q; i++) {
			A[i] = sc.nextLong();
			B[i] = sc.nextLong();
		}
		sc.close();

		for (int i = 0; i < Q; i++) {
			long min = Math.min(A[i], B[i]);
			long max = Math.max(A[i], B[i]);

			if (min == max || min + 1 == max) {
				System.out.println(min * 2 - 2);
				continue;
			}
			long sqrt = (long)Math.sqrt(min * max);
			while (sqrt * sqrt >= min * max)
				sqrt--;
			if (sqrt * (sqrt + 1) >= min * max) {
				System.out.println(sqrt * 2 - 2);
				continue;
			}
			System.out.println(sqrt * 2 - 1);
		}
	}
}

Measured memory_bytes: 21972
function Main(inputs) {
	const inputlines = inputs.split("\n");
  	const firstline = inputlines[0].split(" ");
  	const votevalues = inputlines[1].split(" ").map(x => parseInt(x, 10));
  	const standard = 1 / (4 * firstline[1]);
  	let yes = 0; 
  
    let totalvotes  = function(arr) {
    	let sum = 0;
    	arr.forEach(function(elm) {
        	sum += elm;
    	});
    	return sum;
	};
  
  	const currentstandard = totalvotes(votevalues) * standard;
  
  	for (let i = 0; i < votevalues.length; i++){
      	if(votevalues[i] >= currentstandard){
          	yes++;
          	if(yes == firstline[1]){
              	console.log("Yes");
              	break;
            }
        }
    }
  	if(yes != firstline[1]){
        console.log("No");
    }
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29568
import * as fs from 'fs';

namespace AtCoder.abc001 {

    export class Program {

        constructor(private readonly args: string[][]) {
        }

        /**
         * in
         *
         * out
         *
         */
        main(this: Program): void {
            let [a, b, c, d]: number[] = this.args[0].map(Number);


            while (a > 0 || c > 0) {

                c -= b;
                if (c <= 0) {
                    console.log('Yes');
                    break;
                }

                a -= d;

                if (a <= 0) {
                    console.log('No');
                    break;
                }


            }


        }
    }
}

const args: string[][] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n').map(r => r.split(' '));
const prg: AtCoder.abc001.Program = new AtCoder.abc001.Program(args);
prg.main();


Measured memory_bytes: 29628
#include "bits/stdc++.h"
using namespace std;
#define OUT(x)                cout << #x << " = " << x << endl
#define rep(i, n)             for (int (i) = 0; (i) < (int)(n); (i)++)
#define rer(i, l, r)          for (int (i) = (int)(l); (i) <= (int)(r); (i)++)
#define reu(i, l, r)          for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define all(x)                (x).begin(), (x).end()
#define rall(x)               (x).rbegin(), (x).rend()
template<typename T> void pv(T a, T b) { for (T i = a; i != b; i ++) cout << *i << " "; cout << endl; }
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }
int in() { int x; scanf("%d", &x); return x; }
long long lin() { long long x; scanf("%lld", &x); return x; }

signed main() { 
        int a = in(), b = in();
        if (a + b >= 10) cout << "error" << endl;
        else cout << a + b << endl;
        return 0;
}               



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

int main() {
    
    char C;
    cin >> C;
    cout << char(C + 1) << endl;

    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define LLPair pair<ll, ll>
#define vint vector<int>
#define vll vector<ll>
typedef long long ll;

using namespace std;

int main(void){
	int N, W; cin >> N >> W;
	vint w(N), v(N);
	rep(i, N) cin >> w[i] >> v[i];

	static int dp[110][110000]; //dp[商品][価値] = 最小の重さ
	fill(dp[0], dp[110], INF);
	dp[0][0] = 0;
	rep2(i, 0, N){
		rep(j, 1010*N){
			if(dp[i][j] != INF){
				if(dp[i][j]+w[i] <= W){
					dp[i+1][j+v[i]] = min(dp[i+1][j+v[i]], dp[i][j]+w[i]);
				}
				if(dp[i+1][j] == INF) dp[i+1][j] = dp[i][j];
				else dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
			}
		}
	}
	
	int ans = 0;
	rep(i, 1010*N){
		if(dp[N][i] == INF) continue;
		ans = max(ans, i);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 47488
n = int(input())
h = list(map(int, input().split()))

flag = True
res_max = 0
for i in range(n-1):
    if h[i+1]-h[i] >= 1:
        h[i+1] -= 1
    elif h[i+1]-h[i] >= 0:
        continue
    else:
        flag = False
        break

print('Yes' if flag else 'No')


Measured memory_bytes: 14396
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<limits.h>

int pw(int n) {
    if(n==0) {
        return 1;
    }
    int i;
    int ans = 1;
    for(i=0; i<n; i++) {
        ans *=10;
    }
    return ans;
}

int main(void){
    int N;
    scanf("%d", &N);
    int digit = 0;
    int number = N;
    while(number!=0) {
        number = number / 10;
        ++digit;
    }


    int i;
    int sum = 0;
    for(i=0; i<digit; i++) {
        sum += (N/pw(i)) % 10;
    }
    if(N % sum == 0) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main{
  public static void main(String[]args){
    Scanner sc=new Scanner(System.in);
    int n=0;
    String S=sc.next();
    String T=sc.next();
    String tenS[]=S.split("");
    String tenT[]=T.split("");

    for(int i=0;i<3;i++){
      if(tenS[i].equals(tenT[i])){
        n++;
      }
    }

     System.out.println(n);

  }
}


Measured memory_bytes: 21844
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n;
  Cout(n * (n - 1) / 2);
  return 0;
}

Measured memory_bytes: 256
#include <ctype.h>
#include <stdio.h>

int main(void)
{
        int N, K;
        char S[55];
        scanf("%d%d%s", &N, &K, S);

        S[K-1] = tolower(S[K-1]);

        printf("%s\n", S);

        return 0;
}


Measured memory_bytes: 128
def resolve():
    INF = 1<<60
    H, N = map(int, input().split())
    A, B = [], []
    for i in range(N):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)

    dp = [INF]*(H+1)
    dp[0] = 0

    for h in range(H):
        for i in range(N):
            to = min(H, A[i]+h)
            dp[to] = min(dp[to], dp[h]+B[i])

    print(dp[H])


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 74036
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fast()    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod   1000000007
int main()
{
	fast()
	int x,y;
    cin>>x>>y;
    int Y=(y-2*x);
    if(y%1)
    cout<<"No";
    else if(Y<0)
    cout<<"No";
    else if(Y%2!=0)
    cout<<"No";
    else if((Y/2)<=x)
    cout<<"Yes";
    else
    cout<<"No";
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i=0; i < N; i++){
    cin >> vec.at(i);
  }
  int ans = 0;
  for(int i=0; i < N; i++){
    for(int j=i+1; j < N; j++){
      ans += vec.at(i)*vec.at(j);
    }
  }
  cout << ans << endl;
}
      

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

enum Type{
	I,
	O,
};

int dp[2001][2001][2];

int main(){

	int M,N;
	scanf("%d %d",&M,&N);

	char* S = new char[M+1];
	char* T = new char[N+1];

	scanf("%s",S);
	scanf("%s",T);

	for(int i = 0; i <= M; i++){
		for(int k = 0; k <= N; k++){
			dp[i][k][I] = 0;
			dp[i][k][O] = 0;
		}
	}

	int ans = 0;

	for(int i = 0; i <= M; i++){
		for(int k = 0; k <= N; k++){
			if(i != 0){
				//S[i-1]???????°???????????????´???
				if(S[i-1] == 'I'){
					dp[i][k][I] = dp[i-1][k][O]+1;
				}else if(S[i-1] == 'O' && dp[i-1][k][I] > 0){
					dp[i][k][O] = dp[i-1][k][I]+1;
				}
			}

			if(k != 0){
				//T[k-1]???????°???????????????´???
				if(T[k-1] == 'I'){
					dp[i][k][I] = max(dp[i][k][I],dp[i][k-1][O]+1);
				}else if(T[k-1] == 'O' && dp[i][k-1][I] > 0){
					dp[i][k][O] = max(dp[i][k][O],dp[i][k-1][I]+1);
				}
			}
			ans = max(ans,dp[i][k][I]);
		}
	}

	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 34472