akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h=sc.nextInt(),r=sc.nextInt();
        if(h+r==0) {
            System.out.println(0);
        }else if(h+r<0) {
            System.out.println(-1);
        }else {
            System.out.println(1);
        }
     
    }
}


Measured memory_bytes: 26372
#include <bits/stdc++.h>
 
#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
const int max_n = 200111, inf = 1000111222;
const ll mod = 1000000007;
 
int n, m;
string s;
 
ll dp[max_n];
ll pr[max_n];
ll dp2[max_n];
 
ll solve_allr() {
    ll ans = 1;
    dp[1] = 1;
    dp[2] = 0;
    ll sum = dp[1];
    for (int i = 3; i < max_n; ++i) {
        dp[i] = sum;
        sum += dp[i - 1];
        sum %= mod;
    }
    for (int len = 1; len < n; ++len) {
        ans += dp[n - len] * (len + 1);
        ans %= mod;
    }
    return ans;
}
 
ll solve(int L) {
    int L1 = L / 2;
    pr[0] = 0;
    pr[1] = 1;
    dp2[1] = 1;
    for (int i = 2; i < max_n; ++i) {
        dp2[i] = (pr[i - 1] - pr[max(1, i - L1 - 1) - 1] + 2 * mod) % mod;
        pr[i] = pr[i - 1] + dp2[i];
        pr[i] %= mod;
    }
    dp[1] = 1;
    for (int i = 3; i < max_n; i += 2) {
        dp[i] = dp2[i / 2 + 1];
    }
    ll ans = 0;
    for (int len = 1; len <= L; len += 2) {
        ans += dp[n - len] * (len + 1);
        ans %= mod;
    }
    return ans;
}
 
int main()
{
    //freopen("input.txt", "r", stdin);
    cin >> n >> m;
    cin >> s;
    if (s[0] == 'B') {
        for (int i = 0; i < s.size(); ++i) {
            s[i] = (s[i] == 'B' ? 'R' : 'B');
        }
    }
    bool allr = 1;
    for (char c : s) {
        if (c == 'B') {
            allr = 0;
            break;
        }
    }
    if (allr) {
        cout << solve_allr() << endl;
        return 0;
    }
    if (n % 2 == 1) {
        cout << 0 << endl;
        return 0;
    }
    while (s.back() == 'R') {
        s.pop_back();
    }
    int L = 0;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == 'B') {
            break;
        } else {
            ++L;
        }
    }
    if (L % 2 == 0) {
        ++L;
    }
    int len = 0;
    for (int i = L; i < s.size(); ++i) {
        if (s[i] == s[i - 1]) {
            ++len;
        } else {
            if (s[i] == 'B' && len % 2 == 1) {
                L = min(L, len);
            }
            len = 1;
        }
    }
    cout << solve(L) << endl;
    return 0;
}
 
// think 2:06

Measured memory_bytes: 5252
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define rep(i, f, n) for (int i = (f); i < (int)(n); i++)
#define repe(i, f, n) for (int i = (f); i <= (int)(n); i++)
using namespace std;
using ll = long long;
using pint = pair<int, int>;

const int INF = 1001001001;

int main() {
  string s;
  cin >> s;
  int a = -1, ans = 0;
  rep(i, 0, s.size()) {
    if (a == -1 && s[i] == 'A') a = i;
    if (s[i] == 'Z') ans = max(ans, i - a + 1);
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	int n,m; cin >> n >> m;
	int cntm[21][100005];
	int sm[22];
	for (int i = 1;i < m;i++){
		cntm[i][0] = 0;
		sm[i] = 0;
	}

	int a;

	for (int i = 0;i < n;i++){
		cin >> a;
		for (int j = 1;j <= m;j++){
			if(a == j) cntm[j][i+1] = cntm[j][i]+1;
			else cntm[j][i+1] = cntm[j][i];
		}
		sm[a]++;
	}

	int dp[1<<20];
	fill(dp,dp+(1<<20),INT_MAX);

	dp[0] = 0;

	for (int i = 0;i < (1<<m);i++){
		for (int j = 0;j < m;j++){
			if((i>>j & 1) == 0){
				int st = 0;
				for (int k = 0;k < m;k++){
					if(i>>k&1)st += sm[k+1];
				}
				int next = sm[j+1] - (cntm[j+1][st+sm[j+1]] - cntm[j+1][st]);
				dp[i|1<<j] = min(dp[i|1<<j],dp[i]+next);
			}
		}
	}

	cout << dp[(1<<m)-1] << endl;

	return 0;

}



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

dp = [float('inf') for i in range(n)]
dp[0] = 0

dp[1] = min(dp[1], dp[0] + abs(h[1] - h[0]))

for i in range(2, n):
  dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
  dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
  
print(dp[n-1])

Measured memory_bytes: 13980
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <sstream>
using namespace std;

typedef long long int64;
const int inf = (int)1e9;

pair<int, int> findpos(vector<pair<int, int> > &s, int x)
{
	int total = 0;
	
	for(int i = 0; i < s.size(); ++i) {
		
		if(x < total + s[i].first)
			return make_pair(i, x - total);
		
		total += s[i].first;
	}
	
	return make_pair(s.size(), 0);
}

void copy(vector<pair<int, int> > &s, vector<pair<int, int> > &t, int l, int r)
{
	pair<int, int> lp, rp;
	lp = findpos(s, l);	
	rp = findpos(s, r);
	
	int lidx = lp.first, ridx = rp.first, lpos = lp.second, rpos = rp.second;
	
	if(lidx == ridx) {
		t.push_back(make_pair(rpos - lpos, s[lidx].second + lpos));
		return;
	}
	
	t.push_back(make_pair(s[lidx].first - lpos, s[lidx].second + lpos));
	for(int i = lidx + 1; i < ridx; ++i)
		t.push_back(s[i]);
	t.push_back(make_pair(rpos, s[ridx].second));
	
	return;
}

void shuffle(vector<pair<int, int> > &s, vector<pair<int, int> > &t, int x, int y, int n)
{
	t.clear();
	
	copy(s, t, y, n);
	copy(s, t, x, y);
	copy(s, t, 0, x);
	
	return;
}

int countnum(vector<pair<int, int> > &s, int l, int r, int x)
{
	int total = 0;
	pair<int, int> lp, rp;
	lp = findpos(s, l);	
	rp = findpos(s, r);
	
	int lidx = lp.first, ridx = rp.first, lpos = lp.second, rpos = rp.second;
	
	if(lidx == ridx) {
		total += max(min(x, (s[ridx].second + rpos)) - (s[lidx].second + lpos), 0);
		return total;
	}
	
	total += max(min(x, s[lidx].second + s[lidx].first) - (s[lidx].second + lpos), 0);
	for(int i = lidx + 1; i < ridx; ++i)
		total += max(min(x, s[i].second + s[i].first) - s[i].second, 0);
	total += max(min(x, s[ridx].second + rpos) - s[ridx].second, 0);
	
	return total;
}

int main()
{
	while(true) {

		int n, m, p, q, r;
		vector<pair<int, int> > c, d;
	
		scanf("%d", &n);
		if(n == 0)
			break;
		scanf("%d%d%d%d", &m, &p, &q, &r);
		
		c.push_back(make_pair(n, 1));
		c.reserve(3 * m);
		d.reserve(3 * m);
		
		for(int i = 0; i < m; ++i) {
			
			int x, y;
			
			scanf("%d%d", &x, &y);
			
			shuffle(c, d, x, y, n);
			c = d;
		}
		
		//for(int i = 0; i < c.size(); ++i)
		//	printf("(%d, %d)\n", c[i].second, c[i].first);
		int ans = countnum(c, p - 1, q, r + 1);
		
		printf("%d\n", ans);
	}
	
	return 0;
}

/* ハラスメントに負けず */
/* 0完太陽にも負けず */
/* はやく人権を獲得したい */
/* nullmineralが書きましたが */
/* 責任はまったくとりません */

Measured memory_bytes: 1520
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def check(y,x):
        res = 0
        c = s[x][y]
        for x in range(x,5):
            if s[x][y] != c:
                break
            res += 1
        if res < 3:
            return 0
        else:
            return res

    def update(y,x,d):
        for i in range(x,x+d):
            s[i][y] = 0

    def fall(s):
        q = [[] for i in range(5)]
        for x in range(5):
            for y in range(h):
                if s[x][y]:
                    q[x].append(s[x][y])
            for y in range(h-len(q[x])):
                q[x].append(0)
        return q

    while 1:
        h = I()
        if h == 0:
            break
        s = LIR(h)
        s = [[s[-1-y][x] for y in range(h)] for x in range(5)]
        ans = 0
        f = 1
        while f:
            f = 0
            for y in range(h):
                for x in range(3):
                    if s[x][y]:
                        d = check(y,x)
                        ans += s[x][y]*d
                        if d:
                            update(y,x,d)
                            f = 1
            if f:
                s = fall(s)
        print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()



Measured memory_bytes: 6240
N = int ( input())
ans = [0]*N
for x in range (1,101):
  for y in range (1,101):
    for z in range (1,101):
      m = (x+y+z)**2-(x*y+y*z+z*x)
      if m <= N:
        ans[m-1] += 1
for i in ans:
  print(i)

Measured memory_bytes: 9164
#include<iostream>
#include<stdio.h>
#include<string>
#include <algorithm>
#include<cstring>
#include <math.h>
#include <iomanip>
using namespace std;

int main()
{
  int n;
  int x[2019];
  int m;
  int a;

  cin>>n;
  for(int i=0;i<n;i++)
    cin>>x[i];
  cin>>m;
  for(int i=0;i<m;i++){
    cin>>a;
    a=a-1;
    int num=1;
    for(int j=0;j<n;j++){ 
      if((x[a]+1)==x[j]){
	num=0;
      }
    }
    if(x[a]!=2019){
      x[a]+=num;
    }
  }
  for(int i=0;i<n;i++){
    cout<<x[i]<<endl;
  }
  return 0;
}




Measured memory_bytes: 3096
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int x = Integer.parseInt(in.next());
            int y = Integer.parseInt(in.next());
            int z = Integer.parseInt(in.next());

            int tmp = 0;
            tmp = x;
            x = y;
            y = tmp;

            tmp = x;
            x = z;
            z = tmp;

            out.printf("%d %d %d", x, y, z);
        }

    }
}



Measured memory_bytes: 23124
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

llong n;
int main() {
    scanf("%lld", &n);
    ++n;
    llong t = 1, i = 0;
    while (n / t > 0) {
        t *= 10;
        ++i;
    }
    t /= 10;
    --i;
    int ret = 9 * i + (n / t - 1);
    printf("%d\n", ret);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h=sc.nextInt();
		int w=sc.nextInt();
		boolean[][] s=new boolean[h+2][w+2]; 
		int all=0;
		for(int i=1;i<=h;i++) {
			String S=sc.next();
			for(int j=1;j<=w;j++) {
				s[i][j]=S.charAt(j-1)=='.';
				if(s[i][j])all++;
			}
		}
		boolean dp[][]=new boolean[h+2][w+2];
		dp[1][1]=true;
		for(int t=1;t<h*w;t++) {
			boolean next[][]=new boolean[h+2][w+2];
			for(int i=1;i<=h;i++) {
				for(int j=1;j<=w;j++) {
					next[i][j]=s[i][j]&&
							   (dp[i-1][j]||
							    dp[i+1][j]||
							    dp[i][j-1]||
							    dp[i][j+1]);
				}
			}
			
			if(next[h][w]) {
				System.out.println(all-t-1);
				return;
				}
			dp=next;
		}
		System.out.println(-1);
		}
}


Measured memory_bytes: 21844
#include "bits/stdc++.h"
#include <unordered_set>

#define _CRT_SECURE_NO_WARNINGS

#define FOR(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1; i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

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

using LL = long long int;
using LD = long double;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

int main() {
//	ios::sync_with_stdio(false);
//	cin.tie(0);
	int x, p;
	cin >> x >> p;
	double ans = (x + 1) / 2 * 100.0 / p;
	printf("%.7lf\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint N; cin >> N;
    string S; cin >> S;
    range(i, 0, S.size()) {
        char c = S.at(i);
        if (c + N > 'Z') c = 'A' + c + N - 'Z' - 1;
        else c = c + N;
        S.at(i) = c;
    }
    cout << S << "\n";
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args)throws IOException{
         Scanner sc = new Scanner(System.in);
         int n = sc.nextInt();
         int num[] = new int[n];
         long total = 0;
       for(int i = 0; i < n; i++){
           int a = sc.nextInt();
           num[i] = a;
           total += num[i];
     }
 Arrays.sort(num);
 int min = num[0];
 int max = num[n - 1];
        System.out.println(min+" "+max+" "+total);
}
}

Measured memory_bytes: 41412
#include<iostream>

using namespace std;

int main() {
	int k, s;
	cin >> k >> s;

	int ans = 0;

	for (int x = 0; x <= k; x++) {
		for (int y = 0; y <= k; y++) {
			if (s-x - y <=k && x+y<=s) ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=acos(-1);
const ll INF = 1LL<<62;
const ll MINF = -(1LL<<62);

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)


int main() {
	IO;
	ll n;
	cin>>n;
	vector<ll> t(n);
	for(int i=0;i<n;++i) cin>>t[i];
	sort(all(t));
	if(t[0]==0) cout<<"0\n";
	else {
		double sum=0;
		ll val=1;
		for(int i=0;i<n;++i) {
			sum+=log(t[i]);
			val*=t[i];
		}
		if(sum>log(1e18) || val>(ll)1e18) {
			cout<<"-1\n";
		}else {
			cout<<val<<"\n";
		}
	}
	return 0;
}


Measured memory_bytes: 3988
//==========================================c#
using System; //Console, IComparable
using System.IO; //StreamWriter 
using System.Linq; //Select(), Where(), OrderBy(), Count()
using System.Collections.Generic; //List<T>

public class Run{
    private static class gv{
        public static string input;
    }
    
    public void build(){
        IOC io = new IOC();
        
        gv.input = io._string;
    }
    
    public void fail(){
        Console.WriteLine("No");
    }
    
    public void solve(){
        StreamWriter so = new StreamWriter(Console.OpenStandardOutput());
        
        var slen = gv.input.Length;
        if ((slen&1) == 1) {
            fail();
            return;
        }
        for (int i = 0; i < slen; i += 2) {
            if (gv.input.Substring(i,2) == "hi"){
                continue;
            }
            fail();
            return;
        }
        
        Console.WriteLine("Yes");
    }
}

class Program { 
    static void Main() { 
        var run = new Run();
        run.build();
        run.solve();
        
        
        
        
    } 
}

public class IOC{
    public int _int{get{return int.Parse(Console.ReadLine());}}
    public int[] _inta{get{return Array.ConvertAll(Console.ReadLine().Split(), int.Parse);}}
    public long _long{get{return long.Parse(Console.ReadLine());}}
    public long[] _longa{get{return Array.ConvertAll(Console.ReadLine().Split(), long.Parse);}}
    public string _string{get{return Console.ReadLine();}}
    public string[] _stringa{get{return (Console.ReadLine().Split());}}
    public double _double{get{return double.Parse(Console.ReadLine());}}
    public double[] _doublea{get{return Array.ConvertAll(Console.ReadLine().Split(), double.Parse);}}
}


Measured memory_bytes: 13140
def search(n):
    for i in range(1, n+1):
        if i*(i+1)/2 >= n:
            return i

n = int(input())
lim = search(n)
s = lim*(lim+1)//2
ans = []

for i in range(1, lim+1):
    if i != s-n:
        print(i)

Measured memory_bytes: 3408
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;

int main() {
  std::vector<string> v = {"Christmas", "Christmas Eve", "Christmas Eve Eve", "Christmas Eve Eve Eve"};
  int d; cin>>d;
  cout << v[25-d] << endl;
}


Measured memory_bytes: 380
import sys
from math import ceil, sqrt


def input(): return sys.stdin.readline().strip()


def prime_factors(x):
    f = []
    for i in range(2, ceil(sqrt(x))+1):
        if x % i != 0:
            continue
        f.append([i, 0])
        while x % i == 0:
            x //= i
            f[-1][1] += 1
    if x != 1:
        f.append([x, 1])
    return f


def solve(A, B):
    d_a = set([x[0] for x in prime_factors(A)])
    d_b = set([x[0] for x in prime_factors(B)])
    return d_a & d_b


def main():
    A, B = map(int, input().split())
    ans = len(solve(A, B)) + 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const long long  N=1e9+7;
long long n;
map<long long ,long long>f;
long long dfs(long long u){
	if(f[u]) return f[u];
	else	return f[u]=(dfs(u/2)+dfs((u-1)/2)+dfs((u-2)/2))%N;
}
int main(){
	f[0]=1;
	f[1]=2;
	cin>>n;
	printf("%ld",dfs(n));
	return 0;
} 

Measured memory_bytes: 256
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;

#define amen ;
#define vec vector
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()

typedef long long ll;
typedef double d;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;
typedef unsigned int ui;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    vector <int> v(n);
    for (auto &it : v)
        cin >> it;
    reverse(all(v));
    for (int i = 0; i < n; i++)
    {
        if (v[i+1] > v[i])
            v[i+1]--;
    }
    reverse(all(v));
    for (int i = 0; i < n - 1; i++)
    {
        if (v[i] > v[i+ 1])
        {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}

Measured memory_bytes: 640
n = int(input())
sp_list = [input().split() for _ in range(n)]

tmp = []
for i,sp in enumerate(sp_list,1):
    tmp.append([i,sp[0],int(sp[1])])

sp_list1 = sorted(tmp, key=lambda x: x[2], reverse=True)
sp_list2 = sorted(sp_list1, key=lambda x: x[1], reverse=False)

for i,s,p in sp_list2:
    print(i)

Measured memory_bytes: 3064
# https://atcoder.jp/contests/abc124/tasks/abc124_d

N, K = map(int, input().split())
S = input()
arr = []
prev = '1'
length = 0
for c in S:
  if prev != c:
    arr.append(length)
    length = 0
  length += 1
  prev = c
arr.append(length)
if S[-1] == '0':
  arr.append(0)

sarr = [0]
for a in arr:
  sarr.append(sarr[-1] + a)

L = K * 2 + 1
if L >= len(sarr):
  print(N)
  exit()
ans = 0
for i in range(0, len(sarr)-L, 2):
  t = sarr[i+L] - sarr[i]
  ans = ans if ans > t else t
print(ans)


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

int main (){
    vector <float> v;
    int n;
    cin >> n;
    int temp_n = n;
    while(n--){
        int no;
        cin >> no;
        v.push_back(no);
    }
    int middle = round (accumulate (v.begin(), v.end(), 0.0) / (float)temp_n);
    ll sum=0;
    for (int i=0; i<v.size(); i++){
        sum += (v[i]-middle)*(v[i] - middle);
    }

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 384
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int N;
	int[] p;

	Main(BufferedReader in) throws IOException {
		N = Integer.parseInt(in.readLine());
		p = new int[N];
		String[] tokens = in.readLine().split(" ");
		for (int i = 0; i < N; ++i) {
			p[i] = Integer.parseInt(tokens[i]) - 1;
		}
	}

	void swap(int[] array, int i, int j) {
		int temp = array[i];
		array[i] = array[j];
		array[j] = temp;
	}

	void calc() {
		int count = 0;
		int[] array1 = Arrays.copyOf(p, p.length);
		for (int i = 0; i + 1 < N; ++i) {
			if (array1[i] == i) {
				count++;
				swap(array1, i, i + 1);
			}
		}
		if (array1[N - 1] == N - 1) {
			++count;
			swap(array1, N - 2, N - 1);
		}
		System.out.println(count);
	}

	void showResult() {
	}
}

Measured memory_bytes: 41340
fn main() {
    proconio::input! {
        a: i64,
        b: i64,
        c: i64,
    }
    let v = [
        ((a / 2) * b * c - (a / 2 + a % 2) * b * c).abs(),
        ((b / 2) * a * c - (b / 2 + b % 2) * a * c).abs(),
        ((c / 2) * a * b - (c / 2 + c % 2) * a * b).abs(),
    ];
    let ans = v.iter().min().unwrap();
    println!("{}", ans);
}


Measured memory_bytes: 2136
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
const ll mod = 1000000007;
ll modpow(ll a,ll n){
    ll result = 1;
    while(n > 0){
        if(n & 1)
            result = result * a % mod;
        a = a * a % mod;
        n /= 2;
    }
    return result;
}
int main(){
    int n;
    cin >> n;
    ll ans = modpow(10, n);
    ans = (ans - modpow(9, n)) % mod;
    ans = (ans - modpow(9, n)) % mod;
    ans = (ans + modpow(8, n)) % mod;
    if(ans < 0)
        ans += mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

const int N = 5;
int c[N][N], a[N], b[N];
int n;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    n = 3;
    rep(i, 1, n) {
        rep(j, 1, n) {
            cin >> c[i][j];
        }
    }
    rep(i, 1, n) {
        a[i] = c[i][1];
    }
    rep(i, 1, n) {
        rep(j, 1, n) {
            c[i][j] -= a[i];
        }
    }
    rep(i, 1, n) {
        b[i] = c[1][i];
    }
    rep(i, 1, n) {
        rep(j, 1, n) {
            c[i][j] -= b[j];
            if(c[i][j]) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

before = 0
d = [0] * N
for i in range(N):
    if i == 0:
        before = i
        continue

    if (A[before] + d[before]) > A[i]:
        d[i] = (A[before] + d[before]) - A[i]
        before = i
    else:
        before = i

print(sum(d))


Measured memory_bytes: 32060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define MOD 1000000007
#define INF 987654321
#define PI 3.1415926535

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

    string s, h;
    int a;
    cin >> a;
    cin >> s >> h;
    for(int i=0; i<a; i++) {
        cout << s[i] << h[i];
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
char w[105];
int flag[30];
int main()
{
	scanf("%s",w);
	int len = strlen(w);
	for(int i =0;i < len; i++)
	{
		flag[w[i] - 'a']++;
	}
	for(int i = 0;i < 26;i++)
	{
		if(flag[i] % 2 != 0)
		{
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
long long a,b,k;
int main()
{
    cin>>a>>b>>k;
    if(b-a+1<=k)
    {
        for(int i=a; i<=b; i++)
            cout<<i<<endl;
    }
    else
    {
        for(int i=a; i<=a+k-1; i++)cout<<i<<endl;
        if(b-k+1<=a+k-1)for(int i=a+k; i<=b; i++)cout<<i<<endl;
        else for(int i=b-k+1; i<=b; i++)cout<<i<<endl;
    }
}


Measured memory_bytes: 256
import java.io.*
import java.util.*

fun solve(AB: Int, BC: Int, CA: Int){
    println(AB*BC/2)
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    solve(sc.next().toInt(), sc.next().toInt(),sc.next().toInt())
}



Measured memory_bytes: 31516
#include <iostream>
#include <vector>
#include <string>
#include <bitset>

using namespace std;

int main(int argc, const char *argv[])
{
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  for (int i = 0; i < h; i++) {
    cin >> s[i];
  }

  int ans = h + w + 1;
  for (int bit = 0; bit < (1 << (h - 1)); bit++) {
    bitset<16> bs(bit);
    int x = 0, split_cnt = bs.count();
    bool ok = true;
    while (x < w && ok) {
      bool exceeded = false;
      vector<int> white_cnts(bs.count() + 1, 0);
      int left = x;
      for (; !exceeded && x < w; x++) {
        for (int y = 0, cur = 0; y < h; y++) {
          white_cnts[cur] += s[y][x] - '0';
          exceeded = exceeded || white_cnts[cur] > k;
          cur += bs[y];
        }
      }

      if (exceeded) {
        split_cnt++;
        x--;

        if (left == x) {
          ok = false;
        }
      }
    }

    if (ok) {
      ans = min(ans, split_cnt);
    }
  }

  cout << ans << "\n";

  return 0;
}


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

using namespace std;
int main() {
  int a[5];
  int k;
  
  for(int i = 0; i<5;i++){
    cin >> a[i];
  }
  cin >> k;
  
  sort(a,a+5);
  
  if((a[4] - a[0]) > k){
	cout <<":(" << endl;
  }else{
    cout << "Yay!" << endl;
  }
  
  return 0;
}
  

Measured memory_bytes: 256
from collections import deque

h,w=map(int, input().split())
a = [input() for i in range(h)]
visited = [[-1]*w for i in range(h)]
black = []
for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            black.append((i,j))
            visited[i][j] = 0

queue = deque(black)


while queue:
    y,x = queue.popleft()
    dydx = [[1,0],[-1,0],[0,1],[0,-1]]
    for j,k in dydx:
        newy,newx = y+j,x+k 
        if newy < 0 or newy >= h:continue 
        if newx < 0 or newx >= w:continue 
        if visited[newy][newx] == -1:
            visited[newy][newx] = visited[y][x] + 1
            queue.append((newy,newx))

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans,visited[i][j])

print(ans)


Measured memory_bytes: 159376
a,b=int(input()),int(input())
if a==b:
	print(1)
else:
	r=60
	while (a&(1<<r))==(b&(1<<r)):
		r-=1
	t=(1<<(r+1))
	a&=t-1
	b&=t-1
	k=r-1
	while k>=0 and (b&(1<<k))==0:
		k-=1
	ans=t-a
	if a>(1<<(k+1)):
		ans-=a-(1<<(k+1))
	print(ans)

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

long long f(long long N, long long gA, long long sA, long long bA, long long gB, long long sB, long long bB)
{
    vector<bool> need_search({gA < gB, sA < sB, bA < bB});

    long long ans = 0;
    long long g, s, b, score;
    if (N <= 5000)
    {
        for (g = 0; g <= (need_search[0] ? N : 0); g += gA)
        {
            for (s = 0; g + s <= (need_search[1] ? N : g); s += sA)
            {
                if (need_search[2])
                {
                    b = ((N - g - s) / bA) * bA;
                }
                else
                {
                    b = 0;
                }
                score = gB * (g / gA) + sB * (s / sA) + bB * (b / bA);
                score += N - g - s - b;
                ans = max(ans, score);
            }
        }
    }
    else
    {
        if (need_search[0])
        {
            if (need_search[1])
            {
                // need_search[2] must be false
                swap(gA, bA);
                swap(gB, bB);
                swap(need_search[0], need_search[2]);
            }
            else
            {
                swap(gA, sA);
                swap(gB, sB);
                swap(need_search[0], need_search[1]);
            }
        }
        g = 0;
        for (s = 0; s <= N; s += sA)
        {
            if (need_search[2])
            {
                b = ((N - s) / bA) * bA;
            }
            else
            {
                b = 0;
            }
            score = gB * (g / gA) + sB * (s / sA) + bB * (b / bA);
            score += N - g - s - b;
            ans = max(ans, score);
        }
    }
    return ans;
}

int main()
{
    long long N, gA, sA, bA, gB, sB, bB;
    cin >> N >> gA >> sA >> bA >> gB >> sB >> bB;

    long long ans = f(N, gA, sA, bA, gB, sB, bB);

    ans = f(ans, gB, sB, bB, gA, sA, bA);
    cout << ans << endl;
}


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

#define ll              long long int
#define ull             unsigned long long int
#define pii             pair < int, int>
#define pll             pair < ll, ll>
#define sc              scanf
#define scin(x)         sc("%d",&(x))
#define scln(x)         sc("%lld",&(x))
#define pf              printf
#define ms(a,b)         memset(a,b,sizeof(a))
#define pb(a)           push_back(a)
#define mp              make_pair
#define db              double
#define EPS             10E-10
#define ff              first
#define ss              second
#define sqr(x)          (x)*(x)
#define vi              vector< int >
#define vl              vector< ll >
#define vii             vector<vector< int > >
#define vll             vector<vector< ll > >
#define DBG             pf("HI\n")
#define MOD             1000000007
#define CIN             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define RUN_CASE(t,T)   for(__typeof(t) t=1;t<=T;t++)
#define CASE(t)         printf("Case %d: ",t)
#define CASEL(t)        printf("Case %d:\n",t)
#define intlimit        2147483648
#define longlimit       9223372036854775808
#define infinity        (1<<28)
#define gcd(a, b)       __gcd(a,b)
#define lcm(a, b)       ((a)*(b)/gcd(a,b))
#define mx              123456789

using namespace std;

///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fx[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------

int main()
{
    char ch[5];
    scanf("%s",ch);
    int n = strlen(ch);
    int i,cnt = 0;
    for(i=0;i<n-1;i++)
    {
        if(ch[i]==ch[i+1])
            cnt++;
        else cnt=0;
        if(cnt==2) break;
    }
    if(cnt==2)pf("Yes\n");
    else pf("No\n");
    return 0;
}


Measured memory_bytes: 256
def Infomation():
    if not (c11 - c21 == c12 - c22 == c13 - c23):
        return False
    if not (c11 - c31 == c12 - c32 == c13 - c33):
        return False
    if not (c11 - c12 == c21 - c22 == c31 - c32):
        return False
    if not (c11 - c13 == c21 - c23 == c31 - c33):
        return False
    return True

c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())

flag = Infomation()

if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
c = 3.times.map { gets.split.map(&:to_i) }

a = Array.new(3)
b = Array.new(3)
isOut = false

a[0] = 0
(0...3).each do |i|
  b[i] = c[0][i] - a[0]
end

a[1] = c[1][0]-b[0]
(0...3).each do |j|
  isOut = true if c[1][j] != a[1]+b[j]
end

a[2] = c[2][0]-b[0]
(0...3).each do |k|
  isOut = true if c[2][k] != a[2]+b[k]
end

if isOut
  puts 'No'
else
  puts 'Yes'
end

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<queue>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

typedef long long ll;
const ll INF = 1e17;



int main() {

	int N, M;
	cin >> N >> M;

	int A;
	int B;

	int kigen;

	vector<int> bite[100001];//1-n日目まで働けるアルバイトの報酬リスト

	for (int i = 1; i <= N; i++) {
		cin >> A >> B;
		
		kigen = M-A;

		if (kigen >= 0) { bite[kigen].push_back(B); }

	}

	struct priority_queue<int> C;

	int ans=0;

	for (int i = M; i >= 0; i--) {
		for (int j = 0; j < bite[i].size(); j++) {
			C.push(bite[i][j]);
		}

		if (!C.empty()) { 
			ans += C.top();
			C.pop();
		}
	}
	
	
	cout << ans;

	

	system("PAUSE");


}


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

long long inf = (1 << 30);
long long mod = 1e9;

int main(){

    int a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;

    bool ans = true;
    if(b - a > k) ans = false;
    if(c - a > k) ans = false;
    if(d - a > k) ans = false;
    if(e - a > k) ans = false;
    if(c - b > k) ans = false;
    if(d - b > k) ans = false;
    if(e - b > k) ans = false;
    if(d - c > k) ans = false;
    if(e - c > k) ans = false;
    if(e - d > k) ans = false;

    if(ans) cout << "Yay!" << endl;
    else cout << ":(" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 100000007
#define mp make_pair
using namespace std;

int main()
{
    vector<int> v1,v2;
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int t;
        cin>>t;
        v1.push_back(t);
    }
    v2=v1;
    sort(v2.begin(),v2.end());
    int k=1;
    for(int i=0;i<n;i++)
    {

        if(v2[n-1]>v1[i])
        {
            cout<<v2[n-k]<<endl;
        }
        else if(v2[n-1]==v1[i])
        {

            cout<<v2[n-2]<<endl;
            //k++;
        }
        //cout<<v2[i]<<' ';
    }
//cout<<endl;
    /*for(int i=0;i<n;i++)
    {
        vector<int> v3;
        v3=v1;
        v3.erase(v3.begin()+i);
        sort(v3.begin(),v3.end());
        cout<<v3[v3.size()-1]<<endl;

    }*/










    return 0;
}


Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long double ld;
typedef long long ll;
int main()
{
  ll n,m,d;cin >> n >> m >> d;
  ll x;
  if(d == 0) x = n;
  else x = ( ( n / d - 1 ) * d + n % d ) * 2;
  ld res = (ld) x / n / n * (m - 1);
  printf("%.7Lf\n", res);
 
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
#include <utility>
#include <stack>
#include <numeric>
#include <random>
#include <algorithm>
#include <queue>
#include <functional>
#include <iterator>
#include <list>
#include <unordered_map>
#include <deque>
using namespace std;

#define rep(i, b, e) for(i = b; i < e; ++i)
#define repr(i, b, e) for (i = b; i >= e; --i)
#define ull unsigned long long int
#define ll long long int
#define pint pair<int, int>

#define M_DEBUG 1
#define PI 3.141592653589793

#define E '\n'

#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << "\n";}
#define INF (1e18)

const ll MAX = 1000000000;
const ll MOD = 1e9 + 7;

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

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

ll aabs(ll a) {
    if (a < 0) return -a;
    return a;
}

//fast power
ll calc(ll a, ll b) {
    if (b == 0) return 1;
    else if (b % 2 == 0) {
        ll d = calc(a, b / 2);
        return (d * d) % MOD;
    }
    else return (a * calc(a, b - 1)) % MOD;
}

//fast combination
ll comb(ll n, ll a) {
    ll b = 1, c = 1;
    for (ll i = 1; i <= a; ++i) {
        b = b * i % MOD;
        c = c * (n - i + 1) % MOD;
    }

    return c * calc(b, MOD - 2) % MOD;
}


int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int aa[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cin >> k;
    cout << aa[k - 1] << endl;


    

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep2(i,x,n) for(int i=x;i<n;++i)

int main()
{    
    int n;
    string s;
    cin >> n >> s;
    int cnt = 0;
    rep(i,n-2)
        if(s.substr(i,3) == "ABC")
            ++cnt;
    
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
S = input()

cond = True

if not S[0] == 'A':
    cond = False

if not S[2:-1].count('C') == 1:
    cond = False

for i, s in enumerate(S):
    if i == 0:
        continue

    if s.isupper():
        if s == 'C':
            if i < 2 or len(S)-2 < i:
                cond = False
        else:
            cond = False

if cond:
    print('AC')
else:
    print('WA')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using vi=vector<int>;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int cnt=0;
    string s,t;
    cin >> s >> t;
    int x=s.size();
    rep(i,x){
      if(s[i]!=t[i]) ++cnt;
    }
    cout << cnt << "\n";
    return 0;
}   

Measured memory_bytes: 3796
/* Ashish Joshi
   NIT Hamirpur */

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
using ll = long long;
const int MAXN = 300005;

int  t[4*MAXN];

void build(int a[],int v, int tl, int tr){
    if(tl == tr){
        t[v] = a[tl];
    }else{
        int tm = (tl + tr) / 2;
        build(a, v*2, tl, tm);
        build(a, v*2 + 1, tm + 1, tr);
        t[v] = max(t[v*2], t[v*2+1]);
    }
}

int query(int v, int tl, int tr, int l, int r) {
    if (l > r) 
        return 0;
    if (l == tl && r == tr) {
        return t[v];
    }
    int tm = (tl + tr) / 2;
    return max(query(v*2, tl, tm, l, min(r, tm))
           , query(v*2+1, tm+1, tr, max(l, tm+1), r));
}

void update(int v, int tl, int tr, int pos, int new_v){
    if(tl == tr){
        t[v] = max(t[v],new_v);
    }else{
        int tm = (tl + tr)/2;
        if(pos <= tm){
            update(v*2, tl, tm, pos, new_v);
        }else{
            update(v*2 + 1, tm + 1, tr, pos, new_v);
        }
        t[v] = max(t[v*2],t[v*2 + 1]);
    }
}

int dp[MAXN];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int temp[MAXN]={0};
    int n,k;cin>>n>>k;
    vector<int> a(n);
    for(int i=0;i<n;i++)
        cin>>a[i];
    build(temp,1,0,MAXN-1);
    int ans=0;
    for(int i=0;i<n;i++){
        int l = max(0, a[i] - k), r = min(a[i] + k, (int)MAXN-1);
        int val = query(1, 0, MAXN-1, l, r);
        ans=max(ans,val+1);
        update(1, 0, MAXN-1, a[i], val+1);
    }
    cout<<ans;

}

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

# Input
s = [input() for i in range(3)]
ST = list(s[0].split())
S = str(ST[0])
T = str(ST[1])

AB = list(s[1].split())
A = int(AB[0])
B = int(AB[1])

U = str(s[2])


# Proccess
if U == S:
	A -= 1
else:
	B -= 1

# Output							
print(str(A)+" "+str(B))

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define SIZE 10000
struct WORD {
	char value[13];
	struct WORD *next;
};
struct WORD* HashTable[SIZE];	//default: all NULL
int HashFunc(char s[]) {
	long long hash = 0;
	for (int i = 0; s[i] != '\0'; i++) {
		hash += s[i] * (i + 1);
	}
	return (int)(hash * 13 % SIZE);
}
void Insert(char s[]) {
	int hash = HashFunc(s);
	struct WORD* newWord = (struct WORD*)malloc(sizeof(struct WORD));
	strcpy(newWord->value, s);
	newWord->next = HashTable[hash];
	HashTable[hash] = newWord;
}
void Find(char s[]) {
	int hash = HashFunc(s);
	struct WORD* pos;
	for (pos = HashTable[hash]; pos != NULL; pos = pos->next) {
		if (!strcmp(s, pos->value)) {
			printf("yes\n");
			return;
		}
	}
	printf("no\n");
	return;
}
int main() {
	int n;
	char command[7], value[13];
	for (int i = 0; i < SIZE; i++) {
		HashTable[i] = NULL;
	}
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s %s", command, value);
		if (command[0] == 'i') Insert(value);
		else if (command[0] == 'f') Find(value);
	}
	return 0;
}


Measured memory_bytes: 19612