akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#define debug(x) cout << #x " => " << (x) << endl
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  lint n, x, d;
  cin >> n >> x >> d;
  if (d == 0) {
    if (x == 0) {
      cout << 1 << endl;
    } else {
      cout << n + 1 << endl;
    }
    return 0;
  }
  if (d < 0) {
    x = -x;
    d = -d;
  }
  unordered_map<int, vector<pair<lint, lint>>> now;
  for (lint A = 0; A <= n; ++A) {
    // S = Ax + Bd
    lint Bmin = (A - 1) * A / 2, Bmax = (2 * n - A - 1) * A / 2;
    lint Adiv = A * x / d, Smod = A * x % d;
    if (Smod < 0) {
      Smod += abs(d);
      ++Adiv;
    }
    now[Smod].push_back({Adiv + Bmin, Adiv + Bmax});
  }
  lint cnt = 0;
  allrep (m, now) {
    sort(all(m.second));
    lint now = LLONG_MIN;
    allrep (p, m.second) {
      lint l = max(now, p.first), r = max(now, p.second + 1);
      cnt += r - l;
      now  = r;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 17864
#include<iostream>
using namespace std;
int p=1e9+7;
int main()
{
  long long n,m,i,res;
  cin >> n >> m;
  if(n>m+1 || m>n+1){
    cout << "0" << endl;
    return 0;
  }
  if(n==m){
    res=2;
  }else if(n==m+1){
    res=n;
    n--;
  }else{
    res=m;
  }
  for(i=2;i<=n;i++){
    res*=i;
    res%=p;
    res*=i;
    res%=p;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3604
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < int > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vll vector < ll >
# define pii pair < int , int >
# define mp make_pair
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    int n;
    fi>>n;
    static int s[1 << 20];
    n = n + n - 1;
    for (int i = 1;i <= n;++i)
        fi>>s[i];
    auto f = [&](int k)
    {
        static int v[1 << 20];
        for (int i = 1;i <= n;++i)
            v[i] = s[i] >= k;
        int a = (n + 1) / 2,b = (n + 1) / 2;
        while (a > 1 && v[a] != v[a - 1]) --a;
        while (b < n && v[b] != v[b + 1]) ++b;
        return v[(n + 1) / 2] ^ (min((n + 1) / 2 - a,b - (n + 1) / 2) & 1);
    };
    int ans = 0;
    for (int k = 1 << 20;k;k /= 2)
        if (ans + k <= n && f(ans + k))
            ans += k;
    fo << ans << '\n';
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}

Measured memory_bytes: 1792
q = int(input())
lr = []
for i in range(q):
    lr.append(list(map(int, input().split())))


def binarySearch(alist, item):
    first = 0
    last = len(alist) - 1
    found = False
    while first <= last and not found:
        midpoint = (first + last) // 2
        if alist[midpoint] == item:
            found = True
        else:
            if item < alist[midpoint]:
                last = midpoint - 1
            else:
                first = midpoint + 1
    return found


def is_prime(num):
    i = 2
    while i ** 2 <= num:
        if num % i == 0:
            return False
        i += 1
    return True


primes = []
for i in range(2, 10 ** 5 + 1):
    if is_prime(i):
        primes.append(i)

like_2017 = []
count = [0 for _ in range(10 ** 5)]
for i in range(len(primes)):
    if binarySearch(primes, primes[i] * 2 - 1):
        like = 2 * primes[i] - 1
        count[like] += 1
for i in range(len(count) - 1):
    count[i + 1] += count[i]
for i in range(q):
    print(count[lr[i][1]] - count[lr[i][0] - 1])


Measured memory_bytes: 31584
#include<bits/stdc++.h>
using namespace std;
#define ll long long int

ll fun(ll a[], ll ind, ll dp[]){
    if(ind==0)return dp[0]=0;
    if(ind==1)return dp[1]=abs(a[0]-a[1]);
    ll& ans=dp[ind];
    if(ans!=-1)return ans;
    return ans=min(abs(a[ind]-a[ind-1])+fun(a,ind-1,dp),abs(a[ind]-a[ind-2])+fun(a,ind-2,dp));
}

int main() {
    ll n;
    cin>>n;
    ll a[n];
    ll dp[n];
    for(ll i=0;i<n;i++){
        cin>>a[i];
        dp[i]=-1;
    }
    cout<<fun(a,n-1,dp);
}

Measured memory_bytes: 8996
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;
const lli inf = 1e12;

int main(){
    int n,m,r;
    cin >> n >> m >> r;
    vector<int> ord(r);
    for(int i=0; i<r; i++){
        cin >> ord[i];
        ord[i]--;
    }
    vector<vector<lli> > adj(n, vector<lli>(n, inf));
    for(int i=0; i<m; i++){
        int a,b,c;
        cin >> a >> b >> c;
        a--; b--;
        adj[a][b] = adj[b][a] = c;
    }
    for(int k=0; k<n; k++){
        for(int i=0; i<n; i++){
            for(int j=0; j<n; j++){
                adj[i][j] = min(adj[i][j], adj[i][k]+adj[k][j]);
            }
        }
    }
    sort(ord.begin(), ord.end());
    lli ans = inf;
    do{
        lli sub = 0;
        for(int i=0; i<r-1; i++){
            sub += adj[ord[i]][ord[i+1]];
        }
        ans = min(ans, sub);
    }while(next_permutation(ord.begin(), ord.end()));
    cout << ans << endl;
    return 0;
}


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

vector<int> EratosthenesForA(vector<int> a, int n) {
  vector<int> arr(a[n-1]+1, 1);
	
	for( int i = 0; i < n; i++ ) {
		if ( arr[a[i]] ) {
			for( int j = 0; a[i] * (j + 2) <= a[n-1]; j++ ) {
				arr[a[i] * (j + 2)] = 0;
			}
		}
	}

  return arr;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n, 0);
  for ( int i = 0; i < n; i++ ) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  vector<int> arr = EratosthenesForA(a, n);
  int ans = 0;
  vector<int> ct(a[n-1]+1, 0);
  for ( int i = 0; i < n; i++ ) {
    if ( arr[a[i]] ) {
      ans++;
      ct[a[i]]++;
    }
  }
  for ( int i = 0; i <= a[n-1]; i++ ) {
    if ( ct[i] > 1 ) {
      ans -= ct[i];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 11640
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    std::string S;
    std::cin >> S;

    // 隙間の数
    size_t dn = S.size() - 1;

    int64_t ans =0;
    for (uint64_t bit = 0; bit < (1UL << dn); ++bit) {
        int64_t acc = 0;
        int64_t sum = 0;
        for (size_t i = 0; i < S.size() - 1; ++i) {
            acc *= 10;
            acc += S[i] - '0';
            // 場所i(0 ~ N-1)の後ろに + があるかどうかフラグ
            bool isPlus = bit & (1 << i);
            if (isPlus) {
                sum += acc;
                acc = 0;
            }
        }
        // 最後のところ
        acc *= 10;
        acc += S[S.size() - 1] - '0';
        sum += acc;

        ans += sum;
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();
		int m = sc.nextInt();
		double aAng = h * 30 + m * 0.5;
		double bAng = m * 6;
		System.out.println(
				Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2*a * b * Math.cos(Math.toRadians(Math.abs(360-(aAng - bAng))))));
	}

}


Measured memory_bytes: 27156
import itertools

n, m, x = map(int, input().split())

a = [list(map(int, input().split())) for i in range(n)]

cost = []

for i in range(1, n + 1):
    for k in itertools.combinations(range(n), i):
        c = 0
        a_list = [0] * m
        for l in k:
            c += a[l][0]
            for p in range(1, m + 1):
                a_list[p - 1] += a[l][p]
        
        if min(a_list) < x:
            continue
        else:
            cost.append(c)

if len(cost) != 0:
    print(min(cost))
else:
    print(-1)


Measured memory_bytes: 9344
use std::env;
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();

    let A = read::<i32>();
    let B = read::<i32>();

    if A + B > 9 {
        println!("error");
    }else {
        println!("{}", A+B);
    }
}


Measured memory_bytes: 4352
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=500010,inf=0X3f3f3f3f;
int n,f[maxn][3],suml[maxn],sumr[maxn];
char s[maxn];
int main(){
	scanf("%d",&n); scanf("%s",s+1);
	f[1][1]=f[2][1]=-inf;
	int co=0,cnt=0;
	for (int i=1;i<=n;i++){
		if (s[i]=='1') co++;
		else {
			cnt++;
			suml[i]=co; 
			co=0;
		}
	}
	co=0;
	for (int i=n,tot=cnt;i>=1;i--){
		if (s[i]=='1') co++;
		else {
			sumr[i]=co;
			co=0;
			tot--;
		}
	}
	f[0][0]=0;f[0][1]=f[0][2]=-inf;
	int last=0,ans=0;
	for (int i=1;i<=n;i++) if (s[i]=='0'){
		f[i][0]=max(f[last][0],max(f[last][1],f[last][2]));
		f[i][1]=suml[i] && sumr[i]?max(f[last][0]+suml[i],suml[i]>=1?f[last][1]+suml[i]-1:-inf):-inf;
		f[i][2]=suml[i] && sumr[i]?
		max(max(f[last][0]+sumr[i],suml[i]>=2?f[last][1]+sumr[i]:0),suml[i]>=1?f[last][2]+sumr[i]-1:-inf):-inf;
		ans=max(ans,max(f[i][0],max(f[i][1],f[i][2])));
		last=i;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 10368
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
using namespace std;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
#define pb push_back
template<class T> void print(const T& x){cout << x << endl;}
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;

int main(){
    int N; cin >> N;
    double T, A; cin >> T >> A;
    double diff = (double) inf;
    int ans = 0;
    rep(i, 0, N){
        double x; cin >> x;
        double tmp = abs(A - (T - x * 0.006));
        if(diff > tmp){
            diff = tmp;
            ans = i;
        }
    }
    cout << (ans+1) << endl;
    return 0;
}




Measured memory_bytes: 3752
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int A,B,C,K;
    cin >> A >> B >> C >> K;
    int ans = 0;
    int a = 0;
    a = max(max(A,B),C);
    ans = a * pow(2,K) + min(min(A,B),C) + ((A+B+C)-max(max(A,B),C)-min(min(A,B),C));
   cout << ans << endl;
}   

Measured memory_bytes: 256
MOD=10**9+7
H,W,A,B=map(int,input().split())

def invmod(a):
  return pow(a,MOD-2,MOD)
def comb_mod(n,r):
  if 0<=r<=n:
    return fact_dic[n]*fact_inv_dic[r]*fact_inv_dic[n-r]
  else:
    return 0

fact_dic={0:1}
fact_inv_dic={0:1}
fact_mod=1
for i in range(1,H+W-1):
  fact_mod=(fact_mod*i)%MOD
  fact_dic[i]=fact_mod
  fact_inv_dic[i]=invmod(fact_mod)
  
answer=0
for i in range(B,W):
  answer+=comb_mod(H-A-1+i,i)*comb_mod(A-1+W-1-i,W-1-i)
  answer%=MOD
    
print(answer)

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

int main() {
	int N,K,r=0;
	cin >> N >> K;
	vector<vector<int>> snk(N);

	rep(i,K) {
		int d,A;
		cin >> d;

		rep(j,d) {
			cin >> A;
			snk.at(--A).push_back(i);
		}
	}

	rep(i,N)
		if(snk.at(i).size() == 0)
			++r;
	cout << r << endl;
}

Measured memory_bytes: 3636
n, m = map(int, input().split())

if n > m:
    t = n
    n = m
    m = t

w = 0

if m == n == 1:
    print(1)
    exit()

if n == 1 and m != 1:
    print(m-2)
elif n != 1:
    print((n-2)*(m-2))


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

var1 = 0
var2 = 0

for i in range(a[1]):
    var1 = var1 * 10 + a[0]

for i in range(a[0]):
    var2 = var2 * 10 + a[1]

if a[0] <= a[1]:
    print(var1)
else:
    print(var2)


Measured memory_bytes: 2940
def check
  @blue = []
  @red = []

  line = STDIN.gets.chomp
  Integer(line).times do
    line = STDIN.gets.chomp
    @blue << line
  end

  line = STDIN.gets.chomp
  Integer(line).times do
    line = STDIN.gets.chomp
    @red << line
  end


  blue_num = {}
  @blue.each do |w|
    if blue_num[w]
      blue_num[w] += 1
    else
      blue_num[w] = 1
    end
  end
  red_num = {}
  @red.each do |w|
    if red_num[w]
      red_num[w] += 1
    else
      red_num[w] = 1
    end
  end

  good = 0
  blue_num.each do |w,n|
    score = n-red_num[w].to_i
    good = score if good <= score
  end

  return good
end


def main
 puts check()
end

main()

Measured memory_bytes: 1788
#include<iostream>

using namespace std;

int main()
{
  int n,m;
  cin >> n >> m;
  int g[m];
  for(int i=0;i<m;i++)
      cin >> g[i];
  int a[m][n];
  int p[n]={};
  for(int i=0;i<m;i++)
      for(int j=0;j<n;j++)
         cin >> a[i][j];
  for(int i=0;i<m;i++){
      int q=0;
      for(int j=0;j<n;j++){
          if(a[i][j]==g[i]) p[j]++;
          else q++;
      }
      p[g[i]-1]+=q;
  }
  for(int i=0;i<n;i++)
      cout << p[i] << endl;
  return 0;
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int n,k;
int p[1010];
int ans;
int main() {
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++) scanf("%d",&p[i]);
	sort(p+1,p+n+1);
	for(int i=1;i<=k;i++) ans+=p[i];
	printf("%d",ans);
	return 0;
} 

Measured memory_bytes: 3820
#include<iostream>
using namespace std;
static const int MAX = 1000000;

int main(){
  long long K, N;
  int A[MAX];
  int B[MAX];
  long long sum;
  long long maxi;

  cin >> K >> N;
  for (int i = 0; i < N; i++) cin >> A[i];

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

  B[N - 1] = (K - A[N - 1]) + A[0];


  maxi = 0;
  for (int i = 1; i < N; i++){

    if (B[i] > B[maxi]){
      maxi = i;
    }
  }

  for (int i = 0; i < N; i++){
    if (i != maxi){
      sum += B[i];
    }
  }


  cout << sum << endl;



  return 0;
}


Measured memory_bytes: 6912
s = input().strip()
n = len(s)
s = "0"+s
flag = 0
if s[n]=="1" or s[1]=="0":
    flag = 1
else:
    for i in range(1,n):
        if s[i]!=s[n-i]:
            flag = 1
            break
if flag==1:
    print(-1)
else:
    A = [1]
    for i in range(2,n):
        if s[i]=="1":
            while A:
                print(A.pop(),i)
            A = [i]
        else:
            A.append(i)
    print(n-1,n)
            

Measured memory_bytes: 78892
#include<stdio.h>
void handan(int a,int b,int c);
int main(void){
	int n;
	scanf("%d",&n);
	int a,b,c;
	for(;n>0;n--){
		scanf("%d %d %d",&a,&b,&c);
		handan(a,b,c);
	}
}

void handan(int a,int b,int c){
	if(a*a==b*b+c*c||b*b==a*a+c*c||c*c==a*a+b*b)printf("YES\n");
	else printf("NO\n");
}

Measured memory_bytes: 576
#include<cstdio>
#include<cstring>
#include<functional>
#include<algorithm>
#include<iostream>
#define rep(i,a) for(i=0;i<a;i++) 
using namespace std;
int main(void)
{
	int n,m,sum,i,j;
	int gyoretu[101][101];
	int bectol[101];
	cin>>n>>m;
	rep(i,n)rep(j,m)cin>>gyoretu[i][j];
	rep(i,m) cin>>bectol[i];
	rep(i,n){
		sum=0;
		rep(j,m) sum+=gyoretu[i][j]*bectol[j];
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 3080
N, W = list(map(int, input().split()))

values = [[] for i in range(4)]

w0, v0 = list(map(int, input().split()))
values[0].append(v0)

for i in range(N-1):
    w, v = list(map(int, input().split()))
    values[w-w0].append(v)

for i in range(4):
    values[i].sort(reverse=True)
    for j in range(len(values[i])-1):
        values[i][j+1] = values[i][j] + values[i][j+1]
    values[i].append(0)

res = 0

for i1 in range(len(values[0])+1):
    for i2 in range(len(values[1])+1):
        for i3 in range(len(values[2])+1):
            for i4 in range(len(values[3])+1):
                if(w0*i1 + (w0+1)*i2 + (w0+2)*i3 + (w0+3)*i4 <= W):
                    res = max(res, values[0][i1-1] + values[1][i2-1] + values[2][i3-1] + values[3][i4-1])

print(res)

Measured memory_bytes: 3064
#include <stdio.h>

int ru_ta_num;
int map[100][100];

int main(void) {
	int i,j,k;
	int ru_ta_id;
	int ru_ta_connect_num;
	int ru_ta_connect;
	int packet_num;
	int packet_from,packet_to,packet_ttl;
	scanf("%d",&ru_ta_num);
	for(i=0;i<ru_ta_num;i++) {
		for(j=0;j<ru_ta_num;j++) {
			map[i][j]=100000;
		}
		map[i][i]=0;
	}
	for(i=0;i<ru_ta_num;i++) {
		scanf("%d%d",&ru_ta_id,&ru_ta_connect_num);
		ru_ta_id--;
		for(j=0;j<ru_ta_connect_num;j++) {
			scanf("%d",&ru_ta_connect);
			map[ru_ta_id][ru_ta_connect-1]=1;
		}
	}
	for(k=0;k<ru_ta_num;k++) {
		for(i=0;i<ru_ta_num;i++) {
			for(j=0;j<ru_ta_num;j++) {
				if(map[i][k]+map[k][j]<map[i][j]) {
					map[i][j]=map[i][k]+map[k][j];
				}
			}
		}
	}
	scanf("%d",&packet_num);
	for(i=0;i<packet_num;i++) {
		scanf("%d%d%d",&packet_from,&packet_to,&packet_ttl);
		packet_from--;packet_to--;
		if(packet_ttl<map[packet_from][packet_to]+1) {
			puts("NA");
		} else {
			printf("%d\n",map[packet_from][packet_to]+1);
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>

#include <cmath>


using namespace std;

int division(int num, int div)
{
  int count = 0;
  while (num % div == 0) {
    count++;
    num = num / div;
  }
  return count;
}

void Snacks()
{
  int a;
  int b;
  cin >> a >> b;

  long long ans = 1;
  int n = 2;
  while (a > 1 || b > 1)
  {
    int anum=0;
    int bnum=0;
    if (a % n == 0)
    {
      anum = division(a, n);
      a = a / pow(n, anum);
    }
    if (b % n == 0)
    {
      bnum = division(b, n);
      b = b / pow(n, bnum);
    }
    int m = max(anum, bnum);
    ans = ans * pow(n, m);
    n++;
  }

  cout << ans << endl;
}

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

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

using namespace std;

int main(int argc, char *argv[]) {
    int n, a, b;
    cin >> n >> a >> b;

    int max_both = min({a, b});
    int c_min_both = (a + b) - n;
    int min_both = (c_min_both > 0) ? c_min_both : 0;

    cout << max_both << " " << min_both << endl;
    return 0;
}


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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    ll N, H, W;
    cin >> N >> H >> W;
    cout << (N - H + 1) * (N - W + 1) << endl;
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();

    #ifdef LOCAL_ENV
    assert(cin.rdstate() & ios_base::eofbit);
    #endif
}

Measured memory_bytes: 764
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func exec(stdin *Stdin, stdout *Stdout) {
	n := stdin.ReadInt()
	p := []int{}
	for i := 0; i < n; i++ {
		p = append(p, stdin.ReadInt())
	}

	t := int(math.MaxInt32)
	ans := 0
	for i := 0; i < n; i++ {
		if p[i] <= t {
			ans++
		}
		t = Min(t, p[i])
	}

	stdout.Println(ans)
}

func Min(a ...int) int {
	v := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] < v {
			v = a[i]
		}
	}
	return v
}
func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), int(math.MaxInt32))
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
using namespace std;
int n, a[200005], cnt = 0;
int main () {
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	for(int i = 0; i < n - 1; i++) {
		if(a[i] == a[i + 1]) {
			cout << "NO";
			return 0;
		}
	}
	cout << "YES";
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;

int N;
vector<vector<ll> > s;
vector<ll> ai(16,20e10);

int dfs(vector<ll> di, int ni, int nn){
  if(ni==N){
    ll ans=0;
    for(int i=0;i<N;i++) ans+=s[i][2]*di[i];
    ai[nn]=min(ai[nn],ans);
    return 0;
  }
  dfs(di,ni+1, nn);
  for(int i=0;i<2;i++){
    vector<ll> dt(N);
    copy(di.begin(),di.end(),dt.begin());
    for(int j=0;j<N;j++) dt[j]=min(dt[j],abs(s[j][i]-s[ni][i]));
    dfs(dt,ni+1,nn+1);
  }
  return 0;
}

int main(){
  cin >> N;
  s.resize(N, vector<ll>(3));

  for(int i=0;i<N;i++) cin >> s[i][0] >> s[i][1] >> s[i][2];

  vector<ll> d(N,20000);

  for(int i=0;i<N;i++){
    d[i]=min(abs(s[i][0]),abs(s[i][1]));
  }

  dfs(d,0,0);

  for(int i=0;i<N+1;i++){
    cout << ai[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 3632
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <unordered_set>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

vector<bool> prime_table(int n) {
  vector<bool> prime(n + 1, true);
  if (n >= 0) prime[0] = false;
  if (n >= 1) prime[1] = false;
  for (int i = 2; i * i <= n; i++) {
    if (!prime[i]) continue;
    for (int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}

map<int64_t, int> prime_factor(int64_t n) {
  map<int64_t, int> ret;
  for (int64_t i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}

int main(void) {
  ios::sync_with_stdio(false);
  vector<bool> ptbl = prime_table(1e6 + 1);
  int N;
  cin >> N;
  vector<int64_t> A(N);
  vector<int64_t> B;
  unordered_set<int64_t> hist;
  rep(i, N) {
    cin >> A[i];
    if (ptbl[A[i]]) {
      hist.emplace(A[i]);
    } else {
      B.emplace_back(A[i]);
    }
  }

  int64_t Agcd = A[0];
  for (int i = 1; i < N; ++i) {
    Agcd = gcd(Agcd, A[i]);
  }
  if (Agcd != 1) {
    cout << "not coprime" << endl;
    return 0;
  }

  int BN = B.size();
  rep(i, BN) {
    for (auto& d : prime_factor(B[i])) {
      if (hist.count(d.first)) {
        cout << "setwise coprime" << endl;
        return 0;
      }
      hist.emplace(d.first);
    }
  }
  cout << "pairwise coprime" << endl;
  return 0;
}


Measured memory_bytes: 21676
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <iomanip>
#include <sstream>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 1LL << 60;
constexpr int inf = 1 << 30;

int main() {
    int N, K; cin >> N >> K;
    int k;
    for (int i = 0; i < N; ++i) {
        int a; cin >> a;
    }
    for (int i = 1; ; ++i) {
        if (i * K - (i - 1) >= N) {
            cout << i << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
class Main{
    public static void main(String args[]){
        BufferedReader reader = 
        		new BufferedReader(new InputStreamReader(System.in));
        
        String st = "";
        int[] a = new int[100];
        int sum;
        try{
        while((st = reader.readLine()) != null){
        	
        	sum = 0;
            
            for (int i = 0; i < st.length(); i++) {
                if (st.charAt(i) == 'I') a[i] = 1;
                if (st.charAt(i) == 'V') a[i] = 5;
                if (st.charAt(i) == 'X') a[i] = 10;
                if (st.charAt(i) == 'L') a[i] = 50;
                if (st.charAt(i) == 'C') a[i] = 100;
                if (st.charAt(i) == 'D') a[i] = 500;
                if (st.charAt(i) == 'M') a[i] = 1000;
                if (i != 0 && a[i - 1] < a[i]) {
                    a[i] -= a[i - 1];
                    a[i - 1] = 0;
                }
            }
            
            for (int i = 0; i < st.length(); i++) {
                sum += a[i];
            }
            
            System.out.println(sum);
        }
        }catch(IOException e){
    	}
        try{
        	reader.close();
        }catch(IOException e){
        }
    }
}

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

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9+7;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef long long i64;

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

  int w, h, n;
  cin >> w >> h >> n;

  int px = 0, py = 0;
  rep(i, 0, n) {
    int x, y, a;
    cin >> x >> y >> a;
    if(a == 1) px = max(px, x);
    else if(a == 2) w = min(w, x);
    else if(a == 3) py = max(py, y);
    else h = min(h, y); 
  }
  cout << max(0, h - py) * max(0, w - px) << endl;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d", $N,$T);
for($i=0; $i<$N; $i++){
    $arr[] = explode(" ", trim(fgets(STDIN)));
}

for($i=0; $i<$N; $i++){
    if($arr[$i][1] <= $T){
        $check[] = $arr[$i][0];
    }
}
if(!isset($check)){
    echo "TLE";
}else{
    echo min($check);
}
?>

Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main(){
  ll n,sum=0;cin>>n;
  vector<ll> p(n);
  rep(i,n){
    ll a,b;cin>>a>>b;
    p[i]=a+b;
    sum-=b;
  }
  sort(p.begin(),p.end());
  for(int i=n-1;i>=0;i-=2){
    sum+=p[i];
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 1024
A = []
for i in range(3):
    A.append(list(map(int, input().split())))
N = int(input())
b = []
for j in range(N):
    b.append(int(input()))
for i in range(3):
    for j in range(3):
        for k in range(N):
            if A[i][j] == b[k]:
                A[i][j] = 0
Answer = []
for i in range(3):
    if A[i][0:3] == [0,0,0]:
        Answer.append('Yes')
        break
    elif A[0][i] == A[1][i] and A[1][i] == A[2][i]:
        Answer.append('Yes')
        break
    elif A[0][0] == A[1][1] and A[1][1] == A[2][2]:
        Answer.append('Yes')
        break
    elif A[0][2] == A[1][1] and A[1][1] == A[2][0]:
        Answer.append('Yes')
        break
if len(set(Answer)) == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>
#include<string.h>

typedef struct dice{
	int e[7]; /*Dice Eyes 1～6*/
}dice_t;

/*縦奥回転*/
void DiceRoll_N(dice_t* pDice){
	pDice->e[0] = pDice->e[1];
	pDice->e[1] = pDice->e[2];
	pDice->e[2] = pDice->e[6];
	pDice->e[6] = pDice->e[5];
	pDice->e[5] = pDice->e[0];
	return ;
}
void DiceRoll_S(dice_t* pDice){
	pDice->e[0] = pDice->e[1];
	pDice->e[1] = pDice->e[5];
	pDice->e[5] = pDice->e[6];
	pDice->e[6] = pDice->e[2];
	pDice->e[2] = pDice->e[0];
	return ;
}
/*時計回り回転*/
void DiceRoll_E(dice_t* pDice){
	pDice->e[0] = pDice->e[1];
	pDice->e[1] = pDice->e[4];
	pDice->e[4] = pDice->e[6];
	pDice->e[6] = pDice->e[3];
	pDice->e[3] = pDice->e[0];
	return ;
}
void DiceRoll_W(dice_t* pDice){
	pDice->e[0] = pDice->e[1];
	pDice->e[1] = pDice->e[3];
	pDice->e[3] = pDice->e[6];
	pDice->e[6] = pDice->e[4];
	pDice->e[4] = pDice->e[0];
	return ;
}
/*左回りのスピン*/
void DiceRoll_Spin(dice_t* pDice){
	pDice->e[0] = pDice->e[2];
	pDice->e[2] = pDice->e[4];
	pDice->e[4] = pDice->e[5];
	pDice->e[5] = pDice->e[3];
	pDice->e[3] = pDice->e[0];
	return ;
}

/*１回し分のダイス比較*/
int Dice_Cmp(dice_t* dice, dice_t* dice2){
	int i;
	dice_t* pDice = dice;
	dice_t* pDice2 = dice2;
	
	for(i=0; i<3; i++){
		if( dice->e[1] == dice2->e[1] )	break;
		DiceRoll_N( pDice2 );
	}
	if( dice->e[1] != dice2->e[1] ){	/*縦回しで見つからない→側面を捜索*/
		if( dice->e[1] == dice2->e[3] ){
			DiceRoll_E( pDice2 );
		}else if( dice->e[1] == dice2->e[4] ){
			DiceRoll_W( pDice2 );
		}else{
			;
		}
	}
	for(i=0; i<3; i++){
		if( dice->e[2] == dice2->e[2] )	break;
		DiceRoll_Spin( pDice2 );
	}
	for(i=1; i<7; i++)	if( dice->e[i] != dice2->e[i] )	break;
	if( i == 7){
		return 1;
	}else{
		return 0;
	}
}

/*Dice_Cmp()を6面分実行する*/
int Dice_Cmp_6face(dice_t* dice, dice_t* dice2){
	int i;
	int same_cnt;
	dice_t* pDice = dice;
	dice_t* pDice2 = dice2;
	
	same_cnt = 0;
	
	for(i=0; i<7; i++){
	/*1～6面までそれぞれを上面にした場合の一致を確認するためにダイス１を回す(目の数が同じ面の場合に対応するため)*/
		if(i == 0){
			;
		}else if(i>0 && i<4){
			DiceRoll_N( pDice );	/*1面は回さず、2~4面を回しながら確認*/
		}else if(i==4){
			DiceRoll_E( pDice );	/*横倒しにして5面を頂点に*/
		}else{
			DiceRoll_E( pDice );	/*横倒し×２で5面の裏面を頂点に*/
			DiceRoll_E( pDice );
		}
		
		/*ダイス１と２の比較を開始*/
		same_cnt += Dice_Cmp( pDice, pDice2 );
		
	}
	if( same_cnt == 0){
		return 0;
	}else{
		return 1;	/*完全一致が確認出来たら1を出力*/
	}
}



int main(){
	int i,j,k;
	dice_t dice[202];
	dice_t* pDice;
	int same_cnt, dice_num;
	
	same_cnt = 0;
	
	scanf("%d", &dice_num);
	for(i=0; i<dice_num; i++){
		for(j=1; j<7; j++)	scanf("%d", &dice[i].e[j]);
	}
	
	for(i=0; i<dice_num; i++){
		for(j=1; j<dice_num; j++){
			same_cnt += Dice_Cmp_6face( &dice[i], &dice[i+j] );
		}
		pDice = &dice[dice_num + i];
		for(k=0; k<7; k++)	pDice->e[k] = dice[i].e[k];
	}
	
	if( same_cnt == 0){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	
	
	return 0;
}


Measured memory_bytes: 2144
# -*- coding: utf-8 -*-
import sys
from collections import deque
from math import sqrt
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline()[:-1]

# n = int(input())



def solve():
    n = int(input())
    ans = 0
    a = 0
    b = 0
    c = 0
    for _ in range(n):
        s = input()
        a += s[-1] == 'A' and s[0] != 'B'
        b += s[0] == 'B' and s[-1] != 'A'
        c += s[0] == 'B' and s[-1] == 'A'
        ans += s.replace('AB', "*").count('*')
    if (a+b) > 0:
        print(ans + c + min(a, b))
    else:
        if c:
            c -= 1
        print(ans + c)
    

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()




"""




"""



Measured memory_bytes: 3444
N=int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

total=B[A[0]-1]
for i in range(1,N):
    total+=B[A[i]-1]
    if(A[i]-1==A[i-1]):
        total+=C[A[i-1]-1]

print(total)

Measured memory_bytes: 3064
from collections import deque

H, W = map(int, input().split())
ch, cw = map(lambda x: int(x)-1, input().split())
dh, dw = map(lambda x: int(x)-1, input().split())
s = [input() for _ in range(H)]

INF = 10**9
m = [[INF]*W for _ in range(H)]
m[ch][cw] = 0

q = deque()
q.append((ch, cw, 0))

cnt = 0
while q:
    cnt += 1
    h, w, n = q.popleft()
    for i, j in [(0,1), (0,-1), (1,0), (-1,0)]:
        if (h+i<0 or w+j<0) or (h+i>=H or w+j>=W):
            continue
        if m[h+i][w+j] <= n:
            continue
        if s[h+i][w+j] == '#':
            continue
        m[h+i][w+j] = n
        q.appendleft((h+i, w+j, n))

    for i in range(-2, 3):
        for j in range(-2, 3):
            if (h+i<0 or w+j<0) or (h+i>=H or w+j>=W):
                continue
            if m[h+i][w+j] <= n+1:
                continue
            if s[h+i][w+j] == '#':
                continue
            m[h+i][w+j] = n + 1
            q.append((h+i, w+j, n+1))
if m[dh][dw] == INF:
    print(-1)
else:
    print(m[dh][dw])

Measured memory_bytes: 107700
#include<stdio.h>
#include <iomanip>
#include <iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include <random>
#include <chrono>

#define pai 3.14159265359

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

using namespace std;
int main() {
	double a, b, h, m;
	double ans;
	double rad;
	cin >> a >> b >> h >> m;
	rad = abs(h * 30.00 - m * 6 + 0.5 * m);
	if (rad > 180) {
		rad =360-rad;
	}

	ans = sqrt(a * a + b * b - 2.0000000 * a * b * cos(rad * pai / 180.0));
	cout << setprecision(30) << ans;


}

Measured memory_bytes: 3644
import itertools
from math import sqrt

N = int(input())
zahyo = []
kyori_ichiran = []
for i in range(N):
    x,y = map(int,input().split())
    zahyo.append((x,y))
junban_ichiran = list(itertools.permutations(range(N),N))
for i in range(len(junban_ichiran)):
    junban = junban_ichiran[i]
    kyori = 0
    for j in range(len(junban)-1):
        kyori += sqrt((zahyo[junban[j]][0]-zahyo[junban[j+1]][0])**2 + (zahyo[junban[j]][1]-zahyo[junban[j+1]][1])**2)
    kyori_ichiran.append(kyori)
print(sum(kyori_ichiran)/len(kyori_ichiran))


Measured memory_bytes: 9252
N, M = map(int,input().split())
LR = [list(map(int,input().split())) for i in range(M)]

L_lst = []
R_lst = []
for i in range(M):
  L_lst.append(LR[i][0])
  R_lst.append(LR[i][1])
  
L_max = max(L_lst)
R_in = min(R_lst)

if L_max > R_in:
  print(0)
else:
  print(R_in - L_max + 1)

Measured memory_bytes: 29096
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int main() {
	int N, K;
	string S;
	cin >> N >> S >> K;

	for (int i = 0; i <= N; i++) {
		if (S[i] != S[K - 1]) {
			S[i] = '*';
		}
	}
	cout << S;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

int main() {
    int x, y;
    cin >> x >> y;

    int p[3][13] = {
        { 1, 3, 5, 7, 8, 10, 12 },
        { 4, 6, 9, 11 },
        { 2 },
    };
    int c[13];
    for (int j = 0; j < 3; j++) {
        for (int i = 0; i < 13; i++) {
            c[p[j][i]] = j;
        }
    }
    

    cout << (c[x] == c[y] ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  vector<string> a(3);
  rep(i,3) cin >> a.at(i);
  rep(i,3){
    cout << a.at(i).at(i);
  }
  cout << endl;
}


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

namespace ConsoleApp15
{
    class Class214
    {
        static void Main()
        {
            var NKQ = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = NKQ[0], K = NKQ[1], Q = NKQ[2];
            var A = new int[N];
            for(int i = 0; i < Q; i++)
            {
                var r = int.Parse(Console.ReadLine()) - 1;
                A[r]++;
            }
            foreach(int i in A)
            {
                Console.WriteLine(K-Q+i>0?"Yes":"No");
            }
        }
    }
}


Measured memory_bytes: 17884
#include <stdio.h>
int main(){
    char s[4];
    int a=0,b=0,c=0,i;
    scanf("%s",s);
    for(i=0;i<4;i++){
        if(s[i]=='a')a++;
        if(s[i]=='b')b++;
        if(s[i]=='c')c++;
    }
    if(a==b&&b==c)printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 128
n = int(input())
Dn = list(map(int, input().split()))#ダム


memo = 0 # M_n = M_0
for i in range(n):
    memo += Dn[i]*(-1 if i%2==0 else 1)

memo *= -1

#print(memo)



M0_max = min(Dn[0], Dn[-1])*2 
Mn0 = 0

def set_Mn0():

    for i in range(0, M0_max+1, 2):
    
        valid = i == memo 
#    print(i, memo, valid)
#    print(Dn)
#    print()

        if valid:
            Mn0 = i
            break


m0_l = 0
m0_h = M0_max
mid = m0_l + m0_h
mid = mid//2 + mid%2

while mid != memo:
    if memo < mid :
        m0_h = mid
    else:
        m0_l = mid
    
    mid = m0_l + m0_h
    mid = mid // 2 + mid%2
    
    #print(mid)

Mn0 = mid


Mn = [0]*n
Mn[0] = Mn0
for i in range(1,n):
    Mn[i] = 2*Dn[i-1]-Mn[i-1]

print(*Mn)




Measured memory_bytes: 14400
#include<bits/stdc++.h>
#define INFTY 1<<20
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const int MOD=1000000007;

int main(){
   char c;cin>>c;
    char d = c+1;
    printf("%c",d);


return 0;
}

Measured memory_bytes: 256
/* ex7_1
    fmuacshai */
#include <stdio.h>

//構造体pointを定義
typedef struct point{
    int x_elem;
    int y_elem;
}point;

//shift_point関数を定義
point shift_point(point square1,point square2){
    //square3を定義
    point square3;
    //x座標とy座標の差
    int diffx,diffy;
    //diffxとdiffyの計算
    diffx=square1.x_elem-square2.x_elem;
    diffy=square1.y_elem-square2.y_elem;
    //ずらす
    square3.x_elem=square2.x_elem+diffy;
    square3.y_elem=square2.y_elem-diffx;
    //square3を返す
    return square3;
}
//pointの変数を出力するprint_pointを定義
point print_point(point square){
    printf(" %d %d",square.x_elem,square.y_elem);
    return square;
}
int main(void){
    //以下4つを定義
    point square1,square2,square3,square4;
    //与えられた値を入力
    scanf("%d",&square1.x_elem);
    scanf("%d",&square1.y_elem);
    scanf("%d",&square2.x_elem);
    scanf("%d",&square2.y_elem);
    //square3とsquare4を計算
    square3=shift_point(square1,square2);
    square4=shift_point(square2,square3);
    //結果を出力
    print_point(square3);
    print_point(square4);
    printf("\n");
    return 0;
}




Measured memory_bytes: 1736
#include <stdio.h>

#define NIL -2000000001

int main(){
    int i,H,key[251];
    int p,l,r;

    scanf("%d",&H);

    for(i=1; i<=H; i++)scanf("%d",&key[i]);
    key[0] = NIL;
    for(i=1; i<=H; i++){
        p = i/2;
        l = i*2; 
        r = i*2+1;
        printf("node %d: key = %d, ",i,key[i]);
        if(key[p] != NIL) printf("parent key = %d, ",key[p]);
        if(l <= H) printf("left key = %d, ",key[l]);
        if(r <= H) printf("right key = %d, ",key[r]);

        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2056
(let ((n (read))
      (h nil))
  (loop :for i :from 1 :to n
        :do (push (read) h))
  ;
  (loop :named main
        :with p := (car h)
        :for x :in (cdr h)
        :do (cond ((= x (1+ p))
                   (setf p p))
                  ((<= x p)
                   (setf p x))
                  (t
                   (format t "No~%")
                   (return-from main)))
        :finally (format t "Yes~%")))


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

using namespace std;
typedef long long unsigned int ll;

#define PI (acos(-1))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    int p; cin>>p;
    int q; cin>>q;
    int r; cin>>r;
    cout << min(min(p+q, q+r), (r+p)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
int vis[55];
char s[55],t[55];
int n,m,sum=0;
string a[100];

int chick(int q){
	int tot = 1;
	for(int i = q;i <= q+m;i++){
		if(s[i] == '?' || s[i] == t[tot]){
			vis[i] = tot;
			tot++;
		}
		else{
			return 0;
		}
		if(tot == m+1)return 1;
	}
}



int main()
{
	scanf("%s",s+1);
	scanf("%s",t+1);
	n=strlen(s+1);
	m=strlen(t+1);
	for(int i=1;i<=n;i++){
		memset(vis,0,sizeof(vis));
		if(chick(i)){
			sum++;
			for(int j=1;j<=n;j++){
				if(vis[j]!=0){
					a[sum]+=t[vis[j]];
				}
				else if(vis[j]==0&&s[j]=='?'){
					a[sum]+='a';
				}
				else a[sum]+=s[j];
			}
		}
	}
	if(sum==0) printf("UNRESTORABLE\n");
	else{
		sort(a+1,a+sum+1);
		cout<<a[1]<<endl;
	}

}

Measured memory_bytes: 256
//password1488
#include <bits/stdc++.h>
using namespace std;
typedef __int128 ll;
const ll N = 2e5+228;
const ll MM = 1e18;
signed main(){
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
    long long n;
    cin >> n;
    ll r=1;
    for(long long a, i=0;i<n;i++){
        cin >> a;
        ll orr = r;
        if(a==0){
            r=0;
            break;
        }
        if(r!=-1) r*=a;
        if(r!=-1&&(orr!=r/a||r>MM)){
            r=-1;
        }
    }
    long long ot = r;
    cout<<ot;
}

Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());

        if (a + b >= c) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> v(n);
	for( auto &i : v ) cin >> i;
	sort( v.begin(), v.end() );
	cout << v.back() - v.front() << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

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

    vector<ll> sa(a);
    sort(ALL(sa));
    sa.erase(unique(ALL(sa)), sa.end());

    vector<ll> cnt(1000001);
    REP(i, n) cnt[a[i]]++;

    vector<bool> v(1000001, true);
    for(auto i: sa) {
        for(ll j=2*i; j<=1000000; j+=i) {
            v[j] = false;
        }
    }

    ll ret = 0;
    REP(i, n) if(v[a[i]] && cnt[a[i]]<=1) ret++;
    cout << ret << endl;

    return 0;
}

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


double ternary_search(
        const std::function<double(double)> &fn,
        double lo=0., double hi=1e9) {
    for (int iter = 0; iter < 100; iter++) {
        double midl = lo + (hi - lo) / 3;
        double midr = lo + 2*(hi - lo) / 3;
        if (fn(midl) < fn(midr)) hi = midr;
        else lo = midl;
    }
    return lo;
}

constexpr double EPS = 1e-12;

double binary_search_left(
        const std::function<double(double)> &fn,
        double t, double lo = 0., double hi = 1e9) {
    hi = t;
    double targ = fn(t);
    for (int iter = 0; iter < 100; iter++) {
        double mid = lo + (hi - lo)/2;
        if (std::abs(fn(mid) - targ) < EPS) hi = mid;
        else lo = mid;
    }
    return lo;
}

double binary_search_right(
    const std::function<double(double)> &fn,
    double t, double lo = 0., double hi = 1e9) {
    lo = t;
    double targ = fn(t);
    for (int iter = 0; iter < 100; iter++) {
        double mid = lo + (hi - lo) / 2;
        if (std::abs(fn(mid) - targ) < EPS) lo = mid;
        else hi = mid;
    }
    return lo;
}

int main() {
    int n; std::cin >> n;
    std::vector<double> x(n), y(n);
    std::vector<double> dx(n), dy(n);
    for (int i = 0; i < n; i++) {
        std::cin >> x[i] >> y[i];
        char c; std::cin >> c;
        if (c == 'R') dx[i] = 1;
        if (c == 'L') dx[i] = -1;
        if (c == 'U') dy[i] = 1;
        if (c == 'D') dy[i] = -1;
    }
    auto fxmax = [&](double t) {
        double ret = -1e9;
        for (int i = 0; i < n; i++) {
            ret = std::max(ret, x[i] + t*dx[i]);
        }
        return ret;
    };
    auto fxmin = [&](double t) {
        double ret = 1e9;
        for (int i = 0; i < n; i++) {
            ret = std::min(ret, x[i] + t*dx[i]);
        }
        return -ret;
    };
    auto fymax = [&](double t) {
        double ret = -1e9;
        for (int i = 0; i < n; i++) {
            ret = std::max(ret, y[i] + t*dy[i]);
        }
        return ret;
    };
    auto fymin = [&](double t) {
        double ret = 1e9;
        for (int i = 0; i < n; i++) {
            ret = std::min(ret, y[i] + t*dy[i]);
        }
        return -ret;
    };

    std::vector<double> cand;
    auto push = [&](const auto& fn) {
        double t = ternary_search(fn);
        cand.push_back(binary_search_left(fn, t));
        cand.push_back(binary_search_right(fn, t));
    };
    push(fxmax);
    push(fxmin);
    push(fymax);
    push(fymin);

    double ans = 2e18;
    for (double t : cand) {
        ans = std::min(ans, (fxmax(t) + fxmin(t))*(fymax(t) + fymin(t)));
    }
    printf("%.14f\n", ans);
    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define INF 2e9
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}

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

Measured memory_bytes: 256