akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y)
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll n;
	cin >> n;
	ll ans = 0;
	repn(i, 1, n){
		//we guess a
		ll l = 1, r = n;
		while(l < r){
			ll mid = (l + r + 1) / 2;
			if(mid * i < n) l = mid;
			else r = mid - 1;
		}
		ans += l;
	}
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 3648
def examA():
    A = LI()
    if sum(A)>=22:
        ans = "bust"
    else:
        ans = "win"
    print(ans)
    return

def examB():
    return

def examC():
    return

def examD():
    return

def examE():
    return

def examF():
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()


Measured memory_bytes: 38384
/**
    AUTHOR:Jun_SH
    TIME:2019/6/16
    PROBLEM:ABC130_c
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    double w,h,x,y;
    cin>>w>>h>>x>>y;
    ll f1=0;
    ll f2=0;
    if(2*x==w)f1=1;
    if(2*y==h)f2=1;
    if(f1*f2!=1){
        printf("%.6lf 0",w*h/2);
    }
    else printf("%.6lf 1",w*h/2);
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		long[] memo = new long[n + 1];
		memo[0] = 2;
		memo[1] = 1;
		System.out.println(lucas(n, memo));
		
		sc.close();
	}
	
	static long lucas(int n, long[] memo) {
		if (memo[n] > 0) return memo[n];
		return memo[n] = lucas(n - 1, memo) + lucas(n - 2, memo);
	}
}




Measured memory_bytes: 27104
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
//#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	
	int n, d;
	int cnt=0;
	double a;
	long long int  x, y;
	cin >> n >> d;

	for (int i = 0; i < n; i++)
	{
		cin >> x >> y;
		a = sqrt((x * x) + (y * y));
		if (a <= d)
		{
			cnt++;
		}
	}
	cout << cnt << endl;
}


	
	

	
	
/**/
/*#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

#define PI 3.141592653589793

int main(void) {
	return 0;
}
*/

Measured memory_bytes: 3676
using System;

namespace ABC160a
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().ToCharArray();

            string result = "No";
            if(s[2] == s[3] && s[4] == s[5])
            {
                result = "Yes";
            }
            Console.WriteLine(result);
        }
    }
}


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

const int MAX_N = 2e5 + 5;
const lint INF = 1e15;
int N;
lint A[MAX_N], dp[MAX_N][5];

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    cin >> N;
    for(int i=1;i<=N;i++) cin >> A[i];

    for(int i=0;i<=N+1;i++) for(int j=0;j<5;j++) dp[i][j] = INF;
    dp[0][0] = 0;

    for(int i=1;i<=N+1;i++){
        dp[i][0] = dp[i-1][0] + A[i];
        dp[i][1] = min(dp[i-1][0], dp[i-1][1]) + A[i] % 2 + (A[i]==0 ? 2 : 0);
        for(int j=0;j<3;j++) dp[i][2] = min(dp[i][2], dp[i-1][j]+(A[i]+1)%2);
        for(int j=0;j<4;j++) dp[i][3] = min(dp[i][3], dp[i-1][j]+A[i]%2+(A[i]==0 ? 2 : 0));
        for(int j=0;j<5;j++) dp[i][4] = min(dp[i][4], dp[i-1][j]+A[i]);
    }

    cout << dp[N+1][4] << endl;
    return 0;
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int Cnter(string a,string b){
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  int ret = 0;
  for(int i = 'a'; i <= 'z'; ++i){
    ret += binary_search(a.begin(),a.end(),i)&&binary_search(b.begin(),b.end(),i);
  }
  return ret;
}

int main(){
  int n; cin >> n;
  string s; cin >> s;
  int ans = 0;
  for(int i = 1; i < n-1; ++i){
    ChangeMax(ans,Cnter(s.substr(0,i),s.substr(i,n-i)));
  }
  cout << ans << endl;
}


Measured memory_bytes: 3640
n = int(input())

lis = []

sortsecond0 = lambda val: val[0]
sortsecond1 = lambda val: val[1]

for i in range(n):
    city, point = input().split()
    point = int(point)
    lis.append([city, point, i])

lis.sort(key=sortsecond1, reverse=True)
lis.sort(key=sortsecond0)

for i in range(n):
    print(lis[i][2]+1)


Measured memory_bytes: 3060
#include<cstdio>
#include<cctype>

using namespace std;
int main(){
    char ch;
    //chを文字型の箱にしましたよ！//
    
    while(1){
        scanf("%c",&ch);
        if (isalpha(ch)){
            if (islower(ch)) printf("%c",toupper(ch));
            else printf("%c",tolower(ch));
        } else printf("%c",ch);
        
        if (ch == '\n') break;
    }
    return 0;
}
    


Measured memory_bytes: 2608
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main()
{
        //input->compute->output//

        int N;
        cin >> N;

        vector<int> A(N + 1);
        for (int i = 0; i < N + 1; i++)
        {
                cin >> A[i];
        }

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

        ll ans = 0;
        for (int i = 0; i < N; i++)
        {
                int left = min(A[i], B[i]);
                ans += left;
                A[i] -= left;
                B[i] -= left;

                int right = min(A[i + 1], B[i]);
                ans += right;
                A[i + 1] -= right;
                B[i] -= right;
        }

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


Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int z(int a){
  if(a<1)a*=-1;
  return a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
int kt(ll a){
  int sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
int ks(ll a){
  int sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
int n;
int f(int b,int c){
  return c*((n-1)/b+1);
}
int main(void){
  int n,j;
  scanf("%d",&n);
  ll a[n],ans=0;
  FOR(n)scanf("%lld",&a[i]);
  qsort(a,n,sizeof(ll),d);
  for(int i=1;i<n;i++){
    if(ans<=min(a[i],a[0]-a[i])){
      ans=min(a[i],a[0]-a[i]);
      j=i;
    }
  }
  printf("%lld %lld\n",a[0],a[j]);
  return 0;
}


Measured memory_bytes: 1788
#!/usr/bin/python3

sx, sy, tx, ty = [ int(i) for i in input().split() ]
x = tx - sx
y = ty - sy
s = ''
s += 'U' * y + 'R' * x
s += 'D' * y + 'L' * x
s += 'L' + 'U' * (y+1) + 'R' * (x+1) + 'D'
s += 'R' + 'D' * (y+1) + 'L' * (x+1) + 'U'
print(s)


Measured memory_bytes: 3060
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		System.out.println(sc.nextInt()*sc.nextInt());
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

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

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
		public int[] nextArr(int n) throws IOException{
			int arr[]=new int[n];
			for(int i=0;i<n;i++)arr[i]=nextInt();
			return arr;
		}

	}
}

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

int N, M;

int main(){
  std::cin >> N >> M;
  std::vector<long long> a(N), b(N), c(M), d(M);
  for(int i = 0; i < N; ++i){
    std::cin >> a[i] >> b[i];
  }
  for(int j = 0; j < M; ++j){
    std::cin >> c[j] >> d[j];
  }
  for(int i = 0; i < N; ++i){
    int count = -1;
    long long min_length= 1000000000000;
    for(int j = 0; j < M; ++j){
      long long length = std::abs(a[i]-c[j])+std::abs(b[i]-d[j]);
      if(min_length > length){
        min_length = length;
        count = j+1;
      }
    }
    std::cout << count << std::endl;
  }
}


Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
if n >= 1800:
    print(1)
elif n >= 1600:
    print(2)
elif n >= 1400:
    print(3)
elif n >= 1200:
    print(4)
elif n >= 1000:
    print(5)
elif n >= 800:
    print(6)
elif n >= 600:
    print(7)
else:
    print(8)


Measured memory_bytes: 10384
#include <iostream>
#include <array>
#include <math.h>

int main(){

	std::array<double, 3> a; //0:xa 1:ya 2:ra
	std::array<double, 3> b;

	int N;
	std::cin >> N;

	for(int i = 0; i < N; ++i){
		
		for(int j = 0; j < 3; ++j)
			std::cin >> a[j];

		for(int j = 0; j < 3; ++j)
			std::cin >> b[j];

		double ab = hypot( (a[0] - b[0]) , (a[1] - b[1]) ); //distance a,b

		if( ab > (a[2] + b[2]) ) std::cout << 0 << std::endl;
		
		else if ( a[2] > ab + b[2] ) std::cout << 2 << std::endl;

		else if ( b[2] > ab + a[2] ) std::cout << -2 << std::endl;

		else std::cout << 1 << std::endl;

	}
	return 0;
}

Measured memory_bytes: 1252
a, b, c, x, y = map(int, input().split())
ab = a * x + b * y
cc = max(x, y) * c * 2
abc = min(x, y) * c * 2 + (x - min(x, y)) * a + (y - min(x, y)) * b
print(min(ab, cc, abc))


Measured memory_bytes: 3064
n = int(input())
S = list(map(int, input().split()))


def partition(p, r):
    x = S[r]
    i = p - 1
    for k in range(p, r):
        if S[k] <= x:
            i += 1
            S[i], S[k] = S[k], S[i]
    S[i + 1], S[r] = S[r], S[i + 1]
    return i + 1


i = partition(0, n - 1)
S[i] = '[' + str(S[i]) + ']'

print(*S)



Measured memory_bytes: 16392
#include<bits/stdc++.h>
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define sz(x) int(x.size())
#define All(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef priority_queue<int> BQ;
typedef priority_queue<int,vector<int>,greater<int> > SQ;
const int maxn=3e5+10,mod=1e9+7,INF=0x3f3f3f3f;
vector<int> e[maxn];
int a[maxn];
int main()
{
	int n,m;
	cin>>n>>m;
	for (int i=1;i<=n;++i)
		scanf("%d",&a[i]);
	for (int i=1;i<=m;++i){
		int u,v;
		scanf("%d%d",&u,&v);
		e[u].pb(v);
		e[v].pb(u);	
	}
	int ans=0;
	for (int i=1;i<=n;++i){
		int ok=1;
		for (auto j:e[i]){
			if (a[j]>=a[i])
				ok=0;
		}
		ans+=ok;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 13884
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int h, w;
    cin >> h >> w;

    string board[50];
    for (int i = 0; i < h; ++i) cin >> board[i];

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

    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            if (board[i][j] == '#') continue;
            
            int num = 0;
            for (int d = 0; d < 8; ++d)
            {
                const int ni = i + dy[d];
                const int nj = j + dx[d];
                if (ni < 0 or h <= ni) continue;
                if (nj < 0 or w <= nj) continue;
                if (board[ni][nj] == '#')
                    num++;
            }
            board[i][j] = char(num + '0');
        }
    }
    for (int i = 0; i < h; ++i)
        cout << board[i] << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  std::string S, T; std::cin >> S >> T;
  int ans = 0;
  if(S[0]==T[0]) ++ans;
  if(S[1]==T[1]) ++ans;
  if(S[2]==T[2]) ++ans;
  fin(ans);
  return 0;
}


Measured memory_bytes: 256
import math
Q=int(input())

def query(a,b):
    if a>b:
        a,b=b,a
    ab=a*b
    c=int(math.sqrt(ab))
    if c*c==ab:
        c-=1
    if b-a<=1:
        print(2*a-2)
    elif c*(c+1)>=ab:
        print(2*c-2)
    else:
        print(2*c-1)
    
for _ in range(Q):
    a,b=map(int,input().split())
    query(a,b)
    



Measured memory_bytes: 38256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1001001001;

int main() {
    int N, i=1, ans;

    cin >> N;

    cout << (1000-N%1000)%1000 << endl;

    return 0;
    
}

Measured memory_bytes: 3612
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()

if N >= M:
    print(0)
else:
    sub = [0]*(M-1)
    for i in range(M-1):
        sub[i] = X[i+1]-X[i]
    sub.sort()

    ans = 0
    for i in range(M-N):
        ans += sub[i]
    print(ans)


Measured memory_bytes: 13968
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    long M = 1_000_000_007;
    int N = scanner.nextInt();
    long K = scanner.nextInt();
    long res = 0;
    for (long k = K; k <= N + 1; k++) {
      res += (k * (N - k + 1) % M + 1) % M;
      res %= M;
    }
    System.out.println(res);
  }
}


Measured memory_bytes: 27216
#include <iostream>

using namespace std;

int main(void){
  int a, b, c;
  int ab, bc, ca;
  int cou;
  cin >> a >> b >> c;

  ab = a + b;
  bc = b + c;
  ca = c + a;
  cou = ab;
  if(bc < cou){
    cou = bc;
  }
  if(ca < cou){
    cou = ca;
  }
  cout << cou;
  return 0;
}


Measured memory_bytes: 256
fn main() {
    let scan = std::io::stdin();
    
    let mut line = String::new();
 
    let _ = scan.read_line(&mut line);
    let vec: Vec<&str> = line.split_whitespace().collect();
 
    let n: i32 = vec[0].parse().unwrap();
    let a: i32 = vec[1].parse().unwrap();
    let b: i32 = vec[2].parse().unwrap();

    let mut ans = 0;
    for i in 1..n+1 {
        let s = i/10000+(i%10000)/1000+(i%1000)/100+(i%100)/10+(i%10);
        if s >= a && s <= b {
            ans += i
        }
    }
    println!("{}", ans);
 
}

Measured memory_bytes: 4352
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

n = int(input())
a = [int(item) for item in input().split()]
aind = []
for i, item in enumerate(a):
    aind.append((item, i))
aind.sort(reverse=True)

# dp[i-th item][put j item left] : max value
dp = [[-1] * (n + 1) for _ in range(n + 1)]
dp[0][0] = 0

for i, (item, index) in enumerate(aind): 
    for j in range(n):
        if dp[i][j] == -1:
            continue
        # put left
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + abs(index - j) * item)
        # put right
        dp[i+1][j] = max(dp[i+1][j], dp[i][j] + abs(index - (n - 1 - i + j)) * item)

print(max(dp[-1]))

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

#define ll long long int
#define fi first
#define se second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define debug(a) cout << #a << " = " << a << endl;
#define endl "\n"
#define MOD (int) 1e9+7
#define inf (int) (1e18)

void solve() {
    ll n;
    cin >> n;

    if (n % 2 == 0 || n % 5 == 0) {
        cout << "-1\n";
        return;
    }

    ll xx = 0, cnt = 0;
    while (xx < n) {
        xx = 10 * xx + 7;
        cnt++;
    }
    while (xx % n != 0) {
        xx = xx % n;
        xx = 10 * xx + 7;
        cnt++;
    }
    cout << cnt << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long int t=1;
    // cin >> t;
    for(long int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3596
N,A,B=map(int,input().split())
inf=float("inf")
dp=[[inf]*401 for _ in range(401)]
dp[0][0]=0
for i in range(N):
    a,b,c=map(int,input().split())
    for j in range(-1,-402,-1):
        for k in range(-1,-402,-1):
            if dp[j][k]!=inf:
                dp[j+a][k+b]=min(dp[j+a][k+b],dp[j][k]+c)
ans=inf
for i in range(1,401):
    for j in range(1,401):
        if i/j==A/B:
            ans=min(ans,dp[i][j])
if ans==inf:
    ans=-1
print(ans)

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

#define ll long long
#define ld long double
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define int long long

using namespace std;
const int INF = 2e16;
const int MB = 20;
const int MOD = 1e9 + 7;


void solve() {
	int n, k;
	cin >> n >> k;
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i].first;
		if (a[i].first < 0) {
			a[i].first = -a[i].first;
			a[i].second = 1;
		}
	}
	sort(rall(a));

	int ans = 1, cnt = 0;
	for (int i = 0; i < k; i++) {
		ans = ans * a[i].first % MOD;
		cnt ^= a[i].second;
	}

	if (!cnt || n == k) {
		cout << (cnt ? ans * (MOD - 1) % MOD : ans);
		return;
	}

	int lPos = -1, lNeg = -1, rPos = -1, rNeg = -1;
	
	for (int i = k - 1; i >= 0; i--) {
		if (a[i].second && lNeg == -1) lNeg = i;
		else if (!a[i].second && lPos == -1) lPos = i;
	}

	for (int i = k; i < n; i++) {
		if (a[i].second && rNeg == -1) rNeg = i;
		else if (!a[i].second && rPos == -1) rPos = i;
	}

	if ((lNeg == -1 || rPos == -1) && (lPos == -1 || rNeg == -1)) {
		ans = 1;
		for (int i = n - 1; i >= n - k; i--) {
			ans = ans * a[i].first % MOD;
		}
		ans = ans * (MOD - 1) % MOD;
		cout << ans;
		return;
	}

	ans = 1;
	if (rPos == -1 || (lPos != -1 && rNeg != -1 && a[rNeg].first * a[lNeg].first > a[lPos].first * a[rPos].first)) {
		for (int i = 0; i < k; i++) {
			if (i != lPos) ans = ans * a[i].first % MOD;
		}
		ans = ans * a[rNeg].first % MOD;
	}
	else {
		for (int i = 0; i < k; i++) {
			if (i != lNeg) ans = ans * a[i].first % MOD;
		}
		ans = ans * a[rPos].first % MOD;
	}
	cout << ans;
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	srand(time(0));
	int t = 1;
	//int t;
	//cin >> t;
	while (t--) solve();
}

Measured memory_bytes: 6344
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
using namespace std;
typedef long long ll;
int main(){
  string a,b,c;
  cin >> a >> b >> c;
  int anow,bnow,cnow;
  anow = 0;
  bnow = 0;
  cnow = 0;
  char now;
  now = 'a';
  char res;
  while(1){
    if(now == 'a'){
      if(anow == a.size()){
        res = 'A';
        break;
      }
      now = a[anow];
      anow++;
    }
    else if(now == 'b'){
      if(bnow == b.size()){
        res = 'B';
        break;
      }
      now = b[bnow];
      bnow++;
    }
    else{
      if(cnow == c.size()){
        res = 'C';
        break;
      }
      now = c[cnow];
      cnow++;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define hell 998244353
#define PI 3.14159265358979323846
using namespace std;

int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    //int c=0;
    while(t--) {
     int x;
     cin>>x;
     cout<<1-x;
    }

}


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

using namespace std;

const int N = 1e6 + 6;

char s[N];
int bit[N];
int get(int x) {
  int ret = 0;
  for (; x; x -= x&-x)
    ret += bit[x];
  return ret;
}

void upd(int x, int v) {
  for (; x < N; x += x&-x)
    bit[x] += v;
}

int get(int l, int r) {
  return get(r) - (l > 0 ? get(l-1) : 0);
}
set<int> st[26];
bool used[N];

int main() {
  scanf("%s", s+1);
  int n = strlen(s+1);
  for (int i = 1; i <= n; ++i) {
    s[i] -= 'a';
    st[s[i]].insert(i);
  }
  int cnt = 0;
  for (int i = 0; i < 26; ++i)
    cnt += st[i].size() & 1;
  if (cnt > 1) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i <= n; ++i)
    upd(i, +1);
  long long ans = 0;
  for (int l = 1, r = n; l < r; ) {
    while (l < r && used[l]) ++l;
    while (l < r && used[r]) -- r;
    if (l >= r) break;
    if (st[s[l]].size() == 1) {
      int b = *st[s[r]].begin();
      ans += get(b-1);
      used[b] = 1;
      used[r] = 1;
      upd(b, -1);
      upd(r, -1);
      st[s[r]].erase(b);
      st[s[r]].erase(r);
    }
    else {
      int b = *st[s[l]].rbegin();
      ans += get(b+1, n);
      upd(b, -1);
      upd(l, -1); 
      used[l] = 1;
      used[b] = 1;
      st[s[l]].erase(b);
      st[s[l]].erase(l);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 12800
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
 
int main() {
	int s,w;
	cin >> s >> w;
	if (w >= s) cout << "unsafe" << endl;
	else cout << "safe" << endl;
	return 0;
}


Measured memory_bytes: 3128
class FifteenPuzzle
  N = 4
  N2 = N * N
  LIMIT = 100
  DX = [ 0, 1, 0, -1 ]
  DY = [ 1, 0, -1, 0 ]
  DIR = [ 'u', 'r', 'd', 'l' ]
  MDTable = Array.new(N2).map { Array.new(N2) }

  class Puzzle
    attr_accessor :space, :f, :md

    def initialize
      @f = []
    end

    # get current md
    def get_all_md
      sum = 0
      (0...N2).each do |i|
        sum += MDTable[i][@f[i] - 1] if @f[i] != N2
      end
      return sum
    end

    def initialize_copy(obj)
      @f = obj.f.dup
      @space = obj.space
      @md = obj.md
    end

  end

  def initialize
    # init MDtable
    (0...N2).each do |i|
      (0...N2).each do |j|
        MDTable[i][j] = get_manhattan_distance(i % N, i / N, j % N, j / N)
      end
    end

    @puzzle = Puzzle.new
    4.times do |i|
      gets.split.map(&:to_i).each_with_index do |c, j|
        k = (4 * i) + j
        if c == 0
          @puzzle.f[k] = N2
          @puzzle.space = k
        else
          @puzzle.f[k] = c
        end
      end
    end

    @limit = 0
    @path = Array.new(LIMIT)
    @state = nil
  end

  def dfs(depth, prev)
    return true if @state.md == 0
    return false if depth + @state.md > @limit
    sx = @state.space / N
    sy = @state.space % N
    tmp = nil

    (0...4).each do |r|
      tx = sx + DX[r]
      ty = sy + DY[r]
      next if tx < 0 || N <= tx || ty < 0 || N <= ty
      next if [ prev, r ].max - [ prev, r ].min == 2
      tmp = @state.clone
      @state.md -= MDTable[tx * N + ty][@state.f[tx * N + ty] - 1]
      @state.md += MDTable[sx * N + sy][@state.f[tx * N + ty] - 1]
      @state.f[tx * N + ty], @state.f[sx * N + sy] = @state.f[sx * N + sy], @state.f[tx * N + ty]
      @state.space = tx * N + ty
      if dfs(depth + 1, r)
        @path[depth] = r
        return true
      end
      @state = tmp
    end
    return false
  end

  def iterative_deepening
    @puzzle.md = @puzzle.get_all_md

    (@puzzle.md..LIMIT).each do |limit|
      @state = @puzzle.clone
      @limit = limit
      if q = dfs(0, -100)
        ans = ""
        (0...limit).each { |i| ans += DIR[@path[i]] if @path[i] }
        return ans
      end
    end
    return -1
  end

  def get_manhattan_distance(x1, y1, x2, y2)
    return (x1 - x2).abs + (y1 - y2).abs
  end

end

fp = FifteenPuzzle.new
ans = fp.iterative_deepening
puts ans.length

Measured memory_bytes: 9324
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;

#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ll MOD = 1000000007;

int main() {
  ll s;
  cin >> s;
  vector<ll> A;
  A.push_back(0);
  A.push_back(0);
  A.push_back(0);
  A.push_back(1);
  if (s < 4) {
    cout << A[s] << endl;
  } else {
    FOR(i, 4, s + 1) { A.push_back((A[i - 3] + A[i - 1]) % MOD); }
    cout << A[s] << endl;
  }
  return 0;
}


Measured memory_bytes: 3636
l,r=map(int,input().split())

if r-l>=2019:
    print(0)
else:
    i_l=[]
    for i in range(l,r):
        for j in range(i+1,r+1):
            i_l.append((i%2019*j%2019)%2019)
    print(min(i_l))
           

Measured memory_bytes: 75392
const int N = 400005;
const int LG = 21;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <bitset>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(N);
    __ufact.resize(N);
    __rev.resize(N);
    __rev[1] = 1;
    for (int i = 2; i < N; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < N; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

long long x, y;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> x >> y;
    int cnt = 1;
    while (1)
    {
        x *= 2;
        if (x <= y) cnt++;
        else break;
    }
    cout << cnt;
}

/* Note:
Check constants at the beginning of the code.
N is set to 4e5 but be careful in problems with large constant factor.
Check corner cases.
No def int long long for now.
*/


Measured memory_bytes: 256
N, Q = map(int, input().split())
S = input()
items = []
for i in range(Q):
    items.append(tuple(map(int, input().split())))

from itertools import accumulate

prev = ""
acc = [0] * N
for i, s in enumerate(S):
    if s == "C" and prev == "A":
        acc[i] = 1
    prev = s


acc = list(accumulate(acc))
ans = []
for i in range(Q):
    l, r = items[i]

    ans.append(acc[r -1] - acc[l-1])
for a in ans:
    print(a)


Measured memory_bytes: 25228
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <stack>

using namespace std;

int common_time=1,n;

int table[101][101],time_table[101][2];

void func(int node){
	if(time_table[node][0] == 0){
		time_table[node][0] = common_time++;
	}else{
		return;
	}
	for(int i=1;i<=n;i++){
		if(table[node][i] == 1){
			func(i);
		}
	}
	time_table[node][1] = common_time++;
}

int main(){
	int row,num,col;
	scanf("%d",&n);

	for(int i=1;i<=n;i++){
		for(int k=1;k<=n;k++){
			table[i][k]=0;
		}
		time_table[i][0]=0;
		time_table[i][1]=0;
	}

	for(int i=1;i<=n;i++){
		scanf("%d %d",&row,&num);
		for(int k=1;k<=num;k++){
			scanf("%d",&col);
			table[row][col]=1;
		}
	}

	for(int i=1;i<=n;i++){
		func(i);
	}

	for(int i=1;i<=n;i++){
		printf("%d %d %d\n",i,time_table[i][0],time_table[i][1]);
	}

    return 0;
}


Measured memory_bytes: 3204
#include <cstdio>
#include <cstring>
using namespace std;

unsigned char R[1000000][10][3];

int main()
{
	int x,y,c,t;
	while(scanf("%d %d",&x,&y), (x||y))
	{
		memset(R,0,sizeof(R));
		for(c=1; 1; c++)
		{

			x*=10;
			t=x/y;
			x%=y;

			if(R[x][t][0] || R[x][t][1] || R[x][t][2])
			{
				break;
			}

			R[x][t][0] = 0xFF&(c);
			R[x][t][1] = 0xFF&(c>>8);
			R[x][t][2] = 0xFF&(c>>16);
		}

		c = (x ? c : c-1);
		y = R[x][t][0] | (R[x][t][1]<<8) | (R[x][t][2]<<16);
		printf("%d %d\n",y-1,c-y);
	}

	return 0;
}

Measured memory_bytes: 29000
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
using namespace std;
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int R;
//=============================
void input()
{
    cin>>R;
}

void solve()
{
    int ans;

    if (R < 1200) ans=0;
    else if (R < 2800) ans = 1;
    else ans = 2;

    cout<<(ans==0 ? "ABC" : (ans==1 ? "ARC" : "AGC"))<<endl;

}

//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;

int main(){
	int n;
	int ac=0,wa=0,tle=0,re=0;
	string s;
	cin >> n;
	REP(i,n){
		cin >> s;
		if(s=="AC") ac++;
		else if(s=="WA") wa++;
		else if(s=="TLE") tle++;
		else re++;
	}
	
	printf("AC x %d\n",ac);
	printf("WA x %d\n",wa);
	printf("TLE x %d\n",tle);
	printf("RE x %d\n",re);
	
	
	
	return 0;
}

Measured memory_bytes: 3700
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>

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; }

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;
const long long INF = 1e9;

int main()
{
  int n; cin >> n;
  vector<vector<int>> happy(n, vector<int>(3));
  for(int i = 0; i < n; i++){
    cin >> happy[i][0] >> happy[i][1] >> happy[i][2];
  }
 
  vector<vector<int>> dp(n+1, vector<int>(3));
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 3; k++){
        if(j == k) continue;
        dp[i+1][k] = max(dp[i+1][k], dp[i][j] + happy[i][j]);
      }
    }
  }

  cout << max_3(dp[n][0], dp[n][1], dp[n][2]) << endl;
  return 0;
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,m,x,ma=1;
  cin>>n>>k;
  vector<int> e(n);
  for(int i=0;i<n;i++){
    m=i+1;x=1;
    if(m>=k){
    }
    else{
      for(int j=0;j<k;j++){
        x*=2;
        if(m*x<k)continue;
        else break;
      }
    }
    e.at(i)=x;
    ma=max(ma,x);
  }
  double p=(double)1/(double)n;int l=0;
  for(int i=0;i<n;i++){
    l+=ma/e.at(i);
  }
  double v=(double)l/(double)ma;
  cout<<setprecision(12)<<p*v<<endl;
}

Measured memory_bytes: 640
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    a=parseMap(split(readline()))
    # j-i==a[i]+a[j]
    # a[i]+i==j-a[j]
    cnt1=Dict{Int,Int}()
    cnt2=Dict{Int,Int}()
    for i in 1:n
        if haskey(cnt1,a[i]+i)
            cnt1[a[i]+i]+=1
        else
            cnt1[a[i]+i]=1
        end
        if haskey(cnt2,i-a[i])
            cnt2[i-a[i]]+=1
        else
            cnt2[i-a[i]]=1
        end
    end
    ans=0
    for (key,val) in cnt1
        ans+=val*get(cnt2,key,0)
    end
    println(ans)
end
main()

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

using namespace std;

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

  int n;
  cin >> n;
  vector<int64_t> a(n), b(n);
  int64_t asum = 0, bsum = 0;
  priority_queue<int64_t> extra;
  priority_queue<int64_t> luck;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    asum += a[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
    bsum += b[i];
  }
  for (int i = 0; i < n; ++i) {
    if (a[i] < b[i]) {
      luck.push(b[i] - a[i]);
    } else if (b[i] < a[i]) {
      extra.push(a[i] - b[i]);
    }
  }
  int64_t ops = bsum - asum;
  while (0 < ops && !luck.empty()) {
    int64_t l = luck.top();
    luck.pop();
    int64_t lk = l / 2 + l % 2;
    if (l % 2) {
      extra.push(1);
    }
    while (0 < lk && !extra.empty()) {
      int64_t e = extra.top();
      extra.pop();
      int64_t done = min(e, lk);
      ops -= done;
      lk -= done;
      e -= done;
      if (0 < e) {
        extra.push(e);
      }
    }
    if (0 < lk) {
      luck.push(lk);
    }
  }
  if (extra.empty() && luck.empty()) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int s[100001],t[100001];
int main(void){
    // Your code here!
    for(int i=2;i<=100000;i++){
        bool ok=true;
        for(int j=2;j*j<=i;j++){
            if(i%j==0){
                ok=false;
                break;
            }
        }
        if(ok){
            s[i]=1;
            if(s[(i+1)/2]==1)t[i]=1;
        }
    }
    for(int i=0;i<100000;i++){
        t[i+1]+=t[i];
    }
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        cout<<t[b]-t[a-1]<<endl;
    }
}


Measured memory_bytes: 1408
using System;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine(CardGameforThreeABCEdit());
    }

    private static char CardGameforThreeABCEdit()
    {
        string A = string.Empty;
        string B = string.Empty;
        string C = string.Empty;

        readData(ref A, ref B, ref C);

        return gameWinner(A, B, C);
    }

    private static char gameWinner(string a, string b, string c)
    {
        var openCard = 'a';
        int[] index = new int[3];

        while(true)
        {
            switch(openCard)
            {
                case 'a':
                    if (playerTurn(ref openCard, ref index[0], a) == true)
                        return 'A';
                    break;
                case 'b':
                    if (playerTurn(ref openCard,ref index[1], b) == true)
                        return 'B';
                    break;
                case 'c':
                    if (playerTurn(ref openCard,ref index[2], c) == true)
                        return 'C';
                    break;
            }
        }
    }

    private static bool playerTurn(ref char openCard, ref int index, string player)
    {
        if (player.Length - index == 0) return true;

        openCard = player[index];

        index++;

        return false;
    }

    /// <summary>
    /// データを読み込む
    /// </summary>
    private static void readData(ref string a, ref string b, ref string c)
    {
        a = Console.ReadLine();
        b = Console.ReadLine();
        c = Console.ReadLine();
    }
}




Measured memory_bytes: 13140
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<tuple>
using namespace std;
int main() {
  string s,t;
  cin >> s >> t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  if (s<t) cout << "Yes" << endl;
  else cout << "No" << endl;
}
  

Measured memory_bytes: 256
h = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
tem = 10**6
x = 1
for i in h:
    if abs(a-(t-i*0.006)) < tem:
        tem = abs(a-(t-i*0.006))
        ans = x
    x += 1
print(ans)

Measured memory_bytes: 3064
s, k = input(), int(input())

if len(set(list(s))) == 1:
    print(len(s) * k // 2)
    exit()

ans, cnt = [], 1
for i in range(1, len(s)):
    if s[i] == s[i - 1]:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 1
else:
    ans.append(cnt)

if s[0] != s[-1]:
    ans = [i//2 for i in ans]
    print(sum(ans) * k)
elif s[0] == s[-1]:
    f, m, l = ans[0] // 2, (ans[0] + ans[-1]) // 2, ans[-1] // 2
    ans = [i//2 for i in ans[1:-1]]
    print(f + sum(ans) * k + m * (k - 1) + l)


Measured memory_bytes: 9176
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define INF 1e9
using ll = std::int64_t;

template <class T>
bool chmax(T &a, const T &b);
template <class T>
bool chmin(T &a, const T &b);
//最大公約数
std::int64_t gcd(std::int64_t a, std::int64_t b);
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb);
//ラングレス圧縮
std::vector<std::pair<char, std::int64_t>> rle(std::string str);
//素数判定
bool is_prime(std::int64_t n);
// 約数の列挙
std::vector<std::int64_t> divisor(std::int64_t n);
// 素因数分解
std::map<std::int64_t, std::int64_t> prime_factor(std::int64_t n);

//10^9 + 7
#define yojo 1000000007
#define MAX_NUM 200001


void Main()
{
  char s;
  cin >> s;
  char ss = s+1;
  std::cout << ss << std::endl;

  return;
}

int main()
{
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

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

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

//最大公約数
std::int64_t gcd(std::int64_t a, std::int64_t b)
{
  // a >= b && b != 0
  std::int64_t c;
  do
  {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}

//最大公約数安全版
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb)
{
  std::int64_t a = max(aa, bb);
  std::int64_t b = min(aa, bb);
  std::int64_t c;
  if (b == 0)
  {
    return -1;
  }
  do
  {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}

//ラングレス圧縮
std::vector<std::pair<char, std::int64_t>> rle(std::string str)
{
  std::vector<std::pair<char, std::int64_t>> data;
  char now = str[0];
  std::int64_t count = 0;
  for (std::int64_t i = 0; i < str.size() + 1; i++)
  {
    if (i == str.size())
    {
      data.push_back(make_pair(str[i - 1], count));
      break;
    }
    else if (now != str[i])
    {
      data.push_back(make_pair(now, count));
      now = str[i];
      count = 0;
    }
    count++;
  }

  return data;
}

//素数判定
bool is_prime(std::int64_t n)
{
  for (std::int64_t i = 0; i * i <= n; i++)
  {
    if (n % i == 0)
    {
      return false;
    }
  }

  return n != 1;
}

//約数の列挙
std::vector<std::int64_t> divisor(std::int64_t n)
{
  std::vector<std::int64_t> res;
  for (int i = 0; i < n; i++)
  {
    if (n % i == 0)
    {
      res.push_back(i);
      if (i != n / i)
        res.push_back(n / i);
    }
  }
  return res;
}

// 素因数分解
std::map<std::int64_t, std::int64_t> prime_factor(std::int64_t n)
{
  std::map<std::int64_t, std::int64_t> res;
  for (int i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      ++res[i];
      n /= i;
    }
  }

  if (n != 1)
  {
    res[n] = 1;
  }

  return res;
}

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

using namespace std;

const int MaxN = 2e5;

int n, m;

vector <int> v[MaxN];
string s;

bool deleted[MaxN];

set<pair<int, int> > S;

int cnt[2][MaxN];

void popV(int x)
{
    deleted[x] = true;

    for(int to : v[x])
        if(!deleted[to])
        {
            S.erase(make_pair(min(cnt[0][to], cnt[1][to]), to));
            if(s[x] == 'A')
                --cnt[0][to];
            else
                --cnt[1][to];
            S.insert(make_pair(min(cnt[0][to], cnt[1][to]), to));
        }
}

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);

    cin >> n >> m;
    cin >> s;

    for(int i = 0; i < m; ++i)
    {
        int x, y;
        cin >> x >> y;
        --x, --y;

        v[x].push_back(y);
        v[y].push_back(x);

        if(s[x] == 'A')
            ++cnt[0][y];
        else
            ++cnt[1][y];

        if(s[y] == 'A')
            ++cnt[0][x];
        else
            ++cnt[1][x];
    }

    for(int i = 0; i < n; ++i)
        S.insert(make_pair(min(cnt[0][i], cnt[1][i]), i));

    while(!S.empty() && (*S.begin()).first == 0)
    {
        int x = (*S.begin()).second;
        S.erase(S.begin());

        popV(x);
    }

    if(S.empty())
        cout << "No\n";
    else
        cout << "Yes\n";

    return 0;
}


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

int main(){
  string s,r;
  cin >> s;
  for(int i=0;i<s.size();i++){
    if(s[i] == '0')
      r.push_back('0');
    else if(s[i] == '1')
      r.push_back('1');
    else if(s[i] == 'B' && !r.empty())
      r.erase(r.size() - 1); 
  }
  cout << r;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,D,L,R;
  cin >> A >> B >> C >> D;
  L = A + B;
  R = C + D;
  if (L > R) {
    cout << "Left" << endl;
  }
  if (L < R) {
    cout << "Right" <<endl;
  }
  if (L == R) {
    cout << "Balanced" << endl;
  }
}


Measured memory_bytes: 256
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n, k = i_map()
    num_list = i_list()

    for i in range(n-k):
        if num_list[i] < num_list[i+k]:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 98484
#include <iostream>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;

int N;
long long W, weight[110], value[110];
long long dp[110][1000100] = {0};

int main() {
    cin >> N >> W;
    for (int i = 0; i < N; ++i) cin >> weight[i] >> value[i];

    for (int i = 0; i < N; ++i) {
        for (int sum_w = 0; sum_w <= W; ++sum_w) {
            if (sum_w - weight[i] >= 0) {
                chmax(dp[i + 1][sum_w], dp[i][sum_w - weight[i]] + value[i]);
            }
            chmax(dp[i + 1][sum_w], dp[i][sum_w]);
        }
    }

    cout << dp[N][W] << endl;
    return 0;
}


Measured memory_bytes: 284928
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int r, d, x; scan(r, d, x);

    for (int i = 0; i < 10; i++) {
        x = r * x - d;
        writeln(x);
    }
}


Measured memory_bytes: 256