akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main{
	static final double EPS = 0.00000000001;
	static final int COUNTER_CLOCKWISE = 1;
	static final int CLOCKWISE = -1;
	static final int ONLINE_BACK = 2;
	static final int ONLINE_FRONT = -2;
	static final int ON_SEGMENT = 0;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<Point> s = new ArrayList<Point>();
		for(int i = 0; i < n; i++) {
			s.add(new Point(sc.nextInt(), sc.nextInt()));
		}
		sc.close();
		List<Point> l = andrewScan(s);
		System.out.println(l.size());
		for(int i = 0; i < l.size(); i++) {
			System.out.println((int)l.get(i).x + " " + (int)l.get(i).y);
		}
	}
	static List<Point> andrewScan(List<Point> s){
		List<Point> u = new ArrayList<Point>();
		List<Point> l = new ArrayList<Point>();
		if(s.size() < 3) return s;
		Collections.sort(s, new MyComp(1));
//		for(int i = 0; i < s.size(); i++) {
//			System.out.printf("%d %d %d\n", i, s.get(i).x, s.get(i).y);
//		}
		// x が小さいものから2つ u に追加
		u.add(s.get(0));
		u.add(s.get(1));
		// x が大きいものから2つ l に追加
		l.add(s.get(s.size() - 1));
		l.add(s.get(s.size() - 2));

		// 凸包の上部を生成
		for(int i = 2; i < s.size(); i++) {
			for(int n = u.size(); n >= 2 && ccw(u.get(n - 2), u.get(n - 1), s.get(i)) != CLOCKWISE; n--) {
				u.remove(u.size() - 1);
			}
			u.add(s.get(i));
		}

		// 凸包の下部を生成
		for(int i = s.size() - 3; i >= 0; i--) {
			for(int n = l.size(); n >= 2 && ccw(l.get(n - 2), l.get(n - 1) , s.get(i)) != CLOCKWISE; n--) {
				l.remove(l.size() - 1);
			}
			l.add(s.get(i));
		}

		// 時計回りになるように凸包の点を列に生成
		Collections.reverse(l);
		for(int i = u.size() - 2; i >= 1; i--) {
			l.add(u.get(i));
		}
		return l;
	}
	static class Point{
		double x, y;
		Point(double x, double y){
			this.x = x;
			this.y = y;
		}
	}
	static class MyComp implements Comparator<Point>{
		int sign;
		MyComp(int sign) {
			this.sign = sign;
		}
		public int compare(Point p1, Point p2) {
			if(p1.y < p2.y) {
				return -1 * sign;
			}else if(p1.y == p2.y) {
				if(p1.x < p2.x) {
					return -1 * sign;
				}else if(p1.x == p2.x) {
					return 0;
				}else {
					return 1 * sign;
				}
			}else {
				return 1 * sign;
			}
		}
	}

	static int ccw(Point p0, Point p1, Point p2) {
		Point a = vec(p0, p1);
		Point b = vec(p0, p2);
		if(cross(a, b) > EPS) return COUNTER_CLOCKWISE;
		if(cross(a, b) < EPS) return CLOCKWISE;
		if(dot(a, b) < EPS) return ONLINE_BACK;
		if(norm(a) < norm(b)) return ONLINE_FRONT;
		return ON_SEGMENT;
	}
	static double norm(Point p) {
		return p.x * p.x + p.y * p.y;
	}
	static Point vec(Point p1, Point p2) {
		return new Point(p2.x - p1.x, p2.y - p1.y);
	}
	static double dot(Point u, Point v) {
		return u.x * v.x + u.y * v.y;
	}
	static double cross(Point u, Point v) {
		return u.x * v.y - u.y * v.x;
	}
}


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

int main() {
int k=0;
cin>>k;
int num=0;

  for (int i = 1; i <= k; i++) {
      for (int j = 1; j<=k;j++){
          for (int n = 1; n<=k;n++){
              num+=gcd(gcd(i,j),n);
          }
      }
  }
cout<<num<<endl;
}

Measured memory_bytes: 3632
#define THRUK for(j=0;j<K;j++)
#include<stdio.h>
int main(){
  int N, K, S[100], i, j, tmp, f;
  while(1){
      f = 0;
      for(i=0;i<100;i++) S[i] = 0;
      scanf("%d %d", &N, &K);
      if(N==0 && K==0)return 0;
      THRUK scanf("%d", &(S[j]));
      for(i=0;i<N;i++) THRUK {
          scanf("%d", &tmp);
          S[j] -= tmp;
      }
    THRUK if(S[j]<0){f++;break;}
    printf(f ? "No\n" : "Yes\n");
  }
}


Measured memory_bytes: 1968
N,K=map(int,input().split())
a=list(map(int,input().split()))
sumf=[0 for i in range(N)]
sumb=[0 for i in range(N)]
Ksum=[0 for i in range(N)]

sumf[0]=(a[0]>=0)*a[0]
for i in range(1,N):
    sumf[i]=sumf[i-1]+(a[i]>=0)*a[i]

sumb[-1]=(a[-1]>=0)*a[-1]
for i in range(1,N):
    sumb[-i-1]=sumb[-i]+(a[-i-1]>=0)*a[-i-1]

s=sum(a[:K])
Ksum[0]=s
for i in range(1,N-K+1):
    s-=a[i-1]
    s+=a[i+K-1]
    Ksum[i]=s

ans=-float("inf")
for i in range(0,N-K+1):
    test=0
    if i!=0:
        test+=sumf[i-1]
    if i!=N-K:
        test+=sumb[i+K]
    test2=test
    test+=Ksum[i]

    ans=max(ans,test,test2)

print(ans)

Measured memory_bytes: 72940
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;
int main()
{
    long long a[5];
    for(long long i=0;i<5;i++)
    {
        cin>>a[i];
        if(a[i]==0)
            cout<<i+1;
    }
    return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int x = 800 * N;
		int y = N / 15 * 200;

		System.out.println(x - y);

		sc.close();
	}

}


Measured memory_bytes: 23892
#line 2 "../../library/template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)
template<class T, class U> inline void cmax(T &a, U b) { if (a < b) a = b; }
constexpr char el = '\n';
template<class T> istream &operator>>(istream &is, vector<T> &v) { for(T &i : v) is >> i; return is; }
struct IoSetup {
  IoSetup() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15); }
} io_setup;
#line 2 "d.cpp"

int main() {
  ll n;
  cin >> n;
  vl a(n);
  cin >> a;

  vl dp(n+1);
  dp[0] = 1000;
  rep(i, n) {
    dp[i+1] = dp[i];
    rep(j, i) {
      ll cnt = dp[j+1]/a[j];
      cmax(dp[i+1], dp[j+1] - cnt*a[j] + cnt*a[i]);
    }
  }

  cout << dp[n] << el;
}


Measured memory_bytes: 3648
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    A = list(map(int, input().split()))

    prev = A[0]
    ans = 0
    for i in range(1, N):
        if prev > A[i]:
            ans += prev - A[i]
            A[i] = prev
        prev = A[i]
    print(ans)


main()


Measured memory_bytes: 33200
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#pragma optimize("JARU SOSISONI")

using namespace std;

#define int long long
#define fast cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define geometry cout.setf(ios::fixed); cout.precision(15);
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;

const int INF = 1e9 + 100;
const int MOD = 998244353;
const int MOD1 = 1e9 + 7;
const int N = 10100;
const int nul = 0;
const int SIZE = 1e6 * 3;



signed main() {
#ifdef parasha
    freopen("A.in", "r", stdin);
#endif // parasha
    fast;
    int ans = 0, n;
    cin >> n;
    vector<int> a(n);
    for (int &i : a) cin >> i;
    a.push_back(0);
    int sum = 0;
    for (int &i : a) {
        if (i == 0) {
            ans += sum / 2;
            sum = 0;
        } else sum += i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4756
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;


public class Test
{	
    public static void Main()
	{
        int[] nums = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        
        int[] list = nums.Distinct().ToArray();
	    Console.WriteLine(list.Length);
	}
}

Measured memory_bytes: 13280
#pragma GCC optimize ("O2")
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-label"

#define DEBUG 1
#define dd if (DEBUG)

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

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, A) for (auto & a : A)
#define all(a) (a).begin (), (a).end ()
#define rall(a) (a).rbegin (), (a).rend ()
#define sz(a) (int) (a).size ()
#define szl(a) (int) (a).length ()
#define FASTIO cin.sync_with_stdio (0); cin.tie (0); cin.exceptions (cin.failbit);

typedef long long ll;
typedef pair <int, int> pii;
#define f first
#define s second
#define mp(a, b) make_pair((a), (b))
typedef vector <int> vi;
#define pb(a) push_back ((a))

const ll MOD = 1e+9+7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int INFi = 0x3f3f3f3f;
const ll MAXN = 1e+6+7;

int main ()
{
    FASTIO;
    int i, j, n;
    cin >> n;
    vi h (n), dp (n);
    trav (a, h)
        cin >> a;
    for (i = 1; i < n; i++)
    {
        for (j = 1, dp[i] = INFi; j <= 2 && i - j >= 0; j++)
        {
            dp[i] = min (dp[i], dp[i - j] + abs (h[i] - h[i - j]));
        }
    }
    cout << dp[n - 1] << "\n";

    return 0;
}



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

int main(){
  int n,m;
  cin>>n;
  vector<string> s(n);
  for(int i=0;i<n;i++){
    cin>>s[i];
  }
  cin>>m; 
  vector<string> t(m);
  for(int i=0;i<m;i++){
    cin>>t[i];
  }
  int plus=0;
  for(int i=0;i<n;i++){
    int plus1=0;
    for(int j=0;j<n;j++){
      if(s[i]==s[j]){
        plus1++;
      }
    }
    for(int j=0;j<m;j++){
      if(s[i]==t[j]){
        plus1--;
      }
    }
    plus=max(plus1,plus);
  }
  if(plus>0){
    cout<<plus<<endl;
  }else{
    cout<<0<<endl;
  }
}
         


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

int main(){
	string s;
	int a=0;
	cin>>s;
	for(int i=0;i<3;i++){
		if(s[i]=='a'){
			a+=1;
		}else if(s[i]=='b'){
			a+=2;
		}else if(s[i]=='c'){
			a+=3;
		}
	}
	if(a==6&&s[0]!=s[1]&&s[0]!=s[2]&&s[1]!=s[2]){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
n, m = list(map(int,(input().split())))
l = []
d = {}
for _ in range(m):
  x = list(map(int,(input().split())))
  l.append(x)
#  d[str(x[0])] = x[1]

l2 = sorted(l)
#print(l,d)
#f = l[0][0]
#print(l2)
count = 1
pcount = 1
p = 0
d = {}
for i in l2:
#  print(i)
  if p != i[0] :
    pcount = 1
    p = i[0]
  else :
    pcount += 1 
    p = i[0]
  d[str(i)] = str(i[0]).zfill(6)+ str(pcount).zfill(6)

for i in l:
  print(d[str(i)])

#print(d)    


Measured memory_bytes: 49344
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<ll,ll>;

ll ketasu(ll a){
   ll num=1;
   while(a/10){
       num++;
       a/=10;
   }
   return num;
}

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

ll kosuu(ll a){
    ll sum=0;
    for(ll i=1;i*i<=a;i++){
        if(a%i==0){
            if(a!=1&&i*i!=a){
            sum+=2;
            }else{
             sum++;   
            }
        }
    }
    return sum;
}

ll n;



    vector<pair<ll,ll>>p;
void fs(ll a){
    for(ll i=2;i*i<=n;i++){
        ll cnt=0;
        while(n%i==0){
            n/=i;
            cnt++;
        }
        p.emplace_back(i,cnt);
    }
    return;
}


ll di[]={1,0,-1,0};
ll dj[]={0,-1,0,1};
int main()
{
 const ll m=1000000007;
 ll n;
 cin>>n;
 vector<ll>a(n);
 rep(i,n)cin>>a[i];
 vector<ll>v(n-1);
 ll sum=0;
 Rep(i,n)sum+=a[i];
 v[0]=sum;
 Rep(i,n-1){
     v[i]=(v[i-1]-a[i]);
     v[i]=v[i]%m;
     if(v[i]<0)v[i]+=m;
 }  
 ll ans=0;
 rep(i,n-1){
     
         ans+=(a[i]%m * (v[i]%m))%m;
         ans%=m;
 }
 cout<<ans<<endl;
 
}
 




Measured memory_bytes: 6428
""" AtCoder """

N = int(int(input()))

l = []

def f(n):
    if len(n) < 10:
        a = n + '7'
        b = n + '5'
        c = n + '3'
        if '7' in a and '5' in a and '3' in a:
            l.append(int(a))
        if '7' in b and '5' in b and '3' in b:
            l.append(int(b))
        if '7' in c and '5' in c and '3' in c:
            l.append(int(c))
        f(a)
        f(b)
        f(c)

f('')

l.sort()

for i in range(len(l)):
    if int(l[i]) > N:
        print(i)
        break


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const ll MAX = 10000;
static const ll INFTY = 1e12;

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

// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
using P = pair<ll, ll>;
// 入力
// 入力
ll h, w;
ll startX, startY, endX, endY;
vector<vector<char>> s;
vector<vector<ll>> cnts; // 魔法使った回数


int main() {

  ll D, T, S;
  cin >> D >> T >> S;
  if(S*T>=D)cout << "Yes" << endl;
  else cout << "No" << endl;
   
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    long double l; cin >> l;
    long double ans = l*l*l/27.;
    printf("%18f", double(ans));
    return 0;
}

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

const int MAX_N=1000000;

typedef long long ll;

using namespace std;

ll n,dat[2*MAX_N-1];

void init(int n_){
	n=1;
	while(n<n_)n*=2;
	for(int i=0;i<2*n-1;i++)dat[i]=0;
}

void update(int k,ll a){
	k+=n-1;
	dat[k]=a;
	
	while(k>0){
		k=(k-1)/2;
		dat[k]=max(dat[2*k+1],dat[2*k+2]);
	}
}

ll query(int a,int b,int k,int l,int r){
	if(r<=a || b<=l)return 0;
	if(a<=l && r<=b)return dat[k];
	else {
		ll vl=query(a,b,k*2+1,l,(l+r)/2);
		ll vr=query(a,b,k*2+2,(l+r)/2,r);
		return max(vl,vr);
	}
}

int main(void){
	
	ll in,m,ans=0;
	
	cin >> m;
	
	init(m);
	
	for(int i=0;i<m;i++){
		cin >> in;
		update(in,in+query(1,in,0,0,n));
		ans=max(ans,dat[in+n-1]);
	}
	cout << m*(m+1)/2-ans << endl;
	
	return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

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

  int keta[n][60];
  memset(keta, 0, sizeof(keta));

  rep(i, n) {
    rep(j, 60) {
      if (a[i] % 2 == 1) keta[i][j] = 1;
      a[i] >>= 1;
    }
  }

  ll ans = 0, res = 1;
  rep(j, 60) {
    vector<ll> c(2, 0);
    rep(i, n) {
      c[keta[i][j]]++;
    }
    ll comb = c[0] * c[1] % mod;

    ans = (ans + res * comb) % mod;
    res = (res * 2) % mod;
  }
  cout << ans << endl;



  
  return 0;
}

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

#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2") //Enable AVX

using namespace std;

#define F first
#define S second 

#ifdef __debug_leywar
#include <debug/debugger.h>
#else
#define db(...) ;
#endif

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  
    int n , d ; 
    cin >> n >> d ; 

    int ans = 0 ; 

    for( int i = 1 ; i <= n ; i++ )
    {
        long long a , b ;
        cin >> a >> b ; 

        if( d >= sqrt( a * a + b * b ) ) 
            ans++ ; 
    }
    
    cout << ans ;

    return 0;
}

Measured memory_bytes: 3664
#include<iostream>
using namespace std;
int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(a>=b && c>=d){
    cout << b+d << endl;
  }else if(a>=b && c<d){
    cout << b+c << endl;
  }else if(a<b && c>=d){
    cout << a+d << endl;
  }else if(a<b && c<d){
    cout << a+c << endl;
  }
}

Measured memory_bytes: 256
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return len(divisors)

n=int(input())
ans=0
for i in range(1,n+1,2):
  if divisors(i)==8:
    ans+=1
print(ans)

Measured memory_bytes: 3060
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class DCaracalVsMonster {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      ll h; cin >> h;
      ll cnt = 1;
      ll tmp = h;
      while(tmp > 0) {
        tmp /= 2;
        cnt *= 2;
      }
      cout << cnt-1 << endl;
    }
};

signed main() {
  DCaracalVsMonster solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

using namespace std;

using ll = long long;

constexpr ll mod = 1e9 + 7;

ll dp[101][4][4][4];

int main()
{
	int n;
	cin >> n;
	ll ans = 0;
	for (int i = 3; i <= n; ++i)
	{
		for (int a = 0; a < 4; ++a)
		{
			for (int b = 0; b < 4; ++b)
			{
				for (int c = 0; c < 4; ++c)
				{
					if (a == 0 && b == 2 && c == 1)
						continue;
					if (a == 0 && b == 1 && c == 2)
						continue;
					if (a == 2 && b == 0 && c == 1)
						continue;
					if (i == 3)
					{
						dp[i][a][b][c] = 1;
					}
					for (int k = 0; k < 4; ++k)
					{
						if (k == 0 && a == 2 && b == 3 && c == 1)
							continue;
						if (k == 0 && a == 3 && b == 2 && c == 1)
							continue;
						if (k == 0 && a == 2 && b == 2 && c == 1)
							continue;
						dp[i][a][b][c] += dp[i - 1][k][a][b];
						dp[i][a][b][c] %= mod;
					}
					if (i == n)
					{
						ans += dp[i][a][b][c];
						ans %= mod;
					}
				}
			}
		}
	}
	cout << ans % mod << endl;
}

Measured memory_bytes: 256
A1 = gets.chomp.split.map(&:to_i)
A2 = gets.chomp.split.map(&:to_i)
A3 = gets.chomp.split.map(&:to_i)
N = gets.chomp.to_i
b = N.times.map{gets.chomp.to_i}

if b.include?(A1[0]) && b.include?(A1[1]) && b.include?(A1[2])
  puts "Yes"
elsif b.include?(A2[0]) && b.include?(A2[1]) && b.include?(A2[2])
  puts "Yes"
elsif  b.include?(A3[0]) && b.include?(A3[1]) && b.include?(A3[2])
  puts "Yes"
elsif b.include?(A1[0]) && b.include?(A2[1]) && b.include?(A3[2])
  puts "Yes"
elsif b.include?(A3[0]) && b.include?(A2[1]) && b.include?(A1[2])
  puts "Yes"
elsif b.include?(A1[0]) && b.include?(A2[0]) && b.include?(A3[0])
  puts "Yes"
elsif b.include?(A1[1]) && b.include?(A2[1]) && b.include?(A3[1])
  puts "Yes"
elsif b.include?(A1[2]) && b.include?(A2[2]) && b.include?(A3[2])
  puts "Yes"
else
  puts "No"
end

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

using namespace std;

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

    long long x;
    cin >> x;
    map<long long, long long> mp;

    for (long long i = -5404; i <= 5404; i++)
        mp[i * i * i * i * i] = i;

    for (long long i = 0; i <= 5404; i++)
        if (mp[i * i * i * i * i - x]) {
            cout << i << ' ' << mp[i * i * i * i * i - x] << "\n";
            break;
        }

    return 0;
}

Measured memory_bytes: 4340
n, a, b = gets.chomp.split.map(&:to_i)
s = gets.chomp.chars
hs = Hash.new(false)
(1..n).each do |i|
  break if a + b <= 0
  if s[i - 1] == "a"
    hs[i] = true
    a -= 1
  elsif s[i - 1] == "b" && b > 0
    hs[i] = true
    b -= 1
  end
end

(1..n).each do |i|
  puts (hs[i])? "Yes" : "No"
end

Measured memory_bytes: 16380
def gcd(a,b):
  x = max([a,b])
  y = min([a,b])
  while y:
    x, y = y, x % y
  return x

# x * y = lcm(x, y) // gcd(x, y)より
def lcm(x, y):
  return x * y // gcd(x, y)


a,b,c,d = map(int, input().split())

cd = lcm(c,d)
b_c = b // c
b_d = b // d
a_c = (a-1)//c
a_d = (a-1)//d
b_cd = b//(cd)
a_cd = (a-1)//(cd)
nums = b-a+1

ans = nums - (b_c - a_c) - (b_d - a_d) + (b_cd - a_cd)


print(ans)


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

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

    int ans=0;
    if(n<10){
        ans = 100 * (10-n);
    }
    cout << ans+r << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // ABC152C - Low Elements

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] p = new int[n];

        int max = 0;
        int min = 0;
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
            if (i == 0) {
                max = min = p[i];
            }
            if (min >= p[i]) {
                ++cnt;
                min = p[i];
            } else {
                max = p[i];
            }
        }

        System.out.println(cnt);
    }
}

Measured memory_bytes: 66880
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef vector<int> vi;
typedef pair<int, int> pi;
#define SQ(a) (a) * (a)
#define deb(x) cout << #x << " = " << x << '\n'
#define deb2(x, y) cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"
 
 
int main(int argc, char const *argv[])
{
 
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    string str;
    cin>>str;
    int count=0;
    for(int i=0;i<n;i++){
        if(str[i]=='W'){
            count++;
        }
    }
    int ans=0;
    for(int i=0;i<count;i++){
        if(str[n-1-i]=='R'){
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3776
// ABC127_A
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::prev(iter, n) n 個分デクリメントしたイテレータ
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値
#define pll pair<ll, ll>
#define F first
#define S second
const ll INF = 1LL<<60;  // 10^18（const int inf   = 1<<29;）

int main() {
    // input(sunippets: inpv, inpn, inps)
    ll A, B, C;
    cin >> A >> B >> C;
    
    // calculation
    if (A <= 5) {
        cout << 0 << "\n";
    } else if (6 <= A && A <= 12) {
        cout << B/2 << "\n";
    } else {
        cout << B << "\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<ctype.h>
#define PI 3.141592653589
#define N_MAX 1000
#define NUM 26

int main()
{
  int m, h, i, j, len, sum;
  while(1)
    {
      char buf[N_MAX], tmp[N_MAX];
      sum = 0;
      scanf("%s",buf);
      if(strcmp(buf,"-") == 0) break;
      len = strlen(buf);
      scanf("%d",&m);
      for(i = 0; i < m; i++)
	{
	  scanf("%d",&h);
	  sum += h;
	}
      for(j = 0; j < len; j++)
	{
	  tmp[j] = buf[(sum+j)%len];
	}
      for(j = 0; j < len; j++)
	{
	  buf[j] = tmp[j];
	}
      printf("%s\n",buf);
    }
  return 0; 
}

Measured memory_bytes: 584
/* ex3-2
   Sagzar1993  */


#include <stdio.h>

int main(void) {
    //鉛筆の本数と、その数の一の位を定義
    int pencilNum, onesplace;

    //入力を受け取る
    scanf("%d", &pencilNum);

    //一の位は10で割った余りに等しい
    onesplace = pencilNum % 10;

    //一の位に応じた読み方を表示
    switch (onesplace)
    {
    case 0:
        printf("pon\n");
        break;
    case 1:
        printf("pon\n");
        break;
    case 2:
        printf("hon\n");
        break;
    case 3:
        printf("bon\n");
        break;
    case 4:
        printf("hon\n");
        break;
    case 5:
        printf("hon\n");
        break;
    case 6:
        printf("pon\n");
        break;
    case 7:
        printf("hon\n");
        break;
    case 8:
        printf("pon\n");
        break;
    case 9:
        printf("hon\n");
        break;
    }

    return 0;
}

Measured memory_bytes: 1604
#include <iostream>

using namespace std;

int main()
{
    int k,a,b;
    cin >> k;
    cin >> a >> b;
    for(int i = a; i <= b; i++)
    {
        if( i % k == 0 )
        {
            cout << "OK" <<endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}


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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	vi x={1,3,5,7,8,10,12};
	vi y={4,6,9,11};
	vi z={2};
	map<int,int> f;
	rep(i,x.size()) f[x[i]]=0;
	rep(i,y.size()) f[y[i]]=1;
	rep(i,z.size()) f[z[i]]=2;
	for(int a,b;cin>>a>>b&&a|b;){
		cout<<(f[a]==f[b]?"Yes":"No")<<endl;
	}
}


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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
    int n;
    cin >> n;
    int a[n - 1];
    rep(i, n - 1)
    {
        cin >> a[i];
        a[i]--;
    }
    int mgr[n];
    rep(i, n) mgr[i] = 0;

    rep(i, n - 1)
    {
        mgr[a[i]]++;
    }
    rep(i, n) OP(mgr[i]);

    return 0;
}

Measured memory_bytes: 5184
#include <bits/stdc++.h>
#define ll long long
#define all(x) begin(x), end(x)
#define range(x) begin(x), begin(x)
#define what(x) cout << #x << ": " << x << '\n'
#define print(x) for (auto &el: x) cout << el << ' '; cout << '\n'
using namespace std;
 
template<typename S, typename T>
ostream& operator <<(ostream &os, pair<S, T> &m) { 
    os << '[' << m.first << " " << m.second << ']'; 
    return os; 
}

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

    ll a, b, d;
    cin >> a >> b >> d;

    cout << b / d - (a - 1) / d << endl;
    
    

    return 0;
}

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


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

  long long x=2;
  long long y=1;
  long long z=0;
  if(N==1){
    z=1;
  }
  else{
    for(int i=2; i<N+1;i++){
    z=x+y;
    if(i%2==0){
    x=z;
    }
    else{
      y=z;
    }
  }
  }
   cout<<z<<endl;
}

Measured memory_bytes: 3596
def main():
    k, n = (int(i) for i in input().split())
    st = [int(i) for i in input().split()]

    st = sorted(st)
    st.append(st[0] + k)

    diffs = [st[i+1] - st[i] for i in range(n)]

    print(k - max(diffs))

main()


Measured memory_bytes: 31440
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(x) cout<<x<<endl
#define Gput(a,b) G[a].push_back(b)
int main() {
 ll n,m;
 cin>>n>>m;
 vec x(m);
 loop(i,m){
 cin>>x[i];
 }
 if(m<=n) putout(0);
 else{
sort(all(x));
vec d(m-1);
loop(i,m-1){
d[i]=x[i+1]-x[i];
}
sort(all(d));
ll ans=0;
loop(i,m-n){
ans+=d[i];
}
putout(ans);

}
}


Measured memory_bytes: 1920
#include <iostream>
#include <numeric>
#include <vector>
#include <math.h>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
using namespace std; 

int main(){
    int n; cin >> n;
    vector<int> A(n);
    int s=1000;
    int d=0;
    long long ans=0;
    long long ans1=1000000000000000;
    for (int i=0;i<n;i++) {
        cin >> A[i];
        s=min(s,A[i]);
        d=max(d,A[i]);
    }
    for (int i=s;i<=d;i++){
        for (auto val : A) ans+=pow(val-i,2);
        ans1=min(ans1,ans);
        ans=0;
    }
    cout << ans1 << "\n";
}



Measured memory_bytes: 256
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long d,n;
    scan(d,n);
    if(n % 100)
    {
        writeln(n * pow(100, d));
    }
    else
    {
        writeln((n + 1) * pow(100, d));
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v){
  const char* dlm = "";
  for(const auto& x:v) os << exchange(dlm, "\n") << x;
  return os;
}
struct Graph{
  using seen_t=int32_t; using ver_t=size_t; using edge_t=pair<seen_t,ver_t>;
  const seen_t NO=-1; vector<seen_t> seen;
  vector<vector<edge_t>> edge;
  Graph(size_t n): seen(n,NO), edge(n) {}
  void dfs(ver_t frm){
    // preorder
    for(const auto& v:edge[frm]){
      if(seen[v.second]==NO){
      if(v.first%2==0){ seen[v.second]=seen[frm]; dfs(v.second); }
      else{ seen[v.second]=1-seen[frm]; dfs(v.second); }
      }
    }
    // postorder
  }
};
int32_t main(){
  size_t n; cin>>n;
  Graph g(n);
  for(size_t i=0; i<n-1; ++i){
    int32_t u,v,w; cin>>u>>v>>w;
    g.edge[u-1].emplace_back(w,v-1);
    g.edge[v-1].emplace_back(w,u-1);
  }
  g.seen[0]=0; g.dfs(0);
  cout<<g.seen;
}


Measured memory_bytes: 13056
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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



int main()
{
  ll N; cin>>N;
  vector<ll> a(N+1); rep(i,N) cin>>a[i+1];
  
  vector<int> vec(N+1,-1);
  for(int i=N;i>=1;i--){
    ll count=0;
    for(int j=2*i;j<=N;j+=i) if(vec[j]) count++;
    count%=2;
    if(count==a[i]) vec[i]=0;
    else vec[i]=1;
  }
  
  ll M=0; rep(i,N) if(vec[i+1]) M++; cout<<M<<endl;
  
  vector<ll> ans_list(0); rep(i,N) if(vec[i+1]) ans_list.push_back(i+1);  
  ll sz=ans_list.size();
  rep(i,sz){
    if(i!=0) cout<<" ";
    cout<<ans_list[i];
  }
  cout<<endl;
  
  return 0;
}

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

int main() {
	string s;
	while (getline(cin, s), s != "0") {
		stringstream ss(s);
		int cnt = 0;
		int n;
		bool is_1 = false;
		while (ss >> n) {
			if (n == 1)is_1 = true;
			if (n < 10)cnt += n;
			else cnt += 10;
		}
		if (is_1&&cnt + 10 <= 21)cnt += 10;
		cout << (cnt > 21 ? 0 : cnt) << endl;
	}
}

Measured memory_bytes: 3008
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9

int main(){
	while(1){
	int n;
	cin>>n;
	if(n==0)break;
	vector<int> dp(1<<n,inf);
	vector<vector<int> > map(n,vector<int> (n+1,0) );
	for(int i=0;i<n;i++)
		for(int j = 0;j<n+1;j++)cin>>map[i][j];
	dp[0] = 0;

	for(int i=0;i<(1<<n);i++){
		vector<bool> b(n,false);
		for(int j=0;j<n;j++) if( (i&(1<<j))!=0 ) b[j] = true;
		for(int j=0;j<n;j++){
			if(!b[j] ) {
				int cost = map[j][0] ;
				for(int k = 0;k<n;k++)if(b[k]){
					cost  = min(cost,map[j][k+1]);
				}
				int next  =i|(1<<j);
				dp[next]  = min(dp[i] + cost,dp[next]);
			}
		}

	}
	cout<<dp[(1<<n)-1] << endl;
	}
	return 0;
}



Measured memory_bytes: 3384
/*
    Author : Nishant Gupta 2.0
*/
#include<bits/stdc++.h>
using namespace std;

#define LL long long int
#define getcx getchar_unlocked
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define MAX 200005
#define LOG_MAX 20
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL (LL(1e18))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define in(x) scanf("%d", &x)
#define inl(x) scanf("%lld", &x)
#define in2(x, y) scanf("%d %d", &x, &y)
#define inl2(x, y) scanf("%lld %lld", &x, &y)
#define MSV(A,a) memset(A, a, sizeof(A))
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
typedef pair<int, int> pi;
typedef pair<LL, LL> pl;
const char en = '\n';

void print(int a[], int n) {
	for(int i=0;i<n;i++) cout<<a[i]<<" ";
	cout<<en;
}
void solve() {
	int n, k;
	in2(n, k);
	int a[n];
	for(int i=0;i<n;i++) in(a[i]);
	
	for(int j=0;j<k;j++) {
		int temp[MAX] = {0};
		for(int i=0;i<n;i++) {
			int s = max(0, i-a[i]);
			int e = min(n-1, i+a[i]);
			temp[s]++;
			temp[e+1]--;
		}
		for(int i=1;i<n;i++) temp[i] += temp[i-1];
		int cnt = 0;
		for(int i=0;i<n;i++) {
			a[i] = temp[i];
			if(a[i] == n) cnt++;
		}
		if(cnt == n) break;
	}
	
	print(a, n);
}

int main() {
	int t = 1;
	
	//~cin>>t;
	while(t--) {
		solve();
	}
    return 0;
}


Measured memory_bytes: 5280
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let x = read::<i64>();
  // let mut memo = vec![false; x as usize + 1];
  let mut prev = 0;
  let mut max_v = 1;

  for i in 2..32 {
    prev = i;
    while prev * i <= x {
      prev = prev * i;
      max_v = max(max_v, prev);
    }
  }

  println!("{}", max_v);

  // if x < 9 {
  //   println!("4")
  // }

}



Measured memory_bytes: 4352
#include <iostream>
#include<vector>
using namespace std;
int N,A,B,C;
vector<int> v;

int dfs(int i,int a,int b,int c){
      if(i == N){
            if(a == 0 || b == 0 || c == 0){
                  return 100000;
            }else{
                  return abs(A - a) + abs(B - b) + abs(C - c) - 30;
            }
      }
      vector<int> t(4);
      t[0] = dfs(i + 1,a,b,c);
      t[1] = dfs(i + 1,a + v[i],b,c) + 10;
      t[2] = dfs(i + 1,a,b + v[i],c) + 10;
      t[3] = dfs(i + 1,a,b,c + v[i]) + 10;
      return min(min(t[0],t[1]),min(t[2],t[3]));
}
int main(void){
    cin >> N >> A >> B >> C;
    v.resize(N);
    for(int i = 0;i < N;i++){
          cin >> v[i];
    }
    cout << dfs(0,0,0,0);
}


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

int main(){
  int a,b;
  cin>>a>>b;
  if(a==b){
    cout<<a<<endl;
  }
  else if(a!=b){
    if((a%2!=0 and b%2==0)or(b%2!=0 and a%2==0)){
      cout<<int((a+b)/2+1)<<endl;
    }
    else if((a%2==0 and b%2==0)or(a%2!=0 and b%2!=0)){
      cout<<((a+b)/2)<<endl;
    }
  }
  

}

Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        // 入力
        int[] nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int n = nk[0];
        int k = nk[1];

        double ans = 0;
        for (int i = 1; i <= n; i++)
        {
            double tmp = 1.0 / n;
            int now = i;
            while (now < k)
            {
                now *= 2;
                tmp /= 2;
            }
            ans += tmp;
        }
        Console.WriteLine(ans);

    }
}


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

using namespace std;
using ll = long long;

int main()
{
  ios_base::sync_with_stdio (0);
  cin.tie (0);
  const ll mod = 1e9;
  ll n;
  cin >> n;
  multiset<ll>s;
  vector<ll>a (n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    s.insert (a[i]);
  }
  for (ll i = 0; i < n; i++) {
    s.erase (s.find (a[i]) );
    auto it = s.end();
    it--;
    cout << *it << '\n';
    s.insert (a[i]);
  }
  return 0;

}


Measured memory_bytes: 12544
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline

H, W = map(int, readline().split())
S = [list(readline()) for i in range(H)]


def bfs(grid, start):
    distance = [[-1] * W for _ in range(H)]
    queue = deque([start])
    distance[start[0]][start[1]] = 0
    while queue:
        x, y = queue.popleft()

        for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):
            new_y, new_x = y + j, x + i
            if 0 <= new_y < W and 0 <= new_x < H:
                if grid[new_x][new_y] == '.' and distance[new_x][new_y] == -1:
                    distance[new_x][new_y] = distance[x][y] + 1
                    queue.append((new_x, new_y))
    return max(map(max, distance))


answer = 0
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue

        tmp = bfs(S, (i, j))
        if tmp > answer:
            answer = tmp

print(answer)


Measured memory_bytes: 3316
#include<stdio.h>
#include<algorithm>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <functional>
using namespace std;
int dp[101][10001] = { 0 };
int c[101][2] = { 0 };//c[i][0]..v, c[i][1]...w 
int n, w;
int main() {
	scanf("%d %d", &n, &w);
	for (int i = 0; i < n; ++i) {
		scanf("%d %d", &c[i + 1][0], &c[i + 1][1]);
	}
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= w; ++j) {
			if (j < c[i][1]) {
				dp[i][j] = dp[i - 1][j];
			}
			else {
				dp[i][j] = max(dp[i][j - c[i][1]] + c[i][0], dp[i - 1][j]);
			}
		}
	}
	printf("%d\n", dp[n][w]);
}

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

int main(){
  int N;  cin >> N;
  vector<int> p(N);
  for(int i=0; i<N; i++){
    cin >> p[i];
  }
  int cnt = 0;
  for(int i=0; i<N; i++){
    if(p[i]!=i+1) cnt++;
  }
  if(cnt==0 || cnt==2){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> time(5);
  for (int i=0; i<5; i++) {
    cin >> time.at(i);
  }
  
  vector<int> jouyo(5);
  for (int i=0; i<5; i++) {
    jouyo.at(i) = time.at(i) % 10;
  }
  
  int min=10;
  int count=0;
  for (int i=0; i<5; i++) {
    if (jouyo.at(i) < min && jouyo.at(i) != 0) {
      min = jouyo.at(i);
      count = i;
    }
  }
  
  int goukei=0;
  for (int i=0; i<5; i++) {
    if (time.at(i)%10 != 0) {
      goukei += (time.at(i)/10+1)*10;
    }
    else {
      goukei += time.at(i);
    }
  }
  
  if (time.at(count)%10 != 0) {
      goukei -= (time.at(count)/10+1)*10;
    }
    else {
      goukei -= time.at(count);
    }
  goukei += time.at(count);
    
  cout << goukei << endl;

}

Measured memory_bytes: 256
//created by pyoxiao on 2020/05/10
#include<bits/stdc++.h>
#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define CL(a, b) memset(a, b, sizeof(a))
using namespace std;
const int mod = 1e9 + 7;
LL fpow(LL a, LL b, LL p = mod){LL ans = 1; a %= p; while(b) {if(b & 1) ans = ans * a % p; b >>= 1; a = a * a % p;} return ans;}
LL gcd(LL a, LL b){return b == 0 ? a : gcd(b, a % b);}
int a, b, c, k;
void solve() {
    cin >> a >> b >> c >> k;
    if(k <= a) {
        cout << k << '\n';
        return;
    }
    k -= a;
    if(k <= b) {
        cout << a << '\n';
        return;
    }
    k -= b;
    cout << a - k << '\n';
}
int main() {
    int T = 1;
    // scanf("%d", &T);
    while(T --) 
        solve();
    return 0;
}

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

int main(void) {
  string a, s, c;
  cin >> a >> s >> c;
  cout << "A" << s[0] << "C" << endl;
}

Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
using namespace std;

int main()
{
	double ans = 0;
	int N;
	cin >> N;
	double x[100];
	string u[100];
	for (int i = 0; i < N; i++)
	{
		cin >> x[i] >> u[i];
		if (u[i] == "JPY")
		{
			ans += x[i];
		}
		else
		{
			ans += x[i] * 380000.0;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
if n%2==0 or n%5==0:
    print(-1)
else:
    count=1
    flag=0
    num=7
    mod=7%n
    while flag==0:
        if mod==0:
            flag=1
        else:
            mod=(mod*10+7)%n
            count=count+1
    print(count)


Measured memory_bytes: 9132
#include<bits/stdc++.h>
using namespace std;
int solve(int n, vector<int> c,vector<int> v)
{
    int ans = INT_MIN;
    for(int i=0;i<(1<<n);++i)
    {
        int now = 0;
        for(int j=0;j<n;++j)
        {
            if(i&(1<<j))
            {
                now += v[j] - c[j];
            }
        }
        ans = max(now,ans);
    }
    return ans;
}
int main()
{
    int n;
    cin>>n;
    vector<int> v(n),c(n);
    for(int i=0;i<n;++i)cin>>v[i];
    for(int i=0;i<n;++i)cin>>c[i];
    cout<<solve(n,c,v);
}

Measured memory_bytes: 256
N = int(input())
Alist = [list(map(int, input().split())) for _ in range(2)]
max_candies = 0
for change in range(N):
    candies = sum(Alist[0][:change + 1]) + sum(Alist[1][change:])
    max_candies = max(max_candies, candies)

print(max_candies)


Measured memory_bytes: 2940
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

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

	for (int i = 0; i <= m; ++i) {
		for (int j = 0; j <= n; ++j) {
			if (j * (m - i) + i * (n - j) == k) {
				cout << "Yes\n";
				return 0;
			}
		}
	}

	cout << "No\n";

	return 0;

}

Measured memory_bytes: 256