akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007LL;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;

ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1LL;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}

ll a[(1 << 18) + 10];

int main(void) {

  int n, D;
  
  cin >> D;
  n = 1 << D;
  
  rep(i, n) scanf("%lld", &a[i]);

  

  vector<ll> ans(n + 10);
  vector< pair<ll, ll> > b(n + 10);
  vector<int> c(D + 10);
  

  b[0].first = 0;
  b[0].second = -1;
  b[1].first = 1;
  b[1].second = -1;

  
  ans[1] = a[0] + a[1];
  printf("%lld\n", ans[1]);

  
  for (int k = 2; k < n; k++) {
    c.clear();
    int j = 0;
    for (int i = 0; i <= D; i++) {
      if ((k >> i) & 1) c[j++] = i;
    }
    
    vector<ll> d;
    for (int i = j - 2; i >= 0; i--) {
      d.push_back(b[k - (1 << c[i])].first);
      if (b[k - (1 << c[i])].second != -1) {
	d.push_back(b[k - (1 << c[i])].second);
      }
    }
    d.push_back(k);
      
    int f = d[0], s = -1;

    for (int i = 0; i < d.size(); i++) {
      if (a[f] < a[d[i]]) f = d[i];
    }

    for (int i = 0; i < d.size(); i++) {
      if (d[i] != f && (s == -1 || a[s] < a[d[i]])) s = d[i];
    }
    
    b[k].first = f;
    b[k].second = s;

    int l = k, m = j - 1;
    ll g = 0;
    while (m >= 0) {
      l -= 1 << c[m--];
      g = max(g, a[b[l].first]);
    }

    if (s == -1) ans[k] = a[f] + g;
    else ans[k] = a[f] + max(g, a[s]);
    ans[k] = max(ans[k - 1], ans[k]);

    cout << ans[k] << endl;

  }

  return 0;

}

    


Measured memory_bytes: 11264
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int, K: int):
    ret = 0
    while N > 0:
        N //= K
        ret += 1
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
// Problem : D - Wall
// Contest : AtCoder - AtCoder Beginner Contest 079
// URL : https://atcoder.jp/contests/abc079/tasks/abc079_d
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);    
	int H,W;
	cin>>H>>W;
	vi v[10];
	F0R(x,10)
	{
		F0R(y,10)
		{
			int nb;
			cin>>nb;
			v[x].pb(nb);
		}
	}
	F0R(k,10)
	{
		F0R(x,10)
		{
			F0R(y,10)
			{
				if(v[x][k]+v[k][y]<v[x][y])
					v[x][y]=v[x][k]+v[k][y];
			}
		}
	}
	ll ans=0;
	F0R(x,H)
	{
		F0R(y,W)
		{
			int nb;
			cin>>nb;
			if(nb!=-1)
			{
				ans+=v[nb][1];
			}
		}
	}
	cout<<ans<<nl;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3652
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 

int main(){
    fastio
    int n ; 
    cin >> n ; 
    int nax = 0 ; 
    for(int i=0;i<n;i++){
    	int x ; 
    	cin >> x ; 
    	nax = max(nax,x) ; 
    	if ( x < nax - 1 ){
    		return cout << "No" << endl , 0 ; 
    	}
    }
    cout << "Yes" << endl;
    return 0 ;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1145141919364364
#define double long double
using namespace std;
typedef pair<ll, ll>P;
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
signed main() {
	ll a, b;
	cin >> a >> b;
	if (abs(a - b) % 2 == 1)puts("IMPOSSIBLE");
	else cout << (a + b) / 2 << endl;
	ggr
}

Measured memory_bytes: 256
import numpy as np

mod = 10 ** 9 + 7
n = int(input())
a = np.array(list(input().split()), np.int64)

ans = 0
for i in range(60):
    b = (a >> i) & 1
    cnt = np.sum(b[b > 0])
    tmp = cnt * (n - cnt)
    for _ in range(i):
        tmp = tmp * 2 % mod
    ans += tmp
print(ans % mod)

Measured memory_bytes: 62736
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
//using System.Numerics;
using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;


    void solve()
    {
        int N = cin.nextint;
        var Z = cin.nextlong;
        var W = cin.nextlong;

        var A = cin.scanlong;
        if (N == 1)
        {
            WriteLine(Abs(W - A[0]));
            return;
        }

        var MAX = new long[N];
        var MIN = new long[N];
        MAX[N - 1] = Abs(A[N - 1] - A[N - 2]);
        MIN[N - 1] = Abs(A[N - 1] - A[N - 2]);


        for (int j = N - 2; j > 0; j--)
        {
            MAX[j] = Abs(A[j - 1] - A[N - 1]);
            MIN[j] = Abs(A[j - 1] - A[N - 1]);
            for (int i = j + 1; i < N; i++)
            {
                MAX[j] = Max(MAX[j], MIN[i]);
                MIN[j] = Min(MIN[j], MAX[i]);
            }
        }
        long ans = Abs(W - A[N - 1]);
        int id = N;
        for (int i = 1; i < N; i++)
        {
            if (ans < MIN[i])
            {
                id = i;
                ans = MIN[i];
            }
        }
        WriteLine(ans);

    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 13288
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main(){
  
    char c[2][3];
    
    for(int i=0;i<2;i++){
        for(int j=0;j<3;j++){
            
            cin>>c[i][j];
        }
    }
    
    int s=0;
    
    for(int i=0;i<3;i++){
        if(c[0][i]!=c[1][2-i]){
            s=1;
        }
    }
    
    if(s==0){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    
    return 0;
}







Measured memory_bytes: 256
S=input()
T=input()
d={}
for s,t in zip(S,T):
    if s in d:
        if d[s]!=t:
            print("No")
            exit()
    else:
        d[s]=t

if len(d)!=len(set(d.values())):
    print("No")
else:
    print("Yes")

Measured memory_bytes: 41804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll N,M;
    cin >> N >> M;
    vector<ll> dp(N+5);
    queue<ll> A;
    REP(i,M){
        ll tmp;
        cin >> tmp;
        A.push(tmp);
    }
    dp[0] = 1;
    REP(i,N){
        if(i == A.front()&&i != 0){
            A.pop();
        }else{
            dp[i+1] += dp[i];
            dp[i+2] += dp[i];
            dp[i+1]%=mod;
            dp[i+2]%=mod;
        }
    }
    cout << dp[N]%mod << "\n";
}

Measured memory_bytes: 1920
n = int(input())
A = list(map(int, input().split()))
A = [0] + A
A.append(0)

tot = 0
s = 0
for a in A:
    tot += abs(a-s)
    s = a

for i in range(1, n+1):
    print(tot - abs(A[i]-A[i-1]) - abs(A[i]-A[i+1]) + abs(A[i+1]-A[i-1]))


Measured memory_bytes: 14176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int A, B;
    cin >> A >> B;
    if(B % A == 0)
        cout << A + B;
    else
        cout << B - A;
    return 0;
}

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

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

  rep(i, n) {
    if (i==0) {
      rep(x, n-1) cout<<a[x]<<" ";
      cout<<a[n-1]<<endl;
      continue;
    }
    int v=a[i];
    int j=i-1;
    while (j>=0&&a[j]>v) {
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=v;
    rep(x, n-1) cout<<a[x]<<" ";
    cout<<a[n-1]<<endl;
  }
  return 0;
}


Measured memory_bytes: 3096
#include<stdio.h>
#include<string.h>
int main(){
  char ymd[15];
  char now[10] = "2019/04/30";
  
  scanf("%s",&ymd);
  if(strcmp(ymd,now) <= 0){
    printf("Heisei");
  }else{
    printf("TBD");
  }
  return 0;
}

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

typedef long long ll;

const ll MOD = 1e9 + 7;
ll N, M, K;
vector<ll> Inv, Fact, InvFact;

void init(ll limit) {
  Inv.resize(limit + 1);
  Fact.resize(limit + 1);
  InvFact.resize(limit + 1);
  Inv[1] = 1;
  Fact[0] = Fact[1] = InvFact[0] = InvFact[1] = 1;
  for (ll i = 2; i <= limit; ++i) {
    Inv[i] = MOD - MOD / i * Inv[MOD % i] % MOD;
    Fact[i] = i * Fact[i - 1] % MOD;
    InvFact[i] = Inv[i] * InvFact[i - 1] % MOD;
  }
}
ll choose(ll n, ll k) {
  return Fact[n] * InvFact[k] % MOD * InvFact[n - k] % MOD;
}
ll perm(ll n, ll k) { return Fact[n] * InvFact[n - k] % MOD; }
ll calc(ll m, ll n) {
  ll res = 0;
  for (ll i = 1; i <= n - 1; ++i) {
    (res += i * 2 * (n - i) * m * m) %= MOD;
  }
  return res;
}
ll solve() {
  return choose(K, 2) * (calc(M, N) + calc(N, M)) % MOD *
         perm(N * M - 2, K - 2) % MOD * InvFact[K] % MOD;
}
int main() {
  cin >> N >> M >> K;
  init(N * M);
  cout << solve() << endl;
  return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	int N;
	cin>>N;
	vector<int> a(N);
	rep(i,N){
		int x;
		cin>>x;
		x--;
		a[x] = i;
	}
	int ans = 1;
	int now = 1;
	rep(i,N-1){
		bool b = a[i]<a[i+1];
		if(b){
			now++;
			chmax(ans,now);
		}else{
			now = 1;
		}
	}
	cout<<N-ans<<endl;
}


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

int main(){
	int p, q, r;
	cin >> p >> q >> r;
	vector<int> vc = {p, q, r};
	sort(vc.begin(), vc.end());
	cout << vc.at(0)+vc.at(1) << endl;
}

Measured memory_bytes: 256
N = int(input())
L = list(map(int, input().split()))
L.sort()
count = 0
for i in range(len(L)-2):
    for j in range(i, len(L)-1):
        for k in range(j, len(L)):
            if L[k] < L[i] + L[j] and L[i] != L[j] and L[j] != L[k]:
                count += 1
print(count)


Measured memory_bytes: 9180
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
typedef long long int ll;

int main()
{
    int cost=0;
    int l;
	int m,n;
	bool f;
    for(;;){
		cin >> l;
		cost=0;
		f=true;
		if(l==0)break;
		for(int i=0;i<12;i++){
			cin >> m >> n;
			cost+=m;
			cost-=n;
			if(cost>=l&&f){
				printf("%d\n",i+1);
				f=false;
			}
		}
		if(f)printf("NA\n");
	}
    return 0;
}

Measured memory_bytes: 1148
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<n;i++)
#define repb(i, a, b) for(int i=a;i<b;i++)

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

const int INF = 1<<30;

int main(){
  map<int, int> mp;
  int a, b;cin>>a>>b;
  mp[a]++;mp[b]++;
  repb(i, 1, 4){
    if(mp[i]==0){cout<<i<<endl;return 0;}
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<string>
#include<cstdio>
#include<queue>
#include<functional>
#include<tuple>
#include<iomanip>
#include<stack>
#include<cmath>
#define ll long long
#define N 1000000007
using namespace std;
int j, y;
vector<string>v;
void rec(int a,int b,string s) {
	if (a != j) {
		rec(a + 1, b, s+'A');
	}
	if (b != y) {
		rec(a, b + 1, s+'B');
	}
	if (a == j && b == y) v.push_back(s);
}
int main() {
	string s;
	cin >> j >> y;
	if (j == 5 && y == 5) {
		j = 4; y = 4;
		rec(0, 0, s);
		for (int i = 0; i < v.size(); ++i) {
			cout << v[i] << "AB" << endl;
			cout << v[i] << "BA" << endl;
		}
	}
	else if (j == 5) {
		j = 4;
		rec(0, 0, s);
		for (int i = 0; i < v.size(); ++i) cout << v[i] << "A" << endl;
	}
	else if (y == 5) {
		y = 4;
		rec(0, 0, s);
		for (int i = 0; i < v.size(); ++i) cout << v[i] << "B" << endl;
	}
	else if (j == 6) {
		j = 4;
		rec(0, 0, s);
		for (int i = 0; i < v.size(); ++i) cout << v[i] << "AA" << endl;
	}
	else if (y == 6) {
		y = 4;
		rec(0, 0, s);
		for (int i = 0; i < v.size(); ++i) cout << v[i] << "BB" << endl;
	}else{
		rec(0, 0, s);
		for (int i = 0; i < v.size(); ++i) cout << v[i] <<endl;
	}
	return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 998244353;
const int maxn = 1e6 + 233;
ll f[maxn],v[maxn];
void exgcd(ll a,ll b,ll &x,ll &y){
	if(b==0){
		x = 1;y = 0;
		return;
	}
	exgcd(b,a%b,y,x);
	y -= (a/b)*x;
}
inline ll inv(int i){
	ll x,y;
	exgcd(i,mod,x,y);
	if(x<0) x += mod;
	return x%mod; 
}
int main()
{
	memset(v,0,sizeof(v));
	int n;cin>>n;ll ans = 0;
	for(int i=1;i<=n;i++){
		int x;scanf("%d",&x);
		v[x] += x;
		ans = (ans+mod-x%mod);
//		cout<<"!"<<x<<" "<<v[x]<<endl;
	}
	for(int i=1000000;i;i--){
		ll sum = 0;
		for(int j=i;j<=1000000;j+=i)
			sum += v[j];
//		if(sum) cout << i<<": "<<sum << endl;
		sum %= mod;
		f[i] = sum*sum%mod;
		for(int j=i+i;j<=1000000;j+=i)
			f[i] = (f[i]-f[j]+mod)%mod;
//		if(f[i])cout<<i<<" "<<f[i]<<" "<<f[i]*inv(i)%mod << endl;
		ans = (ans+f[i]*inv(i))%mod;
	}
	cout << ans*inv(2)%mod << endl;
	return 0;
}

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

int main(void){
	int a = 2, b, r, x, tmp;
	cin >> b;
	x = a * b;
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	cout << x / b;
}



Measured memory_bytes: 256
#include <stdio.h>

int main() {
	char c;

	scanf("%c", &c);

	switch (c) {
	case 'A':
		printf("T");
		break;

	case 'C':
		printf("G");
		break;
	case 'G':
		printf("C");
		break;
	case 'T':
		printf("A");
		break;
	}
}

Measured memory_bytes: 128
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
"""
n,x = LI()
a = LI()
ans = 0
for i in range(n-1):
    if a[i]+a[i+1] > x:
        ans += a[i+1]+a[i]-x
        if x > a[i]:
            a[i+1] = x-a[i]
        else:
            a[i+1] = 0
            a[i] = x
print(ans)
"""

#D
s = S()
l = len(s)
k = (s[0] == s[-1])
if (l%2)^k:
    print("First")
else:
    print("Second")
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 46704
#include <iostream>

using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int total = a + b + c + d;
    int x, y;
    x = total / 60;
    y = total % 60;
    cout << x << endl;
    cout << y << endl;
}

Measured memory_bytes: 0
N, L = list(map(int, input().split()))

def result(min_, max_):
  out = 0
  for i in range(min_, max_+1):
    out += i
  return out

min_taste = L
max_taste = L + N -1

if (min_taste <= 0) and (max_taste <= 0):
  print(result(min_taste, max_taste-1))
elif (min_taste <= 0) and (max_taste > 0):
  print(result(min_taste, max_taste))
else:
  print(result(min_taste+1, max_taste))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define show(x) cerr << #x << " = " << x << endl
using namespace std;
using ll = long long;
int main()
{
    int N, D1, D2;
    cin >> N >> D1 >> D2;
    vector<int> sq(4 * N * N + 1, -1);
    for (int i = 0; i <= 2 * N; i++) { sq[i * i] = i; }
    using P = pair<int, int>;
    vector<P> d1, d2;
    for (int i = 0; i <= 2 * N; i++) {
        if (i * i <= D1 and sq[D1 - i * i] >= 0) { d1.push_back({i, sq[D1 - i * i]}), d1.push_back({i, -sq[D1 - i * i]}), d1.push_back({-i, sq[D1 - i * i]}), d1.push_back({-i, -sq[D1 - i * i]}); }
        if (i * i <= D2 and sq[D2 - i * i] >= 0) { d2.push_back({i, sq[D2 - i * i]}), d2.push_back({i, -sq[D2 - i * i]}), d2.push_back({-i, sq[D2 - i * i]}), d2.push_back({-i, -sq[D2 - i * i]}); }
    }
    const int SZ = 4 * N * N;
    vector<vector<int>> g1(SZ), g2(SZ);
    auto enc = [N](const int i, const int j) { return i * 2 * N + j; };
    auto in = [N](const int i, const int j) { return 0 <= i and i < 2 * N and 0 <= j and j < 2 * N; };
    for (int i = 0; i < 2 * N; i++) {
        for (int j = 0; j < 2 * N; j++) {
            for (const auto& d : d1) {
                const int di = d.first, dj = d.second;
                if (in(i + di, j + dj)) { g1[enc(i, j)].push_back(enc(i + di, j + dj)); }
            }
            for (const auto& d : d2) {
                const int di = d.first, dj = d.second;
                if (in(i + di, j + dj)) { g2[enc(i, j)].push_back(enc(i + di, j + dj)); }
            }
        }
    }
    vector<bool> ok(SZ, true);
    vector<bool> used(SZ, false);
    auto bfs = [&](const vector<vector<int>>& g, const int s) {
        using P = pair<int, bool>;
        queue<P> q;
        vector<int> b, w;
        used[s] = true, q.push({s, false}), b.push_back(s);
        while (not q.empty()) {
            const auto p = q.front();
            q.pop();
            for (const int to : g[p.first]) {
                if (used[to] or not ok[to]) { continue; }
                used[to] = true, q.push({to, not p.second}), (p.second ? b : w).push_back(to);
            }
        }
        if (b.size() < w.size()) { swap(b, w); }
        for (const int W : w) { ok[W] = false; }
    };
    for (int i = 0; i < SZ; i++) {
        if (not used[i]) { bfs(g1, i); }
    }
    fill(used.begin(), used.end(), false);
    for (int i = 0; i < SZ; i++) {
        if (ok[i] and not used[i]) { bfs(g2, i); }
    }
    auto dump = [N](const int code) { cout << code / 2 / N << " " << code % (2 * N) << endl; };
    int ans = 0;
    for (int i = 0; i < SZ and ans < N * N; i++) {
        if (ok[i]) { dump(i), ans++; }
    }
    assert(ans == N * N);
    return 0;
}


Measured memory_bytes: 97008
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;
typedef pair<P, llint> E;

struct SegTree{
	int size;
	vector<llint> seg;
	
	SegTree(){}
	SegTree(int size){
		this->size = size;
		seg.resize(1<<(size+1));
	}
	
	void init()
	{
		for(int i = 0; i < (1<<(size+1)); i++) seg[i] = -inf;
	}
	
	void update(int i, llint val)
	{
		i += (1 << size);
		seg[i] = val;
		while(i > 1){
			i /= 2;
			seg[i] = max(seg[i*2], seg[i*2+1]);
		}
	}

	llint query(int a, int b, int k, int l, int r)
	{
		if(b < l || r < a) return -inf;
		if(a <= l && r <= b) return seg[k];
		llint lval = query(a, b, k*2, l, (l+r)/2);
		llint rval = query(a, b, k*2+1, (l+r)/2+1, r);
		return max(lval, rval);
	}
	llint query(int a, int b)
	{
		if(a > b) return -inf;
		return query(a, b, 1, 0, (1<<size)-1);
	}
};

llint n;
llint a[200005];
vector<llint> G[200005];
vector<E> vec;
llint depth[200005], pos[200005], ans[200005];
SegTree seg(18);

void predfs(llint v, llint p, llint d)
{
	depth[v] = d;
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == p) continue;
		predfs(G[v][i], v, d+1);
	}
}

void dfs(llint v, llint p, llint a)
{
	llint x = pos[v], res = seg.query(0, x-1);
	ans[v] = max(a, max(0LL, res) + 1);
	seg.update(x, max(0LL, res) + 1);
	
	for(int i = 0; i < G[v].size(); i++){
		if(G[v][i] == p) continue;
		dfs(G[v][i], v, ans[v]);
	}
	
	seg.update(x, -inf);
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	
	llint u, v;
	for(int i = 1; i <= n-1; i++){
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	
	predfs(1, -1, 0);
	for(int i = 1; i <= n; i++){
		vec.push_back(E(P(a[i], -depth[i]), i));
	}
	sort(vec.begin(), vec.end());
	for(int i = 0; i < vec.size(); i++) pos[vec[i].second] = i;
	
	seg.init();
	dfs(1, -1, -inf);
	
	for(int i = 1; i <= n; i++) cout << ans[i] << endl;
	
	return 0;
}

Measured memory_bytes: 52256
#include <bits/stdc++.h>
using namespace std;
bool calc() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];

  int mmax = INT_MIN;
  int mmin = INT_MAX;
  for (auto c : v) {
    mmax = max(mmax, c);
    mmin = min(mmin, c);
  }

  if (mmax - mmin > 1) {
    return false;
  }

  if (mmax == mmin) {
    //      all single            all dup
    return (mmax == n - 1 || (mmax >= 1 && mmax <= n / 2));
  }

  int uniq = 0;
  for (auto c : v)
    if (c == mmin) uniq++;

  return (mmax >= uniq + 1 && mmax <= uniq + (n - uniq) / 2) ;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  if (calc()) {
    cout << "Yes";
  } else cout << "No";
  cout << endl;
}

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

int main() {

  int H, W;

  for(;;) {
    std::cin >> H >> W;
    if( H == 0 && W == 0 ) {
      break;
    }
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
	if( i == 0 || i == H-1 || j == 0 || j == W-1 ) {
	  std::cout << "#";
	}
	else {
	  std::cout << ".";
	}
      }
      std::cout << std::endl;
    }
    std::cout << std::endl;
  }
  
  
  
  return 0;
}

Measured memory_bytes: 1152
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;

void solve1() {
    int x,a,b;
    cin>>x>>a>>b;

    cout<<((abs(x-a) < abs(x-b)) ? "A" : "B") <<endl;

}

void solve2() {
    string s;
    cin>>s;

    map<char,int> map;

    for (int i = 0; i < s.size(); i++)
    {
        map[s[i]]++;   
    }
    for (char i = 'a'; i != 'z'+1; i++)
    {
        if(map[i] == 0){
            cout<<i<<endl;
            return;
        }
        
    }
    cout<<"None"<<endl;
}

void solve3() {

}

void solve4() {

}

int main() {
	// solve1();
	solve2();
	//solve3();
	//solve4();

	return 0;
}

Measured memory_bytes: 512
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let mut n: i64 = read();
    let k: i64 = read();

    let mut ans = 0;

    while n > 0 {
        ans += 1;
        n /= k;
    }

    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <iostream>

int main(int argc, char* argv[]) {
  int sum = 0;
  for(int i = 0; i < 3; ++i){
    int n;
    std::cin >> n;
    sum += n;
  }
  if(sum > 21) {
    std::cout << "bust" << std::endl;
  } else {
    std::cout << "win" << std::endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define INF 100000000000
#define MAX 200001
#define MOD 1000000007

void Eratosthenes(int n, vector<int> &arr){
    for(int i = 2; i < sqrt(n); i++)
    {
        if(arr[i])
        {
            for(int j = 2; i*j <= n; j++){
                arr[i*j] = 0;
            }
        }
    }
    for(int i = 2; i < n + 1; i++)
    {
        if(arr[i]){
            if(i % 5 != 1) arr[i] = 0; 
        }
    }
}

int main(){
    int N; 
    int cnt = 0;
    cin >> N;
    vector<int> arr(55555, 1);
    Eratosthenes(55555, arr);
    for(int i = 2; i < 55556; i++)
    {
        if(arr[i] == 1 && cnt == N - 1)
        {
            cout << i << endl;
            break;
        }
        if(arr[i] == 1){
            cout << i << ' ';
            cnt++;
        }
    }
}

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

using namespace std;

void solve(long N, int A, int B) {
  long long ans = 0;
  rep(i, N) {
    string i_str = to_string(i + 1);
    int sum = 0;
    rep(j, i_str.length())
      sum += (i_str[j] - '0');
    if (A <= sum && sum <= B)
      ans += i + 1;
  }
  cout << ans << endl;
}

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

  long N;
  int A, B;
  cin >> N >> A >> B;
  solve(N, A, B);
  return 0;
}


Measured memory_bytes: 256
use std::cmp::Reverse;
use std::collections::BTreeMap;
use whiteread::parse_line;

fn main() {
    let n: u32 = parse_line().unwrap();
    let mut dic: BTreeMap<String, Vec<(u32, u32)>> = BTreeMap::new();

    for i in 1..=n {
        let (s, p): (String, u32) = parse_line().unwrap();
        dic.entry(s)
            .and_modify(|x| x.push((i, p)))
            .or_insert(vec![(i, p)]);
    }
    for (_, v) in dic.iter() {
        let mut v = v.clone();
        v.sort_by_key(|x| Reverse(x.1));
        for &(i, _) in &v {
            println!("{}", i);
        }
    }
}


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

int main(){
    int s, count=1;
    cin >> s;
    int a = s;
    map<int, int> mp;
    mp[a] = 1;
    while(count<1000001){
        if(a%2==0) a = a/2;
        else a = 3*a+1;
        if(mp[a]==0) mp[a]=1;
        else{
            cout << count + 1 << endl;
            return 0;
        }
        count++;
    }

}

Measured memory_bytes: 256
import numpy as np
MOD = 10**9 + 7
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)
ans = 0
POW = 1
for j in range(60):
  tmp = A & 1
  one = np.count_nonzero(tmp)
  zero = N - one
  ans = (ans + (one * zero * POW)) % MOD
  A >>= 1
  POW = (POW<<1)%MOD
print(ans%MOD)

Measured memory_bytes: 48792
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int n;
    string a, b, c;
    cin >> n >> a >> b >>c;
    ll ans = 0;
    REP(i,n) {
        int cnt = 0;
        if (a[i] == b[i]) {
            if (b[i] != c[i]) cnt++; 
        } else {
            if (b[i] == c[i] || a[i] == c[i]) cnt++;
            else cnt = 2;
        }
        ans += cnt;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <iomanip>
#include<cstdlib>
#include<string>
#include<cmath>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define mod 1000000007
#define pi 3.14159265358979323846
#define fo(i,n) for(ll i=0;i<n;i++)
#define rf(i,n) for(ll i=n-1;i>=0;i--)
//Comment this while submitting as it might cause TLE
//It will change the WA from Integer Overflow to RE.
//#pragma GCC optimize "trapv"
using namespace std;
ll countDigits(ll n){ ll dig = floor(log10(n)+1);  return dig;}
 
 
int main(){
    string str;
    cin>>str;
    int n=str.length();
    fo(i,n){
        if(str[i]=='?'){
            str[i]='D';
        }
    }
    cout<<str<<"\n";
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dp[105][100005];
int main(){
	ll i,j,n,we;
	cin>>n>>we;
	ll v[n],w[n];
	for(i=0;i<n;i++){
		cin>>w[i];
		cin>>v[i];
	}
	for(i=0;i<=n;i++){
		for(j=0;j<=we;j++){
			if(i==0 || j==0){
				dp[i][j]=0;
			}
			else if(j>=w[i-1]){
				dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
			}
			else{
				dp[i][j]=dp[i-1][j];
			}
		}
	}
	cout<<dp[n][we];
}

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

int main(){
    string s;
    int N;
    cin >> s;
    cin >> N;
    vector<string> t;
    string tmp;

    for(int i=0; i<s.size(); i++){
	for(int j=1; j<=5; j++){
	    if(i+j <= s.size()){	    
		tmp = s.substr(i, j);
		t.push_back(tmp);
	    }
	}
    }
    
    sort(t.begin(), t.end());
    unique(t.begin(), t.end());
    
    cout << t[N-1] <<endl;
}




Measured memory_bytes: 1660
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
4
0 1 2
1 2 1
1 3 3

output:
5
"""

import sys
from math import isinf
from collections import deque


def generate_adj_table(v_table, init_adj_table):
    for each in v_table:
        source, target, cost = map(int, each)
        init_adj_table[source][target] = cost
        init_adj_table[target][source] = cost

    return init_adj_table


def graph_bfs(current, v_num, adj_table):
    queue = deque()
    distance = [float('inf')] * v_num
    distance[current] = 0
    queue.appendleft(current)

    while queue:
        current = queue.popleft()
        for adj, cost in adj_table[current].items():
            if isinf(distance[adj]):
                distance[adj] = distance[current] + cost
                queue.append(adj)
    return distance


def calc_tree_diameter(v_num, adj_table):
    # init x -> bridge vertex
    init_v = 0
    distance_1 = graph_bfs(init_v, v_num, adj_table)
    diameter, bridge_v = 0, 0
    for v, dis_1 in enumerate(distance_1):
        if isinf(dis_1):
            continue
        elif diameter < dis_1:
            diameter = dis_1
            bridge_v = v

    # bridge vertex -> y
    distance_2 = graph_bfs(bridge_v, v_num, adj_table)
    diameter = 0
    for dis_2 in distance_2:
        if isinf(dis_2):
            continue
        diameter = max(diameter, dis_2)

    return diameter


def solve():
    _input = sys.stdin.readlines()
    v_num = int(_input[0])
    edges = map(lambda x: x.split(), _input[1:])

    init_adj_table = tuple(dict() for _ in range(v_num))
    adj_table = generate_adj_table(edges, init_adj_table)
    ans = calc_tree_diameter(v_num, adj_table)
    print(ans)
    return None


if __name__ == '__main__':
    solve()

Measured memory_bytes: 62864
// inputに入力データ全体が入る
function Main(input) {


  var inp = input.split('\n');

  var buf = inp[0].split(' ');

  var N = parseInt(buf[0]);
  var x = parseInt(buf[1]);

  var an = inp[1].split(' ');

  // 昇順ソート
  an.sort(function (a, b) {
    return a - b;
  })

  var ans = 0;
  for (var i = 0; i < N; i++) {
    if(parseInt(an[i]) <= x){
      x -= parseInt(an[i]);
      ans++;
    }else{
      break;
    }
    if(i === N - 1){
      if(x !== 0) ans--;
    }
  }

  console.log('%d', ans);

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 9420
#include<stdio.h>
#include<string.h>
int main()
{
    char S[100000];
    scanf("%s", S);
	int count = 0;
	int i;
	char tmp = S[0];
	for(i = 1; i < strlen(S); i++) {
		if( tmp != S[i] ) {
			tmp = S[i];
			count++;
		}
	}
	printf("%d", count);
    return 0;
}

Measured memory_bytes: 256
/**
 * 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 ull = unsigned 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 ARegistration {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      string s, t; cin >> s >> t;
      int n = s.size();
      rep(i, n) {
        if (s[i] != t[i]) {
          cout << "No" << endl;
          return;
        }
      }
      cout << "Yes" << endl;
    }
};

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

Measured memory_bytes: 3656
// https://atcoder.jp/contests/dp/tasks/dp_i

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;

#define precision(x,d) cout<<fixed<<setprecision(d)<<x

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

    long double dp[n][n+1];

    for(int i=0 ; i<n ; i++)
    {
        for(int j=0 ;j<=n ; j++)
            dp[i][j] = 0.0;
    }

    dp[0][0] = 1-a[0];
    dp[0][1] = a[0];

    for(int i=1 ; i<n ; i++)
        dp[i][0] = dp[i-1][0]*(1-a[i]);

    for(int i=1 ;i<n ;i++)
    {
        for(int j=1 ;j<=n ; j++)
                dp[i][j] = dp[i-1][j]*(1-a[i]) + dp[i-1][j-1]*a[i];
    }
    /*for(int i=0 ; i<n ; i++)
    {
        for(int j=0 ; j<=n ; j++)
          cout << dp[i][j] << " ";
        cout << endl;
    }*/
    long double ans = 0.0;
    for(int i=(n/2+1) ; i<=n ; i++)
        ans += dp[n-1][i];
    precision(ans,13);
    return 0;
}


Measured memory_bytes: 144360
#include "bits/stdc++.h"
using namespace std;
#ifndef LOCAL
#define endl '\n'
#endif

#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rf(i, a, b) for(int i = a; i >= b; i--)
#define pf push_front
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef long double f80;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int pct(int x) { return __builtin_popcount(x); }
int pct(ll x) { return __builtin_popcountll(x); }
int bt(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int bt(ll x) { return 63 - __builtin_clzll(x); } // floor(log2(x))
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
ll cdiv(ll a, ll b) { return a / b + !(a < 0 || a % b == 0); }
int nxt_C(int x) { int c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }
ll nxt_C(ll x) { ll c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }

vector<int> get_bits(int mask) {
	vector<int> bb;
	while(mask) { int b = bt(mask); bb.pb(b); mask ^= (1 << b); }
	reverse(all(bb));
	return bb;
}

int get_mask(vector<int> v) {
	int mask = 0;
	for(int x : v) { mask ^= (1 << x); }
	return mask;
}

template<typename T>
void uniq(vector<T> &v) { sort(all(v)); v.resize(unique(all(v)) - v.begin()); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll rand(ll l, ll r){
	uniform_int_distribution<ll> uid(l, r);
	return uid(rng);
}

void sc() {}

template <typename Head, typename... Tail>
void sc(Head &H, Tail &... T) { cin >> H; sc(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L:" << __LINE__ << "][" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// #ifndef LOCAL
// string to_string(__int128 x) {
// 	string s = "";
// 	bool neg = 0;
// 	if(x < 0) { s += "-"; neg = 1; x = -x; }
// 	if(!x) s += '0';
// 	while(x) {
// 		int rem = x % 10;
// 		s += to_string(rem);
// 		x /= 10;
// 	}
// 	reverse(s.begin() + neg, s.end());
// 	return s;
// }
// #endif

const int mod = 1e9 + 7; // 998244353;

int pwr(int a,ll b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = (ans * 1LL * a) % mod;
		a = (a * 1LL * a) % mod;
		b >>= 1;
	}
	return ans;
}

/*
	Lookout for overflows!!
	Check array sizes!!
	Clear before test cases!!
	Use the correct modulo!!
	Check for corner cases!!
	Are you forgetting something?!
	Read problem statement carefully!!!
*/

void solve() {
	int x;
    sc(x);
    for(int m = 1; m <= 360; m++) {
        if((360 * m) % x == 0) {
            cout << (360 * m) / x << endl;
            return;
        }
    }
}

int main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin >> t;
	for(int tt = 1; tt <= t; tt++) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

vector<vector<int>> masu;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};


bool check(int h,int w){
    rep(i,h)rep(j,w){
        bool ok = true;
        rep(k,4){
            int a = i+dx[k];
            int b = j+dy[k];
            

            if(a < 0 || b < 0 || a >= h || b >= w)continue;
            if(masu[i][j] == 0){
                ok = false;
                break;
            }
            else{
                if(masu[a][b] == 1)ok = false;
            }
        }
        if(ok){
            return false;
        }
    }
    return true;
}


int main(){
    int H,W;cin >> H >> W;
    masu.resize(H,vector<int>(W,0));

    rep(i,H)rep(j,W){
        char x;cin >> x;
        if(x == '.')masu[i][j] = 0;
        else masu[i][j] = 1;
    }

    bool ans = check(H,W);

    if(ans)cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int main() {
  string s;
  cin >> s;
  if(s.at(0) == s.at(1) && s.at(0) == s.at(2)){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
}

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

int main() {
    int a , b ;
    std::cin >> a >> b ;
    
    std::string s ;
    if( a > b ) {
        s = ">" ;
    } else if( a == b ) {
        s = "==" ;
    } else {
        s = "<" ;
    }
    
    std::cout << "a " << s << " b" << std::endl ;
}


Measured memory_bytes: 3196
#include <stdio.h>
#include <math.h>

void swap(int *a, int *b)
{
  int temp;
  temp = *a;
  *a = *b;
  *b = temp;
}

int main(){
  int yakusuu;
  int x, y;
  int amari;
  
  scanf("%d %d\n", &x, &y);
  if(x == y)
    {
      printf("%d\n", x);
      return 0;
    }
  
  if(x < y){swap(&x, &y);}
  
  amari = x % y;
  yakusuu = floor(amari / 2);
  
  do
    {
      if((x % yakusuu) == 0)
	{
	  if((y % yakusuu) == 0)
	    {
	      break;
	    }
	}
      yakusuu--;
    }while (yakusuu > 1);
  
  printf("%d\n", yakusuu);
  
  return 0;
}




Measured memory_bytes: 2080
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;
using ll = long long;

int main()
{
    ll n;
    cin >> n;
    map<ll, ll> a;
    ll mx = 0;
    auto bunkai = [&](ll x){
        ll tmp = x;
        for(ll i = 2; i*i <= tmp; i++){
            if(x % i == 0){
                mx = max(i, mx);
            }
        }
        if(mx == 0) mx = max(x, mx);
        return mx;
    };
    ll yaku = bunkai(n);
    ll ans = (yaku-1) + (n/yaku -1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3564
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] arr = new int[N+1000][3];
        int[] memo = new int[N+1000];

        for (int i = 0; i < N; i++) {
            arr[i][0] = sc.nextInt();
            arr[i][1] = sc.nextInt();
            arr[i][2] = sc.nextInt();
            memo[i]=-1;
        }
        int[][] dp = new int[N+1000][3];
//        for (int i = 0; i <dp.length ; i++) {
//            dp[i] = Integer.MAX_VALUE;
//        }

        dp[1][0] = arr[0][0];
        dp[1][1] = arr[0][1];
        dp[1][2] = arr[0][2];

        for (int i = 1; i <= N-1 ; i++) {
            //A
            dp[i+1][0]=Math.max(dp[i][1],dp[i][2]) + arr[i][0];
            dp[i+1][1]=Math.max(dp[i][0],dp[i][2]) + arr[i][1];
            dp[i+1][2]=Math.max(dp[i][0],dp[i][1]) + arr[i][2];
        }

        System.out.println(Math.max(Math.max(dp[N][0],dp[N][1]),dp[N][2]));

//        System.out.println(recur(arr,memo,K,N-1));

    }

    static public int recur(int[] arr,int[] memo,int K, int idx){
        if(memo[idx]!=-1) return memo[idx];
        if(idx <=0){
            return 0;
        }

        int min = Integer.MAX_VALUE;
        for (int i = Math.max(0,idx-K); i <= idx-1; i++) {
            min = Math.min(min, recur(arr,memo,K,i) + Math.abs(arr[idx] - arr[i]));
        }

        memo[idx] =min;
        return min;
    }


}


Measured memory_bytes: 97752
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

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

	vector<ll> a(n);
	ll s = 0, s1 = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a.at(i);
		s += a.at(i);
		if (i % 2 == 1)
		{
			s1 += a.at(i);
		}
	}

	vector<ll> b(n);
	b.at(0) = s - 2 * s1;
	for (int i = 1; i < n; i++)
	{
		b.at(i) = 2 * a.at(i - 1) - b.at(i - 1);
	}

	for (int i = 0; i < n; i++)
	{
		cout << (i == 0 ? "" : " ") << b.at(i);
	}

	cout << endl;
}

Measured memory_bytes: 2944