akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
#include <cassert>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1e9)
#define LINF (long long int)(1e18)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}

/*std::mt19937 mt{ std::random_device{}() };

std::uniform_int_distribution<int> dist(1, 6);
dist(mt);

while(1){
	val;
	cout << val << endl;
	sol1 = solver1();
	sol2 = solver2();
	if(sol1==sol2){
	cout << "OK" << endl;
	}else{
	cout << "NG" << endl;
	cout << sol1 << endl;
	cout << sol2 << endl;
	break;
	}
}
*/

int main(void){
  fast_io
  cout<<fixed<<setprecision(15);
  ll sum = 0;
  string s;
  cin >> s;
  ll length = s.size();
  rep(i,length){
	  char ss;
	  ss = s[i];
	  int a = ss - '0';
	  
	  sum += a;
	  if(sum%9 == 0){
		  sum = 0;
	  }

  }
  if(sum == 0){
	  cout << "Yes" << endl;
  }else{
	  cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3768
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	long n;
	cin>>n;
	vector<long long> arr(n);
	for(int i=0;i<n;i++) cin>>arr[i];
	long ans=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			for(int k=j+1;k<n;k++){
				if(arr[i]!=arr[j]&&arr[j]!=arr[k]&&arr[k]!=arr[i])
				if(arr[i]+arr[j]>arr[k]&&arr[i]+arr[k]>arr[j]&&arr[k]+arr[j]>arr[i])
					ans++;
			}
		}
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
// #define vec(v) vector<int>(v)
// #define be(v) (v).begin(), (v).end()
// #define pb(q) push_back(q)
// #define mapci(mp) map<char*,int>(mp)
// #define mapcc(mp) map<char*,char*>(mp)
// typedef long long ll;
using namespace std;

int main(){
    int ans=0;
    vector<int> a(5);
    vector<int> t(5);
    for(int i=0;i<5;i++){
        cin>>a[i];
        t[i]=10-(a[i]%10);
        if(t[i]!=10) a[i]+=t[i];
        ans+=a[i];
    }
    sort(t.begin(),t.end(),greater<int>());
    int num=ans;
    for(int i=0;i<5;i++){
        if(ans!=num) break;
        if(t[i]!=10) ans-=t[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import itertools
n = int(input())
p = tuple(i for i in input().split())
q = tuple(i for i in input().split())
pi = 0
qi = 0

for i,j in enumerate(itertools.permutations(str(i) for i in range(1,n+1))):
    if p == j:
        pi = i
    if q == j:
        qi = i

print(abs(pi-qi))

Measured memory_bytes: 3064
A,B,C,D,E,F = map(int,input().split())
a = 0
x = 100*A
y = 0
for n in range(30):
    for m in range(30):
        if n*100*A+m*100*B>F:continue
        c = (n*A+m*B)*E
        d = F-100*(n*A+m*B)
        for k in range(min(c,d)+1):
            for l in range(min(c,d)+1):
                if k*C+l*D>(n*A+m*B)*E or n*100*A+m*100*B+k*C+l*D>F:continue
                if x*(k*C+l*D)>y*(n*100*A+m*100*B+k*C+l*D):
                    x = n*100*A+m*100*B+k*C+l*D
                    y = k*C+l*D
                    a = y/x
print(x,y)

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

int main(){
  int H, W;
  while(true){
    cin >> H >> W;
    if(H==0 && W==0){
      break;
    }
    for(int i=1;i<=H;i++){
      for(int j=1;j<=W;j++){
        if((i+j)%2==0){
          cout << "#";
        } else {
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
}



Measured memory_bytes: 3112
from collections import defaultdict

N = int(input())
A = list(map(int,input().split()))
dic = defaultdict(int)
for a in A:
  dic[a] += 1
a = dic[1]
b = dic[2]
c = dic[3]

dp = [[[0 for k in range(N+1)] for j in range(N+1)] for i in range(N+1)]
dp[a+b][a][0] = 1
for i in range(a+b,N+1):
  for j in range(a,i+1):
    for k in range(j+1):
      p,q,r = j-k,i-j,N-i
      if p:
        dp[i][j][k+1] += dp[i][j][k] * p/(p+q+r)
      if q:
        dp[i][j+1][k] += dp[i][j][k] * q/(p+q+r)
      if r:
        dp[i+1][j][k] += dp[i][j][k] * r/(p+q+r)

ans = 0
for i in range(a+b,N+1):
  for j in range(a,i+1):
    for k in range(j+1):
      p,q,r = j-k,i-j,N-i
      if p:
        ans += dp[i][j][k]*N/(p+q+r)*p/(p+q+r)
      if q:
        ans += dp[i][j][k]*N/(p+q+r)*q/(p+q+r)
      if r:
        ans += dp[i][j][k]*N/(p+q+r)*r/(p+q+r)
        
print(ans)

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main()
{
  int N;
  ll M;
  cin >> N >> M;
  vector<ll> A(N + 1);
  REP1(i, N)
  cin >> A[i];
  vector<ll> B(N + 1);
  B[0] = 0;
  REP1(i, N)
  B[i] = B[i - 1] + A[i];
  map<ll, ll> mp;
  for (int i = 0; i <= N; i++)
    mp[B[i] % M]++;
  ll ans = 0;
  for (auto a : mp)
  {
    if (2 <= a.second)
      ans += a.second * (a.second - 1) / 2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
	int n, total=0;
	int a[20];
	int b[20];
	int c[19];

	cin >> n;

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

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

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

	total = b[0];
	int t = 0;
	for (int i = 1; i < n; i++) {
		total += b[i];

		if (a[i - 1] + 1 == a[i]) {
			total += c[a[i-1]-1];
		}
	}
	
	cout << total << endl;
	
}

Measured memory_bytes: 256
// SwappingTwoNumbers.cc
// ２つの整数 x, y を読み込み、それらを値が小さい順に出力するプログラムを作成して下さい。
// ただし、この問題は以下に示すようにいくつかのデータセットが与えられることに注意して下さい。
// 【入力】
// 入力は複数のデータセットから構成されています。
// 各データセットは空白で区切られた２つの整数 x, y を含む１行から構成されています。
// x と y がともに 0 のとき入力の終わりを示し、このデータセットに対する出力を行ってはいけません。
// 【出力】
// 各データセットごとに、x と y を小さい順に並べたものを１行に出力して下さい。
// x と y の間には１つの空白を入れて下さい。
// 【制約】
// 0 ≤ x, y ≤ 10,000
// データセットの数は 3,000 を超えない。
// 【例】
// 入力：
// 3 2
// 2 2
// 5 3
// 0 0
// 出力：
// 2 3
// 2 2
// 3 5
#include<iostream>
using namespace std;

int main( void) {
  int x, y;

  while( true) {
    cin >> x >> y;

    if ( x == 0 && y == 0) break;

    if ( x > y) cout << y << " " << x << endl;
    else cout << x << " " << y << endl;
  }

  return 0;
}



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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int H, n;
    cin >> H >> n;
    vector<int> A(n, 0), B(n, 0);
    rep(i, n) { cin >> A[i] >> B[i]; }
    vector<int> min_mp(H + 10, INF);
    min_mp[0] = 0;

    for (int h = 1; h <= H; h++) {
        int mi = INF;
        for (int i = 0; i < n; i++) {
            if (h - A[i] <= 0) {
                mi = min(mi, B[i]);
            } else {
                mi = min(mi, min_mp[h - A[i]] + B[i]);
            }
        }
        min_mp[h] = mi;
    }
    // dump(min_mp);
    cout << min_mp[H] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {
	
	int N; cin >> N;
	int A,B; cin >> A >> B;


	int cnt = 0;
	for (int i = 1; i <= N; i++) {
		int num = i;
		int sum = 0;
		while(num != 0) {
			sum += (num % 10);
			num /= 10;
		}
		if (A <= sum and sum <= B) {
			cnt += i;
		}
	}
	cout << cnt << endl;
	

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main (){
	char weth[7];
	scanf("%s",weth);
	if(weth[0] == 'S'){
		printf("Cloudy\n");
	}else if(weth[0] == 'C'){
		printf("Rainy\n");
	}else if(weth[0] == 'R'){
		printf("Sunny\n");
	}
	return 0;
}

Measured memory_bytes: 128
def inN():
    return int(input())
def inL():
    return list(map(int,input().split()))
def inNL(n):
    return [list(map(int,input().split())) for i in range(n)]

s = input()
n = int(s)
l = len(s)
cnt = 0
mod = [0]*2019
m = 0
for i in range(l):
    m = (int(s[l-1-i])*pow(10,i,2019) + m)%2019
    mod[m] += 1

cnt += mod[0]

for i in range(2019):
    if mod[i] > 1:
        cnt += (mod[i]*(mod[i]-1))/2
        #print(i)
print(int(cnt))


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

N,A,B = map(int,input().split())

def seq(start,bits):
    arr = [0]
    for i in bits:
        arr += [x^(1<<i) for x in arr[::-1]]
    return [x^start for x in arr]

def solve(A,B,rest):
    if len(rest) == 1:
        return [A,B]
    if len(rest) == 2:
        i,j = rest
        x,y = 1<<i,1<<j
        if A^x == B:
            return [A,A^y,A^x^y,B]
        elif A^y == B:
            return [A,A^x,A^x^y,B]
        else:
            return None
    diff_bit = [i for i in rest if (A&(1<<i)) != (B&(1<<i))]
    if len(diff_bit) % 2 == 0:
        return None
    i = diff_bit[0]
    rest = [j for j in rest if j != i]
    if A^(1<<rest[0])^(1<<i) == B:
        rest[0],rest[1] = rest[1],rest[0]
    arr = seq(A,rest)
    return arr + solve(arr[-1]^(1<<i),B,rest)

rest = list(range(N))
answer = solve(A,B,rest)

if answer is None:
    print('NO')
else:
    print('YES')
    print(' '.join(map(str,answer)))

Measured memory_bytes: 18452
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const int MAX_N = 1299709+5;
bool prime[MAX_N];
vector<int> p;

void make_prime (void )
{
	fill (prime, prime + MAX_N, true ); 
	prime[0] = false;
	prime[1] = false;
	for (int i = 2; i < MAX_N; i++ ){
		if (prime[i] ){
			for (int j = 2*i; j < MAX_N; j += i ){
				prime[j] = false;
			} // end for
		} // end if
	} // end for
	p.clear();
	rep (i, MAX_N ){
		if (prime[i] ){
			p.push_back (i );
		} // end if
	} // end rep
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.PrimeGap", "r", stdin );
	make_prime();

	int n;
	while (scanf ("%d", &n ), n ){
		if (prime[n] ){
			cout << 0 << endl;
		}else{
			vector<int>::iterator it = upper_bound (ALL (p ), n );	// n より大きい素数の位置がでる。
			int m = upper_bound (ALL (p ), n ) - p.begin();
			cout << (*it) - p[m-1] << endl;
		} // end if
	} // end loop
		
	return 0;
}

Measured memory_bytes: 2984
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main(){
    int N;
    cin>>N;
    int cnt = N/2;
    double ratio = 1.0 - (double)cnt/(double)N;
    std::cout << std::fixed;
    std::cout << std::setprecision(7) <<ratio<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int l, r, d;
    cin >> l >> r >> d;
    int bot = l + (d - (l % d)) % d;
    int top = r - r % d;
    cout << ((top >= bot) ? 1 + (top - bot) / d : 0) << '\n';
}

Measured memory_bytes: 3592
public class Main {
		 
		public static void main(String[] args) {
	 
			java.util.Scanner scan = new java.util.Scanner(System.in);
		

			long x = scan.nextLong();
			
			for( int a = -1000; a <= 1000; a++) {
				for(int b = -1000; b <= 1000; b++ ) {
					if(Math.pow(a, 5)== x + Math.pow(b, 5)) {
						System.out.println(a + " " + b);
					return;
					}
				}
			}
			
			
		
		}
	 
	}


Measured memory_bytes: 38852
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
string s[5000];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int r,c;
    cin>>r>>c;
    for(int i=0; i<r; i++)
    {
        cin>>s[i];
    }
    for(int i=0; i<c+2; i++)
    {
        cout<<"#";
    }
    cout<<endl;
    for(int i=0; i<r; i++)
    {
        cout<<"#";
        cout<<s[i];
        cout<<"#"<<endl;
    }
    for(int i=0; i<c+2; i++)
    {
        cout<<"#";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3752
#include <cstdio>
#include <cctype>
char c;

int main(){
    while (1){
        scanf("%c", &c);
        if (isupper(c)){
            printf("%c", tolower(c));
        }
        else {
            printf("%c", toupper(c));
        }
        if (c == '\n') break;
    }
    return 0;
}

Measured memory_bytes: 2676
#include<bits/extc++.h>
#ifdef _debug 
#define dout(i) cout << #i << ' ' << i << ' '
#else 
#include<bits/stdc++.h>
#define dout(i) 0&&0
#endif
#pragma GCC optimize("unroll-loops,no-stack-protector,O3")
#define eout(i) {cout << (i) << '\n';exit(0);}
#define rout(i) {return cout << (i) << '\n', 0;}
#define priority_queue __gnu_pbds::priority_queue
#define unordered_map __gnu_pbds::gp_hash_table
#define rep(a, b) {for(int _i = a;_i > 0;--_i){b;}}
#define multe int _T;for(cin >> _T;_T--;)
using namespace std;
using ll = long long;using ull = unsigned long long;using ul = unsigned;using db = double;
using __gnu_pbds::null_type;
template<typename T> void read(int n, T s){while(n--)cin >> *s, ++s;}
template<typename T> void write(int n, T s){while(n--)cout << *s << " \n"[n==0], ++s;}
template<typename T> using rbtree = __gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T> inline ostream& operator << (ostream &ou, const vector<T> &a){for(auto it = a.begin();it != a.end();++it)ou << (it != a.begin() ? " " : "") << *it;return ou;}
template<typename T1, typename T2>inline istream& operator >> (istream &in, pair<T1, T2> &a){return in >> a.first >> a.second;}
template<typename T1, typename T2>inline ostream& operator << (ostream &ou, const pair<T1, T2> &b){return ou << b.first << ' ' << b.second;}
template<typename T> inline long long pow(long long v, long long t, const T &p){long long res = 1;for(;t;t >>= 1, v = v * v % p)if(t & 1)res = res * v % p;return res;}
int n;
#define int ll
ll a, k;
int grundy;
int gof(ll a, ll k){
	if(a % k == 0)return a / k;
	else if(a < k)return 0;
	else{
		int b = a / k, c = a % k % (b+1);
		if(c == 0)return b;
		return gof(b*k+c-b-1, k);
	}
}
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	multe{
		cin >> a >> k;
		if(a >= k)grundy ^= gof(a, k);
		// cout << gof(a, k) << '\n';
	}		
	if(grundy)cout << "Takahashi" << '\n';
	else cout << "Aoki" << '\n';
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, D, X;
    vector<int> A;
    cin >> N;
    cin >> D >> X;
    A.resize(N, 0);
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }

    int ans = X;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < D; j++){
            if((j * A[i] + 1) <= D){
                ans++;
            }
            else{
                continue;
            }
        }
    }

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 256
n = int(input())
w_list = [input() for _ in range(n)]
if len(w_list) != len(set(w_list)):
    print('No')
else:
    f = True
    tail = w_list[0][0]
    for w in w_list:
        if w[0] != tail:
            f = False
        else:
            tail = w[-1]
            pass
    print('Yes' if f else 'No')

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <string>
#include <numeric>
#include <algorithm>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <complex>
#include <ctime>
#define ll long long
using namespace std;

int main(){
	ll x;
	scanf("%lld",&x);
	ll a,b;
	for(a=0;a<=1000;a++)
    {
        for(b=-1000;b<a;b++)
        {
            if(a*a*a*a*a-b*b*b*b*b==x)
            {
                printf("%lld %lld",a,b);
                return 0;
            }
        }
    }
	return 0;
}


Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    string S; cin >> S;
    if(SZ(S) == 1){
        Out(1);
        return 0;
    }else if(SZ(S) == 2){
        if(S[0] == S[1]) Out(1);
        else Out(2);
        return 0;
    }
    vector<string> v;
    string now = "";
    now = S[0];
    v.pb(now);
    now = "";
    FOR(i, 1, SZ(S)){
        now += S[i];
        if(now != v.back()){
            v.pb(now);
            now = "";
        }
    }
    int ans = SZ(v);
    //if(ans >= 2 && v[ans - 1] == v[ans - 2]) ans--;
    Out(ans);

    return 0;
}


Measured memory_bytes: 11016
/* ex6_2
    nnasy */

#include <stdio.h>
#include <string.h>

int main(void) {
    // 宣言と入力
    char word[256];
    int lenword;
    scanf("%s", &word);
    lenword = strlen(word);

    // 頭文字、頭文字と末尾文字を除いた文字数、末尾文字の出力
    printf("%c%d%c\n", word[0], lenword-2, word[lenword-1]);
    return 0;
}

Measured memory_bytes: 128
N, K = map(int, input().split())

A = list(map(int, input().split()))

visited = [0] * N

order = []

cur = 1
cnt = 0

while True:
    if visited[cur-1] == 0:
        visited[cur-1] += 1
        if cnt == K:
            print(cur)
            break

    elif visited[cur-1] == 1: # cur == 2
        
        order_from_cur = order[order.index(cur):]
        r = (K-cnt) % len(order_from_cur)

        final = order_from_cur[r]
        print(final)
        break
    order.append(cur)
    cur = A[cur - 1]
    cnt += 1


Measured memory_bytes: 32148
/*
AuThOr GaRyMr
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
LL n,a,d;
pair<LL,LL> each[200000+1]; 
LL res=0;
LL A[200000+1];
int main(){
	fastio;
	cin>>n>>d>>a;
	//d<<=1;
	rb(i,1,n)
		cin>>each[i].FIR>>each[i].SEC;
	sort(each+1,each+1+n);
	LL tmp=0;
	rb(i,1,n){
//		cout<<tmp<<endl;
		each[i].SEC-=tmp;
		if(each[i].SEC>0){
			LL need=(each[i].SEC+a-1)/a;
			tmp+=need*a;
			res+=need;
			int l=i,r=n+1;
			//cout << l << r;
			while(l<r-1){
				int mid=(l+r)/2;
				if(each[i].FIR+2*d>=each[mid].FIR){
					l=mid;
				}
				else{
					r=mid;
				}
			}
//			cout<<each[i].FIR+d<<endl;
//			cout<<l<<endl;
			A[l]+=need*a;
		}
		tmp-=A[i];
	}
	cout<<res;
	return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main() {
  ll n;cin >>n;
  vector<int> a(n);
  for(int i = 0; i < n; ++i){
    cin >> a[i];
  }
  
  if(a[0] != 0){
    cout << -1 << endl;
    return 0;
  }
  ll ans=0, top = a[n-1], now = a[n-1];
  for(int i = n-2; i >= 0; --i){
    if(a[i]==now-1){
      now=a[i];
    }
    else if(a[i]<now-1){
      cout << -1 << endl;
      return 0;
    }
    else{
      ans+=top;
      top=a[i];
      now=a[i];
    }
  }
  ans+=top;
  cout << ans<< endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
    int n;
    while(cin >> n&&n!=0){
        vector<int>a(n),b(n);
        rep(i,n){
            cin >> a[i] >> b[i];
        }
        int sa=0,sb=0;
        int mx = 0;
        int bb = 0;
        rep(i,n){
            sa += a[i];
            sb += b[i];
            mx = max(mx,a[i]);
        }
        if(sa-mx>=mx){
            cout << sa+sb << endl;
        }else{
            bool dp[1001][2000]={};
            dp[0][0] = 1;
            for(int i=0;i<n;i++){
                if(mx==a[i]){
                    for(int j=0;j<=1000;j++){
                        dp[i+1][j] = dp[i][j];
                    }
                }else{
                    for(int j=0;j<=1000;j++){
                        if(dp[i][j]){
                            dp[i+1][j] = 1;
                            dp[i+1][j+a[i]] = 1;
                            dp[i+1][j+a[i]+b[i]]=1;
                        }
                    }
                }
            }
            int zz=0;
            for(int i=0;i<=mx;i++){
                if(dp[n][i]){
                    zz = i;
                }
            }
            cout << sa+sb+mx-zz << endl;
        }
    }
    return 0;
}


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

int main() {
	int A, B, M;
	cin >> A >> B >> M;
	vector<int> a(A), b(B);
	int min_a, min_b;
	for (int i = 0; i < A; i++) {
		cin >> a.at(i);
		if (i == 0) {
			min_a = a.at(i);
		} else {
			if (min_a > a.at(i)) {
				min_a = a.at(i);
			}
		}
	}
	for (int i = 0; i < B; i++) {
		cin >> b.at(i);
		if (i == 0) {
			min_b = b.at(i);
		} else {
			if (min_b > b.at(i)) {
				min_b = b.at(i);
			}
		}
	}

	int min_cost = min_a + min_b;
	for (int i = 0; i < M; i++) {
		int x, y, c;
		cin >> x >> y >> c;
		int cost = a.at(x - 1) + b.at(y - 1) - c;
		if (min_cost > cost) {
			min_cost = cost;
		}
	}

	cout << min_cost << endl;
}

Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;
int main()
{

	auto cmp=[](auto a,auto b)
	{
		return a.first>b.first;
	};
	
	int n,m,k;
	cin>>n>>m>>k;

	vector<pair<int,int> > row(n),col(m);

	for(int i=0;i<n;i++)
	{
		row[i].second=i;
	}

	for(int j=0;j<m;j++)
	{
		col[j].second=j;
	}

	set<pair<int,int> > st;

	for(int i=0;i<k;i++)
	{
		int u,v;
		cin>>u>>v;
		u--,v--;
		st.insert({u,v});
		row[u].first++;
		col[v].first++;
	}

	sort(row.begin(),row.end(),cmp);
	sort(col.begin(),col.end(),cmp);

	int mx=0;


	for(auto [count1,x]:row)
	{
		bool flag=0;
		for(auto [count2,y]:col)
		{
			if(!flag)
			{
				int mymax=count1+count2;
				if(st.find({x,y})==st.end())
				{
					flag=1;
				}
				else
				{
					mymax--;
				}

				mx=max(mx,mymax);
			}
			else
				break;
		}
	}



	cout<<mx<<endl;




	return 0;
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
      #include <chrono>
    
      using namespace std;
      using namespace std::chrono; 
   
      typedef long long int ll;
   
      #define MOD (ll)(1e9+7)
      #define endl "\n"
      #define pb push_back
      #define TEST_CASES  ll t;cin>>t;while(t--)
      #define forn(i,a,n) for (int i = a; i < n; ++i)
      #define f first
      #define s second
      #define all(x) x.begin(), x.end()


      
      ll powD(ll x,ll y){
        ll res = 1;
        while(y > 0){
          if(y & 1)
            res = (res*x)%MOD;
          x = (x*x)%MOD;
          y = y>>1;
        }
        return res;
      }
  
      int main()
      {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        int n,x;
        cin>>x>>n;
        vector<bool> v(205,0);
        int ans = -1;
        int minm = abs(x+1);
        forn(i,0,n){
          int x;
          cin>>x;
          v[x] = true;
        }
        forn(i,0,205){
          if(!v[i]){
            if(abs(i-x) < minm){
              minm = abs(i-x);
              ans = i;
            }
          }
        }
        cout<<ans<<endl;
      }

      
    


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int x,a,b;
    cin>>x>>a>>b;
    a=abs(a-x);
    b=abs(b-x);
    if(min(a,b)==a)
      cout<<"A";
      else cout<<"B";

return 0;
}




Measured memory_bytes: 3584
#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long int
#define MOD 1000000007
#define P pair<ll,ll>
#define INF 1000000000000000000

//using namespace atcoder;
using namespace std;

int main(void){
  ll n;
  cin >> n;
  
  vector<ll> a(n);
  for (int i = 0; i < n; i++){
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  
  cout << a[n-1] - a[0] << endl;

  return 0;
}


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

int main(){
  int n;
  cin>>n;
  vector<pair<int,int>> d(n);
  rep(i,n){
    int x,y;
    cin>>x>>y;
    d[i].first=x+y;
    d[i].second=x;
  }
  sort(d.begin(),d.end(),greater());
  ll res=0;
  rep(i,n){
    if(i%2==0){
      res+=d[i].second;
    }else{
      res-=d[i].first-d[i].second;
    }
  }
  cout<<res<<endl;
}

Measured memory_bytes: 4048
//Created by Kira

#include<bits/stdc++.h>
using namespace std;

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
    



int main(){
   IOS

    vi a(5);
    for(int i = 0; i < 5; i++)cin>>a[i];

    for(int i = 0; i < 5; i++){
        if(a[i] == 0)cout<<i + 1<<"\n";
    }







}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
    if(b&1) res = res * a % mod;
        a = a * a % mod;
    b >>= 1;
    }

    return res;
}



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

using namespace std;
int dp[100005];
bool pro(vector<int> a, int k)
{
  if(k==0)
    return false;
  if(dp[k]!=-1)
    return dp[k];
  bool ans=false;
  int n=a.size();
  for(int i=0;i<n;i++)
  {
    if(k-a[i]>=0 && !pro(a,k-a[i]))
    {
      ans=true;
      break;
    }
  }
  return dp[k]=ans;
}

int main()
{
  int n,k;
  cin>>n>>k;
  vector<int> a(n);
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  memset(dp,-1,sizeof(dp));
  cout<<(pro(a,k)?"First":"Second")<<endl;
  return 0;
}


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

signed main() {
  cin.tie(0); ios::sync_with_stdio(false);
  long long a, b, c, k; cin >> a >> b >> c >> k;
  cout << (k % 2 == 0 ? a - b : b - a) << '\n';
  return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define N 105
#define V 31627

using namespace std;

const int mod = 1e9 + 7;

int n, K;
int f[N][V], g[N][V];
int cnt[V];

int main() {
	scanf("%d %d", &K, &n); /* 把 n, k 的定义反了一下*/
	
	int p = sqrt(K);
	
	for(int i = 1; i < p; ++i)
		cnt[i] = K / i - K / (i + 1);
	cnt[p] = K / p - p;
	
	for(int i = 1; i <= p; ++i) {
		f[1][i] = 1;
		g[1][i] = cnt[i];
	}
	
	for(int i = 1; i <= n; ++i) {
		int sum = 0;
		for(int j = 1; j <= p; ++j) {
			sum = (sum + f[i][j]) % mod;
			g[i + 1][j] = 1LL * sum * cnt[j] % mod;
		}
		for(int j = p; j >= 1; --j) {
			sum = (sum + g[i][j]) % mod;
			f[i + 1][j] = sum;
		}
	}
	
	printf("%d\n", f[n + 1][1]);
	return 0;
}

Measured memory_bytes: 25856
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <cmath>
#include <queue>
using namespace std;
using i64 = int64_t;
#define rep(i, j, n) for(int i = (j); i < (n); ++i)
#define rrep(i, j, n) for(int i = (n - 1); (j) <= i; --i)
constexpr i64 MOD = 1000000007;
constexpr i64 INF = 1LL << 60;

bool x[200000], y[200000];

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

	int n, m, a, b; cin >> n >> m;
	rep(i, 0, m) {
		cin >> a >> b;
		--a, --b;
		if (a > b) swap(a, b);
		if (a == 0) x[b] = true;
		if (b == n - 1) y[a] = true;
	}
	rep(i, 1, n - 1) {
		if (x[i] && y[i]) {
			cout << "POSSIBLE";
			return 0;
		}
	}
	cout << "IMPOSSIBLE";
	return 0;
}

Measured memory_bytes: 4028
#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cassert>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<limits>
#include<ctime>
#include<stack>
#include<bits/stdc++.h>
#include<string>
#include<stdlib.h>
#include<stdio.h>

typedef long long ll;
using namespace std; 
int main(){
	int a[3];
	for(int i=0;i<3;i++){
		cin>>a[i];
	}
	sort(a,a+3);
	if((a[2]-a[1])%2!=(a[2]-a[0])%2){
		cout<<a[2]-a[1]+((1-a[0]+a[1])/2)+1;
	}
	else{
		cout<<a[2]-a[1]+((a[1]-a[0])/2);
	}
}

Measured memory_bytes: 3644
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
using namespace std;
int main()
{
      int a,b;
      cin >> a >> b ;
      if(a==b)
        cout << "Yes" << endl;
      else
        cout << "No" <<endl;



      return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
    char s1,s2,s3,s4,s5,s6;
    while(cin >> s1 >> s2 >> s3 >> s4 >> s5 >> s6)
    {
        
        if(s3 == s4 && s5 == s6 && s1 != s2 && s1 != s3 && s1 != s5 && s2 != s3 && s2 != s5)
        {
            cout << "Yes" << "\n";
        }
        else
        {
            cout << "No" << "\n";
        }
    }
    return 0;
}

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

int main()
{
    ll n;
    cin>>n;
    ll sum = 0;
    ll d = n / 500;
    sum += d * 1000;
    n = n - d*500;
    d = n/5;
    sum += d * 5;
    cout<<sum<<endl;

    return 0;
}


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

int main(){
  ll n ;
  cin >> n ;
  vector<ll> F(1e4+5,0) ;
    rep(x,101){
      rep(y,101){
        rep(z,101){
          if( x*x + y*y + z*z + x*y + y*z + z*x <= 1e4 ) F[x*x + y*y + z*z + x*y + y*z + z*x ]++ ;
        }
      }
    }
    rep(i,n){
      cout << F[i] << endl ;
    }
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n,k;
    cin >> n >> k;
    vector<ll>p(n);
    vector<ll>c(n);
    for(ll i=0;i<n;i++){ 
        cin >> p[i];
        p[i]--;
    }
    for(ll i=0;i<n;i++) cin >> c[i];
    vector<vector<ll>>ord(n,vector<ll>(n+1,-1));
    vector<vector<ll>>s(n);
    vector<ll>cycle(n,1);
    vector<ll>l(n,0);
    for(ll i=0;i<n;i++){
        ll v=i;
        while(ord[i][v]==-1){
            ord[i][v]=s[i].size();
            s[i].push_back(v);
            v=p[v];
        }
        cycle[i]=s[i].size()-ord[i][v];
        l[i]=ord[i][v];
    }
    ll ans=-1e10;
    for(ll i=0;i<n;i++){
        ll sum=0;
        ll v=i;
        ll copy=k;
        if(cycle[i]>k){
            for(ll j=0;j<k;j++){
                sum+=c[v];
                v=p[v];
                ans=max(ans,sum);
            }
        }
        else {
            for(ll j=0;j<l[i];j++){
                sum+=c[v];
                v=p[v];
                ans=max(ans,sum);
            }
            ll roop=0;
            for(ll j=0;j<cycle[i];j++){
                sum+=c[v];
                roop+=c[v];
                v=p[v];
                ans=max(ans,sum);
            }
            if(roop<0) continue;
            ll kai=(k-l[i])/cycle[i];
            kai--;
            copy-=l[i]+(cycle[i]*(kai));
            roop*=(kai-1);
            sum+=roop;
            for(ll j=0;j<copy;j++){
                sum+=c[v];
                v=p[v];
                ans=max(ans,sum);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 414552
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007

using namespace std;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin>>n;
	
	int h[n];
	
	for(int i=0;i<n;i++) {
		cin>>h[i];
	}
	
	int dp[n];
	dp[0] = 0;
	dp[1] = abs(h[0]-h[1]);
	
	for(int i=2;i<n;i++) {
		dp[i] = min(dp[i-2]+abs(h[i-2]-h[i]),dp[i-1]+abs(h[i-1]-h[i]));
	}
	
	cout<<dp[n-1];
	
	return 0;
}


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

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++)
        if(i%3&&i%5)
            ans+=i;
    cout<<ans;
}


Measured memory_bytes: 3608
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){

    input!{
        a: usize,
        b: usize,
    }

    let sum = a+b;
    if sum==3{
        println!("3");
    } else if sum==5{
        println!("1");
    }  else {
        println!("2");
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define mp make_pair
#define gcd __gcd
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 1000000007
#define N 100005  //check the limits, man
const ll INF = 1e18;
int cnt[N];
int main()
{
    int i,n,a,x;
    in(n);
    rep(i,n)
        in(a),cnt[a]++;
    a=0,x=0;
    rep(i,N)
    {
        while(cnt[i]>=3)
            cnt[i]-=2;
        if(cnt[i])
            a++;
        if(cnt[i]==2)
            x++;
    }
    if(x&1)
        a--;
    out(a);
}






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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
#define MAXN 100  
ll L[MAXN];

ll dp(ll i){
  if(L[i] != LLINF)
    return L[i];
  else{
    L[i] = dp(i-1) + dp(i-2);
    return L[i];
  }
}

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

  ll n;
  cin >> n;

  REP(i, 100)
    L[i] = LLINF;
  L[0] = 2;
  L[1] = 1;

  cout << dp(n) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 10000
#define NOT_FOUND -1

int linearSearch(int[],int);

int n;

int main(){
    int q,count = 0;
    int S[MAX],T[MAX];

    scanf("%d",&n);
    for(int i = 0;i < n;i++)scanf("%d",&S[i]);

    scanf("%d",&q);
    for(int i = 0;i < q;i++)scanf("%d",&T[i]);

    for(int i = 0;i < q;i++)if(linearSearch(S,T[i]) >= 0)count++;

    printf("%d\n",count);

    return 0;
}

int linearSearch(int A[n],int key){
    int i = 0;
    A[n] = key;
    while(A[i] != key){
        i++;
    }
    if(i == n)return NOT_FOUND;
    return i;
}


Measured memory_bytes: 2128
#include<stdio.h>
#include<string.h>

int main(){
  char S[1000000];
  int i,z=0,o=0;
  scanf("%s",S);
  for(i=0;i<strlen(S);i++){
    if(S[i]=='0')
      z++;
    else
      o++;
  }
  
  if(z>o){
    printf("%d\n",o*2);
  }
  else
    printf("%d\n",z*2);
  return 0;
}


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

int main()
{
    int a,b,n1,n2,n3;
    while(~scanf("%d %d",&a,&b))
    {

        n1=a+b;
        n2=a-b;
        n3=a*b;

        if(n1>=n2&&n1>=n3)
            printf("%d\n",n1);
        else if(n2>=n1&&n2>=n3)
            printf("%d\n",n2);
        else if(n3>=n1&&n3>=n2)
            printf("%d\n",n3);

    }
    return 0;
}




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

Measured memory_bytes: 256
N, K = map(int, input().split())
h = [int(x) for x in input().split()]

INF = 1e9
dp = [INF] * N
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
    for j in range (1, K + 1):
        if i - j < 0:
            break;
        dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))

print(dp[N - 1])


Measured memory_bytes: 55008
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define MOD2 998244353
#define INF MOD
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int main() {
    int x;
    cin >> x;
    int ans = 0;
    if (x >= 400 && x <= 599) ans = 8;
    else if (x >= 600 && x <= 799) ans = 7;
    else if (x >= 800 && x <= 999) ans = 6;
    else if (x >= 1000 && x <= 1199) ans = 5;
    else if (x >= 1200 && x <= 1399) ans = 4;
    else if (x >= 1400 && x <= 1599) ans = 3;
    else if (x >= 1600 && x <= 1799) ans = 2;
    else if (x >= 1800 && x <= 1999) ans = 1;
    cout << ans << endl;  
}

Measured memory_bytes: 3612
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define inf 1000000007
#define P pair<int,int>
//P pa(114,514);   ,vector<P>vec(N,0);
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}
//cout << setprecision(123);
int main(){
  int N,ans=inf,ansans;
  bool ok=false;
  string s;
  cin>>s;
  N=s.size();

  REP(i,N){
    int a=1;
    for(int j=i+1;j<i+10;j++){   
      if(s[j]==s[i]){
        a++;
        if(j-i+1<2*a){
          ans=i+1;
          ansans=j+1;
          ok=true;
          break;
        }
      }
    }
    if(ok){
      break;
    }
  }
  
  if(ans==inf){
    ans=-1;
    ansans=-1;
  }


  cout << ans << " " << ansans << endl;
  
}

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

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  
  if(A==B){
    if(A!=C){
      cout << "Yes" << endl;
      return 0;
    }
  }
  if(A==C){
    if(A!=B){
      cout << "Yes" << endl;
      return 0;
    }
  }
  if(B==C){
    if(C!=A){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop(idx, N) for (auto idx(0); idx < N; ++idx)
using namespace std;


int main()
{
  int n, x, l, acm(1), nowl(0);
  cin >> n >> x;
  
  for (auto idx(0); idx < n; ++idx) {
    cin >> l;
    nowl += l;
    if (nowl <= x) {
      ++acm;
    }
  }
  cout << acm <<endl;
  return 0;
}


Measured memory_bytes: 256