akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>
#include <functional>

using namespace std;

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define MOD 1000000007LL
#define rep(i,a,n) for (int i=a ; i<n ; i++)
#define per(i,a,n) for (int i=n-1 ; i>=a ; i--)
#define LLINF 100000000000000005LL
#define INF (int)1e9+1
#define endl '\n'
#define pb push_back

// debug 도구

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string)s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for (size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

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 += "}\n";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

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__ << "]:\n", debug_out(__VA_ARGS__)

// debug 도구 end

using llong = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VPII = vector<pair<int, int>>;
using VLL = vector<long long>;
using PII = pair<int, int>;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int rcnt = 0;
    rep(i, 0, s.length()) {
        if (s[i] == 'R') rcnt++;
    }
    int ans = 0;
    rep(i, 0, rcnt) {
        if (s[i] != 'R') ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3704
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n, ans;
template <typename T>inline void in(T &x){
	T ch = getchar(), f = 1; x = 0;
	while(!isdigit(ch)) f = ch == '-' ? -1 : f, ch = getchar();
	while(isdigit(ch)) x = x * 10 + ch - '0', ans += ch == '2', ch = getchar();
	x *= f;
}
int main(){
	in(n);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);

    int n;
    cin >> n;
    for(int i = 0; i < n; i++) cout << "ACL";
    cout << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <array>
#include <vector>

using namespace std;

array<bool, 16001> dp_ys;
array<bool, 16001> dp_ys2;
array<bool, 16001> dp_xs;
array<bool, 16001> dp_xs2;

void dp(const vector<int> &vs, array<bool, 16001> &ary, array<bool, 16001> &ary2, bool is_first_pos)
{
  fill(ary.begin(), ary.end(), 0);
  int start_index;
  if (is_first_pos)
  {
	ary[8000 + vs[0]] = true;
	start_index = 1;
  }
  else
  {
	ary[8000] = true;
	start_index = 0;
  }
  for (int i = start_index; i < vs.size(); i++)
  {
	const int v = vs[i];
	fill(ary2.begin(), ary2.end(), 0);
	for (int i = 0; i <= 16000; i++)
	{
	  if (ary[i])
	  {
		if (0 <= i - v)
		{
		  ary2[i - v] = true;
		}
		if (i + v <= 16000)
		{
		  ary2[i + v] = true;
		}
	  }
	}
	swap(ary, ary2);
  }
}

int main()
{
  string line;
  getline(cin, line);
  int x, y;
  cin >> x >> y;
  vector<int> dist_list;
  int start = 0;
  for (int i = 0; i < line.length(); i++)
  {
	if (line[i] == 'T')
	{
	  const int length = i - start;
	  dist_list.push_back(length);
	  start = i + 1;
	}
  }
  if (start < line.length())
  {
	dist_list.push_back(line.length() - start);
  }
  vector<int> xs;
  vector<int> ys;
  for (int i = 0; i < dist_list.size(); i++)
  {
	if (i % 2 == 0) xs.push_back(dist_list[i]);
	else ys.push_back(dist_list[i]);
  }
  
  dp(xs, dp_xs, dp_xs2, true);
  dp(ys, dp_ys, dp_ys2, false);

  if (dp_xs[8000 + x] && dp_ys[8000 + y])
  {
	cout << "Yes" << endl;
  }
  else
  {
	cout << "No" << endl;
  }
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
	int a,b;
	cin >> a >> b;
	int sum=0;
	if (a>b){
		sum+=a;
		a--;
		if (a>b){
			sum+=a;
			a--;
		}
		else{
			sum+=b;
			b--;
		}
	}
	else{
		sum+=b;
		b--;
		if (a>b){
			sum+=a;
			a--;
		}
		else{
			sum+=b;
			b--;
		}
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<PII> VPI;
typedef vector<PLL> VPL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  char A;
  cin>>A;
  if(A>='A' and A<='Z') cout<<"A"<<endl;
  else cout<<"a"<<endl;
}


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

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

    ll N;
    cin >> N;
    ll res = 1;
    ll MOD = 1e9 + 7;

    for (ll i = 1; i <= N; ++i){
        res = res * i % MOD;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
import heapq as hq
import sys


def main():
    input = sys.stdin.buffer.readline
    x, y, a, b, c = map(int, input().split())
    p = list(map(int, input().split()))
    q = list(map(int, input().split()))
    r = list(map(int, input().split()))
    p = sorted(p, reverse=True)[:x]
    q = sorted(q, reverse=True)[:y]
    r.sort(reverse=True)
    hq.heapify(p)
    hq.heapify(q)
    # r_pointer以降のリンゴは無色
    r_pointer = 0
    while True:
        red_min = p[0]
        green_min = q[0]
        if red_min < green_min and red_min < r[r_pointer]:
            hq.heappop(p)
            hq.heappush(p, r[r_pointer])
            r_pointer += 1
            if r_pointer >= c:
                break
        elif red_min >= green_min and green_min < r[r_pointer]:
            hq.heappop(q)
            hq.heappush(q, r[r_pointer])
            r_pointer += 1
            if r_pointer >= c:
                break
        else:
            break
    print(sum(p) + sum(q))


if __name__ == "__main__":
    main()


Measured memory_bytes: 27104
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                                                       \
    for(long long hoge = 0; (hoge) < (n); ++(hoge))                            \
    cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long H;
    cin >> H;
    int p = 64 - __builtin_clzll(H);
    cout << (1ll << p) - 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int x;
bool dp[110001];

int main() {
	int i, j;
	
	cin >> x;
	dp[0] = true;
	for (i = 0; i < x; i++) {
		if (dp[i] == false) continue;
		dp[i + 100] = true;
		dp[i + 101] = true;
		dp[i + 102] = true;
		dp[i + 103] = true;
		dp[i + 104] = true;
		dp[i + 105] = true;
	}
	if (dp[x]) cout << "1" << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder("");
		int H = sc.nextInt(),W = sc.nextInt(), x;
		while(H!=0 || W!=0) {
			x=0;
			for(int m=1;m<=W;m++) {
				x++;
				sb.append("#");
			}
			
			for(int n=1;n<=H;n++) {
				System.out.println(sb);
			}
			System.out.println();
			sb.delete(0,x);
			H = sc.nextInt(); W = sc.nextInt();
		}
	}
}

Measured memory_bytes: 27500
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n,m;
    string s;
    int k;
    cin >> n >> k;
    cout << (n/2 +(n%2) >= k  ? "YES" : "NO") << endl;
}



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

int main() {
	std::string W;
	std::string T;
	int count = 0;
	std::cin >> W;
	while (std::cin >> T) {
		if (T == "END_OF_TEXT") {
			break;
		}
		else {
			transform(W.begin(), W.end(), W.begin(), tolower);
			transform(T.begin(), T.end(), T.begin(), tolower);
			if (T == W) {
				count++;
			}
		}

	}
	std::cout << count << std::endl;
}

Measured memory_bytes: 3116
n = int(input())
a = list(map(int, input().split()))

a.insert(0, 0)
a.append(0)

total_tmp = 0
for i in range(1, n+2):
    total_tmp += abs(a[i] - a[i-1])

for i in range(1, n+1):
    # delete the i-th spot
    total = total_tmp - abs(a[i] - a[i-1]) - abs(a[i+1] - a[i]) + abs(a[i+1] - a[i-1])
    print(total)


Measured memory_bytes: 14048
import java.util.ArrayList;
import java.util.Scanner;
class Main{

	
	static char[][] map;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力



		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		
		double ans = 0;
		double tate = 0;
		double yoko = 0;
		tate = Math.min(H-y, y)*W;
		yoko = Math.min(W-x, x)*H;
		ans = (double)W*H/2;
		int v = 0;
		if(x * 2 == W && y * 2 == H){
			v =1;
		}
		System.out.print(ans + " " + v);
		
	}
	
	static int rsearch(int y,int x){
		
		int count = 0;
		while(x < map[0].length && map[y][x] != '#'){
			count++;
			x++;
		}
		return count;	
		
	}

	static int csearch(int y,int x){
		
		int count = 0;
		while(y < map.length && map[y][x] != '#'){
			count++;
			y++;
		}
		return count;	
	}


	static boolean checkswitch(int bit,int[] k,ArrayList<ArrayList<Integer>> list,int[] p,int m){

		//		System.out.println("bit " + bit);

		for(int i = 0;i < m;i++){

			ArrayList<Integer> sub = list.get(i);
			int onnum = 0;						//onの数
			for(int j = 0;j < sub.size();j++){
				//				System.out.println("sub "+ sub.get(j));
				if((bit & (1 << sub.get(j))) != 0){				//目的のスイッチがついているか
					onnum++;
					//					System.out.println("on  ");
				}

			}
			if(onnum % 2 != p[i]){				//一個でも電球がつかなかったらout
				return false;
			}

		}


		return true;

	}

	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}





}



class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return  otherpair.end - end;
	}
}




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

int main() {
	// your code goes here
	string s,t;
	cin>>s>>t;
	int ans=0;
	if(s[0]==t[0])ans++;
	if(s[1]==t[1])ans++;
	if(s[2]==t[2])ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 40005
#define eps 1e-12
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
int64 K,A,B;
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	read(K);read(A);read(B);
	int64 now = 1;
	if(now < A) {
		int64 t = min(A - now,K);
		now += t;
		K -= t;
	}
	if(B - A > 2) {
		now += K / 2 * (B - A);
		K %= 2;
	}
	now += K;
	out(now);enter;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int A1, B1, N, A2, B2, tmp, remaind;


    cin >> A1 >> B1;

    tmp = A1;
    A2 = 0;
    while(tmp != 0) {

      remaind = tmp % 10;

      A2 = A2 * 10 + remaind;

      tmp /= 10;
    }

    tmp = B1;
    B2 = 0;
    while(tmp != 0) {

      remaind = tmp % 10;

      B2 = B2 * 10 + remaind;

      tmp /= 10;
    }

    N = (B1/100) - (A1/100) - 1;

    if( (A2%100) - (A1%100) >= 0 )
        N++;
    if( (B1%100) - (B2%100) >= 0 )
        N++;

    cout << N << endl;

    return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque
def input(): return sys.stdin.readline().strip()
mod = 10**9+7

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

comb = Combination(2 * 10**6)

def main():
    K = int(input())
    S = deque(input())
    L = len(S)
    """
    dpではなく単純に組み合わせ論だった。。。
    """
    ans = 0
    for x in range(K + 1):
        ans += comb(K - x + L - 1, L - 1) * pow(25, K - x, mod) * pow(26, x, mod)
        ans %= mod
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 245736
using System;

class SelectionSort {
     static void PrintArr(int[] A, int N) {
        for (int i = 0; i < N; i++) {
            Console.Write(A[i]);
            if (i != N-1)
                Console.Write(" ");
            else
                Console.Write("\n");
        }
    }

    static void SSort(int[] A, int N) {
        int c = 0;

        for (int i = 0; i < N; i++) {
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj])
                    minj = j;
            }

            if (i != minj) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;

                c++;
            }
        }
        PrintArr(A, N);
        Console.WriteLine(c);
    }

    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        
        int[] A = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

        SSort(A, N);
    }
}

Measured memory_bytes: 9220
#include <bits/stdc++.h>    
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//using namespace __gnu_pbds; 
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N       = 1000 * 100 + 10;
const ll N2      = 70;
const ld PI  = 3.141592653589793;
//template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}

signed main()
{
    fastio();
    cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    /*comment for all except cc/cf    
    #ifndef ONLINE_JUDGE    
           freopen("input.txt","r",stdin);
           freopen("output.txt","w",stdout);
    #endif//*/
    int n; cin>>n;
    vector<double> a(n),dp(n+1);
    for (int i = 0; i < n; ++i)
        cin>>a[i];
    dp[0]=1;

    for (int i = 0; i < n; ++i)
    {
        for(int j = i+1 ; j>=0 ; j--)
        {
            if(j)
                dp[j] = dp[j-1]*a[i] + dp[j]*(1-a[i]);
            else
                dp[j] = dp[j]*(1-a[i]);
        }
    }
    double ans = 0;
    for (int i = 0; i < n+1; ++i)
    {
        if(i>(n-i))
            ans+=dp[i];
    }
    cout<<ans;



    printclock;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
  int a;
  cin >> a;
  if(a<1200){
    cout << "ABC" << endl;
  }else if(a>=1200&&a<2800){
    cout << "ARC" << endl;
  }else{
    cout <<"AGC" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
using ll = long long;
int N,M,Q;
vector<int> A;

bool next() {
  int i;
  for (i=A.size()-1;i>=0 && A[i]>=M;i--) {}
  if (i<0) {
    return false;
  } else {
    A[i]++;
    for (int j=i+1;j<A.size();j++) {
      A[j] = A[i];
    }
    return true;
  }
}

int main() {
  int i;
  cin>>N>>M>>Q;
  vector<vector<int>> a(Q, vector<int>(4));
  for (i=0;i<Q;i++) {
    cin>>a[i][0]>>a[i][1]>>a[i][2]>>a[i][3];
  }

  A = vector<int>(N,1);
  int ans = 0;
  do {
    int score = 0;
    for (i=0;i<Q;i++) {
      if (A[a[i][1]-1]-A[a[i][0]-1] == a[i][2]) score += a[i][3];
    }
    ans = max(ans, score);
  } while (next());

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


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

int main(void){
    int N,count;
    cin>>N;
    count=0;
    string S;
    cin>>S;
    for(int i=2;i<N;i++){
        if(S[i-2]=='A'&&S[i-1]=='B'&&S[i]=='C'){
            count++;
        }
    }
    cout<<count<<endl;
}
	
	
	
	

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long 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; }

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int a, b; cin >> a >> b;
    cout << (a+b+1)/2 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
using lint=long long;
using lubl=long double;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    auto advance=[&](auto&&a){
        lint n=a.size();
        for(lint i=n-1;i>=0;i--){
            if(a.at(i)==9||i&&a.at(i-1)+1==a.at(i))continue;
            a.at(i)++;
            for(i++;i<n;i++){
                a.at(i)=std::max(0ll,a.at(i-1)-1);
            }
            return;
        }
        a.insert(a.begin(),1);
        for(lint i=1;i<=n;i++){
            a.at(i)=0;
        }
    };
    std::vector<lint>a={1};
    lint k;std::cin>>k;
    for(lint i=2;i<=k;i++){
        advance(a);
    }
    for(lint x:a)std::cout<<x;
    std::cout<<'\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <tuple>
#include <sstream>
#include <typeinfo>
#include <fstream>
#include <random>
#include <queue>
#include <deque>
#include <iterator>
#include <map>
#include <functional>
using namespace std;
#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 pb(a) push_back(a)
#define llong long long
#define INF 1145141919
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
int dy[] = { 1, 0, -1, 0 };
int dx[] = { 0, 1, 0, -1 };
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }


int n, m, lx,ly;
vector<int> x;
vector<int> y;
string solve() {
	int zl = lx + 1;	// 候補最小値
	int zu = ly;		// 候補最大値
	int gx = x[0];		// X条件 gxより大きい
	int gy = y[0];		// Y条件 gy以下
	if (gy > gx) {	// 条件1 gxがgyより小さい
		int z = zl;
		for (z; z <= zu; z++) {
			if (gx < z) {
				if (gy >= z) {
					return "No War";
				}
			}
		}
	}
	return "War";
}
int main() {
	cin >> n >> m >> lx >> ly;
	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		x.push_back(t);
	}
	for (int i = 0; i < m; i++) {
		int t;
		cin >> t;
		y.push_back(t);
	}
	sort(x.begin(), x.end(), greater<int>());
	sort(y.begin(), y.end());
	cout << solve() << endl;
	return 0;
}

Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	int n,m;cin>>n>>m;
	if(n==m) cout<<"Yes"<<endl;else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}
///////////////////////////////////////

int main() {
	int N; cin >> N;
	int A[100100], B[100100];
	for (int i = 0; i < N + 1; ++i)cin >> A[i];
	for (int i = 0; i < N; ++i)cin >> B[i];
	ll ans = 0;
	for (int i = 0; i < N; ++i) {
		int x = min(A[i], B[i]);
		ans += x;
		B[i] -= x;
		int y = min(A[i + 1], B[i]);
		ans += y;
		A[i + 1] -= y;
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
  int i,j;ll cnt=0;
  int n;
  cin>>n;
  ll a[n],b[n];
  for(i=0;i<n;i++)cin>>a[i]>>b[i];
  ll S=a[n-1];
  for(i=n-1;i>=0;i--){
    if(S%b[i]!=0){
      cnt+=b[i]-S%b[i];
      S+=b[i]-S%b[i];
    }
    if(i==0)break;
    S+=a[i-1]-a[i];
  }
  cout<<cnt;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

struct mint{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){};
    mint operator-() const{
        return mint(-x);
    }
    mint& operator+=(const mint a){
        if((x+=a.x) >= mod) x -= mod;
        return *this;
    } 
    mint& operator-=(const mint a){
        if((x+= mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const{
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const{
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const{
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const{
        if(!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if(1&t) a *= *this;
        return a;
    }

    mint inv() const{
        return pow(mod-2);
    }
    mint& operator/=(const mint a){
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const{
        mint res(*this);
        return res /= a;
    }
};

struct combination{
    vector<mint> fact, ifact;
    combination(int n):fact(n+1), ifact(n+1){
        assert(n < mod);
        fact[0] = 1;
        for(int i=1; i<=n; i++) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for(int i=n; i>=1; i--) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k){
        if(k<0 || k>n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};


int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    ll ans = 0;

    rep(i, 60){
        ll x = 0;
        rep(j, n){
            if(a[j]>>i&1) x++;
        }
        ll tmp = x*(n-x)%mod;
        rep(j, i){
            tmp = tmp * 2 % mod;
        }
        
        ans += tmp;
        ans %= mod;
    }

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


Measured memory_bytes: 2688
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>
#include<set>
#include<vector>
using namespace std;

int n, k;
int r, s, p;
string T;

char GetDifferentFromTheOtherTwoHand(char hand1, char hand2){
  if(hand1 == 'r' && hand2 == 's') return 'p';
  if(hand1 == 'r' && hand2 == 'p') return 's';
  if(hand1 == 's' && hand2 == 'r') return 'p';
  if(hand1 == 's' && hand2 == 'p') return 'r';
  if(hand1 == 'p' && hand2 == 'r') return 's';
  if(hand1 == 'p' && hand2 == 's') return 'r';
}

char GetAnotherHand(char hand){
  switch(hand){
    case 'r':
    return 'p';
    case 's':
    return 'r';
    case 'p':
    return 's';
  }
}

int GetPoint(char hand){
  switch(hand){
    case 's':
    return r;
    case 'p':
    return s;
    case 'r':
    return p;
  }
}

int solve(){
  cin >> n >> k >> r >> s >> p >> T;
  int ans=0;
  for(int i=0; i<n; i++){
    if(i<k){
      ans += GetPoint(T[i]);
    }
    else{
      if(T[i-k]!=T[i])  {
        ans += GetPoint(T[i]);
        continue;
      }
      if(i+k<n){
        if(T[i]==T[i+k]) T[i]=GetAnotherHand(T[i]);
        else  T[i]=GetDifferentFromTheOtherTwoHand(T[i], T[i+k]);
      }
    }
  }

  cout << ans << endl;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt(),b=sc.nextInt(),k=sc.nextInt();

		if((b-a+1)>=2*k) {
			for(int i=a;i<a+k;i++) {
				System.out.println(i);
			}
			for(int i=b-k+1;i<b+1;i++) {
				System.out.println(i);
			}
		}else {
			for(int i=a; i<=b;i++) {
				System.out.println(i);
			}
		}
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<cmath>
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
signed main() {
	int n; cin >> n;
	int p = 2; for1(i, n - 1)p *= i;
	double a[10], b[10];
	for1(i, n)cin >> a[i] >> b[i];
	double sum = 0;
	for1(i, n)for (int j = i + 1; j <= n; j++) {
		sum += sqrt((a[i] - a[j]) * (a[i] - a[j]) + (b[i] - b[j]) * (b[i] - b[j]))*p;
	}
	printf("%.10f\n", sum / (p / 2 * n));
}

Measured memory_bytes: 256
import java.math.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();
        while (true) {
            long tmp = 0;
            if(n>k)
            tmp = Math.abs(n % k);
            else
            tmp = Math.abs(n - k);
            if (tmp < n) {
                n = tmp;
            } else {
                break;
            }
        }
        System.out.println(n);
        }
    }

Measured memory_bytes: 23764
#include <cstring>
#include <cstdio>
#include <algorithm>
#define ll long long
const int MAXN = 200010;
const int MAXLOG = 29;
using namespace std;

int N, A[MAXN], B[MAXN], TA[MAXN], TB[MAXN];

inline int count(int L, int R) {
    return upper_bound(TB + 1, TB + N + 1, R) - lower_bound(TB + 1, TB + N + 1, L);
}

int main() {
    int i, k;
    scanf("%d", &N);
    for(i = 1; i <= N; i++) scanf("%d", &A[i]);
    for(i = 1; i <= N; i++) scanf("%d", &B[i]);

    int Ans = 0;
    for(k = 0; k <= MAXLOG; k++) {
        ll Cnt = 0;

        for(i = 1; i <= N; i++) TA[i] = A[i] & ((1 << (k + 1)) - 1), TB[i] = B[i] & ((1 << (k + 1)) - 1);
        sort(TB + 1, TB + N + 1);

        for(i = 1; i <= N; i++) Cnt += count((1 << k) - TA[i], (1 << (k + 1)) - 1 - TA[i]) + count( (1 << k) + (1 << (k + 1)) - TA[i], (1 << (k + 2)) - 1 - TB[i] );

        if(Cnt & 1) Ans |= (1 << k);
    }
    printf("%d", Ans);
}

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

int main(){
  char c;
  cin >> c;
  
  vector<char> al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  for(int i = 0; i < 26; i++){
    if(c == al.at(i)){
      cout << al.at(i+1);
    }
  }
}

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

int main(){
  int N, X; cin >> N >> X;
  int mi = 1e9;
  int sum = 0;
  int ans = N;
  for(int i = 0; i < N; i++){
    int m; cin >> m;
    mi = min(mi, m);
    sum += m;
  }
  ans += (X - sum) / mi;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>




int main(){
  int i,j=0;
  int s,t;
  int count=0;
  int key;

  scanf("%d",&s);
  int S[s];
  for(i=0;i<s;i++)scanf("%d",&S[i]);


  scanf("%d",&t);
  int T[t];
  for(i=0;i<t;i++)scanf("%d",&T[i]);

  for(i=0;i<t;i++){

    key=T[i];
    j=0;
    S[s]=key;
    while(S[j]!=key)j++;


     if(j==s);
    else{
       count++;
    }
 

  }

  printf("%d\n",count);
   return 0;
}

Measured memory_bytes: 636
k, x = map(int, input().split())
ans = []
t_k = k
t_x = x
while t_k >= 1:
  if t_x not in ans:
  	ans.append(t_x)
  t_x -= 1
  t_k -= 1
  
t_k = k
t_x = x

while t_k >= 1:
  if t_x not in ans:
  	ans.append(t_x)
  t_x += 1
  t_k -= 1
  
ans.sort()
for a in ans:
  print(a, end=" ")

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
vector<long long>Col(100005);
struct Edge {
	int to, id;
	Edge(int to, long long id) :to(to), id(id) {}
};
vector<Edge>g[100005];

void dfs(int v, long long d = 0, int p = -1) {
	Col[v] = d;
	for (Edge e : g[v]) {
		if (p == e.to) {
			continue;
		}
		dfs(e.to, d + e.id, v);
	}
}

int main() {
	int N;
	cin >> N;
	for (int n = 0; n < N - 1; ++n) {
		int a, b;
		long long c;
		cin >> a >> b >>c;
		a--;
		b--;
		g[a].emplace_back(b, c);
		g[b].emplace_back(a, c);
	}
	int Q,K;
	cin >> Q >> K;
	K--;
	dfs(K);
	for (int i = 0;i<Q;++i) {
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		cout << Col[x]+Col[y]<<endl;
	}
	return 0;
}

Measured memory_bytes: 13980
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
bool judge(int n){
  bool flag=true;
  int buf=n;
  for(int i=2;i<=n;++i){
    if(n%i==0){
      int cnt=0;
      while(n%i==0){
        n/=i;
        cnt++;
      }
      flag=n==1&&cnt>=2;
      n=buf;
      if(flag)break;
    }
  }
  return flag;
}
signed main(){
  int x;cin>>x;
  for(int i=x;i>0;--i){
    if(judge(i)){
      cout<<i<<endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif
#define FILE_IO freopen("input.txt","r",stdin)
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define debug(x) cerr << #x << " = " << x << endl;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
void solve(){
     int n,k;
     cin>>n>>k;
     vector<int> v(n);
     map<int,int> m;
     for(auto& it:v){
     	cin>>it;
     	m[it]++;
     }
    vector<int> ans;
    for(auto it:m)ans.emplace_back(it.s);
    sort(all(ans),greater<int>());
    int cnt=0;
    for(int i=k;i<(int)ans.size();i++){
    	cnt+=ans[i];
    }
    cout<<cnt<<endl;
 }
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
    IOS;
    solve();
    #ifdef LOCAL_DEFINE
    cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
    #endif
}

Measured memory_bytes: 11640
#include <iostream>

using namespace std;

int main(){

        string str,order,addedStr,tmp;
        int roop, a, b;
        cin >> str;
        cin >> roop;

        for(int i = 0; i < roop; i++){
                cin >> order;
                cin >> a >> b;
                if(order == "print"){
                        cout << str.substr(a,b-(a - 1)) << endl;
                }

                else if(order == "reverse"){
                                for(int j = b; j >= a; j--){
                                tmp += str.at(j);
                                }
                                str.replace(a,b-(a - 1),tmp);
                                tmp = "";
                }

                else{
                        cin >> addedStr;
                        str.replace(a,b-(a - 1),addedStr);
                }
        }

        return 0;
}

Measured memory_bytes: 1228
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

	String s = sc.next();
	
	char c0 = s.charAt(0);
	char c1 = s.charAt(1);
	char c2 = s.charAt(2);
	char c3 = s.charAt(3);
	
	String result = "Good";
	
	if (c0 == c1) {
		result = "Bad";
	}
	if (c1 == c2) {
		result = "Bad";
	}
	if (c2 == c3) {
		result = "Bad";
	}

    System.out.println(result);
  }
}



Measured memory_bytes: 22612
from collections import Counter

n = int(input())
a = [int(i) for i in input().split()]

tbl0 = Counter(a)
tbl = tuple(Counter(a).items())

t = 0
for v in tbl:
    t += v[1] * (v[1] - 1) // 2

for i in range(n):
    s = tbl0[a[i]]
    print(t - (s - 1))


Measured memory_bytes: 32520
import sys
def main():
    input = sys.stdin.readline
    N,M=map(int, input().split())
    A,B,C=[],[],[]
    for _ in range(M):
        a,b=map(int, input().split())
        A.append(a)
        B.append(b-1)
        C.append(list(map(lambda x:int(x)-1, input().split())))

    #dp[i][j]=i番目の鍵まで見たとき、jの宝箱を開けられるようになった場合の費用の最小値
    dp = [[10**9] * (1<<N) for _ in range(M+1)]
    dp[0][0] = 0

    for i in range(M):
        ni = i + 1
        nj = 0
        for c in C[i]: nj |= 1 << c
        for j in range(1<<N):
            dp[ni][j] = min(dp[ni][j], dp[i][j])
            dp[ni][j|nj] = min(dp[ni][j|nj], dp[i][j] + A[i])

    print(dp[M][(1<<N)-1] if dp[M][(1<<N)-1] < 10**9 else -1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 73328
#include <stdio.h>
int main(){
 int n, data[1000], i;
 scanf("%d",&n);
 for(i = 0; i < n; i++) {
  scanf("%d",&data[i]);
 }
 for(i = n-1; i > 0; i--) {
  printf("%d ",data[i]);
 }
 printf("%d\n",data[0]);
 return 0;
 }

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

    if(a%c==0) x=a/c;
    else x=a/c+1;
    if(b%d==0) y=b/d;
    else y=b/d+1;

    if(x>y) printf("%d\n",l-x);
    else printf("%d\n",l-y);

    return 0;
}

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

int solve() {

    char c;
    cin>>c;
    cout<<(char)(c+1)<<endl;
   
}
 
int main()
{
 
    int test = 1, tc = 0;
    //scanf("%d", &test);
   // (void)getchar();
    //cin >> test;
    while (test--) {
        //printf("Case %d: ", ++tc);
        solve();
    }
 
    return 0;
}

Measured memory_bytes: 256
from itertools import combinations
def solve():
  N = int(input())
  A = [list(map(int, input().split())) for _ in range(N)]
  mod = 10**9+7
  dp = [0]*(1<<N)
  dp[0] = 1
  for i in range(N):
    for com in combinations(range(N),i+1):
      S = 0
      for k in com:
        S += 1<<k
      for j in com:
        dp[S] += dp[S-(1<<j)]*A[i][j]
        dp[S] %= mod
  return dp[-1]
print(solve())

Measured memory_bytes: 83884
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int A = in.nextInt();
			int B = in.nextInt();
			if(A + B >= 10) {
				out.println("error");
			} else {
				out.println(A + B);
			}
		}
	}
		
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

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

int s[200005];
int main(void){
	int N,A,B,C,D;
	cin >> N >> A >> B >> C >> D;
	A--,B--,C--,D--;
	string S;
	int As=A,Bs=B;
	cin >> S;
	int Slen = S.size();
	bool aok = true;
	while(A!=C){
		if(S[A+1]=='.')A++;
		else if(S[A+2]=='.')A+=2;
		else {
			aok = false;
			break;
		}
	}
	bool bok = true;
	while(B!=D){
		if(S[B+1]=='.')B++;
		else if(S[B+2]=='.')B+=2;
		else {
			bok = false;
			break;
		}
	}
	if(aok*bok ==0){
		cout <<"No"<<endl;
	}else if(C<D){
		cout <<"Yes"<<endl;
	}else if(C>D){	
		bool swap = 0;
		for(int i=Bs;i<=D;i++){
			if(S[i-1]=='.'&&S[i]=='.'&&S[i+1]=='.'){
				swap =1;
				break;
			}
		}
		if(swap){
			cout <<"Yes"<<endl;
			return 0;
		}else{
			cout <<"No"<<endl;
			return 0;
		}
	}
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<set>
#include<string>
#include<stdio.h>
#include<cmath>
#include<map>
#include<bitset>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++)
#define repr(i, n) for(int i = n-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define lint long long


int main(){
    int n; cin >> n;
    vector<lint> a;
    rep(i, n){
        lint x; cin >> x;
        a.push_back(x);
    }

    lint count = 0;
    lint sum = 0;
    lint xr = 0;
    int r = 0;
    for(int l = 0; l < n; l++){
        while(r < n){
            if (sum + a[r] == (xr ^ a[r])){
                sum += a[r];
                xr ^= a[r];
                r++;
            }
            else{
                break;
            }
        }
        count += r - l;
        sum = sum - a[l];
        xr = xr ^ a[l];
        if(r == l) r++;
    }
    cout << count << endl;

}

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

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

typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
  int N, M;
  std::cin >> N >> M;

  std::vector<bool> AC(N);
  std::vector<int> WA(N);
  int correct = 0;
  int penalty = 0;
  rep(i, M) {
    int p;
    std::string S;
    std::cin >> p >> S;
    --p;

    if(! AC[p]) {
      if(S == "AC") {
        AC[p] = true;
        ++correct;
        penalty += WA[p];
      } else {
        ++WA[p];
      }
    }
  }

  std::cout << correct << ' ' << penalty << '\n';
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

const double TAX = 100/108.0;
const double TAX2 = 108/100.0;

int main() {
    int n;
    cin >> n;
    double x = n * TAX;
    double y = (int)(x+0.99) * TAX2;
    if (n == (int)y) cout << (int)(x+0.99) << endl;
    else cout << ":(" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
using namespace std;
int a,b,bj=0;
int main() {
    cin>>a>>b;
    if((!((a+b)%3))||(!(b%3))||(!(a%3)))puts("Possible");
    else puts("Impossible");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  string S; cin >> S;
  ll N = sz(S);
  reverse(all(S));
  ll ans = 0;
  vector<ll> A(N+1,0);
  rep(i,N) A[i] = S[i]-'0';
  vector<vector<ll>> dp(2, vector<ll>(N+2,0));
  dp[0][0] = 1;
  //dp[i][j]:下からi桁目まで払う j=0ならおつりあり 1ならきっちり
  for(int i=1; i<=N+1; i++){
    dp[0][i] = min(dp[0][i-1]+9-A[i-1], dp[1][i-1]+10-A[i-1]);
    dp[1][i] = min(dp[0][i-1]+1+A[i-1], dp[1][i-1]+A[i-1]);
  }
  ans = min(dp[1][N+1], dp[0][N+1]+1+A[N]);
  cout << ans << endl;
  return 0;
}


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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

const ll mod = 1000000007;

static const ll INF = 1e15;

struct BIT {
	vector<ll> bit_;
	const int n_;

	BIT(int n) :n_(n) {
		bit_.resize(n + 1, 0);
	}

	ll sum(int i) {
		ll s = 0;
		while (i > 0) {
			s += bit_[i];
			i -= i & (-i);
		}
		return s;
	}

	void add(int i, ll x) {
		while (i <= n_) {
			bit_[i] += x;
			i += (i & (-i));
		}
	}
};

int main(void)	
{
	ll n;
	cin >> n;
	string s;
	cin >> s;
	ll q;
	cin >> q;
	vector<BIT> bits(26, BIT(n));
	rep(i, n) {
		int d = s[i] - 'a';
		bits[d].add(i+1, 1);
	}
	rep(w, q) {
		ll qq;
		cin >> qq ;
		if (qq == 1) {
			int a;
			char b;
			cin >> a >> b;
			int source = s[a-1] - 'a';
			int dest = b - 'a';
			bits[source].add(a, -1);
			bits[dest].add(a, 1);
			s[a-1] = b;
		}
		else {
			int a, b;
			cin >> a >> b;
			ll sum = 0;
			rep(i, 26) {
				ll has = bits[i].sum(b);
				has -= bits[i].sum(a-1);
				if (has) sum++;
			}
			cout << sum << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 106372