akhauriyash/Code-Regression huggingface dataset:
n = int(input())
h_list = list(map(int, input().split()))
dp1, dp2, dp3 = 0, abs(h_list[1]-h_list[0]), 0
for i in range(2, n):
    if abs(h_list[i]-h_list[i-1]) + dp2 >= abs(h_list[i]-h_list[i-2]) + dp1:
        dp3 = abs(h_list[i]-h_list[i-2]) + dp1
    else:
        dp3 = abs(h_list[i]-h_list[i-1]) + dp2
    dp1 = dp2
    dp2 = dp3
print(dp2)

Measured memory_bytes: 13980
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 2e5 + 5;

int n;
int a[N], cache[N][4];
bool vis[N][4];

int dp(int idx, int have)
{
	if(idx > n)
	{
		if(have <= 1)
			return 0;
		return -1e18;
	}
	int &ans = cache[idx][have];
	if(vis[idx][have])
		return ans;
	vis[idx][have] = 1;
	if(!have)
		ans = a[idx] + dp(idx + 2, have);
	else
		ans = max(a[idx] + dp(idx + 2, have), dp(idx + 1, have - 1));
	return ans;
}

int32_t main()
{
	IOS;
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	int ans;
	if(n % 2)
		ans = max(dp(1, 2), dp(2, 1));
	else
		ans = max(dp(1, 1), dp(2, 0));
	cout << ans;
	return 0;
}

Measured memory_bytes: 16932
import io.StdIn.{readInt, readLine}

object Main extends App {
  val n = readInt

  var prev = 0
  var base = 1
  var square = base*base
  while(square <= n) {
    prev = square
    base += 1
    square = base*base
  }

  val result = prev
  println(result)

}

Measured memory_bytes: 54652
h, w = gets.chomp.split(' ').map(&:to_i)
n = gets.chomp.to_i
a = gets.chomp.split(' ').map(&:to_i)

b = a.map.with_index(1) { |m, i| [i] * m }.flatten

(0..(h - 1)).each do |i_h|
  bs = b[(i_h * w)...(i_h * w + w)]
  if (i_h % 2).zero?
    puts bs.join(' ')
  else
    puts bs.reverse.join(' ')
  end
end


Measured memory_bytes: 2940
#pragma region Macros
#include <bits/stdc++.h>
#define int long long
using ll = long long;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b+a); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(a) (a).begin(), (a).end()
using namespace std;
using P = pair<int, int>;
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#pragma endregion

int mod = 1000000007;

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

  int n,k;
  cin >> n >> k;

  int sum = 0;
  for (int i = k; i <= n+1; i++) {
    // min
    int min = i*(i-1)/2;

    // max
    int max = i*(2*n-i+1)/2;

    // sum += max - min + 1
    sum = (sum + max - min + 1) % mod;
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 3620
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(s)-1,i##_len=(int)(n);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int  Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}void hSwap(int x[], int i, int j)
{
	int temp;

	temp = x[i];
	x[i] = x[j];
	x[j] = temp;
}

void ShowData(int x[], int left, int right)
{
	int i;
	for (i = left; i <= right; i++)printf("%d  ", x[i]);
	printf("\n");
}
void QSort(int x[], int left, int right, int n) {
	int i, j;	//左端,右端
	int pivot;	//軸

	i = left;
	j = right;
	pivot = x[(left + right) / 2];

	while (1) {
		if (n > 0) {				//n>0なら昇順、n<=0なら降順
			while ((x[i] < pivot) && (i <= right))i++;	//軸値より大きい要素
			while ((pivot < x[j]) && (i <= right))j--;	//軸値より小さい要素
		}
		else {
			while ((x[i] > pivot) && (i <= right))i++;	//軸値より小さい要素
			while ((pivot > x[j]) && (i <= right))j--;	//軸値より大きい要素
		}
		if (i >= j)	break;
		hSwap(x, i, j);
		i++; j--;
	}
	//ShowData(x, left, right);

	if (left < i - 1)QSort(x, left, i - 1, n);
	if (j + 1 <  right)QSort(x, j + 1, right, n);
}

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

int main() {
	int x,y;
	scanf("%d%d", &x,&y);
	PRINTD(x+y/2);
}

Measured memory_bytes: 128
N, M = map(int, input().split())
path = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    path[A-1].append(B)
    path[B-1].append(A)
parent = [-1 for _ in range(N)]
parent[0] = 0

current_positions = [1]
while current_positions:
    next_positions = []
    for current_position in current_positions:
        for n_p in path[current_position - 1]:
            if parent[n_p - 1] == -1:
                parent[n_p - 1] = current_position
                next_positions.append(n_p)
    current_positions = next_positions

for v in parent:
    if v == -1:
        print('No')
        exit()

print('Yes')
for i in range(1, N):
    print(str(parent[i]))


Measured memory_bytes: 33720
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define IO ios::sync_with_stdio(false); cin.tie(0);
#define all(v) (v).begin(), (v).end()
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
int n, k;
int main() {
    IO;
 
    int n, k;
    cin >> n >> k;
    if (k == 0) {
        cout << 1ll * n * n;
        return 0;
    }
    ll res = 0;
    for (int b = k + 1; b <= n; b++) {
        int p = n / b;
        int r = n % b;
        res += 1ll * p * max(0, b - k) + 1ll * max(0, r - k + 1);
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 256
#include "stdio.h"
#include "math.h"
int putman(int n);
int main(int argc, char const *argv[])
{
	int i,j,num,tmp,flag;
	scanf("%d",&num);
	for(i=3;i<=num;i++){
		flag = 0;
		flag=putman(i);
		if(flag == 1)
			printf(" %d",i);
	}
	printf("\n");
	return 0;
}
int putman(int n){
	if(n%3 == 0)
		return 1;
	while(1){
		if(n%10 == 3)
			return 1;
		else if(n == 0)
			return 0;
		n = n/10;
	}
}


Measured memory_bytes: 600
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;




//ここから編集する


int main() {
    int N;
    int x;
    cin >> N >> x;
    vector<int> a(N);
    REP(i,0,N) cin >> a[i];
    ll ans = 0;
    for(int i = 1; i < N; ++i){
        if(a[i-1] + a[i] > x){
            int dec = min(a[i-1] + a[i] - x,a[i]);
            a[i] -= dec;
            ans += dec;
        }
        if(a[i-1] + a[i] > x){
            int dec = a[i-1] + a[i] - x;
            a[i-1] -= dec;
            ans += dec;
        }
    }
//    int i = N -1;
//    if(a[i-1] + a[i] > x){
//        int dec = min(a[i-1] + a[i] - x,a[i]);
//        a[i] -= dec;
//        ans += dec;
//    }
//    if(a[i-1] + a[i] > x){
//        int dec = a[i-1] + a[i] - x;
//        a[i-1] -= dec;
//        ans += dec;
//    }
    cout << ans << endl;

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define lint long long
#define pii pair<int, int>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
#define SZ(v) ((int)v.size())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define MINF(a) memset(a, 0x3f, sizeof(a))
#define POW(n) (1LL << (n))
#define POPCNT(n) (__builtin_popcount(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e, v); }
const lint MOD = 1000000007;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int N, D, X;
int A[110];

void _main() {
    cin >> N >> D >> X;
    int sum = X;
    REP(i, N) {
        cin >> A[i];
        sum += (D - 1) / A[i] + 1;
    }
    cout << sum << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        if (strchr(argv[1], 'i')) freopen("input.txt", "r", stdin);
        if (strchr(argv[1], 'o')) freopen("output.txt", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i = x; i < (int)(n); i++)
#define rep_ll(i,x,n) for(ll i = x; i < (ll)(n); i++)
using namespace std;
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
const long double PI = (acos(-1));
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1};
ll mod = 1000000007;
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a>=b+c) cout << 0;
    else cout << c-(a-b);
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
int main(){
	int n; cin>>n;
	string s; cin>>s;
	if(n%2==0 and s.substr(0,n/2)==s.substr(n/2)) cout<<"Yes";
	else cout<<"No";


}


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

int main()
{
	int n,l;
	cin>>n>>l;
	int sum=0,ans=0,mn=99999999;
	for(int i=1;i<=n;i++)
	sum+=l+i-1;
	for(int i=1;i<=n;i++)
	if(mn>abs(l+i-1))
	{
		mn=abs(l+i-1);
		ans=sum-(l+i-1);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 384
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int []n = new int[3];
		for(int i = 0; i < 3; i++) {
			n[i] = scan.nextInt();
		}
		scan.close();
		Arrays.sort(n);
		for(int i = 0; i < 2; i++) {
			System.out.print(n[i] + " ");
		}
		System.out.println(n[2]);
	}
}


Measured memory_bytes: 26344
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007;
void boost(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int main(){
    boost();
    ll n,m;
    cin >> n >> m;
    ll arr[n][m],dp[n][m],i,j;
    for(i=0;i<n;i++)
    for(j=0;j<m;j++){
        dp[i][j]=0;
        char a;
        cin >> a;
        if(a=='.')
        arr[i][j]=0;
        else if(a=='#')
        arr[i][j]=1;
        
    }
    
    if(arr[0][0]==0)
    dp[0][0]=1;
    
    for(i=1;i<n;i++)
    if(arr[i][0]==0)
    dp[i][0] = dp[i-1][0];
    
    for(i=1;i<m;i++)
    if(arr[0][i]==0)
    dp[0][i] = dp[0][i-1];
    
    for(i=1;i<n;i++){
        for(j=1;j<m;j++){
            if(arr[i][j]==0){
            dp[i][j] = dp[i-1][j]+dp[i][j-1];
            dp[i][j] = dp[i][j]%mod;
            }
        }
    }
    dp[n-1][m-1]=dp[n-1][m-1]%mod;
    cout << dp[n-1][m-1] << endl;
}

Measured memory_bytes: 19268
import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
from collections import defaultdict #d = defaultdict(int) d[key] += value
'''
N = ii()
A = li()
 
right = 1
cnt = 0
'''
'''
mae = A[0]
for left in range(N):
    if left==right:
        right += 1
    mae = A[right-1]
    while right < N and A[right] > mae:
        mae = A[right]
        right += 1
    
    #print(left, right, mae)
    cnt += right-left
'''
'''
for left in range(N):
    while right < N and A[right] > A[right-1]:
        right += 1
 
    cnt += right-left
    if left+1 == right:
        right += 1
 
print(cnt)
'''

N = ii()
S = [input() for i in range(N)]
d = defaultdict(int)

for word in S:
    d[word] += 1


d2 = sorted(d.items(), key=lambda x:x[1], reverse=True)

num = d2[0][1]
ans = []
for i in range(len(d2)):
    if num != d2[i][1]:
        break
    ans.append(d2[i][0])

for word in sorted(ans):
    print(word)

Measured memory_bytes: 49240
#include <stdio.h>

int check(int a, int b){
    int i;
    for (i=1;i<1001;i++){
        if ((a<=i*0.08)&&(a+1>i*0.08)){
            if ((b<=i*0.1)&&(b+1>i*0.1)){
                return i;
            }
        }
    }
    return -1;
}

int main(void){
    int a, b, ans;
    scanf("%d %d", &a, &b);
    ans = check(a, b);
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 128
n=int(input())
i=1
while(i<=n):
    x=i
    if(int(x%3)==0):
        print(" "+str(i),end='')
    elif(int(x%10)==3):
        print(" "+str(i),end='')
    else:
        while(True):
            if(int(x%10)==3):
                print(" "+str(i),end='')
                break
            else:
                x=int(x/10)
                if(x==0):
                    break
    i+=1
print()


Measured memory_bytes: 5876
#include<cstdio>
int main(){
	int n;
	scanf("%d",&n);
	char a[n]={};
	char b[n]={};
	scanf("%s%s",a,b);
	int l=0;
	int c[n]={};
	for(int i=0;i<n;i++){
		if(a[i]==b[i]){
			c[l]=1;
			l++;
		}else{
			c[l]=2;
			l++;
			i++;
		}
	}
	long long int ans;
	if(c[0]==1)ans=3;
	else ans=6;
	for(int i=1;i<l;i++){
		if(c[i-1]==1)ans=(ans*2)%1000000007;
		if(c[i-1]==2&&c[i]==2)ans=(ans*3)%1000000007;
	}
	printf("%lld\n",ans);
	return 0;
}
	

Measured memory_bytes: 128
#include<bits/stdc++.h>    
using namespace std;
#define ll long long 
#define pi pair<ll,ll>
#define pd pair<ld,ld>
#define pb push_back
#define inf 1e18
#define mod 1000000007
#define en '\n'
#define ld long double
#define ff first
#define ss second
#define ull unsigned long long 
#define lb lower_bound
#define ub upper_bound
#define fr(a,b,c) for(ll a = b ; a <= c ; ++a )
#define frn(a,b,c) for(ll a = b ; a >= c ; a -- )
#define fra(a,b) for(auto a: b)
#define ms(a) memset(a,0,sizeof a);
#define alla(a) a,a+n
#define allv(a) a.begin(),a.end()
#define size(a) (ll)a.size()
#define getMat(x,n,m,val) vector<vector<ll>>x(n,vector<ll>(m,val))
const ll MAXN = 2e5+5;
#define pii 3.14159265358979323846 
ll pw(ll b, ll r, ll md){
	ll ans = 1;
	while(r){
		if(r&1)ans = (ans*b)%md;
		b = (b*b)%md;
		r>>=1;
	}
	return ans;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll a;cin>>a;
	cout<<a+a*a+a*a*a<<en;
	return 0 ;
}

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

int main() {
  string S;
  cin >> S;
char A=S.at(0);
char B=S.at(1);
char C=S.at(2);
char D=S.at(3);
if(A==B&&A==C&&A==D){
  cout<<"No"<<endl;
}
else if(A==B){
  if (C==D) {
    cout << "Yes" << endl;
  }
  else{
    cout<<"No"<<endl;
  }
}
else if(A==C){
  if (B==D) {
    cout << "Yes" << endl;
  }
  else{
    cout<<"No"<<endl;
  }
}
else if(A==D){
  if (B==C) {
    cout << "Yes" << endl;
  }
  else{
    cout<<"No"<<endl;
  }
}
else{
  cout<<"No"<<endl;
}
}

Measured memory_bytes: 256
import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache, reduce
from operator import xor
from heapq import heappush, heappop
INF = float("inf")
sys.setrecursionlimit(10**7)

# 4近傍（右, 下, 左, 上）
dy4, dx4 = [0, -1, 0, 1], [1, 0, -1, 0]


def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def ceil(a, b): return (a + b - 1) // b


def main():
    a, b = map(int, input().split())
    print(ceil((a + b), 2))


if __name__ == '__main__':
    main()


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

int main()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  
  int ans = 0;
  for(int i = 0; i < n; i++){
    if(s[i] == 'A'){
      if(s[i+1] == 'B' && s[i+2] == 'C'){
        ans++;
      }
    }//if
  }//for
  
  cout << ans << endl;
}

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

using namespace std;

#define int long long

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

	int n;
	cin >> n;
	vector<int> vec(n);
	for (int i = 0; i < n; i++)
		cin >> vec[i];
	int cnt = 0;
	for (int i = 1; i < n - 1; i++)
	{
		vector<int> help {vec[i - 1], vec[i], vec[i + 1]};
		sort(help.begin(), help.end());
		if (help[1] == vec[i])
			cnt++;
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
import  java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int a = scan.nextInt();
      	long prepre = 2;//n-2
      	long pre = 1;//n-1
      	long now = 3;
      	if(a == 0){
        	System.out.print(prepre);
        }
      	else if(a == 1){
        	System.out.print(pre);
        }
      	else{
      		for(int i = 2; i < a; i++){
        		prepre = pre;
          		pre = now;
              	now = prepre + pre;
       	 	}
          	System.out.print(now);
        }
    	
    }
 
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <algorithm>
#include <string>
using namespace std;

int m, n;
char g[105][105];
int next[4][2] = {{-1,0},{1,0},{0,1},{0,-1}};

bool isRight(int x, int y)
{
    return (x < n && x >= 0 && y < m && y >= 0);
}

void dfs(int x, int y)
{
    char temp = g[x][y];
    g[x][y] = 'X';
    for(int i = 0; i < 4; i++)
    {
        int tx = x + next[i][0];
        int ty = y + next[i][1];
        if(isRight(tx, ty) && g[tx][ty] == temp)
        {
            dfs(tx, ty);
        }
    }
}

int main()
{
    scanf("%d%d", &n, &m);
    while(n != 0 && m != 0)
    {
        getchar();
        for(int i = 0; i < n; i++)
        {
            scanf("%s", g[i]);
        }
        int ans = 0;
        for(int i = 0; i < n; i++)
        {
            for(int j = 0; j < m; j++)
            {
                if(g[i][j] != 'X')
                {
                    dfs(i, j);
                    ans++;
                }
            }
        }
        printf("%d\n", ans);
        scanf("%d%d", &n, &m);
    }
    return 0;
}



Measured memory_bytes: 3064
#include <stdio.h>

int main() {
    int n;
    while (scanf("%d", &n) != EOF) {
        int sum = 0;
        for (int i = 0; i < n; ++i) {
            int x;
            scanf("%d", &x);
            sum += (x <= 1 ? 0 : x - 1);
        }
        printf("%d\n", sum);
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
	int N;
	cin >> N;
    vector<int> L(N);
    rep (i, N) {
        cin >> L[i];
    }
    sort(all(L));

    ll ans = 0;
    rep (i, N-1) {
        for (int j = i+1; j < N; j++) {
            int p = L[i] + L[j];
            int idx = lower_bound(L.begin(), L.end(), p) - L.begin();
            idx -= j + 1;
            ans += idx;
        }
    }

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


Measured memory_bytes: 256
N , M = map(int,input().split())
L = []
transit = set()
for _ in range(M):
    t = tuple(map(int,input().split()))
    L.append(t)
for x in L :
    if x[1] == N:
        transit.add(x[0])
for x in L:
    if x[0] == 1:
        if x[1] in transit:
            print("POSSIBLE")
            quit()
print("IMPOSSIBLE")


Measured memory_bytes: 81368
// E - Handshake

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int MOD = 1e9 + 7;

const ll MAX_N = 100005;
const ll MAX_A = 100000;

ll A[MAX_N];
ll A_csum[MAX_N]; // 値が大きい側からの累積和
ll N, M;

// t <= Ax + Ay となる組み合わせの数を求める
// Ax = A[i]ごとに二分探索で数を求めて合計する -> O(NlogN)

ll get_n_comb(ll t) {
	ll result = 0;
	for (int i=0; i<N; i++) {
		ll Ay = t - A[i];
		ll idx = lower_bound(A, A+N, Ay) - A; // t <= Ax + Ay となる最初のインデックス
		result += (N - idx);
	}

	//cout << "t=" << t << " -> comb=" << result << endl;

	return result;
}

// t <= Ax + Ay となる組み合わせの数がk以上となる最大のtを求める
ll get_max_t(ll k) {
	ll ok = 0;
	ll ng = 2 * MAX_A + 1;

	while(ng - ok > 1) {
		ll trying = (ok + ng) / 2;

		if (get_n_comb(trying) >= k) {
			ok = trying;
		} else {
			ng = trying;
		}
	}

	return ok;
}

// t <= Ax + Ay となる組み合わせについて総和を求める
ll get_sum_ge(ll t) {
	ll result = 0;
	for (int i=0; i<N; i++) {
		ll Ay = t - A[i];
		ll idx = lower_bound(A, A+N, Ay) - A; // t <= Ax + Ay となる最初のインデックス
		result += (A[i] * (N - idx)) + A_csum[idx]; // Axの和 + Ayの和
	}

	//cout << "t=" << t << " sum=" << result << endl; // **** debug ****

	return result;
}

int main() {

	cin >> N >> M;

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

	sort(A, A+N);

	// 値が大きい側からの累積和を作成（get_sum_ge()で用いる）
	A_csum[N-1] = A[N-1];
	for (int i=N-2; i>=0; i--) {
		A_csum[i] = A[i] + A_csum[i+1];
	}

	// t <= Ax + Ay となる組み合わせの数がM以上となる最大のtを求める
	ll max_t = get_max_t(M);
	//cout << "max_t = " << max_t << endl; // **** debug ****

	// get_sum_ge(t)では t == Ax + Ay となる握手が複数存在する場合に余分な握手が含まれてしまうので
	// （(t == max_t) の和） + （(t >= max_t + 1) の和）で求める
	ll n_max_t = M - get_n_comb(max_t + 1); // t == max_t となる場合の数
	ll ans = (max_t * n_max_t) + get_sum_ge(max_t + 1);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading;

class Program
{

    static int Max_N = 200000 + 1;
    static void Main(string[] args)
    {
        string[] arr1 = Console.ReadLine().Split(' ').ToArray();
        int[] arr2 = Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
        string str = Console.ReadLine();
        if (arr1[0].Equals(str)) arr2[0]--;
        else arr2[1]--;
        Console.WriteLine(arr2[0] + " " + arr2[1]);


    }




}

Measured memory_bytes: 28292
#include <stdio.h>

int m, n, a[101][101], d[4][2] = {0, 1, 0, -1, 1, 0, -1, 0};

void dfs(int x, int y, int z)
{
	a[x][y] = 1;
	int i, b, c;
	for (i = 0; i < 4; i++)
	{
		b = x + d[i][0];
		c = y + d[i][1];
		if (b >= 0 && b < m && c >= 0 && c < n && a[b][c] == z)
			dfs(b, c, z);
	}
}

int main()
{
	int i, j, num;
	char s[101];
	while (scanf("%d%d", &m, &n) && (m || n))
	{
		for (i = 0; i < m; i++)
		{
			scanf("%s", s);
			for (j = 0; j < n; j++)
				if (s[j] == '#')
					a[i][j] = 0;
				else if(s[j] == '*')
					a[i][j] = -1;
				else
					a[i][j] = -2;
		}
		for (i = num = 0; i < m; i++)
			for (j = 0; j < n; j++)
				if (a[i][j] < 1)
				{
					num++;
					dfs(i, j, a[i][j]);
				}
		printf("%d\n", num);
	}
	return 0;
}

Measured memory_bytes: 1112
from math import factorial as fact
import math
import fractions
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(n,r))

def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
def factorization(n):
	tmp=n
	count=0
	for i in range(2,int(n**0.5)+2):
		if tmp%i==0:
			cnt=0
			while tmp%i==0:
				cnt+=1
				tmp//=i
			count+=1
	if tmp!=1:
		count+=1

	return count
			


s,w=input2()
if w >=s:
	print("unsafe")
else:
	print("safe")

# a,b,c,d=input2()

# for i in range(1,101):
# 	if i%2==1:
# 		c-=b
# 		if c<=0:
# 			print("Yes")
# 			break
# 	else:
# 		a-=d
# 		if a<=0:
# 			print("No")
# 			break

	







Measured memory_bytes: 27272
#include<cstdio>
#include<iostream>

using namespace std;
typedef long long ll;

const ll INF = 1LL << 50;//极大值 


 int main() {
 	int x,y;
 	cin>>x>>y;
 	if((y==1||y==3||y==5||y==7||y==8||y==10||y==12)&&(x==1||x==3||x==5||x==7||x==8||x==10||x==12)){
 		printf("Yes");
	 }
	 else if((y==4||y==6||y==9||y==11)&&(x==4||x==6||x==9||x==11)){
 		printf("Yes");
	 }
	 else if((y==2)&&(x==2)){
 		printf("Yes");
	 }
	 else cout<<"No";
 	return 0;
 }

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char input = in.next().charAt(0);
        char output = alphabet(input);
        System.out.println(output);
    }

    // alpha = 'B' -> 'A'
    // alpha = 'z' -> 'a'
    public static char alphabet(char alpha) {
        char result = 'a';
        int ascii = (int) alpha;
        if (ascii >= 65 && ascii <= 90) {
            result = 'A';
        } else {
            result = 'a';
        }
        return result;
    }

}


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

ll MAX_A = 1e9;
ll n, k, s;

int main()
{
    cin >> n >> k >> s;
    vector<int> ans(n, MAX_A);
    if(s == MAX_A)
    {
        rep(i,n-k) ans[i] = 1;
    }
    else
    {    
        rep(i,k) ans[i] = s;
    }
    rep(i,n) cout << ans[i] << ((i == n - 1)? "\n" : " ");


    return 0;
}

Measured memory_bytes: 3720
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)
int main(){
    int A,P;
    cin>>A>>P;
    cout<<(A*3+P)/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

struct mint {
    ll x;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// 2項係数を求める
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

mint choose(int n, int a){
    mint x = 1, y = 1;
    rep(i,a){
        x *= n-i;
        y *= i+1;
    }
    return x/y;
}

int main(){
    
    ll n,a, b;
    cin >> n >> a >> b;

    mint ans = mint(2).pow(n);
    ans -= 1;
    ans -= choose(n,a);
    ans -= choose(n,b);
    cout << ans << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n); i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)	
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define REVSORT(c) SORT(c);REVERSE(c)
#define ALL(x) (x).begin(),(x).end()
#define LOOP while(true)
#define INF 1e9
const long long MOD = 1000000007;
typedef long long ll;

int main(){
	string a, b, c;
	cin >> a >> b >> c;
	cout << a[0] << b[1] << c[2] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(b<=a&&a<=c){
		printf("%d %d %d\n",b,a,c);
	}else if(a<=c&&c<=b){
		printf("%d %d %d\n",a,c,b);
	}else if(b<=c&&c<=a){
		printf("%d %d %d\n",b,c,a);
	}else if(c<=a&&a<=b){
		printf("%d %d %d\n",c,a,b);
	}else if(c<=b&&b<=a){
		printf("%d %d %d\n",c,b,a);
	}else{
		printf("%d %d %d\n",a,b,c);
	}
		
	return 0;
}

Measured memory_bytes: 596
# import bisect
# from collections import Counter, defaultdict, deque, namedtuple
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n, m = list(map(int,ipti().split()))

    ball = [1] * n
    ball[0] = -1

    for i in range(m):
        x, y = list(map(int,ipti().split()))
        x ,y = x-1, y-1

        if ball[x] < 0:
            ball[x] += 1
            if ball[y] >= 0:
                ball[y] += 1
                ball[y] *= -1
            else:
                ball[y] -= 1
        else:
            ball[x] -= 1
            if ball[y] >= 0:
                ball[y] += 1
            else:
                ball[y] -= 1

    ans = 0

    for i in range(n):
        if ball[i] < 0:
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 42332
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

typedef long long ll;
using namespace std;

bool graph[8][8];

int dfs(int v, int N, bool visited[8]) {
  bool a_visited = true;
  for (int i = 0; i < N; i++) {
    if (visited[i] == false) {
      a_visited = false;
    }
  }

  if (a_visited) {
    return 1;
  }

  int ret = 0;

  for (int i = 0; i < N; i++) {
    if (graph[v][i] == false)
      continue;
    if (visited[i])
      continue;
    visited[i] = true;
    ret += dfs(i, N, visited);
    visited[i] = false;
  }
  return ret;
}

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

  for (int i = 0; i < M; i++) {
    int A, B;
    cin >> A >> B;
    graph[A - 1][B - 1] = graph[B - 1][A - 1] = true;
  }

  bool visited[8];
  for (int i = 0; i < N; i++) {
    visited[i] = false;
  }

  visited[0] = true;
  cout << dfs(0, N, visited) << endl;
  return 0;
}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,ans,a[100005];
bool b[100005];
int main(){
	for(int i=0;i<100005;i++)
		a[i]=1;
	b[0]=true;
	cin >> n >> m;
	for(int i=0;i<m;i++){
		int x,y;
		cin >> x >> y;
		x--,y--;
		if(b[x]){
			b[y]=true;
			if(a[x]<=1)b[x]=false;
		}
		a[x]--,a[y]++;
	}
	for(int i=0;i<n;i++)
		if(b[i])ans++;
	cout << ans;
	return 0;
}

Measured memory_bytes: 768
def main():
    R, G, B, N = map(int, input().split())
    ans = 0

    for r in range(N//R + 1):
        for g in range(N//G + 1):

            res = (N - (R*r + G*g)) 

            if res < 0 :
                break

            if res >= 0 and res % B == 0:
                ans += 1

    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
use std::collections::BinaryHeap;
fn main() {
    let mut count_line = String::new();
    std::io::stdin().read_line(&mut count_line).ok();
    let mut count_it = count_line.trim().split_whitespace();
    let line_count:u32 = count_it.next().unwrap().parse().unwrap();
    let amount:u32 = count_it.next().unwrap().parse().unwrap();
    let values:Vec<(i64,i64,i64)> = (0..line_count).map(|_| {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        let mut it = s.split_whitespace();
        (it.next().unwrap().parse().unwrap(),it.next().unwrap().parse().unwrap(),it.next().unwrap().parse().unwrap())
    }).collect();
    let mut ppp:BinaryHeap<i64> = values.iter().map(|v| v.0 + v.1 + v.2).collect();
    let mut ppp_val = 0;
    for _ in 0..amount{
        ppp_val = ppp_val + ppp.pop().unwrap();
    }
    let mut ppm : BinaryHeap<i64> = values.iter().map(|v| v.0 + v.1 - v.2).collect();
    let mut ppm_val = 0;
    for _ in 0..amount{
        ppm_val = ppm_val + ppm.pop().unwrap();
    }
    let mut pmp:BinaryHeap<i64> = values.iter().map(|v| v.0 - v.1 + v.2).collect();
    let mut pmp_val = 0;
    for _ in 0..amount{
        pmp_val = pmp_val + pmp.pop().unwrap();
    }
    let mut pmm : BinaryHeap<i64> = values.iter().map(|v| v.0 - v.1 - v.2).collect();
    let mut pmm_val = 0;
    for _ in 0..amount{
        pmm_val = pmm_val + pmm.pop().unwrap();
    }
    let mut mpp:BinaryHeap<i64> = values.iter().map(|v| -v.0 + v.1 + v.2).collect();
    let mut mpp_val = 0;
    for _ in 0..amount{
        mpp_val = mpp_val + mpp.pop().unwrap();
    }
    let mut mpm : BinaryHeap<i64> = values.iter().map(|v| -v.0 + v.1 - v.2).collect();
    let mut mpm_val = 0;
    for _ in 0..amount{
        mpm_val = mpm_val + mpm.pop().unwrap();
    }
    let mut mmp:BinaryHeap<i64> = values.iter().map(|v| -v.0 - v.1 + v.2).collect();
    let mut mmp_val = 0;
    for _ in 0..amount{
        mmp_val = mmp_val + mmp.pop().unwrap();
    }
    let mut mmm : BinaryHeap<i64> = values.iter().map(|v| -v.0 - v.1 - v.2).collect();
    let mut mmm_val = 0;
    for _ in 0..amount{
        mmm_val = mmm_val + mmm.pop().unwrap();
    }
    println!("{}", vec!(ppp_val,ppm_val,pmp_val,pmm_val,mpp_val,mpm_val,mmp_val,mmm_val).iter().fold(0,|acc,x| if acc >= *x {acc} else {*x}));
}


Measured memory_bytes: 4352
// ALDS1_14_A.cpp
// String Search - Naive String Search

#include <iostream>
#include <string>
using namespace std;

int main()
{
    string P;
    string T;
    cin >> T >> P;

    for (int i = 0; i + P.size() <= T.size(); i++) {
        bool found = true;
        for (int j = 0; j < P.size(); j++) {
            if (P[j] != T[i + j]) {
                found = false;
                break;
            }
        }
        if (found) cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 3224
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;


int main(void)
{
	double l;

	while(scanf("%lf", &l)==1)
	{
		double x=l/3;
		printf("%.8f\n", x*x*x);
	}
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <queue>
#include <assert.h>   
#include <vector>
#include <algorithm>
#include <time.h>
#include <numeric>
#include <string>
#include <cstring>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
#include <numeric>
#include <deque>
#include <iomanip>
#include <cstdlib>
#include <climits>
#include <cmath>
#include <cstdio>
using namespace std;


//#define double long double
#define int long long
//#define int unsigned long long

#define ll long long
#define ld long double 
#define pi pair<int, int> 
#define pl pair<ll,ll>  
#define pd pair<ld,ld> 
#define str string  
#define mp make_pair
#define vi vector<int> 
#define vl vector<ll> 
#define vd vector<ld> 
#define vs vector<str> 
#define vpi vector<pi> 
#define vpl vector<pl> 
#define vpd vector<pd> 
#define si set<int> 
#define FF(i,j,n) for(signed i=j;i<=n;i++)  
#define DD(i,j,n) for(signed i=j;i>=n;i--) 
#define F(i,j,n) for(signed i=j;i<n;i++)   
#define D(i,j,n) for(signed i=j;i>n;i--) 
#define mem(a,b) memset(a,b,sizeof(a))
#define ndl cout << endl
#define ull unsigned long long 

const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;


#define sz(x) (signed)x.size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend() 
#define rsz resize
#define ins insert 
#define ft front() 
#define bk back() 
#define X first
#define Y second
#define pf push_front 
#define pb push_back
#define eb emplace_back 
#define lb lower_bound 
#define ub upper_bound 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);


const int mod = 1e9 + 7;

ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int pct(int x) { return __builtin_popcount(x); } 
int bit(int x) { return 31-__builtin_clz(x); } // floor(log2(x)) 
int cdiv(int a, int b) { return a/b+!(a<0||a%b == 0); } // division of a by b rounded up, assumes b > 0 


//DEBUG, compile with -DLOCAL
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
  cerr << to_string(h); if (sizeof...(t)) cerr << ", ";
  DBG(t...); }
#ifdef LOCAL 
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#define HERE cout << "===GOTHERE===" << endl
#else
#define dbg(...) 42
#define HERE 42
#endif


 /* ============== END OF HEADER ============== */





const int maxn = 1e5*3+20;

int n,_,q,k;

void solve(){
	int x; cin >> x;
	FF(i,-120,120){
		FF(j,-120,120){
			if(i*i*i*i*i - j*j*j*j*j == x){
				cout << i << " " << j;
				exit(0);
			} 
		}
	}
}

signed main(){
  //clock_t t1 = clock();  
	IOS
	solve();
  
  //cout << "THE ALGORITHM TOOK: " << (clock() - t1) * 1.0 / CLOCKS_PER_SEC * 1000 << "ms"<< endl;
	return 0;
}

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

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b && a!=c)
      cout<<"Yes";
  	else if(a==c && a!=b)
      cout<<"Yes";
  else if(b==c && a!=b)
    cout<<"Yes";
  else
    cout<<"No";
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# @Time    : 2020/3/1 19:59
# @Author  : DIRICHLET
# @File    : main.py
a=[]
def myin(fun=int):
    global a
    a=list(map(fun,input().split()))
#myin(int)
a,b=map(int,input().split())
oner=(a+1)/0.08
if a%2==0:
    oner=a//2*25+13
    onel=a//2*25
else:
    oner=(a+1)/2*25
    onel=(a-1)//2*25+13
#*25/2
twol=b*10
twor=b*10+10
l=[[onel,oner],[twol,twor]]
if l[0][0]>l[1][0]:
    l = [[twol, twor],[onel, oner], ]

if l[1][0]<l[0][1]:
    print(l[1][0])
else:
    print(-1)

#print(a)
#[25,37.5) [20,30)
#[19-20) [99-100) 99.5-18.5=81/0.02=4050
#(231.35,243.75] (985,995]
#

Measured memory_bytes: 3064
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

int main (void) {
    int a, b;
    scanf("%d%d", &a, &b);
    if ( a+b == 3 )
        printf("3\n");
    else if ( a+b == 4 )
        printf("2\n");
    else if ( a+b == 5 )
        printf("1\n");
    else
        assert(0);
    return EXIT_SUCCESS;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin>>n;
    string s="";
    while(n>0){
        n--;
        s.insert(s.begin(),(char)(n%26+'a'));
        n/=26;
    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 3596
#include"bits/stdc++.h"
using namespace std;

int main()
{
    int w,h;
    char c;
    cin >> w >> h >> c;
    cout << "+";
    for(int i=0;i<w-2;i++)
        cout << "-";
    cout << "+" << endl;

    for(int i=0;i<(h-1)/2-1;i++){
        cout << "|";
        for(int j=0;j<w-2;j++) cout << ".";
        cout << "|" << endl;
    }

    cout << "|";
        for(int j=0;j<(w-1)/2-1;j++) cout << ".";
        cout << c ;
        for(int j=0;j<(w-1)/2-1;j++) cout << ".";
    cout << "|" << endl;

    for(int i=0;i<(h-1)/2-1;i++){
        cout << "|";
        for(int j=0;j<w-2;j++) cout << ".";
        cout << "|" << endl;
    }

    cout << "+";
    for(int i=0;i<w-2;i++)
        cout << "-";
    cout << "+" << endl;
    return 0;
}



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

using namespace std;

const int N=505,inf=1e9;

int n,m,h,w;

int main(){
	scanf("%d%d%d%d",&n,&m,&h,&w);
	if(n%h==0&&m%w==0)puts("No"),exit(0);
	puts("Yes");
	for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)printf("%d%c",i%h||j%w?4000:3999-4000*w*h," \n"[j==m]);
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
signed main(signed argc, char* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    const int MOD = 1000000007;
	int n;
	cin>>n;
	vector<vector<int>> dp(n,vector<int>(n,0));
	priority_queue<P> que;
	rep(i,n){
		int in;
		cin>>in;
		que.emplace(in,i);
	}
	rep(i,n-1){
		P it=que.top();que.pop();
		rep(j,i+2){
			int l=j,r=n-2-(i-l);
			if(l!=0){
				dp[l][r]=max(dp[l][r],dp[l-1][r]+it.first*abs(it.second-l+1));
			}
			if(r+1!=n){
				dp[l][r]=max(dp[l][r],dp[l][r+1]+it.first*abs(r+1-it.second));
			}
		}
	}
	int mx=0;
	rep(i,n)mx=max(mx,dp[i][i]+que.top().first*abs(que.top().second-i));
	cout<<mx<<endl;
}


Measured memory_bytes: 34832
#include <bits/stdc++.h>
#define INF (1LL<<61)
#define int long long

using namespace std;

typedef pair<int, int> pii;

struct edge {
  int to, cost;
  edge() {}
  edge(int pto, int pcost) {
    to = pto;
    cost = pcost;
  }
};

signed main() {
  int n, k;
  while (cin >> n >> k, n) {
    vector<edge> g[105];

    for (int i = 0; i < k; ++i) {
      int type;
      cin >> type;
      if (type == 0) {
	int a, b, d[105];
	fill(d, d + 105, INF);
	cin >> a >> b;
	d[a] = 0;

	priority_queue<pii, vector<pii>, greater<pii>> q;
	q.push(pii(0, a));

	while(q.size()) {
	  pii p = q.top();
	  q.pop();
	  int v = p.second;
	  if (d[v] < p.first) continue;

	  for (int j = 0; j < g[v].size(); ++j) {
	    edge e = g[v][j];
	    if (d[e.to] <= p.first + e.cost) continue;
	    d[e.to] = p.first + e.cost;
	    q.push(pii(d[e.to], e.to));
	  }
	}

	cout << ((d[b] == INF) ? -1 : d[b]) << endl;
      } else {
	int c, d, e;
	cin >> c >> d >> e;
	g[c].push_back(edge(d, e));
	g[d].push_back(edge(c, e));
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()


using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;

const int Z = 30000;
bool dpx[Z];
bool dpy[Z];
bool tmp[Z];

int main(){
    dpx[0] = dpy[0] = true;
    string s;
    int x, y;
    cin >> s >> x >> y;
    const int len = s.size();
    int z = 0;
    while(z < len && s[z] != 'T'){
        z++;
    }
    
    x -= z;
    if(s[z] == 'T')z++;
    int cnt = 0;
    s += "T";
    int t = 0;              //0のときx, 1のときy
    for(; z <= len; z++){
        if(s[z] == 'T'){
            t ^= 1;
            fill(tmp, tmp + Z, false);

            rep(i, Z){
                if(t){
                    if(!dpy[i])continue;
                    tmp[i + cnt] = tmp[abs(i - cnt)] = true;
                }
                else {
                    if(!dpx[i])continue;
                    tmp[i + cnt] = tmp[abs(i - cnt)] = true;
                }
            }
            cnt = 0;
            swap(tmp, t ? dpy : dpx);
        }
        else cnt++;
    }
    if(dpx[abs(x)] && dpy[abs(y)])cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<long long> a(N);

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

    long long tmp = a[0];
    for(int i=1; i<N; ++i){
        tmp = tmp ^ a[i];
    }
    
    for(int i=0; i<N; ++i){
        long long ans = tmp ^ a[i];
        cout << ans << " "; 
    }

    cout << endl;
}

Measured memory_bytes: 4796