akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int[] d = new int[N];
		d[0] = sc.nextInt();
		int ans = 0;
		for (int i = 1; i < N; i++) {
			d[i] = sc.nextInt();
			for (int j = 0; j < i; j++) {
				ans += d[i]*d[j];
			}
		}
		System.out.println(ans);
	}
	
	public static long gcd(long a, long b) {
		long remainder = a % b;
		if (remainder == 0) {
			return b;
		} else {
			return gcd(b, remainder);
		}
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

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


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

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

  int n, ans = 0, needle = 1;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];

  for (int i = 0; i < n; i++)
  {
    if(v[i] != needle) ans++;
    else needle++;
  }
  
  if(needle != 1) cout << ans << endl;
  else cout << -1 << endl;
  
  return 0;
}

Measured memory_bytes: 3988
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define INF 10000000
#define MOD 1000000007
#define MID (l+r)/2
#define HASHMOD 2305843009213693951
#define ll long long
#define ull unsigned long long
#define F first
#define S second
typedef pair<ll, ll> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef map<int, int> mii;

#define EPS 1e-6

#define T double
typedef complex<T> pt;
#define x real()
#define y imag()
T dot(pt v, pt w) {return (conj(v)*w).x;}
T cross(pt v, pt w) {return (conj(v)*w).y;}
T orient(pt a, pt b, pt c) {return cross(b-a,c-a);}
T dist(pt a, pt b) {return abs(a-b);}

int main(){
	int n;
	cin>>n;
	int a[n], b[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++) cin>>b[i];
	int prea[n+1] = {};
	int preb[n+1] = {};
	prea[0] = 0;
	prea[n] = 0;
	for(int i=1;i<=n;i++) prea[i] = prea[i-1] + a[i-1];
	for(int i=n-1;i>=0;i--) preb[i] = preb[i+1] + b[i];
	int ans=0;
	for(int i=1;i<=n;i++) ans=max(ans, prea[i]+preb[i-1]);
	cout<<ans<<endl;
}


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

int func(int n)
{
	if(n%100 != 0)
		return 0;
	else
		return func(n/100) + 1;
}

int main(void)
{
	int D, N;
	cin >> D >> N;

	int cnt = 0;
	for(int i=1; ; i++){
		if(func(i) == D)
			cnt++;

		if(cnt == N){
			cout << i << endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <utility>
#include <string>
#include <iostream>
using namespace std;

// Declaration of playing card structure
typedef struct{
    char mark;
    int number;
}CARD;

// Bubblesort
int Bubblesort(CARD* temp, int size){

    int swaps = 0;

    for(int i = 0; i < size; i++){
        for(int j = size-1; j > i; j--){
            if(temp[j].number < temp[j-1].number){
                swap(temp[j], temp[j-1]);
                swaps++;
            }
       }
    }
    return swaps;
}

// Selectionsort
int SelectionSort(CARD* temp, int size){

    int swaps = 0;

    for(int i = 0; i < size; i++){
            int mini = i;
        for(int j = i; j < size; j++){
            if(temp[j].number < temp[mini].number){
                mini = j;
            }
        }
        if(i != mini){
            swap(temp[i], temp[mini]);
            swaps++;
        }
    }
    return swaps;
}

bool Compare(CARD* temp1, CARD* temp2, int n){
    bool result = true;
    
    for(int i = 0; i < n; i++){
        if(temp1[i].number == temp2[i].number &&
            temp1[i].mark == temp2[i].mark){
        }else{
            result = false;
        }
    }
    return result;
}

int main(){
    int n, ans1, ans2;
    char buf[2]; 
    bool check = true;
    
    cin >> n;
    
    CARD temp1[n];
    CARD temp2[n];

    for(int i = 0; i < n; i++){
        cin >> buf;
        temp1[i].mark = buf[0];
        temp2[i].mark = buf[0];
        temp1[i].number = buf[1] - '0';
        temp2[i].number = buf[1] - '0';
    }
   
    ans1 = Bubblesort(temp1, n);
    ans2 = SelectionSort(temp2, n);
    check = Compare(temp1, temp2, n);
    
    for(int i = 0; i < n; i++){
        cout << temp1[i].mark << temp1[i].number;
        if(i < n -1){
            printf(" ");
        }if(i == n - 1){
            printf("\n");
        }
    }
    cout << "Stable" << endl;

    for(int i = 0; i < n; i++){
        cout << temp2[i].mark << temp2[i].number;
        if(i < n -1){
            printf(" ");
        }if(i == n - 1){
            printf("\n");
        }
    }
    
    if(check == true){
        cout << "Stable" << endl;
    }else{
        cout << "Not stable" << endl;
    }
    
    return 0;
}



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

#define rep(i, n) for(int i=0; i<n; ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
#define ll long long int

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

    int sum=0;
    rep(i, n) sum+=a[i];
    sort(a.rbegin(), a.rend());
    bool ok=true;
    rep(i, m) if(a[i]*4*m < sum) ok=false;

    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int main(void){
    int N, K, Q, A, count=0;
    cin >> N >> K >> Q;
    vector<int> V(N, K);
    cin.ignore();
    for (int i = 0; i < Q; i++){
        scanf("%d", &A);
        V[A-1] += 1;
        count += 1;
    }

    for (int i = 0; i < N; i++){
        if (V[i] > count) printf("Yes\n");
        else printf("No\n");
    }
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
#include<string.h>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int main() {
	int t[5];
	for (int i = 0; i < 5; i++) {
		cin >> t[i];
	}
	int ans = 1e9;
	int count = 0;
	for (int i = 0; i < 5; i++) {
		for (int j = 0; j < 5; j++) {
			if (i == j) {
				continue;
			}
			for (int k = 0; k < 5; k++) {
				if (i == k || j == k) {
					continue;
				}
				for (int l = 0; l < 5; l++) {
					if (i == l || j == l || k == l) {
						continue;
					}
					int index[] = { i,j,k,l,10 - i - j - k - l };
					for (int s = 0; s < 4; s++) {
						count += t[index[s]];
						if (count % 10 != 0) {
							count += 10 - count % 10;
						}
					}
					count += t[index[4]];
					ans = min(ans, count);
					count = 0;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(int, char**) {
  int64_t K;
  int64_t N;
  std::cin >> K >> N;
  std::vector<int64_t> A(N);
  for (int i = 0; i < N; ++i) {
    std::cin >> A.at(i);
  }
  // 隣り合っているものの中で、距離が一番離れてる家の組み合わせ
  int64_t distance = -1;
  // int64_t left_house_num;
  for (int i = 0; i < N; ++i) {
    int64_t distance_temp;
    if (i == N - 1) {
      distance_temp = K - (A.at(i) - A.at(0));
    } else {
      distance_temp = A.at(i + 1) - A.at(i);
    }
    if (distance < distance_temp) {
      distance = distance_temp;
      // left_house_num = i;
    }
  }
  std::cout << K - distance << std::endl;
}


Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;

const int N = 10005;
const int D = 101;
const int mod = 1e9 + 7;

int dp[N][D][3];
int d;
int lim;
string k;

inline int add(int a, int b, int mod) {
  return (a % mod + b % mod) % mod;
}

inline int add(int a, int b) {
  a += b;
  if(a >= mod) a -= mod;
  if(a < 0) a += mod;
  return a;
}

inline int rec(int cur, int sum, int is_eq){
  if(cur == lim) {
    if(is_eq == 2 && !sum) return -1;
    else return 0;
  }
  int& csi = dp[cur][sum][is_eq];
  if(csi != -1) return csi;
  csi = 0;
  int x = k[cur] - '0';
  for(int i = 0; i <= 9; ++i) {
    int sx = add(sum, i, d);
    int send = is_eq;
    if(((is_eq == 1) && i > x) || (is_eq == 2)) send = 2;
    else if((is_eq == 1) && (i == x)) send = 1;
    else send = 0;
    csi = add(csi, add(rec(cur + 1, sx, send), (sx == 0)));
  }
  return csi;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  memset(dp, -1, sizeof dp);
  cin >> k;
  cin >> d;
  int ans = 0;
  lim = k.size();
  int x = k[0] - '0';
  int sx;
  for(int i = 1; i < x; ++i) {
    sx = i % d;
    ans = add(ans, add(rec(1, sx, 0), (sx == 0)));
  }
  sx = x % d;
  ans = add(ans, add(rec(1, sx, 1), (sx == 0)));
  for(int i = x + 1; i <= 9; ++i) {
    sx = i % d;
    ans = add(ans, add(rec(1, sx, 2), (sx == 0)));
  }
  cout << ans << "\n";
}

Measured memory_bytes: 12544
N = int(input())
A = [int(input()) for _ in range(N)]

sort_A = list(set(A))
A_max = sort_A[-1]
n_A_max = A.count(A_max)

if n_A_max == 1:
    A_second_max = sort_A[-2]

if n_A_max >= 2:
    for idx in range(N):
        print(A_max)
else:
    for idx in range(N):
        print(A_second_max if A[idx] == A_max else A_max)

Measured memory_bytes: 17188
class Main {
	public static void main(String[] a) {
		for (int x = 1; x < 10; x++) {
			for (int y = 1; y < 10; y++) {
				String str_x = Integer.toString(x);
				String str_y = Integer.toString(y);
				System.out.println(str_x + 'x' + str_y + '=' + x * y);
			}
		}
	}
}

Measured memory_bytes: 16860
#pragma comment(linker, "/stack:200000000")
        #pragma GCC optimize ("Ofast")
        #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
        #include <iostream>
        #include <iomanip>
        #include <sstream>
        #include <cstring>
        #include <vector>
        #include <deque>
        #include <queue>
        #include <set>
        #include <map>
        #include <valarray>
        #include <iterator>
        #include <functional>
        #include <limits>
        #include <algorithm>
        #include <numeric>
        #include <cmath>
        #include <cassert>
        #include <unordered_map>
        #include <unordered_set>
        #include <stack>
        using namespace std;
        #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
         #define trace(x) cerr << #x << ": " << x << " " << endl;
     
        typedef int64_t ll;
     
        #define endl '\n'
        #define int ll
        ll mod=1e9+7;
        ll mod1=1e9+5;
        ll power(ll a,ll b)
        {
            if(b==0) return 1;
            else if(b%2==0)
                return power((((a%mod)*(a%mod))%mod),b/2)%mod;
            else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
        }
        int a[301][301];
        int c=0;
        int n,m;
        int init[501][501];

     int32_t main()
        {
        IOS
      

            int n;
            cin>>n;
            int a[n];
            int sum=0;
            for(int i=0;i<n;++i)
                cin>>a[i],sum+=a[i];
            int k=0;
            int ans=1e18;
            for(int i=0;i<n-1;++i)
            {
                k+=a[i];
                ans=min(ans,abs(sum-k-k));
            }
            cout<<ans;

        }

Measured memory_bytes: 1792
import std.stdio;
import std.conv;
import std.regex;
import std.array;



void main() {
    string[] input; 
    string output;
    int[] apple, peach;

    input = readln.split(regex(" "));

    foreach (i; 0..input.length) {
        if (input[i].match(regex("apple"))) apple ~= i.to!int;
        if (input[i].match(regex("peach"))) peach ~= i.to!int;
    }
    foreach (i; apple) input[i] = input[i].replace("apple", "peach");
    foreach (i; peach) input[i] = input[i].replace("peach", "apple");

    output = input.join(" ");
    write(output);
}

Measured memory_bytes: 1408
#include<stdio.h>
int dp[50];
int fib(int n){
     if(n==0||n==1) return dp[n] = 1;
     if(dp[n]!=-1) return dp[n];
     return dp[n] = fib(n-1) + fib(n-2);
}
int main(){
     int n, i;
     for(i=0;i<50;i++) dp[i] = -1;
     scanf("%d", &n);
     printf("%d\n", fib(n));
     return 0;
}

Measured memory_bytes: 596
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
    string s;
    cin >> s;
    string t;
    for(int i =0; i < s.size(); i++){
        if(i % 2 == 0) t.push_back(s[i]);
    }
    cout << t << endl;
}


Measured memory_bytes: 3612
#include <iostream>

using namespace std;

int main(){
	int N;
	while(cin >> N){
		int cnt = 0;
		for(int i=0;i<N;i++){
			int A; cin >> A;
			cnt += A%2;
		}
		cout << (cnt%2 ? "NO" : "YES") << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
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 (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;

void solve()
{
	ll a,b,n;
	cin>>a>>b>>n;
	ll ans=0;
	if(b-1<=n){
		ans=(b-1)*a/b-(b-1)/b*a;
	}else{
		ans=n*a/b-n/b*a;
	}
	cout<<ans<<endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}


Measured memory_bytes: 3608
/**
    @Author:Monk78
    @Topic:D_Knapsack01
**/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll>Vl;
typedef pair<ll,ll>PII;
typedef vector<PII>Vll;
typedef vector<pair<ll,pair<ll,ll> > >Vlll;
typedef priority_queue<ll>PQL;
typedef map<ll,ll>MP;
#define S second;
#define F first;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end));i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define mod 1000000009
#define MAX 100005
#define f(i,a,b) for(int i=(a);i<(b);i++)
#define rf(i,a,b) for(int i=(a);i>=b;i--)
#define sl(n) scanf("%lld",&n)
#define pl(n) printf("%lld",n)
#define vpshVar() int main()
ll dp[101][100005];
ll fxn(ll W,ll wt[],ll value[],ll N){
    if(N==0 || W==0)return 0;
    if(dp[N][W]!=-1)return dp[N][W];
    if(wt[N-1]>W)return dp[N][W]=fxn(W,wt,value,N-1);
    else return dp[N][W]=max(value[N-1]+fxn(W-wt[N-1],wt,value,N-1),
                    fxn(W,wt,value,N-1));

}
vpshVar(){
    ms(dp,-1);
    ll N,W;
    sl(N);sl(W);
    ll wt[N];
    ll value[N];
    for(ll i=0;i<N;i++){
        sl(wt[i]);sl(value[i]);
    }
    ll val=fxn(W,wt,value,N);
    pl(val);

return 0;
}


Measured memory_bytes: 79104
// 優先度付きキュー
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

#define MAX_H 2000000
// 無効な値の定義
const int INV = -1;

int parent(int i);
int leftNode(int i);
int rightNode(int i);

void buildPriorityQueue(int queue[], int size, int addElement);
int MaxPriorityQueue(int queue[], int size);
void maxHeapify(int heap[], int size, int top);

int main(void)
{
    char order[10];
    int size = 0, number;
    int priorityQueue[MAX_H];

    for(int i = 0; i < MAX_H; i++)
    {
        priorityQueue[i] = INV;
    }

    while( 1 )
    {
        cin >> order;

        if( strncmp("insert", &order[0] , 6) == 0 )
        {
            cin >> number;
            // キューを構築する
            buildPriorityQueue(&priorityQueue[0], size, number);
            size++;
        }
        else if( strncmp("extract", &order[0] , 7) == 0 )
        {
            // 最大値を返して, キューを再構築する
            cout << MaxPriorityQueue(&priorityQueue[0], size) << endl;
            size--;
        }
        else
        {
            // end が来た時
            break;
        }
    }

    return 0;
}

// 節点の親のNo.を返す関数
int parent(int i)
{
    return i / 2;
}

// 節点の左の子のNo.を返す関数
int leftNode(int i)
{
    return 2 * i;
}

// 節点の右の子のNo.を返す関数
int rightNode(int i)
{
    return ( 2 * i ) + 1;
}

// 優先度付きキューを構築する関数
void buildPriorityQueue(int queue[], int lastNo, int addElement)
{
    bool cmpFlag = true;
    int parentNo;

    if( lastNo == 0 )
    {
        queue[1] = addElement;

        return;
    }

    // [キューの最後尾 + 1]に要素を追加して, 上に上がっていく
    lastNo++;
    queue[lastNo] = addElement;

    while( cmpFlag == true )
    {
        cmpFlag = false;

        parentNo = parent(lastNo);

        if( parentNo <= 0 )
        {
            // ルートの要素まで来たら, 処理は終了
            break;
        }

        if( queue[lastNo] > queue[parentNo] )
        {
            // 親の値よりも大きければ交換する
            swap(queue[lastNo], queue[parentNo]);
            lastNo = parentNo;

            cmpFlag = true;
        }
    }

    return;
}

// 最大値を返して, 優先度付きキューを再構築する関数
int MaxPriorityQueue(int queue[], int lastNo)
{

    int max = queue[1];

    if( lastNo < 0 )
    {
        // 要素が存在しない時は, 無効値を返す
        return INV;
    }

    // 最後の要素を先頭に持ってくる
    queue[1] = queue[lastNo];
    queue[lastNo] = INV;

    // キューを再構成する
    maxHeapify(&queue[0], lastNo, 1);

    return max;
}

// 節点 node を根とする部分木が max-ヒープになるように A[i] の値を
// max-ヒープの葉へ向かって下降させる関数
// heap[] : ヒープの値を保持する配列
// size : ヒープサイズ
// top : maxヒープの頂点
void maxHeapify(int heap[], int size, int top)
{
    int largest = top;
    int left = leftNode(top);
    int right = rightNode(top);

    // 部分木の中の最大値を検索する
    if( left <= size && heap[left] > heap[top] )
    {
        largest = left;
    }

    if( right <= size && heap[right] > heap[largest] )
    {
        // [top] or [left] の要素と比較する
        largest = right;
    }

    if( largest != top )
    {
        // 新しい最大値が見つかったら, 値を交換する
        swap(heap[top], heap[largest]);
        // 再帰的にCallする
        maxHeapify(&heap[0], size, largest);
    }

    return;
}



Measured memory_bytes: 10884
N = int(input())
A = input()
B = input()
C = input()


def cal_chenge_num(a, b, c):
    if a==b:
        if a==c:
            return 0
        else:
            return 1
    else:
        if a==c or b==c:
            return 1
        else:
            return 2

num = 0
for i in range(N):
    num += cal_chenge_num(A[i], B[i], C[i])
print(num)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int lal=b-a;
	int flag=lal%2;
	if(flag==1) cout<<"Borys"<<endl;
	else cout<<"Alice"<<endl;
	return 0;
}

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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    int na = a, nb = b, nc = c;
    int cnt = 0;
    if (a == b && b == c && a % 2 == 0)
    {
        cout << -1 << endl;
        return 0;
    }
    while (na % 2 == 0 && nb % 2 == 0 && nc % 2 == 0)
    {
        a = na / 2;
        b = nb / 2;
        c = nc / 2;
        na = b + c;
        nb = a + c;
        nc = a + b;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
from heapq import heappush, heappop
from collections import deque
import re
import math
import functools

def sRaw():
    return input().rstrip("\r")

def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29


def make1d_arr(n, val=INF):
    return [val for i in range(n)]


def make2d_arr(h, w, val=INF):
    return [[val for i in range(w)]for i in range(h)]


def gcd(a, b):
    if(b == 0):
        return a
    return gcd(b, a % b)


def BFord(n,es):
    v_cost = [INF]*n
    v_cost[0] = 0
    for v in range(n*2):
        for e in es:
            frm = e[0]
            to = e[1]
            if v_cost[to] > v_cost[frm]+e[2]:
                v_cost[to] = v_cost[frm]+e[2]
                if v >= n:
                    v_cost[to] = -INF
        if v == n-1:
            prev = v_cost[:]
    v_cost = [-INF if prev[idx]!=v_cost[idx] else v_cost[idx] for idx in range(n)]
    return v_cost
    
def ZAlgo(s):
    l = len(s)
    A = [0]*l
    i =1
    j =0
    A[0]=l
    while i<l:
        while i+j<l and s[j] == s[i+j]:
            j+=1
        if j==0:
            i+=1
            continue
        A[i]=j
        k=1
        while (i+k<l) and (k+A[k]<j):
            A[i+k] =A[k]
            k+=1
        i+=k
        j-=k
    return A


DIV = 998244353

def main():
    N = iRaw()
    Ds = isRaw()
    if Ds[0]!=0:
        return 0
    has_n = [0]*(N+1)
    has_n[0] = 1
    Ds = Ds[1:]
    Ds.sort()
    ans = 1
    for d in Ds:
        if d == 0:
            return 0
        else:
            if has_n[d-1]==0:
                return 0
            else:
                has_n[d]+=1
                ans = (ans*has_n[d-1])%DIV
    return ans


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 55148
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//CODE
void solve(void)
{
  int A,B;
  cin>>A>>B;
  int ANS =INF;
  for (int i = 0; i < 10e6; i++)
  {
    if(i*8/100 == A && i*10/100 ==B)
    {
          chmin(ANS,i);
    }
  }
  if(ANS == INF) ANS = -1;
  cout<<ANS<<endl;
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 384
#include<algorithm>
#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>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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

int main()
{
    const int MAX_A = 1000000;
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N;
    cin >> N;

    map<int, int> m;

    rep(i, N)
    {
        int a;
        cin >> a;
        m[a]++;
    }

    vb flg(MAX_A + 1, true);

    for (auto x : m)
    {
        if (!flg[x.first]) continue;

        if (x.second > 1) flg[x.first] = false;

        for (int i = 2 * x.first; i <= MAX_A; i += x.first) flg[i] = false;
    }

    int ans = 0;
    for (auto x : m)
    {
        if (flg[x.first])ans++;
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
  int n;
  cin>>n;
  
  vector<int> arr;
  arr.push_back(0);
  int x;
  
  for(int i =0;i<n;i++){
    cin>>x;
    arr.push_back(x);
  }
  arr.push_back(0);
  
  int sum = 0;
  for(int i =1;i<=n+1;i++){
    sum = sum + abs(arr[i]- arr[i-1]);
  }
  
  for(int i =1;i<=n;i++)
  {
    cout<< sum - abs(arr[i] - arr[i-1]) - abs(arr[i] - arr[i+1]) + abs(arr[i-1] - arr[i+1]) <<"\n";
  }
  return 0;
}

Measured memory_bytes: 1784
Mod = 998244353
def powmod(b,r,mod)
  a = 1
  while r > 0
    if r%2 == 1
      a = a * b % mod
    end
    b = b * b % mod
    r /= 2
  end
  a
end

N,A,B,K = gets.split.map(&:to_i)
$fact = [1]
$finv = [1]
(1..N).each{ |k|
  $fact << ($fact[-1] * k) % Mod
  $finv << powmod($fact[-1], Mod-2, Mod)
}

def comb(n,k)
  return 0 if n-k < 0
  $fact[n]*$finv[k]%Mod*$finv[n-k]%Mod
end

ans = 0

(0..[K/A,N].min).each{ |k|
  next if (K - A*k)%B > 0
  j = (K - A*k)/B
  ans = (ans + comb(N,k) * comb(N,j)) % Mod
}
p ans


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

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> ac(n), wa(n);

  for (int i = 0; i < m; i++) {
    int p;
    string s;
    cin >> p >> s;
    p--;
    if (ac.at(p) != 0) continue;
    if (s == "WA") {
      wa.at(p)++;
    } else {
      ac.at(p)++;
    }
  }

  int ac_cnt = 0;
  int wa_cnt = 0;

  for (int i = 0; i < n; i++) {
    ac_cnt += ac.at(i);
    if (ac.at(i) > 0) {
      wa_cnt += wa.at(i);
    }
  }
  cout << ac_cnt << ' ' << wa_cnt << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
 
int main(void)
{
  int max = 1,cnt,i,j,num,nums[100];
  int tmp;
  
  scanf("%d",&num);
  
  for(i=1;i<=num;i++)
  {
    cnt = 0;
    tmp = i;
    while(tmp % 2 == 0)
    {
      cnt++;
      tmp /= 2;
    }
    nums[i] = cnt;
  }
  
  for(i=1;i<=num;i++){
    if(nums[i] >= nums[max])
    {
      max = i;
    }
  }
  
  printf("%d\n",max);
  return 0;
}

Measured memory_bytes: 128
/*
https://atcoder.jp/contests/dp/tasks/dp_n
*/
#include <bits/stdc++.h>
using namespace std;
long long dp[401][401];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  long long a[401] = {0};
  for(int i=1;i<=n;i++) {
    cin >> a[i];
    a[i] += a[i-1];
  }
  memset(dp,0x7f,sizeof dp[0][0] * 401 * 401);
  // for(int i=0;i<n;i++) {
  //   for(int j=0;j<n;j++) {
  //     cerr << dp[i][j] << ' ';
  //   }
  //   cerr << '\n';
  // }
  for(int l=0;l<n;l++) {
    for(int i=0;i<n;i++) {
      if (l==0) dp[i][i] = 0;
      int limit = min(n-1,i+l);
      for(int j=i;j<limit;j++) {
        dp[i][limit] = min(dp[i][limit],dp[i][j] + dp[j+1][limit] + a[limit+1] - a[i]);
      }
    }
  }
  cout << dp[0][n-1] << '\n';
  return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

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

  vector<pair<int, int>> a(n);

  for (int i = 0; i < n; i++){
    cin >> x;
    cin >> y;

    a[i] = make_pair(x,y);
    //cout << a.first << " " << a.second << endl;
  }

  sort(a.begin(), a.end());

  for (int i = 0; i < n; i++) {
    printf("%d %d\n", a[i].first, a[i].second);
  }

  return 0;
}



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

template<typename T> class Dijkstra {
  struct edge {
    int to; T cost;
  };
  int N;
  vector<vector<edge>> G;
public:
  vector<T> D;
  Dijkstra(int n) : N(n), G(n), D(n, numeric_limits<T>::max()) {}
  void add(int from, int to, T cost) {
    G.at(from).push_back((edge) {to, cost});
  }
  using pit = pair<int, T>;
  void solve(int start) {
    priority_queue<pit, vector<pit>, greater<pit>> Q;
    D.at(start) = 0;
    Q.push(pit(start, 0));
    while (Q.size()) {
      auto [now, dist] = Q.top();
      Q.pop();
      for (auto [next, cost] : G.at(now)) {
        if (dist + cost < D.at(next)) {
          D.at(next) = dist + cost;
          Q.push(pit(next, D.at(next)));
        }
      }
    }
  }
};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int H, W, sh, sw, gh, gw;
  cin >> H >> W >> sh >> sw >> gh >> gw;
  sh--, sw--, gh--, gw--;
  int st = 0, go = 0;
  vector<vector<pair<int, char>>> S(H, vector<pair<int, char>>(W));
  for (int i = 0, id = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      char c;
      cin >> c;
      if (i == sh && j == sw) st = id;
      if (i == gh && j == gw) go = id;
      S.at(i).at(j) = {id++, c};
    }
  }
  
  vector<int> mh(4), mw(4);
  mh = {-1, 0, 1, 0};
  mw = {0, 1, 0, -1};

  Dijkstra<long> D(H * W);
  for (int h = 0; h < H; h++) {
    for (int w = 0; w < W; w++) {
      for (int i = h - 2; i <= h + 2; i++) {
        for (int j = w - 2; j <= w + 2; j++) {
          if (i < 0 || i >= H || j < 0 || j >= W) continue;
          if (S.at(i).at(j).second == '.') D.add(S.at(h).at(w).first, S.at(i).at(j).first, 1);
        }
      }
      for (int i = 0; i < 4; i++) {
        int nh = h + mh.at(i);
        int nw = w + mw.at(i);
        if (nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
        if (S.at(nh).at(nw).second == '.') D.add(S.at(h).at(w).first, S.at(nh).at(nw).first, 0);
      }
    }
  }

  D.solve(st);

  if (D.D.at(go) == LONG_MAX) return cout << -1 << "\n", 0;
  cout << D.D.at(go) << "\n";
}


Measured memory_bytes: 368652
#include <bits/stdc++.h>
using namespace std;
long long fac[2010], inv[2010], finv[2010]; 
long long MOD = 924844033; 
void COMinit(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < 2005; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
	int N, K; cin >> N >> K; 
	COMinit(); 
	int a = 2 * (N % K); int L1 = N / K; // 長さL1+1の鎖がa本
	int b = 2 * (K - N % K); int L2 = L1 - 1; // 長さL2+1の鎖がb本
	int C1[2010] = {}, C2[2010] = {}; 
	for(int i = 0; i <= L1; i++) C1[i] = COM(L1 - i + 1, i); 
	for(int i = 0; i <= L2; i++) C2[i] = COM(L2 - i + 1, i);
	long long dp[4010][2010] = {}; 
	dp[0][0] = 1; 
	for(int i = 0; i < a; i++){
		for(int j = 0; j <= N; j++){
			if(dp[i][j] == 0) break; 
			for(int k = 0; k * 2 <= L1 + 1; k++){
				dp[i+1][j+k] += dp[i][j] * C1[k]; 
				dp[i+1][j+k] %= MOD; 
			}
		}
	}
	for(int i = a; i < a + b; i++){
		for(int j = 0; j <= N; j++){
			if(dp[i][j] == 0) break; 
			for(int k = 0; k * 2 <= L2 + 1; k++){
				dp[i+1][j+k] += dp[i][j] * C2[k]; 
				dp[i+1][j+k] %= MOD; 
			}
		}
	}
	long long ans = 0; 
	for(int i = 0; i <= N; i++){
		long long tmp = dp[a+b][i] * fac[N-i] % MOD; 
		if(i % 2) ans += MOD - tmp; 
		else ans += tmp; 
		ans %= MOD; 
	}
	cout << ans << endl; 
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////

ll A, B, N;
ll i, j, k;



int main(){
    scanf("%lld%lld%lld", &A, &B, &N);
    if(B<=N){
        ll a = A * (B - 1) / B;
        ll b = A * ((B - 1) / B);
        printf("%lld\n", a - b);
    }else{
        ll a = A * N / B;
        ll b = A * (N / B);
        printf("%lld\n", a - b);
    }
    return 0;
}

Measured memory_bytes: 3756
#include <stdio.h>
int main()
{
  char b;
  scanf("%c",&b);

  if(b == 'A')
    printf("T\n");
  else if(b == 'T')
    printf("A\n");
  else if(b == 'C')
    printf("G\n");
  else if(b == 'G')
    printf("C\n");

  return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main{
  
  public static void main (String[] args){
  
  	Scanner scanner = new Scanner (System.in);
  
    int a = scanner.nextInt();
    int b = scanner.nextInt();
    
    int product = a*b;
    
    if (product%2 == 1){
      System.out.println("Odd");
    } else {
      System.out.println("Even");
    }
  }
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define lep(j,n) for(int j=0; j<(n); j++)
#define reps(i,n) for(int i=1; i<(n); i++)
#define leps(j,n) for(int j=1; j<(n); j++)
#define pii pair<int,int>
#define gsort(x,n) sort((x),(x)+(n),greater<int>())
#define all(x) (x).begin(), (x).end()
#define int long long
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const long long mod = 1000000007;
using namespace std;

#define return(Z) re:(Z)

long long h[10000010],x[10000010],z[10000010];

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

  int x,a,b;
  cin>>x>>a>>b;

  a=a-x;
  b=b-x;
  if(llabs(a)<llabs(b)) cout<<"A"<<'\n';
  else cout<<"B"<<'\n';
}


Measured memory_bytes: 764
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> P(N);
  for(int i = 0;i<N;i++){
      cin >> P.at(i);
  }
  int count =0;
  int s = P.at(0);
      for(int i = 0; i<N;i++){
          if(s>=P.at(i)){
              s = P.at(i);
              count++;
          }
      }
      cout << count << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(a) a, a+sizeof(a)/sizeof(a[0])
using namespace std;
ll gcd(ll n, ll m) {
	if (m == 0) return n;
	return gcd(m, n % m);
}

ll lcm(ll n, ll m) {
	return m / gcd(n, m) * n;
}

int main(void) {
	int f;
	cin >> f;
	cout << (f-30)/2 << endl;
	return 0;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)

int main()
{
    int a, b;
    cin >> a >> b;
    char as = (char)(a+'0'), bs = (char)(b+'0');
    string A, B;
    for(int i = 0; i < b; ++i) A += as;
    for(int i = 0; i < a; ++i) B += bs;
    if(A < B) cout << A << endl;
    else cout << B << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
ls = list()
for _ in range(n):
    a = int(input())
    ls.append([list(map(int, input().split())) for _ in range(a)])


ans =0
for i in range(2**n):
    flag = True
    for j in range(n):
        if (1<<j) & i:
            for k in ls[j]:
                if bool(((1<<(k[0]-1)) & i)) != bool(k[1]):
                    flag = False

    if flag:
        count = 0
        for j in range(n):
            if (1<<j) & i:
                count += 1
        ans = max(ans, count)

print(ans)


Measured memory_bytes: 44524
//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
 
const int mod = 1e9 + 7;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    vector<pair<int, int>> points(n);
    set<pair<int, int>> s;
    for (auto& p : points) {
        cin >> p.first >> p.second;
        s.insert({ p.first, p.second });
    }
    int ans = n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) {
                continue;
            }
            int cnt = 0;
            for (int k = 0; k < n; k++) {
                if (s.find(make_pair(points[k].first + points[j].first - points[i].first,
                points[k].second + points[j].second - points[i].second)) == s.end()) {
                    cnt++;
                }
            }
            ans = min(ans, cnt);
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/abc138/tasks/abc138_e
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-1.in"); //input.txt
    std::cin.rdbuf(in.rdbuf());
#endif
    string s,t; cin>>s>>t;    
    string ss=s+s; //sを連結
    unordered_map<char,vector<ll>> chpos_tbl; //a-z
    REP(i,ss.size()){ //連結したやつで
        chpos_tbl[ss[i]].push_back(i);
    }

    ll ans=0;
    ll idx=-1;
    ll multip=0;
    for(auto c:t){
        auto it = chpos_tbl.find(c);
        if(it == chpos_tbl.end()){
            cout<<-1<<endl;
            return 0;
        }
        auto nx = upper_bound(it->second.begin(), it->second.end(), idx);
        ans = multip*s.size() + *nx + 1;
        idx = *nx;
        if (*nx >= s.size()) {
            ++multip;
            idx -= s.size();
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3000
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

//constexpr int inf = 2147483647;
//constexpr int64_t inf64 = 9223372036854775807;
//constexpr int mod = 1e9+7;

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

  string s;
  cin >> s;

  cout << s.substr(0,3) << endl;
  return 0;
}

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

using namespace std;

int main()
{
	string s, c, str;
	int n, l, r;
	
	cin >> s >> n;
	
	map<int, char> m;
	stack<char> st;
	
	for(int i = 0; i < s.size(); m[i]=s[i], i++);
			
	for(int i = 0; i < n; i++)
	{
		cin >> c;
		
		if(c == "replace")
		{
			cin >> l >> r >> str;
			
			for(int j = l, k = 0; j <= r; m[j]=str[k], j++, k++);
		}
		else if(c == "reverse")
		{
			cin >> l >> r;
			
			for(int j = l; j <= r; st.push(m[j]), j++);
			for(int j = l; j <= r; m[j]=st.top(), st.pop(), j++);
		}
		else
		{
			cin >> l >> r;
			
			for(int j = l; j <= r; j++)
				cout << m[j];
			cout << "\n";
		}		
	}
	
	return 0;
}


Measured memory_bytes: 3260
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?(c=getchar()):0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T>inline T cabs(T x){
	return x>=0?x:-x;
}
const int N=500010;
int mv[N],pos[N];
bool ans[N];
struct intv{
	int l,r;
	inline friend bool operator < (const intv &a,const intv &b){
		return a.l!=b.l?a.l<b.l:a.r<b.r;
	}
};
vector<intv>vec,tmp;
inline void psh(int l,int r){
	if(l<0){
		l=0;
	}
	if(r>pos[0]){
		r=pos[0];
	}
	if(l<=r){
		tmp.push_back((intv){l,r});
	}
}
inline void work(){
	vec.clear();
	sort(tmp.begin(),tmp.end());
	for(int i=0,j=0,n=tmp.size();i<n;i=j){
		int l=tmp[i].l,r=tmp[i].r;
		for(;j<n&&tmp[j].l<=r+1;j++){
			if(tmp[j].r>r){
				r=tmp[j].r;
			}
		}
		vec.push_back((intv){l,r});
	}
}
int main(){
	int n=ni;
	pos[0]=ni;
	for(int i=1;i<=n;i++){
		mv[i]=ni;
		pos[i]=min(pos[i-1],cabs(pos[i-1]-mv[i]));
	}
	if(pos[n]){
		for(int tot=ni;tot--;puts("YES"));
		return 0;
	}
	memset(ans,0,sizeof(ans));
	vec.push_back((intv){0,0});
	for(int i=n;i>=1;i--){
		ans[i]=pos[i-1]>vec[0].r;
		tmp.clear();
		for(int j=0;j<(int)vec.size();j++){
			int l=vec[j].l,r=vec[j].r;
			psh(l,min(mv[i]>>1,r));
			psh(max((mv[i]+1)>>1,mv[i]-r),mv[i]-l);
			psh(max((mv[i]+1)>>1,mv[i]+l),mv[i]+r);
		}
		work();
	}
	for(int tot=ni;tot--;puts(ans[ni]?"YES":"NO"));
	return 0;
}

Measured memory_bytes: 6400
a,b=map(int,input().split())
a=min(1,a)
b=min(1,b)
if b==1 and a<=0:
  print('Zero')
elif b==0:
  print('Zero')
elif (b-a)%2==0 and b<0:
  print("Negative")
else:
  print("Positive")

Measured memory_bytes: 3060
import Data.List

main::IO()
main=do
  n<-getLine
  dat<-n_get (read n)
  print (solver dat)

n_get::Int->IO [Int]
n_get 0 = return []
n_get n = do
  st<-getLine
  rest<-n_get (n-1)
  return ((read st):rest)

solver::[Int]->Int
solver = length.group.sort

Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,s,t) for(ll i=s ; i*i<=t ; i++)
typedef long long ll;
typedef pair<ll,ll> P;
const int max_n = 1e5;
const ll mod = 1e9+7;
map<ll,ll> prime_factor(ll n){
  map<ll,ll> ma;
  rep(i,2,n+1){
    while(n%i == 0){
      ma[i]++;
      n /= i;
    }
  }
  if(n != 1) ma[n]=1;
  return ma;
}
int main(){
  ll a,b; cin >> a >> b;
  map<ll,ll> ma1 = prime_factor(a);
  map<ll,ll> ma2 = prime_factor(b);

  ll cnt = 1;
  for(auto ite=begin(ma1);ite!=end(ma1);ite++){
    if(ma2.count(ite->fi))cnt++;
  }
  cout << cnt << endl;
  return 0;

}


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

const long long INF = 1LL << 60;

long long dp[1005][10005];

int main(){
    int H, N;
    cin >> H >> N;

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

    //init
    for(int i=0; i<N; ++i){
        for(int j=0; j<H; ++j){
            dp[i][j] = INF;
        }
    }

    //first line
    for(int j=0; j<H; ++j){
        int life = j +1;
        int cnt = (life+A[0]-1)/A[0];
        dp[0][j] = cnt * B[0];
    }

    //from second line
    for(int i=1; i<N; ++i){
        for(int j=0; j<H; ++j){
            dp[i][j] = min(dp[i][j], dp[i-1][j]);
        }

        for(int j=0; j<H; ++j){
            int life = j+1;
            if(life <= A[i]){
                int cnt = (life+A[i]-1)/A[i];
                dp[i][j] = min(cnt * B[i], dp[i-1][j]);
            }

            if(life + A[i] <= H){
                
                dp[i][j + A[i]] = min( dp[i][j + A[i]], dp[i][j] + B[i] );
            }
        }
    }

    cout << dp[N-1][H-1] << endl;
}

Measured memory_bytes: 81704
#include<bits/stdc++.h>
using namespace std;
#define LL long long

int main(){
	// sengen
	int n,x,y;
	// nyuryoku
	cin >> n >> x >> y;
	map<int,int> ans;
	// keisan
	for(int i=1;i<=n-1;i++){
		for(int j=i+1;j<=n;j++){
			int dmin;
			dmin = min(abs(j-i),abs(x-i)+abs(y-j)+1);
			ans[dmin]++;
		}
	}
	// syutsuryoku
	for(int i=1;i<n;i++){
		cout << ans[i] << endl;
	}
}


Measured memory_bytes: 3728
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<cmath>
#include<bitset>
#include<map>
#include<vector>
#define ll long long
#define mkp make_pair
#define x first
#define y second
#define pli pair<ll,int>
using namespace std;
int x,y;
int gcd(int x,int y){if(!y)return x;return gcd(y,x%y);}
int main(){
	scanf("%d",&x);
	y=360/gcd(360,x);
	cout<<y;
}

Measured memory_bytes: 3256
// Ver19.02
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int n;
  char a[] = "ABC";
  scanf("%d", &n);
  printf("%s%d\n", a, n);

  return 0;
}


Measured memory_bytes: 256