akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________


	int n;
	cin >> n;
	/*sieve();
	vector<int>p = getFactorization(n);
	int cnt = 0;
	int x;
	//um <int, int>mt;
	set<int>s;
	for (int i = 0; i < p.size(); i++)
	{
		s.insert(p[i]);
	}
	for (int y : s)
	{
		x = y;
		while (n % x == 0)
		{
			n = n / x;
			//cout << x << en;
			cnt++;
			x *= y;
		}
		//mt[p[i]]++;
	}
	//cout << p.size() << en;
	cout << cnt  << en;*/
	int cnt = 0;
	// Print the number of 2s that divide n
	int m = n;
	int x = 2;
	while (n % 2 == 0 )
	{
		n = n / 2;
		cnt++;
	}

	int var = 1;
	int result = 0;
	//cout << cnt << en;
	rep(i, 1, cnt)
	{
		if (((i + 1)*i / 2) > cnt)
		{
			break;
		}
		else
		{
			result++;
		}
	}
	for (int i = 3; i <= sqrt(n); i = i + 2)
	{
		//x = i;
		cnt = 0;
		//var = 1;
		// While i divides n, print i and divide n
		while (n % i == 0)
		{
			n = n / i;
			cnt++;
		}
		rep(j, 1, cnt)
		{
			if (((j + 1)*j / 2) > cnt)
			{
				break;
			}
			else
			{
				result++;
			}
		}
	}
	if (check_prime(n))
	{
		result++;
	}
	//cout << primeFactors(n, n) << en;
	cout << result << en;
	return 0;
}



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

#define pb push_back
#define mp make_pair

const int MOD = 1e9+7;
const int MAX_N=1e5+10;

string s;

void solve()
{
	if(s == "ABC") cout <<"ARC\n";
	else cout << "ABC\n";
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> s;
	solve();
	return 0;
}


Measured memory_bytes: 3584
//
//  main.cpp
//  CADDi_2018
//
//  Created by Joe Mori on 2020/06/30.
//  Copyright © 2020 Joe Mori. All rights reserved.
//

#include <iostream>
#include<vector>
#include<map>
#include<cmath>
int main() {
    long long int N,P,sub,ans;
    std::cin>>N>>P;
    ans=1;
//    std::vector<bool>is_prime(P,true);
//    is_prime[0]=is_prime[1]=false;
    sub=P;
    std::map <long long int ,long long int>yaku;
    if(N==1){
        std::cout<<P<<std::endl;
        return 0;
    }
    yaku[1]=N;
    for(long long int i=2;i*i<=P;i++){
//        std::cout<<i<<std::endl;
        while(sub%i==0){
            yaku[i]++;
            sub=sub/i;
//            std::cout<<"sub:"<<std::endl;
        }
        if(sub==1)break;
    }
    for(auto i:yaku){
        auto key=i.first;
        auto y=i.second;
        //std::cout<<"約数"<<key<<"個数"<<y<<std::endl;
        if(y>=N){
            for(int j=1;j<=y/N;j++){
                ans*=key;
            }
        }
    }
    std::cout<<ans<<std::endl;
    return 0;
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
const int MAXN=100010;
int h[MAXN],f[MAXN];
 
int main(){
	int n;scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&h[i]);
	f[0]=1<<30;
	for(int i=2;i<=n;i++)
		f[i]=std::min(std::abs(h[i]-h[i-1])+f[i-1],abs(h[i]-h[i-2])+f[i-2]);
	printf("%d\n",f[n]);
}


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

char hyo[9][5];

char moji(int char_, int count);

int main(void)
{
	int i1,i2;
	char c = 'a';
	char cc;
	string s;
	int n;
	int m;
	int count;

		/* syokika */
		for(i1=0;i1<9;i1++){	
			for(i2=0;i2<5;i2++){
				hyo[i1][i2] = '1';
			}
		}


		/* hyo sakusei */
		hyo[0][0] = '.';
		hyo[0][1] = ',';
		hyo[0][2] = '!';
		hyo[0][3] = '?';
		hyo[0][4] = ' ';


		for( i1=1; i1<9; i1++){
			for(i2=0; i2<4; i2++){
				
				if(i2 == 3) {

					if( i1 == 6 || i1 == 8) {}
					else continue;
				}

				hyo[i1][i2] = c;
				c++;
			}
		}



		cin >> n;

		for(i2=0;i2<n;i2++){


			cin >> s;

			count = 0;
			m = 0;
			for(i1=0;i1<s.size();i1++){
			

				if( s[i1]=='0'){
					if(m != 0){
						cc = moji(m,count);
						count = 0;
						m = 0;
					    cout << cc;
					}
				}
				else{

					c = s[i1];
					m = c - 48;
					count++;
				}
			}

			cout << endl;


		}

	return 0;

}


char moji(int char_, int count)
{

	int n;
	count--;
	if( char_ == 1){
		n = count%5;
	}
	else if( char_ == 7 || char_ == 9){
		n = count%4;
	}
	else {
		n = count%3;
	}

	return hyo[char_-1][n];
}

Measured memory_bytes: 1196
import math

Q = int(input())

def prime(n):
	if n > 1:
		for i in range(2,math.floor(math.sqrt(n))+1):
			if (n % i) == 0:
				return(False)
				break
		else:
			return(True)
	else:
		return(False)

Numero = [0]*100001
for i in range (1, 50001):
	if prime(2*i+1) == 1 and prime(i+1) == 1:
		for j in range (2*i+1, 100001):
			Numero[j]+=1
	else:
		continue

for i in range (0, Q):
	A, B = map(int, input().split())
	print(Numero[B]-Numero[A-1])

Measured memory_bytes: 53468
def rec(i, w):
	if dp[i][w] != -1:
		return dp[i][w]

	if i == 0:
		if w == 0:
			return True
		else:
			return False

	res = 0
	if w >= a[i - 1] and rec(i - 1, w - a[i - 1]) == 1:
		res = 1
	
	if rec(i - 1, w) == 1:
		res = 1

	dp[i][w] = res
	return dp[i][w]

n = int(input())
a = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))

dp = [[-1] * (2000 + 1) for _ in range(n + 1)]

for i in range(m):
	print('yes') if rec(n, q[i]) == 1 else print('no')


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

//既存のsort関数で数字のときと同様にsortすればOK！

//使い方　昇順にソートしたいときは、23行目、
//   　　　降順にソートしたいときは、24行目をコメントアウトする

int main()
{
    ll N,t;
    // ll min = 1;
    // ll max = 100;
    ll summin = 100000000;
    ll sum = 0;
    // vector<ll> X;
    ll X[105];
    scanf("%lld", &N);
    for (int i = 1; i <= N;i++)
    {
        scanf("%lld", &t);
        X[i] = t;

    }
    // std::sort(X.begin(), X.end()); //昇順にソート

    for (int i = 1; i <=100;i++){
        for (int j =1; j <= N;j++){
            sum += (X[j] -i ) * (X[j] - i);
        }
        // cout << i <<" : " <<sum << endl;
        if(summin>sum){
            summin = sum;
        }
        sum = 0;
    }
        cout<<summin<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
  
struct dice{
           int a[6];
       };
struct dice dice1;
struct dice dice2;
  
void tate(){
            int cmp=dice2.a[0];
            dice2.a[0]=dice2.a[4];
            dice2.a[4]=dice2.a[5];
            dice2.a[5]=dice2.a[1];
            dice2.a[1]=cmp;
             }
void yoko(){
            int cmp=dice2.a[1];
            dice2.a[1]=dice2.a[2];
            dice2.a[2]=dice2.a[4];
            dice2.a[4]=dice2.a[3];
            dice2.a[3]=cmp;
             }
  
  
int main(){
    int i,j;
    for(i=0;i<6;i++){
           scanf("%d",&dice1.a[i]);
                     }
for(i=0;i<6;i++){
           scanf("%d",&dice2.a[i]);
                     }
  
for(i=0;i<5;i++){
  
              for(j=0;j<5;j++){
                              if(dice1.a[0]==dice2.a[0])break;
                               tate();
                               }
              for(j=0;j<5;j++){
                                if(dice1.a[1]==dice2.a[1])break;
                                yoko();
                                }
                  }
  
if(dice1.a[0]==dice2.a[0]&&dice1.a[1]==dice2.a[1]&&dice1.a[2]==dice2.a[2])printf("Yes\n");
else printf("No\n");
   
return 0;
}


Measured memory_bytes: 2112
import java.awt.Point;
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();
		int D = sc.nextInt();
		int[][] A = new int[H][W];
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				A[i][j] = sc.nextInt() - 1;
			}
		}
		int Q = sc.nextInt();
		int[] L = new int[Q];
		int[] R = new int[Q];
		for(int i = 0; i < Q; i++) {
			L[i] = sc.nextInt() - 1;
			R[i] = sc.nextInt() - 1;
		}
		sc.close();
		Point[] p = new Point[H * W];
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				p[A[i][j]] = new Point(j, i);
			}
		}
		int l = H * W / D + 1;
		int[][] dp = new int[D][l];
		for(int i = 0; i < D; i++) {
			for(int j = 0; j < l; j++) {
				int t = i + D * j;
				if(t + D >= H * W) break;
				Point v1 = p[t];
				Point v2 = p[t + D];
				dp[i][j + 1] = dp[i][j] + Math.abs(v1.x - v2.x) + Math.abs(v1.y - v2.y);
			}
		}
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < Q; i++) {
			int a = L[i];
			int b = R[i];
			int idx = a % D;
			int ans = dp[idx][b / D] - dp[idx][a / D];
			sb.append(ans).append("\n");
		}
		System.out.print(sb.toString());
	}
}

Measured memory_bytes: 91724
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>

using namespace std;

int main() {
    int N;
    int num = 0;
    int maxcount = -1;
    cin >> N;

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

        while (true) {
            if ((temp % 2) != 0) {
                break;
            }
            count++;
            temp /= 2;
        }
        if (maxcount < count) {
            maxcount = count;
            num = i;
        }
    }

    cout << num << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
const int mod=1e9+7;
ll dp[2][13];
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    string ss;cin>>ss;
    int t=ss.size();
    rep(i,2)rep(j,13)dp[i][j]=0;
    dp[0][0]=1;
    ll keta=1;
    for(int i=0;i<t;i++){
        if(ss[t-i-1]=='?'){
            for(int j=0;j<13;j++)for(int k=0;k<10;k++){
                dp[(i+1)&1][(k*keta+j)%13]+=dp[i&1][j];
                dp[(i+1)&1][(k*keta+j)%13]%=mod;
            }
        }
        else{
            int k=ss[t-i-1]-'0';
            for(int j=0;j<13;j++){
                dp[(i+1)&1][(k*keta+j)%13]+=dp[i&1][j];
                dp[(i+1)&1][(k*keta+j)%13]%=mod;               
            }
        }
        keta=keta*10%13;
        for(int j=0;j<13;j++)dp[i&1][j]=0;
    }
    cout<<dp[t&1][5]<<endl;
    return 0;
}


Measured memory_bytes: 512
<?php
//error_reporting(0);
//$A = explode(" ",trim(fgets(STDIN)));
//$s = trim(fgets(STDIN));
list($X,$Y) = explode(" ",trim(fgets(STDIN)));
$sum=0;
$num=$X;
while(1) {
  if ($num>$Y) break;
  $num=$num*2;
  $sum++;
}
printf("%d\n",$sum);


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

vector<string> ss;

void rec(int i, string s)
{
  if (i == s.size())
  {
    ss.push_back(s);
    return;
  }
  rec(i + 1, s);
  s.insert(s.begin() + i, '+');
  i++;
  rec(i + 1, s);
}

int main()
{
  string s;
  cin >> s;
  ss.clear();
  rec(1, s);
  long long ans = 0;
  for (int i = 0; i < ss.size(); ++i)
  {
    long long tmp = 0;
    for (int j = 0; j < ss[i].size(); ++j)
    {
      if (ss[i][j] == '+')
      {
        ans += tmp;
        tmp = 0;
      }
      else
      {
        tmp *= 10;
        tmp += ss[i][j] - '0';
      }
    }
    ans += tmp;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.C_Challenge
{
    class ABC_065
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int[] inputs = ReadInts();
            int n = inputs[0];
            int m = inputs[1];
            if (Math.Abs(n - m) > 1)
            {
                Console.WriteLine(0);
                return;
            }
            long mask = 1000000000 + 7;

            long factor1 = Permutation(n, n, mask);
            long factor2 = Permutation(m, m, mask);
            long result = (factor1 * factor2) % mask;
            if (n == m)
            {
                result *= 2;
                result %= mask;
            }
            Console.WriteLine(result);
        }

        static long Permutation(long n, long m, long mask)
        {
            long val = 1;
            for (long i = 0; i < m; i++)
            {
                val *= ((n - i) % mask);
                val %= mask;
            }
            return val;
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

const int n=110000;

int main(){
  int x;
  cin>>x;
  while(true){
    if(IsPrime(x))break;
    x++;
  }
  cout<<x<<endl;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#define debug(x...) cout << #x << " = "; _print(x)
typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
#define rep(i,a,b) for (ll i = (a); i < (b); ++i)
#define per(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL) 
const int mod = 1e9 + 7, mxn = 1e5 + 1;

vi get_factors(int n){
    vi ret;
    if(n%2 == 0)
        ret.pb(2);
    while(n%2 == 0)  
        n = n/2;  
    for(int i = 3; i <= sqrt(n); i = i + 2){
        if(n%i == 0)
            ret.pb(i);
        while(n%i == 0)  
            n = n/i;  
    }    
    if(n > 2)  
        ret.pb(n); 
    return ret;
}

bool check_pairwise(vi v){
    map<int, int> m;
    rep(i, 0, v.size()){
        vi factors = get_factors(v[i]);
        for(auto factor: factors)
            m[factor]++;
    }
    for(auto x: m)
        if(x.ss > 1)
            return false;
    return true;
}

bool check_setwise(vi v){
    int x = 0;
    rep(i, 0, v.size())
        x = __gcd(x, v[i]);
    if(x == 1)
        return true;
    return false;
}

int solve(){
    int n;
    cin>> n;
    vi v(n);
    rep(i, 0, n)
        cin>> v[i];
    bool f1 = check_pairwise(v);
    bool f2 = check_setwise(v);
    if(f1)
        cout<< "pairwise coprime\n";
    else if(f2)
        cout<< "setwise coprime\n";
    else
        cout<< "not coprime\n";
    return 0;
}
//Counting problems: Sometimes easier to find complement of the answer
 
int main()
{
    fast;
    int t = 1;
    //cin>> t;
    while(t--){  
        solve();
    }
    return 0;
}
//v.clear(), vis.clear(); vis.resize(n + 1, 0), v.resize(n + 1);
 
/*  inv[1] = 1; // inv is ll
    for(int i=2; i<=mxn; ++i)
        inv[i]=mod-mod/i*inv[mod%i]%mod;*/
        
// lower bound   >=  
// upper bound   >
// vector<int>().swap(vec); //free memory from vec


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

int main(void){
	int a[50001],i,j,x,ans;
	for(i=0;i<=50000;i++)a[i]=1;
	for(i=2;i<225;i++){
		if(a[i]==1){for(j=i*i;j<=50000;j+=i)a[j]=0;}
	}

	while(scanf("%d",&x)){
		if(x==0)break;
		ans=0;
		if(x%2==1 || x==4){if(a[x-2]==1)ans=1;}
		else {
			for(i=3;i<=x/2;i+=2){if(a[i]==1 && a[x-i]==1)ans++;}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 792
N = int(input())
t, x, y = [0] * (N + 1), [0] * (N + 1), [0] * (N + 1)
t[0], x[0], y[0] = 0, 0, 0

ans = "Yes"
for i in range(1, N + 1):
    t[i], x[i], y[i] = map(int, input().split())
    distance_xy = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1])
    distance_t = abs(t[i] - t[i - 1])
    
    # 距離がt[i]-t[i-1]以下、かつ、偶奇が一致すれば移動可能
    if (distance_t >= distance_xy) & (distance_t % 2 == distance_xy % 2):
        pass
    else:
        ans = "No"

print(ans)

Measured memory_bytes: 11636
x, y = gets.split.map &:to_i

remain = 0
diff = (x-y).abs
MOD = 10 ** 9 + 7

if x >= y then
	remain = y - (x - y)
else
	remain = x - (y - x)
end

if remain % 3 == 0 then
	ss = remain / 3
	ll = ss + (x-y).abs
	
	sum = 1
	
	(ss + 1 .. (ss+ll)).each{ |i|
		sum = sum * i % MOD
	}

	arr = (MOD-2).to_s(2).split("").reverse

	a = 1

	(1..ll).each{ |i|
		a = a * i % MOD
	}

	div = 1

	arr.each{ |i|
		if i == "1" then
			div = div * a % MOD
		end
		a = a * a % MOD
	}

	sum = sum * div % MOD

	puts sum
else
	puts 0
end

Measured memory_bytes: 1788
#include<stdio.h>

int main()
{
	int card[14];
	int c[5];
	int i,j,t;
	int pair,tri,fo,st;
	int flag=0;
	while(scanf("%d,%d,%d,%d,%d",&c[0],&c[1],&c[2],&c[3],&c[4])!=EOF){
		flag=pair=tri=fo=st=0;
		for(i=1;i<14;i++)
			card[i]=0;
		for(i=0;i<5;i++){
			card[c[i]]++;
			if(card[c[i]]==4){
				printf("four card\n");
				flag=1;
				break;
			}
			else if(card[c[i]]==3)
				tri=1;
		}
		if(flag)
			continue;
		if(tri){
			for(i=1;i<14;i++){
				if(card[i]==2)
					break;
			}
			if(card[i]==2)
				printf("full house\n");
			else
				printf("three card\n");
			continue;
		}
		for(i=1;i<14;i++){
			if(card[i]==2)
				pair++;
		}
		if(pair==2){
			printf("two pair\n");
			continue;
		}
		else if(pair==1){
			printf("one pair\n");
			continue;
		}
		for(i=1;i<10;i++){
			if(card[i]==1 &&
				card[i+1]==1 &&
				card[i+2]==1 &&
				card[i+3]==1 &&
				card[i+4]==1){
				printf("straight\n");
				st=1;
				break;
			}
		}
		if(st)
			continue;
		if(card[1]==1 &&
			card[10]==1 &&
			card[11]==1 &&
			card[12]==1 &&
			card[13]==1){
			printf("straight\n");
				st=1;
		}
		
		else
			printf("null\n");
	}
	return 0;
}
		
		

Measured memory_bytes: 580
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>

int main() {
  int A, B;
  scanf("%d %d%*c", &A, &B);
  printf("%d\n", (A + B) % 24);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
string solve(long long n)
{
	string s="";
	while(n>0){
	long long rem=n%26;
	if(rem==0){ rem=26;}
	s=(char)(96+rem)+s;
	n/=26; if(rem==26){n-=1;}
	}
	return s;
}
int main() {
    long long n;cin>>n;
    cout<<solve(n)<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<sstream>
#include<cmath>

int main(){
	long long int K,A,B;
	long long int res=1;

	std::cin >> K >> A >> B;

	if(A+1>=B){
		std::cout << K+1 << std::endl;
		return 0;
	}

	K -= (A-1);
	res += (A-1);

	while(K>=2){
		res += (B-A);
		K -= 2;
	}

	if(K == 1) res++;

	std::cout << res << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<double> v(N);
    rep(i,N) cin >> v[i];
    sort(all(v));
    double ans=v[0];
    rep(i,N-1) ans=(ans+v[i+1])/2.0;
    cout << fixed << setprecision(10);
    cout << ans << endl;
}

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


using namespace std ;
int main () {
int sum=0,a,b,c,x;
cin>>a>>b>>c>>x;
for(int i=0;i<=a;i++)
{
for(int j=0;j<=b;j++)
{
    for(int k=0;k<=c;k++)
        if(i*500+j*100+k*50==x)
       sum++;
}
}
cout<<sum<<endl;
return 0;
}



Measured memory_bytes: 256
s = list(input())
alpha = [chr(i) for i in range(97, 97+26)]

flag = True
if s[0] != "A" or (not "C" in s[2:-1]):
  flag = False
  
else:
  cin = s.index("C")
  for i in range(len(s)):
    if i == 0 or i == cin:
      continue

    if (not s[i] in alpha):
      flag = False
      break
    
print("AC" if flag else "WA")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long lint;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

// 逆からやろう
// n[^1] = 階和(n-1)

struct UnionFind {
    vector<int> v;
    vector<int> size;
    int a; // 木の数
    UnionFind(int n) {
        v.resize(n);
        size.resize(n);
        rep(i,n) {
            v[i] = i;
            size[i] = 1;
        }
        a = n;
    }

    int root(int x) {
        if (x == v[x]) return x;
        return v[x] = root(v[x]);
    }

    bool unite(int x, int y) {
        if (root(x) == root(y)) return false;
        size[root(y)] += size[root(x)]; 
        v[root(x)] = v[root(y)];
        return true;
    }

    int cnt(int x) {
        return size[root(x)];
    }

};

int main() {
    int n,m; cin >> n >> m;
    pair<int,int> ab[100000];
    rep(i,m) {
        cin >> ab[i].first >> ab[i].second;
        ab[i].first --;
        ab[i].second --;
    }
    UnionFind uf(n);

    lint ans = 0;
    rep(i,n) ans += i;
    lint anslist[100000] = {0};
    anslist[m-1] = ans;
    for (int i=m-1; i > 0; i--) {
        int x,y;
        x = ab[i].first;
        y = ab[i].second;
        lint cntx = uf.cnt(x);
        lint cnty = uf.cnt(y);
        if(uf.unite(x,y)) ans -= cntx*cnty ;
        anslist[i-1] = ans;
    }
    rep(i,m) {
        cout << anslist[i] << endl;
    }
}

Measured memory_bytes: 6084
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <climits>
#include <functional>
#include <map>
#include <stack>
#include <cstdlib>
#define endl '\n'
#define ll long long
#define NCONS 100001

using namespace std;

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int A, B, C, X; cin >> A >> B >> C >> X;
    
    int ret = 0;
    for(int i = 0; i <= A; i++)
    {
        for(int j = 0; j <= B; j++)
        {
            for(int k = 0; k <= C; k++)
            {
                if(i * 500 + j * 100 + k * 50 == X)
                    ret += 1;
            }
        }
    }
    
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int Nmax = 1e5;
int N, A[Nmax];

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

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

	int ans = 0;
	for(int i=1; i<Nmax-1; i++){
		ans = max(ans, vec[i-1]+vec[i]+vec[i+1]);
	}

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll) x.size()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define MAX(x, y, z) max(x, max(y, z))
#define MIN(x, y, z) min(x, min(y, z))
#define ANS cout << ans << "\n"
#define RETURN(x)    \
  cout << x << "\n"; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << "\n"
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

// ll dist[100005][3];

signed main() {
  init();
  ll N, M;
  cin >> N >> M;

  if (M == 0) {
    COUT(-1);
    return 0;
  }

  vvll to(M);
  rep(i, M) {
    ll u, v;
    cin >> u >> v;
    u--;
    v--;
    to[u].pb(v);
  }
  ll S, T;
  cin >> S >> T;
  S--;
  T--;

  // rep(i, N) rep(j, 3) dist[i][j] = INF;

  queue<P> q;
  q.push({S, 0});
  vector<vector<bool>> done(N, vector<bool>(3, false));
  done[S][0] = true;

  while (!q.empty()) {
    ll i = q.front().first;
    ll d = q.front().second + 1;
    q.pop();
    rep(j, to[i].size()) {
      ll next = to[i][j];

      if (next == T && d % 3 == 0) {
        COUT(d / 3);
        return 0;
      }

      if (done[next][d % 3]) continue;
      done[next][d % 3] = true;
      q.push({next, d});
    }
  }
  COUT(-1);
  return 0;
}

Measured memory_bytes: 15532
import math
a,b,c=map(int,input().split())
if b-c/a/a==0:
 print(0)
elif a*a*b/2<c:
 print(90-math.degrees(math.atan(a/(b*2-c/a/a*2))))
else:
 print(math.degrees(math.atan(b/(2*c/a/b))))

Measured memory_bytes: 3060
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    string S;
    cin >> N >> S;
    map<char,ll> mp;
    rep(i,0,N) mp[S[i]]++;
    ll ans = 1;
    for(auto &e: mp){
        ans *= e.second+1;
        ans %= MOD;
    }
    ans = (ans-1+MOD)%MOD;
    print(ans);
    

}

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

using namespace std;

class range {
private:
  struct Iterator {
    int val;
    int operator*() {return val;}
    bool operator!=(Iterator& itr) {return val < itr.val;}
    void operator++() {++val;}
  };
  Iterator i, n;
public:
  range(int n) : i({0}), n({n}) {}
  range(int i, int n) : i({i}), n({n}) {}
  Iterator& begin() {return i;}
  Iterator& end() {return n;}
};

template<class T> inline T at(const vector<T> &v, int i) {return v[(i % (int)v.size() + v.size()) % v.size()];}

template<class T> inline bool is_max(T &a, const T &b) {return a < b ? a = b, true : false;}
template<class T> inline bool is_min(T &a, const T &b) {return a > b ? a = b, true : false;}

int convert(int t) {return t / 100 * 60 + t % 100;}

int main() {
  while (true) {
    int n, s, t;
    cin >> n >> s >> t;
    if (n == 0 && s == 0 && t == 0) break;
    s = convert(s);
    t = convert(t);
    vector<int> w(t + 1, n);
    for (int i : range(s)) w[i] = 0;
    w[t] = 0;
    for (int i : range(n)) {
      int k;
      cin >> k;
      for (int j : range(k)) {
        int ss, tt;
        cin >> ss >> tt;
        ss = convert(ss);
        tt = convert(tt);
        for (int x : range(ss, tt)) --w[x];
      }
    }
    int p = 0, res = 0;
    for (int i : range(t + 1)) {
      if (w[i] == 0) {
        is_max(res, i - p);
        p = i + 1;
      }
    }
    cout << res << endl;
  }
}

Measured memory_bytes: 1196
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int n;cin>>n;
  vector<int>ha(n);
  for(int i=0;i<n;i++)cin>>ha[i];
  sort(ha.begin(),ha.end(),greater<int>());
  int ma=0;
  int now=INF;
  int cnt=0;
  for(int i=0;i<n;i++){
    if(now==ha[i]){
      continue;
    }
    cnt++;
    now=ha[i];
  }
  cout<<cnt<<endl;
  return 0;
}


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

odd_ans = 0
odd_sum = 0

for i in range(n):
    odd_sum += A[i]
    
    if i % 2 == 1:
        if odd_sum <= 0:
            odd_ans += 1 - odd_sum
            odd_sum = 1
    else:
        if odd_sum >= 0:
            odd_ans += odd_sum + 1
            odd_sum = -1

even_ans = 0
even_sum = 0

for i in range(n):
    even_sum += A[i]
    
    if i % 2 == 0:
        if even_sum <= 0:
            even_ans += 1 - even_sum
            even_sum = 1
    else:
        if even_sum >= 0:
            even_ans += even_sum + 1
            even_sum = -1
                        
print(min(odd_ans, even_ans))

Measured memory_bytes: 14464
S = list(input())
T = list(input())
ans = []

for i in range(len(S)-len(T)+1):
    for j in range(len(T)):
        if S[i+j] == '?' or S[i+j] == T[j]:
            continue
        else:
            break
    else:
        tmp = str("".join(S[:i] + T + S[i+len(T):]).replace('?','a'))
        ans.append(tmp)
if len(ans) == 0:
    print("UNRESTORABLE")
else:
    ans.sort()
    print(ans[0])

Measured memory_bytes: 3064
#include<iostream>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int diff = 0;

    int i, e = (int)s.length() - 1;
    for (i = 0; i < e; i++, e--) {
        if (s[i] != s[e]) {
            diff++;
        }
    }
    
    cout << diff << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long

using namespace std;

long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

int main() {
  int x, y;
  scanf("%d %d", &x, &y);

  int h = 0;
  int v = 0;

  for (;;) {
    if (x <= 1 && y <= 1) {
      break;
    }
    if (x <= 0 || y <= 0) {
      break;
    }

    if (x > y) {
      x -= 2;
      y -= 1;
      h += 1;
    } else {
      x -= 1;
      y -= 2;
      v += 1;
    }
  }

  if (x != 0 || y != 0 || (v == 0 && h == 0)) {
    cout << 0 << endl;
    return 0;
  }

  ll a = 1;

  const ll MOD = 1000000007;

  for (int i = 1; i <= (h + v); i++) {
    a = a * i % MOD;
  }
  for (int i = 2; i <= v; i++) {
    a %= MOD;
    a = a * modinv(i, MOD) % MOD;
  }
  for (int i = 2; i <= h; i++) {
    a %= MOD;
    a = a * modinv(i, MOD) % MOD;
  }

  cout << a << endl;
}


Measured memory_bytes: 256
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n, a, b, c, d = rm()
s = rr()
three = '...' in s[max(0, b-2):min(n-1, d+1)]
sha = '##'in s[b-1:d]
sha1 = '##' in s[a-1:c]
if c < d:
    if sha or sha1:
        print('No')
    else:
        print('Yes')
elif not sha and three and not sha1:
    print('Yes')
else:
    print('No')









Measured memory_bytes: 27468
h, w = map(int, input().split())
cell = []
for _ in range(h):
    cell.append(input())

dist = [[float('inf') for _ in range(w)] for _ in range(h)]
dist[0][0] = 0
next_move = [[0, 0]]
x = [1, 0, -1, 0]
y = [0, 1, 0, -1]

while len(next_move):
    if next_move[0] == [h-1, w-1]:
        break
    
    for i in range(4):
        nx = next_move[0][1] + x[i]
        ny = next_move[0][0] + y[i]
        if (nx >= 0 and nx < w and ny >= 0 and ny < h and 
            cell[ny][nx] != '#' and dist[ny][nx] == float('inf')):
            dist[ny][nx] = dist[next_move[0][0]][next_move[0][1]] + 1
            next_move.append([ny, nx])
    next_move.pop(0)

cnt = 0
for i in range(h):
    for t in range(w):
        
        if cell[i][t] == '#':
            cnt += 1
            
if dist[h-1][w-1] == float('inf'):
    print(-1)
else:
    print((h*w) - (dist[h-1][w-1] + 1) - cnt)


Measured memory_bytes: 3064
import sys

input = sys.stdin.readline
MOD = 1000000007

S = input()[:-1]

S = list(S)

if S[0] == 'A':
    if 'C' in S[2:-1] and  S.count('C') == 1:
        cnt = 0
        for i in range(1,len(S)):
            if S[i].isupper() :
                if  S[i] == 'C':
                    continue
            else:
                cnt+=1
        #print(x)
        if cnt == len(S)-2:
            print("AC")
            exit()

print("WA")



Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

template <int MOD>
struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
    constexpr Fp operator+(const Fp& r) const noexcept {
        return Fp(*this) += r;
    }
    constexpr Fp operator-(const Fp& r) const noexcept {
        return Fp(*this) -= r;
    }
    constexpr Fp operator*(const Fp& r) const noexcept {
        return Fp(*this) *= r;
    }
    constexpr Fp operator/(const Fp& r) const noexcept {
        return Fp(*this) /= r;
    }
    constexpr Fp& operator+=(const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator-=(const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator*=(const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator/=(const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator==(const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator!=(const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator<<(ostream& os,
                                         const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD>& a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

const int MOD = 1000000007;
using mint = Fp<MOD>;

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;

    vector<int> alph(26, 0);
    for (int i = 0; i < S.length(); i++) {
        alph[S[i] - 'a']++;
    }
    mint output = 1;
    for (int i = 0; i < 26; i++) {
        output *= alph[i] + 1;
    }
    output -= 1;

    cout << output << endl;

    return 0;
}


Measured memory_bytes: 3716
//52行目から編集
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

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

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);
    ll a,b,c;cin >> a >> b >> c;
    if(a+b < c and (long long)4*a*b < (c-a-b)*(c-a-b)){
        cout << "Yes" << '\n';
    }else{
        cout << "No" << '\n';
    }
    return 0;
}


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

using namespace std;

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

    vector<int> dp(n);
    vector<int> hs(n);
    cin >> hs[0];
    for (int i=1;i<n;++i){
        cin >> hs[i];
        int minv=INT_MAX;
        for (int j=max(i-k,0);j<i;++j) {
            minv=min(minv,dp[j]+abs(hs[j]-hs[i]));
        }
        dp[i]=minv;
    }
    cout << dp[dp.size()-1];
}

Measured memory_bytes: 3672
#include <stdio.h>

int main(void) {
	int x, y;
	while (scanf("%d%d", &x, &y) != EOF){
		if( x == 0 && y == 0) break;
		if( x < y)
			printf("%d %d\n", x, y);
		else
			printf("%d %d\n", y, x);
	}
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  int p[n];
  int cnt = 0;

  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }

  for (int i = 1; i < n-1; i++) {
    if( ((p[i-1] < p[i]) && (p[i] < p[i+1])) || ((p[i+1] < p[i]) && (p[i] < p[i-1]))){
      cnt++;
    }
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define int long long

int p;

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

int power(int a, int N){
	if(N == 0){
		return 1;
	}
	else if(N % 2 == 0){
		return power(MOD(a * a), N / 2);
	}
	else{
		return MOD(a * power(a, N - 1));
	}
}

int ABS(int a){
	return a >= 0 ? a : -a;
}

int gcd(int a, int b){
	a = ABS(a);
	b = ABS(b);
	if(b == 0){
		return a;
	}
	else{
		return gcd(b, a % b);
	}
}

signed compair(const void *a, const void *b){
	int sub = *(int *)a - *(int *)b;
	if(sub < 0){
		return -1;
	}
	else if(sub == 0){
		return 0;
	}
	else{
		return 1;
	}
}

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

int judge(int m, int N, int *a){
	p = m;
	int i, j, sum;
	if(MOD(a[0]) != 0){
		return 0;
	}
	for(i = 1; i < p && i <= N; i++){
		sum = 0;
		for(j = 0; i + (p - 1) * j <= N; j++){
			sum = MOD(sum + a[i + (p - 1) * j]);
		}
		if(sum != 0){
			return 0;
		}
	}
	return 1;
}

signed main(){
	int N, i, j, k;
	scanf("%lld", &N);
	int *a = (int *)malloc(sizeof(int) * (N + 1));
	for(i = N; i >= 0; i--){
		scanf("%lld", &a[i]);
	}
	int *is_prime = (int *)malloc(sizeof(int) * (N + 1));
	is_prime[0] = 0;
	is_prime[1] = 0;
	for(i = 2; i <= N; i++){
		is_prime[i] = 1;
	}
	for(i = 2; i <= N; i++){
		if(is_prime[i] == 1){
			for(j = 2; i * j <= N; j++){
				is_prime[i * j] = 0;
			}
		}
	}
	int *ans = (int *)malloc(sizeof(int) * 100000);
	k = 0;
	for(i = 2; i <= N; i++){
		if(is_prime[i] == 1){
			if(judge(i, N, a) == 1){
				ans[k] = i;
				k++;
			}
		}
	}
	int aN = ABS(a[N]);
	for(i = 2; i * i <= aN; i++){
		if(aN % i == 0){
			while(aN % i == 0){
				aN /= i;
			}
			if(i > N){
				if(judge(i, N, a) == 1){
					ans[k] = i;
					k++;
				}
			}
		}
	}
	if(aN > N){
		if(judge(aN, N, a) == 1){
			ans[k] = aN;
			k++;
		}
	}
	for(i = 0; i < k; i++){
		printf("%lld\n", ans[i]);
	}
	return 0;
}

Measured memory_bytes: 384
g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]
x, y = list(map(int, input().split()))

if x in g1 and y in g1:
    print('Yes')
elif x in g2 and y in g2:
    print('Yes')
elif x in g3 and y in g3:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
import itertools
N = int(input())
S = input()
out = S.count('R') * S.count('G') * S.count('B')

RGBs = list(itertools.permutations(['R', 'G', 'B'], 3))

for i in range(1, N):
  for j in range(N-i*2):
    if (S[j], S[j+i], S[j+i*2]) in RGBs:
      out -= 1
print(out)

Measured memory_bytes: 9092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>e[200005];
int use[200005];
int num[200005];
int n, m, cnt;
void bfs(int x) {
	if (use[x])return;
	use[x] = cnt;
	for (int i = 0; i < e[x].size(); ++i)bfs(e[x][i]);
}
int main() {
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		int x, y;
		scanf("%d%d", &x, &y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	for (int i = 1; i <= n; ++i) {
		if (!use[i]) {
			++cnt;
			bfs(i);
		}
	}
	for (int i = 1; i <= n; ++i) {
		++num[use[i]];
	}
	int mx = 1;
	for (int i = 1; i <= n; ++i) {
		mx = max(mx, num[i]);
	}
	cout << mx << endl;
	return 0;
}

Measured memory_bytes: 21540
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll N, i;
    cin >> N >> i;

    cout << N - i + 1 << endl;

    return 0;
}

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

using namespace std;

int n, x[6005], y[2005][2005], add, ans, mx[2005], mxx;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n * 3; i++)
		scanf("%d", x + i);
	for (int i = 1; i <= n; i++) {
		mx[i] = INT_MIN;
		for (int j = 1; j <= n; j++)
			y[i][j] = INT_MIN;
	}
	mx[x[0]] = mx[x[1]] = 0;
	y[x[0]][x[1]] = y[x[1]][x[0]] = 0;
	for (int i = 2; i + 3 <= n * 3; i += 3) {
		sort(x + i, x + i + 3);
		vector<tuple<int, int, int>> v;
		if (x[i] == x[i + 2]) {
			add++;
			continue;
		}
		if (x[i] == x[i + 1])
			for (int j = 1; j <= n; j++)
				v.emplace_back(j, x[i + 2], y[x[i]][j] + 1);
		else if (x[i + 1] == x[i + 2])
			for (int j = 1; j <= n; j++)
				v.emplace_back(j, x[i], y[x[i + 1]][j] + 1);
		for (int j = i; j < i + 3; j++)
			v.emplace_back(j == i ? x[i + 1] : x[i], j == i + 2 ? x[i + 1] : x[i + 2], y[x[j]][x[j]] + 1);
		v.emplace_back(x[i], x[i + 1], mxx);
		v.emplace_back(x[i], x[i + 2], mxx);
		v.emplace_back(x[i + 1], x[i + 2], mxx);
		for (int j = 1; j <= n; j++)
			for (int k = i; k < i + 3; k++)
				v.emplace_back(j, x[k], mx[j]);
		for (auto& j : v) {
			int ta, tb, tc;
			tie(ta, tb, tc) = j;
			y[ta][tb] = max(y[ta][tb], tc);
			y[tb][ta] = max(y[tb][ta], tc);
			mx[ta] = max(mx[ta], tc);
			mx[tb] = max(mx[tb], tc);
			mxx = max(mxx, tc);
		}
	}
	y[x[n * 3 - 1]][x[n * 3 - 1]]++;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			ans = max(ans, y[i][j]);
	printf("%d\n", ans + add);
}

Measured memory_bytes: 19536
N,Ma,Mb = map(int,input().split())
ABC = [list(map(int,input().split())) for _ in [0]*N]
INFTY = 10**8
dp = [[[INFTY]*10*(N+1) for _ in [0]*10*(N+1)] for _ in [0]*(N+1)]
dp[0][0][0] = 0
for i in range(1,N+1):
    a,b,c = ABC[i-1]
    for j in range(10*(N+1)):
        for k in range(10*(N+1)):
            dp[i][j][k] = dp[i-1][j][k]
            if j-a>=0 and k-b>=0:
                dp[i][j][k] = min(dp[i][j][k],dp[i-1][j-a][k-b]+c)
ans = min(dp[-1][Ma*k][Mb*k] for k in range(1,(10*(N+1)-1)//max(Ma,Mb)+1))
if ans == INFTY : ans = -1
print(ans)

Measured memory_bytes: 99804
import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        String a = "ABC";
        if (n.equals(a)){
            System.out.println("ARC");
        }else{
            System.out.println("ABC");
        }
    }
}


Measured memory_bytes: 35668
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
const int MOD = 1e9+ 7;
const int INF = numeric_limits<int>::max() - (int)1e8;
const ll INFLL = numeric_limits<ll>::max() - (ll)1e17;

int main() {
    ll X;
    cin >> X;
    auto calc = [&](ll B) {
        return X + B * B * B * B * B;
    };
    for (ll A = -8000; A <= 8000; A++) {
        ll base = A * A * A * A * A;
        for (ll B = -8000; B <= 8000; B++) {
            if (base == calc(B)) {
                cout << A << " " << B << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3632