akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;
//const long long int MOD = 998244353;

long long int N, M, K, H, W, L, R;

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

	cin >> N;
	vector<vector<int>>edge(N);
	vector<int>rev_edge(N);
	for (int i = 0; i < N; i++) {
		cin >> M;
		M--;
		edge[M].push_back(i);
		rev_edge[i] = M;
	}
	queue<int>Q;
	vector<int>num(N,-1);
	vector<int>dir(N);
	for (int i = 0; i < N; i++) {
		if (edge[i].empty()) {
			Q.push(i);
			num[i] = 0;
		}
		else {
			dir[i] = edge[i].size();
		}
	}
	if (Q.empty()) {
		if (N % 2) {
			cout << "IMPOSSIBLE\n";
		}
		else {
			cout << "POSSIBLE\n";
		}
		return 0;
	}
	while (!Q.empty()) {
		int cn = Q.front();
		Q.pop();
		if (num[cn] == -1) {
			vector<int>v;
			for (auto i : edge[cn])v.push_back(num[i]);
			sort(v.begin(), v.end());
			num[cn] = 0;
			for (auto i : v) {
				if (i < num[cn])continue;
				if (i > num[cn])break;
				num[cn]++;
			}
		}
		dir[rev_edge[cn]]--;
		if (!dir[rev_edge[cn]])Q.push(rev_edge[cn]);
	}
	vector<int>loop;
	for (int i = 0; i < N; i++) {
		if (num[i] == -1) {
			loop.push_back(i);
		}
	}
	vector<int>v;
	for (auto i : edge[loop[0]])v.push_back(num[i]);
	L = 0;
	sort(v.begin(), v.end());
	for (auto i : v) {
		if (i < L)continue;
		if (i > L)break;
		L++;
	}
	bool flag = true;
	num[loop[0]] = L;
	int nx = rev_edge[loop[0]];
	while (nx != loop[0]) {
		vector<int>w;
		for (auto i : edge[nx])w.push_back(num[i]);
		sort(w.begin(), w.end());
		num[nx] = 0;
		for (auto i : w) {
			if (i < num[nx])continue;
			if (i > num[nx])break;
			num[nx]++;
		}
		nx = rev_edge[nx];
	}
	for (int i = 0; i < N; i++) {
		for (auto j : edge[i]) {
			if (num[i] == num[j]) {
				flag = false;
			}
		}
	}
	if (flag) {
		cout << "POSSIBLE\n";
		return 0;
	}
	int box = L;
	L++;
	for (auto i : v) {
		if (i < L)continue;
		if (i > L)break;
		L++;
	}
	num[loop[0]] = L;
	nx = rev_edge[loop[0]];
	while (nx != loop[0]) {
		vector<int>w;
		for (auto i : edge[nx])w.push_back(num[i]);
		sort(w.begin(), w.end());
		num[nx] = 0;
		for (auto i : w) {
			if (i < num[nx])continue;
			if (i > num[nx])break;
			num[nx]++;
		}
		if (rev_edge[nx] == loop[0]) {
			if (num[nx] != box) {
				cout << "IMPOSSIBLE\n";
				return 0;
			}
		}
		nx = rev_edge[nx];
	}
	for (int i = 0; i < N; i++) {
		for (auto j : edge[i]) {
			if (num[i] == num[j]) {
				cout << "IMPOSSIBLE\n";
				return 0;
			}
		}
	}
	cout << "POSSIBLE\n";
	return 0;

}

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

void solve(long long N, vector<long long> a)
{
    long long counter = 0;
    for (long long i = 1; i <= N; i += 2)
    {
        if (i % 2 == 1 && a.at(i - 1) % 2 == 1)
        {
            ++counter;
        }
    }
    cout << counter << endl;
}

int main()
{
    long long N;
    cin >> N;
    vector<long long> a;
    for (int i = 0; (unsigned)i < N; i++)
    {
        long long tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    solve(N, a);
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod=1000000007;


int main(){

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

    int N;
    cin >> N;

    int ans;

    ans = N /3;

    cout << ans << endl;

    return 0;

}


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

typedef int ll;
typedef double db;
typedef vector<db>vdb;

ll n,mid;
vdb p;

int mau[3000][1500];
db mem[3000][1500];

void enter()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    mid=n/2;

    p.assign(n+1,0);
    for(int i=1; i<=n; ++i)
        cin>>p[i];
}

db dp(int i,int cnt)
{
    if(i>n)
        return 1;
    db &res=mem[i][cnt];
    if(mau[i][cnt]!=-1)
        return res;
    res=0;
    if(cnt+1<=mid)
        res+=dp(i+1,cnt+1)*(1-p[i]);
    res+=dp(i+1,cnt)*p[i];
    mau[i][cnt]=0;
    return res;
}

void process()
{
    memset(mau,-1,sizeof(mau));
    cout.precision(15);
    cout<<fixed;
    cout<<dp(1,0);
}

int main()
{
    enter();
    process();
}


Measured memory_bytes: 52872
#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i+=1)
#define reps(i,a,b) for(int i=a;i>=b;i-=1)
#define vi vector<int>
#define pb push_back
#define in(x) int x; cin>>x;
#define inn(x, y) int x, y; cin>>x>>y;
#define mi unordered_map<int,int>
#define mem(x) memset(x, 0, sizeof(x))
#define IOS ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
using namespace std;

//bool primes[1000001];
//vi prime;
//void seive(){
//	memset(primes, true, sizeof(primes));
//	primes[0] = primes[1] = false;
//	for(int i = 2; i*i<=1000000;i += 1)
//	{
//		if(primes[i])
//		{
//			for(int j = i*i; j <= 1000000;j += i) primes[j] = false;
//		}
//	}
//	rep(i, 2, 1000001)
//	{
//		if(primes[i]) prime.pb(i);
//	}
//}


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

int32_t main(void){
	IOS;
	
	in(n);
	int ans = 0;
	rep(i, 1, n+1)
	{
		if(i%3 == 0 || i%5 == 0) continue;
		else ans += i;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3608
N, M = map(int, input().split())
S = input()

p = N
ans = []
ans_ok = True
while True:
    if p <= M:
        ans.append(p)
        p -= p
        break
    check = False
    for i in range(M, 0, -1):
        if S[p-i] == '0':
            check = True
            ans.append(i)
            p -= i
            break
    if not check:
        ans_ok = False
        break
if ans_ok:
    print(' '.join(map(str, ans[::-1])))
else:
    print(-1)

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

typedef pair<int, int> P;
#define INF (1<<31-1)
#define ll long long



int main(){

	int N, a;
	int A4=0, A2=0, A1=0;

	cin >> N;
	for (int i = 0; i < N; i++){
		cin >> a;
		if (a % 4 == 0) A4++;
		else if (a % 2 == 0) A2++;
		else A1++;
	}
	if ( A1 <= A4)
		cout << "Yes" << endl;
	else if (A1 <= A4 + 1 && A2 == 0)
		cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

from scipy.misc import comb
import sys
sys.setrecursionlimit(1000000000)


class UnionFind:

    def __init__(self, n):
        self.parent = [i for i in range(n + 1)]
        self.depth = [1] * (n + 1)
        self.count = [1] * (n + 1)

    def find(self, x):
        if self.parent[x] == x:
            if self.depth[x] > 2:
                self.depth[x] = 2
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            self.depth[x], self.count[x] = 0, 0
            return self.parent[x]

    def isSame(self, x, y):
        return self.find(x) == self.find(y)

    def union(self, x, y):
        x, y = self.find(x), self.find(y)

        if self.depth[x] < self.depth[y]:
            self.parent[x] = self.parent[y]
            self.count[y] += self.count[x]
            self.depth[x], self.count[x] = 0, 0
        else:
            self.parent[y] = self.parent[x]
            self.count[x] += self.count[y]
            self.depth[y], self.count[y] = 0, 0
            if self.depth[x] == self.depth[y]:
                self.depth[x] += 1


N, M = map(int, input().split())

A, B = [], []
for _ in range(M):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A.reverse()
B.reverse()

groups = UnionFind(N)
ans = [comb(N, 2, exact=True)]
for i in range(M):
    tmp = ans[-1]
    if not groups.isSame(A[i], B[i]):
        nA, nB = groups.count[groups.find(
            A[i])], groups.count[groups.find(B[i])]
        tmp -= nA * nB
        groups.union(A[i], B[i])
    ans.append(tmp)

for i in range(M):
    print(ans[-(i + 2)])


Measured memory_bytes: 43768
#include<bits/stdc++.h>
using namespace std;
const int M=1000000007;
const int N=1000005;
int i,n,head[N],Next[N],adj[N],p[N],vis[N],j,k,ans[N],u,v;
vector<int> e[2];
void Push(int u,int v)
{
	Next[++k]=head[u];
	head[u]=k;
	adj[k]=v;
}
void dfs(int i,int fa,int d)
{
	int j;
	e[d].push_back(i);
	for(j=head[i];j!=0;j=Next[j])
		if(adj[j]!=fa)
			dfs(adj[j],i,d^1);
}
int main()
{
	scanf("%d",&n);
	for(i=1;i<n;++i)
	{
		scanf("%d %d",&u,&v);
		Push(u,v);
		Push(v,u);
	}
	dfs(1,0,0);
	if(e[0].size()>e[1].size())
		swap(e[0],e[1]);
	if(e[0].size()<=n/3)
	{
		for(i=3,j=0;i<=n&&j<e[0].size();i+=3,++j)
		{
			ans[e[0][j]]=i;
			vis[i]=1;
		}
	}
	else
	{
		for(i=1,j=0;i<=n&&j<e[0].size();i+=3,++j)
		{
			ans[e[0][j]]=i;
			vis[i]=1;
		}
		for(i=3;i<=n&&j<e[0].size();i+=3,++j)
		{
			ans[e[0][j]]=i;
			vis[i]=1;
		}
	}
	j=0;
	for(i=1;i<=n;++i)
		if(vis[i]==0)
			ans[e[1][j++]]=i;
	for(i=1;i<=n;++i)
		printf("%d ",ans[i]);
		
}

Measured memory_bytes: 24052
import java.io.*;

public class Main{
  public static void main(String[]args)throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    long p = 1000000007;
    int N = Integer.parseInt(br.readLine());
    String[] S = br.readLine().split(" ");
    int r = 0, g = 0, b = 0;
    long ans = 1;
    for(int i = 0; i < N; i++){
      int M = Integer.parseInt(S[i]);
      int count = 0;
      if(r == M) count++;
      if(g == M) count++;
      if(b == M) count++;
      
      ans *= count;
      ans %= p;
      
      if(r == M){
        r++;
      }else if(g == M){
        g++;
      }else if(b == M){
        b++;
      }
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 36380
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
import collections
mod = 10 ** 9 + 7
 
N = int(readline())
A = [int(i) for i in readline().split()]
 
answer = 0
for n in range(62):
    B = [(i >> n) & 1 for i in A]
    C = collections.Counter(B)
    x = C[1]
    y = N - x
    x *= y
    for _ in range(n):
        x *= 2
        x %= mod
    answer += x
    answer %= mod
print(answer)

Measured memory_bytes: 138940
def makedivisor(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

def solve():
  n,m = (int(i) for i in input().split())
  div = makedivisor(m)
  if len(div) == 0:
    print(1)
    exit()
  else:
    ans = 1
    for i in div:
      if (m-(n*i)) >= 0:
        ans = max(ans,i)
    print(ans)
solve()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m-1); i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;

Vbo rs, rt;
VV to, ot;

void dfs_s(int u) {
  if (rs[u]) return;
  rs[u] = true;
  for (int v : to[u]) dfs_s(v);
}
void dfs_t(int u) {
  if (rt[u]) return;
  rt[u] = true;
  for (int v : ot[u]) dfs_t(v);
}

template<typename T>
struct edge {
  int u, v; T cost;
  edge(int u, int v, T cost) : u(u), v(v), cost(cost) {}
};

template<typename T>
using Edges = vector<edge<T>>;

template<typename T>
vector<T> bellman_ford(Edges<T> &edges, int n, int s) {
  const auto INF_T = numeric_limits<T>::max() / 2;
  vector<T> dist(n, INF_T);
  dist[s] = 0;
  for (int i = 0; i < n-1; ++i) {
    for (auto &e : edges) chmin(dist[e.v], dist[e.u] + e.cost);
  }
  for (auto &e : edges) if (dist[e.u] + e.cost < dist[e.v]) return vector<T>();
  return dist;
}


int main() {
  int n, m; cin >> n >> m;
  to.assign(n, V());
  ot.assign(n, V());
  rs.assign(n, false);
  rt.assign(n, false);

  Edges<ll> G, G2;

  for (int i = 0; i < m; ++i) {
    int u, v, c;
    cin >> u >> v >> c;
    --u, --v;
    G.emplace_back(u, v, -c);
    to[u].push_back(v);
    ot[v].push_back(u);
  }
  dfs_s(0);
  dfs_t(n-1);

  for (auto &e: G) {
    if (rs[e.u] && rs[e.v] && rt[e.u] && rt[e.v]) G2.push_back(e);
  }

  auto dist = bellman_ford(G2, n, 0);
  if (dist.size() == 0) cout << "inf" << endl;
  else cout << -dist[n-1] << endl;
  return 0;
}


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

int main(){
  int64_t T1,T2,A1,A2,B1,B2;
  cin>>T1>>T2>>A1>>A2>>B1>>B2;
  if(T1*A1+T2*A2==T1*B1+T2*B2){
    cout<<"infinity"<<endl;
  }
  else{
    if(T1*A1+T2*A2<T1*B1+T2*B2){
      swap(A1,B1);
      swap(A2,B2);
    }
    if(A1>B1){
      cout<<"0"<<endl;
    }
    else{
      int64_t D=T1*A1+T2*A2-(T1*B1+T2*B2);
      int64_t C=T1*(B1-A1);
      if(C%D){
        cout<<(C/D)*2+1<<endl;
      }
      else{
        cout<<(C/D)*2<<endl;
      }
    }
  }
}

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

int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  int size=s.size();
  for(int i=0;i<size;i++){
    s[i]=(s[i]-'A'+n)%26+'A';
  }
  cout<<s<<endl;
  return 0;
}
  

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

using namespace std;

typedef long long ll;

int main(void){
    ll n;
    cin >> n;
    ll ans = 0;
    for(ll i = 1; i < n+1; i++){
        if(i % 3 != 0 && i % 5 != 0) ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define p (int)(1e9 + 7)

int MOD(int a){
	a %= p;
	return a >= 0 ? a : a + p;
}

int max(int a, int b){
	return a >= b ? a : b;
}

int min(int a, int b){
	return a <= b ? a : b;
}

int sum(int l, int r, int *s){
	if(r < l || r < 0){
		return 0;
	}
	if(l <= 0){
		return s[r];
	}
	else{
		return MOD(s[r] - s[l - 1]);
	}
}

signed main(){
	int N, M, i, j;
	scanf("%lld%lld", &N, &M);
	char *T = (char *)malloc(sizeof(char) * (M + 1));
	scanf("%s", T);
	int *A = (int *)malloc(sizeof(int) * M);
	for(i = 0; i < M; i++){
		if(T[i] == 'R'){
			A[i] = 0;
		}
		else{
			A[i] = 1;
		}
	}
	if(A[0] == 1){
		for(i = 0; i < M; i++){
			A[i] ^= 1;
		}
	}
	int *val = (int *)malloc(sizeof(int) * M);
	int *num = (int *)malloc(sizeof(int) * M);
	val[0] = A[0];
	num[0] = 1;
	for(i = 1, j = 0; i < M; i++){
		if(A[i] == A[i - 1]){
			num[j]++;
		}
		else{
			j++;
			val[j] = A[i];
			num[j] = 1;
		}
	}
	int K = j + 1;
	if(K == 1){
		int *dp1 = (int *)malloc(sizeof(int) * N);
		dp1[0] = 1;
		int *S1 = (int *)malloc(sizeof(int) * N);
		S1[0] = 1;
		for(i = 1; i < N; i++){
			dp1[i] = sum(0, i - 2, S1);
			S1[i] = MOD(S1[i - 1] + dp1[i]);
		}
		int ans = 1;
		for(i = 1; i < N; i++){
			ans = MOD(ans + (i + 1) * dp1[N - i - 1]);
		}
		printf("%lld\n", ans);
		return 0;
	}
	int Ooddmin = 2 * (num[0] / 2) + 1;
	for(i = 0; i < K - 1; i++){
		if(num[i] % 2 == 0 || val[i] == 1){
			continue;
		}
		Ooddmin = min(Ooddmin, num[i]);
	}
	int *dp = (int *)malloc(sizeof(int) * N);
	dp[0] = 1;
	int **S = (int **)malloc(sizeof(int *) * 2);
	S[0] = (int *)malloc(sizeof(int) * N);
	S[0][0] = 1;
	S[1] = (int *)malloc(sizeof(int) * N);
	S[1][0] = 0;
	for(i = 1; i < N; i++){
		dp[i] = sum(i - Ooddmin - 1, i - 2, S[i % 2]);
		S[i % 2][i] = MOD(S[i % 2][i - 1] + dp[i]);
		S[1 - i % 2][i] = S[1 - i % 2][i - 1];
	}
/*	printf("dp:\n");
	for(i = 0; i < N; i++){
		printf("%lld ", dp[i]);
	}
	printf("\n");
	printf("S0\n");
	for(i = 0; i < N; i++){
		printf("%lld ", S[0][i]);
	}
	printf("\n");
	printf("S1\n");
	for(i = 0; i < N; i++){
		printf("%lld ", S[1][i]);
	}
	printf("\n");
*/	int ans = 0;
	for(i = 1; i <= min(Ooddmin, N - 1); i += 2){
		ans = MOD(ans + (i + 1) * dp[N - i - 1]);
	}
	printf("%lld\n", ans);
	return 0;
}

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

int main(){
	string s;
	cin>>s;
	
	long long int len;
	len=s.size();
	
long long	i=0;
	long long int lt=0,gt=0,ans=0;
	
	while(i<len){
		
		while(i<len&&s[i]=='<'){
			lt++;
			i++;
		}
		while(i<len&&s[i]=='>'){
			gt++;
			i++;
		}
		
		if(lt==0){
			ans+=(gt*(gt+1))/2;
		}
		else if(gt==0){
			ans+=(lt*(lt+1))/2;
		}
		else{
			ans+=max(gt,lt)+((gt-1)*gt)/2+((lt-1)*lt)/2;
		}
		lt=0;gt=0;
			}
	cout<<ans;
}

Measured memory_bytes: 900
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    s = list(input()[:-1].decode())
    n = len(s)
    ans = [0] * n

    tmp_r_count = tmp_l_count = 1
    tmp_index = 0
    for i in range(1, n):
        if s[i - 1] == s[i] == 'R':
            tmp_r_count += 1
        elif s[i - 1] == s[i] == 'L':
            tmp_l_count += 1
        elif s[i - 1] == 'R' and s[i] == 'L':
            tmp_index = i - 1
        elif s[i - 1] == 'L' and s[i] == 'R':
            ans[tmp_index] += (tmp_r_count + 1) // 2 + tmp_l_count // 2
            ans[tmp_index + 1] += tmp_r_count // 2 + (tmp_l_count + 1) // 2
            tmp_r_count = tmp_l_count = 1

    ans[tmp_index] += (tmp_r_count + 1) // 2 + tmp_l_count // 2
    ans[tmp_index + 1] += tmp_r_count // 2 + (tmp_l_count + 1) // 2

    print(*ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 51448
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        String C = stdIn.next();    
        stdIn.close();

        String[] alp = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
        for (int i = 0; i < 26; i++) {
            if (C.equals(alp[i])) {
                C = alp[i+1];
                System.out.println(C);
                break;
            }
        }
    }
}


Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){
	// warikiretara 0
	// else 1
	int n,k;

	cin >> n >> k;
	int ans;
	if (n%k == 0) {
		ans = 0;
	}
	else {
		ans = 1;
	}

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


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

bool lsearch(int A[], int n, int val)
{
	for (int i = 0; i < n; i++) {
		if (A[i] == val) return true;
	}
	return false;
}

int main()
{
	int n, A[10001];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}

	int q, val, sum = 0;
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> val;
		if (lsearch(A, n, val)) sum++;
	}

	cout << sum << endl;
	
}

Measured memory_bytes: 3120
from collections import Counter

c = Counter()  
N = int(input())
for x in input().split():
    c[int(x)] += 1

A_uniq = sorted(c.keys())

def gen_candiate(seq):
    s = set()
    for n in seq:
        s.add(n-1)
        s.add(n)
        s.add(n+1)
    return sorted(s)

result = 0
for n in gen_candiate(A_uniq):
    tmp = c.get(n-1, 0) + c.get(n, 0) + c.get(n+1, 0)
    if tmp > result:
        result = tmp

print(result)


Measured memory_bytes: 17852
#include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<int> hand;
vector<int> org;

bool judgeHand() {
	for (int i = 1; i <= 9; i++) {
		if (hand[i] < 0) return false;
		if (hand[i] >= 3) hand[i] -= 3;
		if (hand[i] != 0) {
			if (i > 7) return false;
			hand[i + 1] -= hand[i];
			hand[i + 2] -= hand[i];
			hand[i] = 0;
		}
	}
	return true;
}

bool ok(int n) {
	for (int i = 1; i <= 9; i++) {
		hand = org;
		hand[n]++;
		if (hand[i] >= 2) {
			hand[i] -= 2;
			if (judgeHand()) return true;
		}
	}
	return false;
}

int main () {
	string str;
	while (cin >> str) {
		org = vector<int>(12, 0);
		for (int i = 0; i < 13; i++) {
			org[str[i] - '0']++;
		}
		bool first = true;
		for (int i = 1; i <= 9; i++) {
			hand = org;
			if (hand[i] < 4 && ok(i)) {
				if (!first) cout << ' ';
				else first = false;
				cout << i;
			}
		}
		if (first) cout << 0;
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define MAX 1e6
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

int main() 
{
   ll n;
   cin>>n;
   ll ans = 1;
   
   // cout<<sqrt(n)<<endl;
   REP(i,2,(long)sqrt(n) + 1){
   	// cout<<i<<endl;
   	if(n % i == 0){
   		ll v1 = n;
   		ll v2 = n;
   		ll v3 = n / i;
   		while(v1 % i == 0){
   			v1 /= i;
   		}
   		while(v2 % v3 == 0){
   			v2 /= v3;
   		}
   		// cout<<v1<<" "<<v2<<endl;
   		if(v1 % i == 1){
   			// cout<<v1<<" "<<i<<endl;
   			ans++;
   		}
   		if(v2 % v3 == 1 && i != v3){
   			// cout<<v2<<" "<<v3<<endl;
   			ans++;
   		}
   	}
   }
   ll val = n - 1;
   ll p = 1;

   REP(i,2,sqrt(n-1) + 2){
   	ll ct = 0;
   	while(val % i == 0){
   		ct++;
   		val /= i;
   	}
   	p = p * (ct + 1);
   }

   if(val > 1){
   	p *= 2;
   }

   // cout<<p-1<<endl;
   cout<<ans + p - 1<<endl;
   return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<double> VD;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	//freopen("In.txt", "w", stdout);
	
	int n;
	string s;
	cin >> n >> s;
	if (n >= 3200)
		cout << s;
	else
		cout << "red";
	
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int r = gi();
    printf("%d\n", 3*r*r);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)
 
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
const ll INF = 10010001010;
const int inf = 1000034000;
 
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
 
int main() {
  string S;
  cin >> S;
  int N = S.size();
  ll black = 0;
  ll ans = 0;
  for(int i = 0;i < N;i++){
    if(S[i] == 'B'){
      black++;
    }
    else{
      ans += black;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
using namespace std;

int main() {
	double n,m;
	cin >> n>>m;
	int x;
	x = 1900*m + 100*(n-m);
	cout << x*pow(2.0,m)<<endl;
	return 0;
}



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

int main (void){
    int n, m, sum = 0;
    cin >> n >> m;
    vector<int> x(m);
    vector<int> sa(m - 1);
    for (int i = 0; i < m; i++) cin >> x[i];

    sort(x.begin(), x.end());
    for (int i = 0; i < m - 1; i++){
        sa[i] = x[i + 1] - x[i];
    }
    sort(sa.begin(), sa.end());
    for (int i = 0; i < n; i++){
        sa.pop_back();
    }
    for (int i = 0; i < m - n; i ++){
        sum += sa[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.io.BufferedReader
import java.util.*

fun main() = agc024c()

@OptIn(ExperimentalStdlibApi::class)
fun agc024c() = SimpleFastIOWithToken_agc024c().exec {
    val n = readInt()
    val aList = readIntList(n)

    if (aList.first() != 0) return@exec println(-1)

    var before = 0
    var answer = 0L

    for (a in aList) {
        when (a) {
            0 -> Unit
            1, before + 1 -> answer++
            in 2..before -> answer += a
            else -> return@exec println(-1)
        }
        before = a
    }

    println(answer)
}

// region kokokara template dayo (^o^)
@Suppress("unused", "HasPlatformType", "MemberVisibilityCanBePrivate", "ClassName")
private class SimpleFastIOWithToken_agc024c(private val separator: String = System.lineSeparator()) {
    private val br: BufferedReader = System.`in`.bufferedReader()
    private var st: StringTokenizer = StringTokenizer("")
    private val sb: StringBuilder = StringBuilder()
    private fun prepareNext() = run { if (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) }

    fun readString(): String = run { prepareNext() }.run { st.nextToken() }
    fun readStringList(size: Int): List<String> = List(size) { readString() }
    fun readInt(): Int = Integer.valueOf(readString())
    fun readIntList(size: Int): List<Int> = List(size) { readInt() }
    fun readLong(): Long = java.lang.Long.valueOf(readString())
    fun readLongList(size: Int): List<Long> = List(size) { readLong() }
    inline fun <reified T> readArray(size: Int, init: () -> T) = Array(size) { init() }
    inline fun <T> readList(size: Int, init: () -> T) = List(size) { init() }

    fun println(): Unit = run { sb.append(separator) }
    fun print(any: Any): Unit = run { sb.append(any) }
    fun println(any: Any): Unit = run { sb.append(any.toString() + separator) }

    fun exec(action: SimpleFastIOWithToken_agc024c.() -> Unit) = run {
        Thread(null, { action() }, "(^o^)", 128 * 1024 * 1024).apply { start() }.join()
    }.run { kotlin.io.print(sb) }

    fun readLine(): Nothing = error("readLine is disabled.")
}
// endregion kokomade template dayo (^o^)


Measured memory_bytes: 57772
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
  string s;
  cin >> s;
  int n = s.size();
  n--;
  ll ans = 0;
  for (int bit = 0; bit < (1 << n); bit++) {
    ll sum = 0;
    ll now = s[0] - '0';
    rep(i,n){
      if((bit>>i)&1){
        sum += now;
        now = s[i+1]-'0';
      }else{
        now = now * 10 + s[i+1] - '0';
      }
    }
    sum += now;
    ans += sum;
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
N=int(input())
A=sorted(int(input())for _ in'_'*N)
A+=10**10,
B=sorted(int(input())for _ in'_'*N)
B+=10**10,
z=1
a=b=i=j=0
M=10**9+7
while i<N or j<N:
	if A[i]<B[j]:
		if b:
			z=z*b%M
			b-=1
		else:
			a+=1
		i+=1
	else:
		if a:
			z=z*a%M
			a-=1
		else:
			b+=1
		j+=1
print(z)


Measured memory_bytes: 11688
import math
def f(s):
    if len(s)%2==0: p=len(s)//2-1
    else: p=len(s)//2
    
    q=p
    while  q<len(s) and s[p]==s[q]:
        q+=1
    return q



s=input()

print(min(f(s),f(s[::-1])))

Measured memory_bytes: 3316
#include<stdio.h>
int main(){
	int n;
	int r;
	int inr;
	
	scanf("%d %d", &n,&r);
	inr=100*(10-n)+r;
	if (n<10){
		printf("%d", inr);
	}
	else {
		printf("%d", r);
	}
	
	return 0;
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string s[105];
ll dp[105][105];
int main ()
{
    ios::sync_with_stdio(false);
    ll n,m;cin>>n>>m;
    for(ll i=0;i<n;i++) cin>>s[i];
    dp[0][0]=(s[0][0]=='#'?1:0);
    for(ll i=1;i<n;i++) dp[i][0]=dp[i-1][0]+(s[i][0]=='#'&&s[i-1][0]!='#');
    for(ll i=1;i<m;i++) dp[0][i]=dp[0][i-1]+(s[0][i]=='#'&&s[0][i-1]!='#');
    for(ll i=1;i<n;i++)
    {
        for(ll j=1;j<m;j++)
        {
            dp[i][j]=min(dp[i-1][j]+(s[i][j]=='#'&&s[i-1][j]!='#'),dp[i][j-1]+(s[i][j]=='#'&&s[i][j-1]!='#'));
        }
    }
    cout<<dp[n-1][m-1];
    return 0;
}



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

using namespace std;
int N,W;
int w[100];
long long v[100];

long long knap(int n,int u){
    double K[n+1][u+1];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=u;j++){
            if(i==0||j==0){
                K[i][j] = 0;
            }
            else if (w[i-1] <= j)
                K[i][j] = max(v[i-1] + K[i-1][j-w[i-1]], K[i-1][j]);
            else
                K[i][j] = K[i-1][j];
            //cout<< K[i][j] << " ";
        }
        //cout << endl;
    }
    return K[n][u];
}

int main(){
    scanf("%d %d",&N,&W);
    for(int i=0;i<N;i++){
        scanf("%d %lld",&w[i],&v[i]);
    }
    long long x = knap(N,W);
    printf("%.0lld",x);
}


Measured memory_bytes: 79104
// In The Name Of The Queen
#include<bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, L, id, A[N];
int main()
{
    scanf("%d%d", &n, &L);
    for (int i = 1; i <= n; i ++)
        scanf("%d", &A[i]);
    for (int i = 1; i < n; i ++)
        if (A[i] + A[i + 1] >= L)
            id = i;
    if (!id)
        return !printf("Impossible\n");
    printf("Possible\n");
    for (int i = n - 1; i > id; i --)
        printf("%d\n", i);
    for (int i = 1; i <= id; i ++)
        printf("%d\n", i);
    return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>
#include<algorithm>
#include<functional>
using namespace std;
typedef pair<float,int> A;
int main(void)
{
	A a[9],b[9],c[9],d[19];
	int i;
	for(i=1;i<=8;i++){
		scanf("%d %f",&a[i].second,&a[i].first);
	}
	sort(a,a+8);
	for(i=1;i<=2;i++){
		printf("%d %.2f\n",a[i].second,a[i].first);
	}
	
	for(i=1;i<=8;i++){
		scanf("%d %f",&b[i].second,&b[i].first);
	}
	sort(b,b+8);
	for(i=1;i<=2;i++){
		printf("%d %.2f\n",b[i].second,b[i].first);
	}
	
	for(i=1;i<=8;i++){
		scanf("%d %f",&c[i].second,&c[i].first);
	}
	sort(c,c+8);
	for(i=1;i<=2;i++){
		printf("%d %.2f\n",c[i].second,c[i].first);
	}
	
	for(i=1;i<=6;i++){
		d[i].first=a[i+2].first;
		d[i].second=a[i+2].second;
	}	
	for(i=1;i<=6;i++){
		d[i+6].first=b[i+2].first;
		d[i+6].second=b[i+2].second;
	}	
	for(i=1;i<=6;i++){
		d[i+12].first=c[i+2].first;
		d[i+12].second=c[i+2].second;
	}
	sort(d,d+18);
	for(i=1;i<=2;i++){
		printf("%d %.2f\n",d[i].second,d[i].first);
	}
	return 0;
}

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


#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()


using namespace std;
using namespace __gnu_pbds;

template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
using ll  = long long;

using point = complex<double>;


void err(istream_iterator<string> it) {cerr << endl;}
template<typename T, typename... Args>void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << " = " << a << endl;err(++it, args...);}




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

const double EPS = 1e-9;
const long long mod = 1e9 + 7;
const long long INF = 1e18;
const int N = 5e3 + 5;



int n , m;
int a[N];
int b[N];
ll msk[6000];
ll dp[N][N];
vector<int> vec;
ll solve(int i , int mask){

    if(mask == (1<<n)-1)
            return 0;
    if(i == vec.size())
            return 1e16;
    ll &ret = dp[i][mask];
    if(~ret)
            return ret;
    ret = 1e16;
    ret = min(solve(i + 1,mask),ret);
    ret = min(solve(i + 1,mask | vec[i] ) + msk[vec[i]],ret);
    return ret;

}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    for(int i = 0; i < 6000; ++i)
        msk[i] = 1e16;
    cin >> n >> m;
    for(int i = 0; i < m; ++i){
            int x = 0,c;
            cin >> a[i] >> b[i];
            for(int j = 0; j < b[i]; ++j){
                cin >> c;
                --c;
                x |= (1 << c);
            }

            msk[x] = min(msk[x],1ll*a[i]);
    }
    for(int i = 0; i < (1 << n); ++i){

            if(msk[i] != 0)vec.push_back(i);
    }
    memset(dp,-1,sizeof dp);
   ll ret = solve(0,0);
   if(ret >= 1e16)cout << -1 << '\n';
   else cout << ret << '\n';
    return 0;
}


Measured memory_bytes: 199608
import sys
import math
from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))

a, b = load_list()

print(lcm(a, b))

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

using namespace std;
int n;
int d[1000001];
long long giaithua[1000001];
long long kq=1;
const long long mod=998244353;
long long ndgiaithua[1000001];
long long power(long long a,long long x)
{
    if(x==0)
        return 1;
    if(x%2==0)
        return power((a*a)%mod,x/2);
    else
        return (a*power((a*a)%mod,x/2))%mod;
}
int main()
{
    cin>>n;
    int maxx=0;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        maxx=max(maxx,x);
        d[x]++;
        if(i==1&&x!=0)
        {
            cout<<0;
            return 0;
        }
        if(i!=1&&x==0)
        {
            cout<<0;
            return 0;
        }
    }
    for(int i=1;i<=maxx;i++)
    {
        if(d[i]==0)
        {
            cout<<0;
            return 0;
        }
        kq=kq*power(d[i-1],d[i]);
        kq%=mod;
    }
    cout<<kq;
    return 0;
}


Measured memory_bytes: 2304
#include <stdio.h>

int main(){
  int a, b, c, k, ans=0;
  int gcd(int ,int ,int );
  scanf("%d",&k);
  for(a=1;a<=k;a++){
    for(b=1;b<=k;b++){
      for(c=1;c<=k;c++){
        ans+=gcd(a,b,c);
      }
    }
  }
  printf("%d",ans);
}

int gcd(int a,int b,int c){
  int gcd_2(int ,int );
  return gcd_2(gcd_2(a,b),c);
}

int gcd_2(int a,int b){
  int d;
  for(;;){
    if(b%a==0) break;
    b = b%a;
    d = b;
    b = a;
    a = d;    
  }
  return a;
}

Measured memory_bytes: 1732
#include <stdio.h>
#include <stdbool.h>
int main() {
	int n;
	bool isChange=false;
	scanf("%d", &n);
	int p[50]={};
	for (int i = 0; i < n; i++) {
		scanf("%d", &p[i]);
	}
	for (int i = 0; i < n; i++) {
		if(p[i]!=i+1){
			if(isChange){
				printf("NO\n");
				return 0;
			}
			p[p[i]-1]=p[i];
			isChange=true;
		}
	}
	printf("YES\n");
	return 0;
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;

inline bool LT(double a,double b) { return !equals(a,b) && a < b; }
inline bool LTE(double a,double b) { return equals(a,b) || a < b; }

void compute() {

}

int main() {
  int x;
  cin >> x;
  x /= 100;
  cout << "ai1333";
  rep(i,x) cout << '3';
  puts("");
  compute();
  return 0;
}


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

long long v[110],w[110];
long long N,W;
long long MEM[100010][110];
long long dp(long long num,int i){
    if(num<0 || i>=N){
        return 0;
    }
    if(MEM[num][i]!=-1){
        return MEM[num][i];
    }
    long long aux=dp(num,i+1);
    if(num>=v[i]){
        aux=max(w[i]+dp(num-v[i],i+1),aux);
    }
//    cout<<num<<" "<<aux<<endl;
    return MEM[num][i]=aux;
}
int main(){
    cin>>N>>W;
    memset(MEM,-1,sizeof(MEM));
    for(int i=0;i<N;i++){
        cin>>v[i]>>w[i];
    }
    cout<<dp(W,0)<<endl;
    return 0;
}


Measured memory_bytes: 86144
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)

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

    int q;
    cin >> q;
    vector<int> L(q), R(q);
    
    int r_max = 0;
    REP(i, q){
        cin >> L[i] >> R[i];
        r_max = max(r_max, R[i]);
    }

    vector<int> A(r_max + 1, 1);
    A[0] = A[1] = 0;
    int lim = sqrt(r_max);
    for(int i = 2; i <= lim; i++){
        if(A[i]){
            for(int j = i * 2; j <= r_max; j += i){
                A[j] = 0;
            }
        }
    }

    vector<int> B(r_max + 1, 0);
    for(int i = 2; i <= r_max; i++){
        if(A[i] and A[(i + 1) / 2]){
            B[i] = 1;
        }
    }

    for(int i = 2; i <= r_max; i++){
        B[i] += B[i - 1];
    }

    REP(i, q){
        cout << B[R[i]] - B[L[i] - 1] << endl;
    }

    return 0;
}

Measured memory_bytes: 2176
import java.io.*;

class Main {

    public static void main(String[] args) {

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        
        try {

            String[] line = reader.readLine().split(" ");

            int W = Integer.parseInt(line[0]);
            int H = Integer.parseInt(line[1]);
            int x = Integer.parseInt(line[2]);
            int y = Integer.parseInt(line[3]);
            int r = Integer.parseInt(line[4]);
            
            boolean flag_width  = (x + r >= 0) && (x + r <= W);
            boolean flag_height = (y + r >= 0) && (y + r <= H);
            
            if (x < 0 || y < 0) { 
                System.out.println("No");
            } else if (flag_width && flag_height) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }

        } catch (IOException e) {

            e.printStackTrace();

        }

    }

}

Measured memory_bytes: 24344
regidents = [[[0 for b in range(10)] for f in range(3) ]for r in range(4)]
n = int(input())
for i in range(n):
    building, floor, room, delta = map(int, input().split())
    regidents[building-1][floor-1][room-1] += delta
print('\n####################\n'.join('\n'.join(' '+' '.join(str(regidents[b][f][r]) for r in range(10) )for f in range(3)) for b in range(4)))

Measured memory_bytes: 7760
import sys
input = sys.stdin.readline

INF = 10 ** 15

N, M = map(int, input().split())

LRCs = [tuple(map(int, input().split())) for _ in range(M)]
LRCs.sort(key = lambda t: (t[1], t[0]))

dp = [INF] * N
dp[0] = 0
for L, R, C in LRCs:
    while dp[R-1] > dp[L-1] + C:
        dp[R-1] = dp[L-1] + C
        R -= 1

if dp[-1] == INF:
    print(-1)
else:
    print(dp[-1])

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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int M = (1e9)+7;
const int N = 3000005;

int p25[N],p26[N],fac[N],ifac[N];


int mpower(int x, int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1){
            res = (res*x) % p;
        }
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

int nCr(int n, int r)
{
    int res = fac[n];
    res *= ifac[r];res %= M;
    res *= ifac[n-r];res %= M;
    return res;
}

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        fac[0] = ifac[0] = p25[0] = p26[0] = 1LL;
        for(int i=1;i<N;i++)
        {
            fac[i] = (i*fac[i-1])%M;
            ifac[i] = mpower(fac[i],M-2,M);
            p25[i] = (p25[i-1]*25LL)%M;
            p26[i] = (p26[i-1]*26LL)%M;
        }
        int n,k;
        cin>>k;
        string s;
        cin>>s;
        n = s.length();
        int ans = 0;
        for(int i=0;i<=k;i++)
        {
            int now = nCr(n+i-1,n-1);
            now *= p25[i];now %= M;
            now *= p26[k-i];now %= M;
            ans += now; ans %= M;
        }
        cout<<ans<<endl;
    }
    return 0;
}


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

#include <iostream>


#define MOD 1000000007

typedef unsigned long long ull;

using namespace std;
auto f=[]()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
};


ull power(ull base, ull p)
{
	if(p==0)return 1;

	ull local=(power(base,p>>1))%MOD;
	local=(local*local)%MOD;

	return !(p&1)?local:(base*local)%MOD;
}

ull nCk(ull n, ull k)
{
	ull prod=1;
	ull i=n;
	while(i>n-k)
	{
		prod*=i;
		prod%=MOD;
		i--;
	}

	ull X=prod;
	
	i=1;
	ull Y=1;
	while(i<=k)
	{
		Y*=i;
		Y%=MOD;
		i++;
	}

	ull mmi=power(Y,MOD-2);
	
	return (X*mmi)%MOD;

}

int main()
{
	f();
	ull n,a;
	cin>>n>>a;
	int ans=0;
	while(n)
	{
		n/=a;
		ans++;
	}
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n,a,b;
  cin>>n>>a>>b;
  long long int x=((n/(a+b))*a);
  n=(n%(a+b));
  x+=min(a,n);
  cout<<x;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
long n,k,a[1<<17],b[1<<17],ans;
main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		cin>>a[i]>>b[i];
		if((a[i]&~k)==0)ans+=b[i];
	}
	for(long i=1;i<=k;i<<=1)
	{
		if((k&i)==0)continue;
		long now=0;
		long K=(k&~(i|(i-1)))|(i-1);
		for(int j=0;j<n;j++)if((a[j]&~K)==0)now+=b[j];
		ans=ans<now?now:ans;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1920
# // Input
# // 文字列が1行に与えられます。
# // Output
# // 与えられた文字列の小文字と大文字を入れ替えた文字列を出力して下さい。アルファベット以外の文字はそのまま出力して下さい。

line = 'fAIR, LATER, OCCASIONALLY CLOUDY.'
line = input()
output = ''
for i in range(len(line)):
    if line[i].isupper():
        output += line[i].lower()
    elif line[i].islower():
        output += line[i].upper()
    else:
        output += line[i]
print(output)


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

vector<int> v;
int n;

int main()
{
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 1, a; i <= n; i++) {
		cin >> a;
		v.push_back(a);
	}
	sort(v.begin(), v.end());
	auto judge = [](int nd) {
		long long cur_siz = v[nd];
		int cnt = 1;
		for (int i = 0; i < n; i++) {
			if (i == nd) continue;
			if (2*cur_siz >= v[i]) {
				cnt++;
				cur_siz += v[i];
			}
		}
		return cnt == n;
	};
	int L = 0, R = n-1, mid;
	while (L <= R) {
		mid = (L+R)>>1;
		if (judge(mid)) R = mid-1;
		else L = mid+1;
	}
	cout << n-1-R << endl;
	return 0;
}


Measured memory_bytes: 892
# input
H, W = map(int, input().split())

# process
if W == 1 or H == 1:
    print(1)

elif W%2 == 0:
    print((W//2) * H)
else:
    t = W//2
    if H%2 == 0:
        print((t*2 + 1) * (H//2))
    else:
        print((t*2 + 1) * (H//2) + t+1)


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

using ll =long long;

int main() {
int H,W,N;
  cin>>H>>W>>N;
  int sum=0;
  int counter=0;
  for(int i=0;i<N;i++){
    sum+=max(H,W);
    
    counter++;
    if(sum>=N){break;}
}
  
  
  cout<<counter<<endl;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
    int n, k;
    std::cin >> n >> k;

    long long half = 0;
    if (k % 2 == 0) half = (n + k / 2) / k;
    long long all = n / k;

    std::cout << all * all * all + half * half * half << std::endl;

    return 0;
}


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

typedef long long ll;
 
using tpl = tuple<int, int, int>;
typedef pair<int,int> pii;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}

int N;
string S;
int sums[200010];

int main(){

    cin >> N;
    cin >> S;
    for(int i = 0; i < N; i++){
        sums[i + 1] = sums[i] + (S[i] == '#');
    }
    
    int ans = 1 << 29;
    for(int i = 0; i < N; i++){
        int b1 = sums[i];
        int b2 = (N - i) - (sums[N] - sums[i]);
        ans = min(ans, b1 + b2);
    }
    ans = min(ans, sums[N]);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1412