akhauriyash/Code-Regression huggingface dataset:
#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;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

vector<ll> mp(string s) {
  ll n = s.size();
  vector<ll> ret(n + 1);
  ret[0] = -1;
  ll j = -1;
  rep(i, n) {
    while (j >= 0 && s[i] != s[j]) j = ret[j];
    ret[i + 1] = ++j;
  }
  return ret;
}

vector<ll> kmp(string str, string word) {
  vector<ll> table = mp(word), ret;
  ll m = 0, i = 0, n = str.size();
  while (m + i < n) {
    if (word[i] == str[m + i]) {
      if (++i == (ll)(word.size())) {
        ret.push_back(m);
        m = m + i - table[i];
        i = table[i];
      }
    }
    else {
      m = m + i - table[i];
      if (i > 0) i = table[i];
    }
  }
  return ret;
}

int main() {
  string s, t;
  cin >> s >> t;

  string ds = s;
  while (s.length() < t.length()) {
    s += ds;
  }
  ds = s + s;
  vector<ll> idx = kmp(ds, t);
  vector<bool> edge(s.length(), false);
  rep(i, idx.size()) {
    if (idx[i] >= s.length()) break;
    edge[idx[i]] = true;
  }
  vector<bool> visited(s.length(), false);
  vector<ll> dist(s.length(), 0);
  ll ans = 0;
  rep(i, s.length()) {
    if (visited[i] || !edge[i]) continue;
    ll start = i, res = i, d = 0;
    while (edge[res]) {
      visited[res] = true;
      res = (res + t.length()) % s.length();
      d++;
      if (res == start) {
        cout << -1 << endl;
        return 0;
      }
      else if (visited[res]) {
        d += dist[res];
        break;
      }
    }
    dist[start] = d;
    ans = max(ans, d);
  }
  cout << ans << endl;










  
  return 0;
}

Measured memory_bytes: 28940
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<algorithm>

#define ll long long
#define dl double
#define mod 1000000007
#define sz 1005
#define szz 150

using namespace std;

int main()
{
    char str[sz],ttr[sz];

    scanf("%s %s",str,ttr);

    ll len1=strlen(str);
    ll len2=strlen(ttr);

    set<string>s;
    set<string>::iterator it;
    s.clear();

    for(ll i=0; i<=(len1-len2); i++)
    {
        ll k=i;
        ll flag=0;

        for(ll j=0; j<len2; j++)
        {
            if(str[k]!='?'&&str[k]!=ttr[j])
            {
                flag=1;
                break;
            }

            k++;
        }

        if(flag==0)
        {
            char ss[sz];

            for(ll j=0; j<i; j++)
            {
                if(str[j]=='?')
                    ss[j]='a';

                else
                    ss[j]=str[j];
            }

            for(ll j=k; j<len1; j++)
            {
                if(str[j]=='?')
                    ss[j]='a';

                else
                    ss[j]=str[j];
            }

            ll x=i;

            for(ll j=0; j<len2; j++)
            {
                ss[x]=ttr[j];
                x++;
            }

            ss[len1]='\0';

            s.insert(ss);
        }
    }

    if(s.size()<=0)
        printf("UNRESTORABLE\n");

    else
    {
        for(it=s.begin(); it!=s.end(); it++)
        {
            cout<<(*it)<<endl;
            break;
        }
    }

    return (0);
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		Map<String, List<Integer>> map = new TreeMap<>();
		List<Integer> order = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			String s = scanner.next();
			int p = scanner.nextInt();
			order.add(p);
			if (map.containsKey(s)) {
				map.get(s).add(p);
			} else {
				List<Integer> set = new ArrayList<>();
				set.add(p);
				map.put(s, set);
			}
		}
		Comparator<Integer> comparator = new Comparator<Integer>() {
			@Override
			public int compare(Integer o1, Integer o2) {
				return o2 - o1;
			}
		};
		for (List<Integer> value : map.values()) {
			value.sort(comparator);
			for (Integer price : value) {
				System.out.println(order.indexOf(price) + 1);
			}
		}
	}
}


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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        s: String,
    }
    let s1 = s
        .chars()
        .take(2)
        .collect::<String>()
        .parse::<i64>()
        .unwrap();
    let s2 = s
        .chars()
        .skip(2)
        .collect::<String>()
        .parse::<i64>()
        .unwrap();
    let ans = match (s1, s2) {
        (1...12, 1...12) => "AMBIGUOUS",
        (1...12, _) => "MMYY",
        (_, 1...12) => "YYMM",
        _ => "NA",
    };
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <math.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <ostream>
#include <set>
#include <tuple>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef int _lcint;
#define REP(i, n) for (_lcint i = 0; i < n; i++)
#define FOR(i, a, b) for (_lcint i = (_lcint)(a); i < (_lcint)(b); i++)
#define FORREV(i, a, b) for (_lcint i = (_lcint)(b)-1; i >= (_lcint)(a); i--)
#define DEBUG(x) cout << #x << ": " << x << endl;
#define DEBUG_VEC(v)  \
  cout << #v << ": "; \
  REP(i, v.size()) cout << " " << v[i] << endl;

#define ALL(a) (a).begin(), (a).end()
#define CHMIN(a, b) a = min((a), (b))
#define CHMAX(a, b) a = max((a), (b))

// permutation
ll mPn(ll m, ll n) {
  ll a = 1;
  REP(i, n) { a *= m - i; }
  return a;
}

// excrametion
ll exc(ll m) {
  ll a = 1;
  FOR(i, 1, m) { a *= i + 1; }
  return a;
}

// combination
ll mCn(ll m, ll n) {
  ll a = 1, b = 1;
  REP(i, n) {
    a *= m - i;
    b *= n - i;
  }
  return a / b;
}

// 最大公約数を求める 条件
ll eculidean(ll a, ll b) {
  ll tmp;
  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }

  return b;
}

struct Position {
  int x, y;
};

int main() {
  int A, B;
  cin >> A >> B;
  if (A >= 13) {
    cout << (B) << endl;
  } else if (A >= 6) {
    cout << (B / 2) << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#各マスがちょうど 1 回ずつ選ばれる
n=int(input())
s=input()
d=[False]
for i in range(1,n*2):
    d.append((s[i]==s[i-1])^d[-1])
from collections import Counter
cd =Counter(d)
if not cd[True] or cd[0]!=cd[1] or s[0]=="W":
    print(0)
    exit()
st=d.index(True)
l=st
ans=1;mod=10**9+7
for i in range(st,2*n):
    if d[i]:
        ans*=l
        l-=1
        ans%=mod
    else:
        l+=1
for i in range(1,n+1):
    ans*=i
    ans%=mod

print(ans)

Measured memory_bytes: 10996
def main():
    n = int(input())
    xs = [int(i) for i in input().split()]

    xx = xs[:]
    xx.sort()
    a, b = xx[n//2-1], xx[n//2]
    #print(a, b, xx)
    for x in xs:
        if x >= b:
            print(a)
        else:
            print(b)
    

if __name__ == '__main__':
    main()


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n, m;
    cin >> n >> m;
    int sum = 0;
    vector<int> v(n);
    for(auto& i : v) {
        cin >> i;
        sum += i;
    }

    int cnt = 0;
    for(auto i : v) {
        if(i*4*m >= sum) cnt++;
    }

    cout << (cnt >= m ? "Yes" : "No") << endl;


    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("fma,avx")

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define sz(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

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

    int n;
    cin >> n;
    int c0 = 0, c1 = 0, c2 = 0, c3 = 0;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        if (s == "AC") {
            c0++;
        } else if (s == "WA") {
            c1++;
        } else if (s == "RE") {
            c3++;
        } else {
            c2++;
        }
    }
    cout << "AC x " << c0 << "\n";
    cout << "WA x " << c1 << "\n";
    cout << "TLE x " << c2 << "\n";
    cout << "RE x " << c3 << "\n";

    return 0;
}

Measured memory_bytes: 3660
N,A,B = map(int,input().split())
H = [int(input()) for n in range(N)]
L = 0
R = 10**9

while 1<R-L:
  m = (L+R)//2
  if m<-sum(min(0,(h-m*B)//(B-A)) for h in H):
    L = m
  else:
    R = m

print(R)

Measured memory_bytes: 13112
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;
    string s;
    char s1;

    cin>>n>>s;
    int l=s.size();

    for(i=0;i<l;i++)
    {
        int x=s[i]-'A';
        x=(x+n)%26;
        s1=(x+'A');
        cout<<s1;
    }
     putchar('\n');


return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int input() {int x; cin>>x; return x;}

int main(){
  int n=input(),m=input();
  vector<int> v[m];
  for(int i=0;i<m;i++) {
    int k=input();
    for(int j=0;j<k;j++) {
      v[i].push_back(input()-1);
    }
  }
  int p[m]; for(int i=0;i<m;i++) p[i]=input();
  int an=0;
  for(int i=0;i<(1<<n);i++) {
    bool ok=true;
    for(int j=0;j<m &&ok;j++) {
      int sm=0;
      for(int k=0; k<v[j].size(); k++) {
        int x = v[j][k];
        if (i & (1<<x)) sm++;
      }
      if (sm % 2 != p[j]) ok=false;
    }
    an += ok;
  }
  cout<<an<<endl;
  //for(bool x:u) cout<<x<<" "; cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) { return std::vector<T>(n, std::forward<T>(val)); }
template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}
template<class Cond> struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  template<class T> bool operator()(T& a, const T& b) const { if(cond(a, b)) { a = b; return true; } return false; }
};
template<class Cond> chain<Cond> make_chain(Cond cond) { return chain<Cond>(cond); }

int main() {
  i64 X, N;
  cin >> X >> N;
  vector<i64> P(101);
  rep(i,0,N) {
    i64 x;
    cin >> x;
    P[x] = 1;
  }
  auto check = [&](i64 x) {
    if(x < 0) return true;
    if(x > 100) return true;
    return P[x] == 0;
  };
  for(int d = 0;;d++) {
    if(check(X - d)) {
      cout << X - d << endl;
      return 0;
    }
    if(check(X + d)) {
      cout << X + d << endl;
      return 0;
    }
  }
}


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  ll x, y; cin >> x >> y;
  if(x % y == 0)
  {
    fin(-1)
  }
  else
  {
    fin(x)
  }
  
  return;
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}

int main(){
    int a,b;
    cin >> a >> b;
    printf("%d",(a-1)*(b-1));
}

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

ans, num, xor, cnt = 0, 0, 0, 0
for i in range(n):
    while cnt < n and xor & a[cnt] == 0:
        num += a[cnt]
        xor ^= a[cnt]
        cnt += 1
    ans += cnt - i
    num -= a[i]
    xor ^= a[i]
print(ans)


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

int main(){
  int K,l=0;
  cin>>K;
  for(int i=1;i<=K;i++)
    for(int j=1;j<=K;j++)
      for(int k=1;k<=K;k++)
        l+=__gcd(__gcd(i,j),k);
  cout<<l<<endl;
}

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

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

	ll N;
	cin >> N;
	vector<ll> A(N + 1, 0);
	for (ll i = 2; i <= N; i++) {
		ll a;
		cin >> a;
		A.at(a)++;
	}
	for (ll i = 1; i < N + 1; i++) {
		cout << A.at(i) << endl;
	}

}


Measured memory_bytes: 4784
import sys

MOD = 10 ** 9 + 7

s = sys.stdin.readline().rstrip()
l = len(s)

def main():
    dp1 = [0] * (l + 1)
    dp2 = [0] * (l + 1)
    dp2[0] = 1
    for i in range(l):
        dp1[i+1] = dp1[i] * 3
        if s[i] == '1':
            dp1[i+1] += dp2[i]
            dp2[i+1] = dp2[i] * 2
        else:
            dp2[i+1] = dp2[i]
        dp1[i+1] %= MOD
        dp2[i+1] %= MOD

    return (dp1[l] + dp2[l]) % MOD

if __name__ == '__main__':
    ans = main()
    print(ans)

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

int bubbleSort(int A[], int N){
    //cout << "bubbleSort() has calleed\n";
    int sw = 0;
    bool flag = 1;
    for(int i=0; flag; i++){
        //cout << "flag is " << flag << endl; 
        flag = 0;
        for(int j=N-1; j>=i+1; j--){
            if(A[j] < A[j-1]){
                swap(A[j], A[j-1]);
                flag = 1;
                sw++;
                //cout << "sw is " << sw << endl;
            }
        }
    }
    return sw;
}
    
int main(void){
    int A[100], N, sw;
    cin >> N;
    for(int i=0; i<N; i++) cin >> A[i];
    
    sw = bubbleSort(A, N);
    
    for(int i=0; i<N; i++){
        if (i) cout << " ";
        cout << A[i];
    }
    cout << "\n";
    
    cout << sw << "\n";
    
    return 0;    
}



Measured memory_bytes: 3120
import sys

sys.setrecursionlimit(1000000)


class St():
    def __init__(self, s):
        self.s = s
        self.i = 0

def expression(st, num):
    while (not st.s[st.i]=="."):
        if (st.s[st.i] == "("):
            if (not factor1(st)):
                return False

        elif (st.s[st.i] == "["):
            if (not factor2(st)):
                return False

        elif (not st.s[st.i] in [")", "]"]):
            st.i += 1

        else:
            if ((num==1) and (st.s[st.i]==")")) or ((num==2) and (st.s[st.i]=="]")):
                break
            else:
                return False
        if (st.i >= len(st.s)):
            return False
    return True
    
    
def factor1(st):
    st.i += 1
    if (st.s[st.i]=="."):
        return False
    if (expression(st, 1)):
        st.i += 1
        return True
    return False

def factor2(st):
    st.i += 1
    if (st.s[st.i]=="."):
        return False
    if (expression(st, 2)):
        st.i += 1
        return True
    return False


def solve(s):
    st = St(s)
    return expression(st, 0)

def main():
    ans = []
    while True:
        s = input()
        if (s=="."):
            break
        ans.append(solve(s))
    for i in ans:
        print("yes" if i else "no")


main()


Measured memory_bytes: 5996
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main() {
    string s;
    cin >> s;
    ll ans=s.size(),c=0;
    for (ll i=0;i<s.size();++i){
        --ans;
        if (s[i]=='A'){
            ++ans;
            break;
        }
    }
    for (ll i=0;i<s.size();++i){
        --ans;
        if (s[s.size()-i-1]=='Z'){
            ++ans;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
function Main(input) {
  "use strict"
  const temp = input.split("\n")[0].split(" ");

  const n = parseInt(temp.shift());
  const base = parseInt(temp.shift());
  
  let digit = 1
  while(n >= Math.pow(base, digit)){
    digit++;
  }
  console.log(digit)
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main()
{
    string S;
    cin >> S;
    if(S[2]==S[3] && S[4]==S[5] && S[0]!=S[1])
    cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const maxBuf = 300100

var buf []byte = make([]byte, maxBuf)
var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Buffer(buf, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	x, _ := strconv.Atoi(sc.Text())

	ma := 1
	for y := 2; y <= x; y++ {
		now := y * y
		for ; now <= x; now *= y {
			if ma < now {
				ma = now
			}
		}
	}
	fmt.Println(ma)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	int w,h,n;
	cin>>h>>w>>n;
	int b=max(h,w);
	if(n%b==0)cout<<n/b<<endl;
	else cout<<n/b+1<<endl;
	return 0;
}



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

typedef long long int int64;

int cmp(const void *a,const void *b){
  return *(int *)a-*(int *)b;
}

void run(void){
  int n;
  scanf("%d",&n);
  int *a=(int *)calloc(n,sizeof(int));
  int i;
  for(i=0;i<n;i++) scanf("%d",a+i);
  qsort(a,n,sizeof(int),cmp);
  i=0;
  int64 sum=0;
  while(i<n){
    sum+=a[i];
    int j=i+1;
    while(j<n && 2*sum>=a[j]) sum+=a[j++];
    if(j>=n){
      printf("%d\n",n-i);
    }
    i=j;
  }
}

int main(void){
  run();
  return 0;
}

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cout << (*begin) << " ";
    *begin++;
  }
  cout << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cout << " " << Array[i][j];
    }
    cout << endl;
  }
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cerr << head << " ";
  print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

// ------------------------------------------------------------------------------------------

int n;
vec<string> v;

string f(string a, string b) {
  if (a == "T" and b == "F") {
    return "F";
  }
  return "T";
}

signed main() {
  cin >> n;
  v.resize(n);
  rep (i, n) {
    cin >> v[i];
  }

  string ans = f(v[0], v[1]);
  repp (i, 1, n-1) {
    ans = f(ans, v[i+1]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 8412
len = 1000000
p = Array.new(len,1)
p[0] = 0
i = 1
m = Math.sqrt(len).to_i
loop do
  begin i += 1; end while p[i-1] == 0 && i < m
  j = i
  p[j-1] = 0 while (j += i) <= len
  break if i == m
end

(1..(len-1)).each do |i|
  p[i] += p[i-1]
end

begin
  while (n = STDIN.readline.chomp.to_i)
    puts p[n-1]
  end
rescue
  exit
end

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

int main() {
  int N;
  cin >> N;
  int Yjudge = 0;
  
  for (int i=0; i<N; i++) {
    string s;
    cin >> s;
    
    if (s == "Y")
      Yjudge = 1;
  }
  
  if (Yjudge == 0)
    cout <<"Three" <<endl;
  
  if (Yjudge == 1)
    cout <<"Four" <<endl;
}


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

namespace ALDS1_12_B_SingleSourceShortestPathI
{
	class Program
	{
		static void Main ( string[] args )
		{
			int dataCount = int.Parse (Console.ReadLine ());
			Graph graph = new Graph (dataCount);

			for (int lp = 0; lp < dataCount; lp++)
			{
				int[] inputNum = Array.ConvertAll (Console.ReadLine ().Split (' '), int.Parse);

				for (int lp2 = 0; lp2 < inputNum[1]; lp2++)
				{
					graph.GetPath (inputNum[0], inputNum[lp2 * 2 + 2], inputNum[lp2 * 2 + 3]);
				}
			}

			int[] result = graph.Dijkstra (0);

			StringBuilder output = new StringBuilder (dataCount * 6);
			int count = 0;

			foreach (var item in result)
			{
				output.Append (count);
				output.Append (" ");
				output.Append (item);
				output.AppendLine ();
				count++;
			}

			Console.Write (output);
		}
	}

	class Graph
	{
		public Graph ( int size )
		{
			this.Size = size;

			this.Path = new int[size][];
			for (int lp = 0; lp < this.Size; lp++)
			{
				this.Path[lp] = Enumerable.Repeat (Infinity, this.Size).ToArray ();
			}
		}

		private int[][] Path { set; get; }
		private const int Infinity = int.MaxValue;
		private int Size { set; get; }	

		public void GetPath ( int beginPoint, int adjacencyPoint,int cost )
		{
			Path[beginPoint][adjacencyPoint] = cost;
		}

		public int[] Dijkstra ( int beginPoint )
		{
			const int Stay = 1;
			const int Visited = 2;
			int[] visitState = new int[Size];

			const int Infinity=int.MaxValue;
			int[] distance = Enumerable.Repeat (Infinity, Size).ToArray ();

			int[] parent = new int[Size];

			distance[beginPoint] = 0;
			parent[beginPoint] = -1;

			while (true)
			{
				int minCost = Infinity;
				int parentIndex = 0;

				for (int lp = 0; lp < Size; lp++)
				{
					if (visitState[lp] != Visited && distance[lp] < minCost)
					{
						minCost = distance[lp];
						parentIndex = lp;
					}
				}

				if (minCost == Infinity)
				{
					break;
				}

				visitState[parentIndex] = Visited;

				for (int lp = 0; lp < Size; lp++)
				{
					if (visitState[lp] != Visited && Path[parentIndex][lp] != Infinity)
					{
						//?????????????????????????????????????????????
						if (distance[parentIndex] + Path[parentIndex][lp] < distance[lp])
						{
							distance[lp] = distance[parentIndex] + Path[parentIndex][lp];
							parent[lp] = parentIndex;
							visitState[lp] = Stay;
						}
					}
				}
			}

			return distance;
		}
	}
}

Measured memory_bytes: 9644
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }
    

    Scanner cin;

    List<int>[] es;

    void calc()
    {
        cin = new Scanner();
        string S = cin.next();
        int ans = (S.Length) / 2;
        foreach (var c in S)
        {
            if (c == 'p')
            {
                ans--;
            }
        }
        Console.WriteLine(ans);
    }
    
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

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

typedef long long ll;
#define rep(i, n) for(ll i=0; i<n; i++)
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define sz(v) ll(v.size)


void solve(long long N, long long M, std::vector<long long> L, std::vector<long long> R){
    ll minR = N;
    ll maxL = 1;
    rep(i, M) {
        if (L[i] > maxL) maxL = L[i];
        if (R[i] < minR) minR = R[i];
    }
    if (minR >= maxL) {
        cout << minR - maxL + 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> L(M);
    std::vector<long long> R(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&L[i]);
        scanf("%lld",&R[i]);
    }
    solve(N, M, std::move(L), std::move(R));
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define F(type, i, a, b) for(type i = a; i <= b; i ++)
#define RF(type, i, a, b) for(type i = a; i >= b;i --)
#define sz(a) sizeof(a)
#define deb(a) cout<<" ["<<(#a)<<"->"<<(a)<<"] "
#define next_line cout<<'\n'
using namespace std;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<char,int> pci;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef map<char,int> mci;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
typedef unordered_map<char,int> umci;
typedef vector<ll>  vll;
typedef vector<vector<ll> > vvll;

ll n,k,*arr;
ll mod = 1e9 + 7LL;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
    size_t operator()(const pair<uint64_t, uint64_t>& p) const
    { 
        auto hash1 = custom_hash{}(p.first); 
        auto hash2 = custom_hash{}(p.second); 
        return hash1 ^ (hash2 >> 1); 
    } 
}; 
unordered_map<pll , ll, hash_pair> dp;

ll NumberOfways(ll k, ll st){
    if(k < 0LL)
        return 0LL;
    if(st == n){
        if(k == 0){
            //deb(k);
            return 1LL;
        }    
        return 0LL;
    }
    if(dp.find({k, st}) != dp.end())   
        return dp[{k, st}];
    ll ans = 0LL;
    //deb(k);deb(st);
    //next_line;
    F(ll, i, 0, arr[st]){
        ans += NumberOfways(k - i, st + 1LL);
        // deb(i);deb(ans);
        // next_line;
        ans %= mod;
    }
    dp[{k, st}] = ans;
    //next_line;
    return ans;
}

void solve()
{
    cin>>n>>k;
    arr = new ll[sz(ll) * n];
    F(ll, i, 0, n - 1) 
        cin>>arr[i];
    vector<ll> dp(1e5 + 1, 0LL), pref(1e5 + 1, 1LL);
    dp[0] = 1LL;
    //dp[k] -> dp[0][k] ->[1, 0, 0, ...]{initially}
    //dp[i] -> = dp[i - a[i] + 1] + dp[i - a[i] + 2] + .... + dp[i] 
    F(int, i, 0, n - 1){
        pref[0] = dp[0];
        F(int, j, 1, k){
            pref[j] = (pref[j - 1] + dp[j]) % mod;
        }
        F(int, j, 0, k){
            if(j <= arr[i]) 
                dp[j] = pref[j];
            else{
                dp[j] = (pref[j] - pref[j - arr[i] - 1] + mod) % mod;
            }
        }
    }
    cout<<dp[k]<<'\n';
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#else
    //#endif
    solve();
}


Measured memory_bytes: 4764
#include<iostream>
#include<string>
#include<algorithm>
#define ll long long
using namespace std;
void get(ll arr[],ll n)
{
for(ll i=0;i<n;i++)
cin>>arr[i];
}
int main()
{
	ll n,k;
	cin>>k>>n;
	ll arr[n];
	get(arr,n);
	ll min=99999999999,temp;
	for(int i=0;i<n;i++)
	{
		if(i==0)
		temp=arr[(n-1)] - arr [i];
		else
		temp= k - arr[i] + arr[(n-1+i)%n];
		if(temp<min)
		min=temp;
	}
	for(int i=0;i<n;i++)
	{
		if(i!=n-1)
		temp = arr[i] + k - arr[i+1];
		else
		temp = arr[n-1]- arr[0];
		if(temp<min)
		min=temp;
	}
	cout<<min;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main()
{
	string s;
	string t;

	cin >> s;
	cin >> t;

	int cnt = 0;
	for (int i = 0; i < 3; i++)
	{
		if (s[i] == t[i])
			cnt++;
	}

	cout << cnt << endl;
}

Measured memory_bytes: 256
#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 all( x ) ( x ).begin(), ( x ).end()
typedef long long lint;
using namespace std;

int main( void ){
	
	lint a, b;
	
	cin >> a >> b;
	
	cout << a + ( b / 2 ) << endl;
	
	return 0;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define vi vector<int>
#define pii pair<int,int>
#define vii vector<pair<int,int>>
#define ll long long
using namespace std;

int main()
{
    ll m,d,ans,o,t;
    cin>>m>>d;
    ans=0;
    rep(i,1,m+1)
    {
        rep(j,10,d+1)
        {
            t=(j/10)%10;
            o=j%10;
            if(o>=2&&t>=2&&o*t==i)
            {
              //  cout<<i<<" "<<j<<"\n";
                ans++;
            }
        }
    }
    cout<<ans;
}


Measured memory_bytes: 256
h,m,s;main(t,u){for(;scanf("%d%d%d",&h,&m,&s),h+1;printf("%02d:%02d:%02d\n%02d:%02d:%02d\n",t/3600,t/60%60,t%60,u/3600,u/60%60,u%60)){t=7200-h*3600-m*60-s;u=t*3;}exit(0);}

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

int main(){
  int H,W,K;
  cin >> H >> W >> K;
  vector<vector<char>> C(H,vector<char>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> C.at(i).at(j);
    }
  }
  int count=0;
  for(int bith=0;bith<(1<<H);bith++){
    for(int bitw=0;bitw<(1<<W);bitw++){
      int kuro=0;
      for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
          if(bith &(1<<i)){
            continue;
          }
          if(bitw &(1<<j)){
            continue;
          }
          if(C.at(i).at(j)=='#'){
            kuro++;
          }
        }
      }
      if(kuro==K){
        count++;
      }
    }
  }
  cout << count << endl;
}

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

int main(){

  int ans=0;
  string S,T;
  cin >> S;
  cin >> T;
  for(int i=0; i<3; i++){
    if(S[i]==T[i]) ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
bool submax(ll x,ll y,ll z){
    if((x<y && y<=z)||(z<y && y<=x)){
        //cout<<x<<" "<<y<<" "<<z<<endl;
        return true;
    }
    return false;
}
int main(void){
    // Your code here!
    ll N;
    cin>>N;
    ll a[N];
    rep(0,i,N)cin>>a[i];
    ll ans=0;
    rep(0,i,N-2){
        if(submax(a[i],a[i+1],a[i+2]))++ans;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
N=int(input())
d=0
maxk=0
for k in range(N+1): 
	d_temp = N - (k*(k+1))//2
	if d_temp < 0:
		break
	else:
		maxk = k
		d = d_temp
if d==0:
	for i in range(maxk):
		print(i+1)
else:
	to_print = [i+1 for i in range(maxk)]
	del to_print[-d]
	to_print.append(maxk+1)
	for x in to_print:
		print(x)

Measured memory_bytes: 3572
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef vector<bool> vb;
 
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()
 
ll k;

 
void solve(){
 cin >> k;
 
 ll res=0;
 rep(a,1,k+1){
  rep(b,1,k+1){ 
    ll ab=__gcd(a,b);
   rep(c,1,k+1){
    res+=__gcd(ab,c); 
   }
  }
 }
  cout << res << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}  

Measured memory_bytes: 3652
fun main(args: Array<String>) {
    val menu = (1..5).map { readLine()!!.toInt() }

    var max = 0
    for (m in menu) {
        if (m % 10 == 0) {
            continue
        }
        max = Math.max(max, 10 - (m % 10))
    }

    var ans = 0
    for (m in menu) {
        if (m % 10 == 0) {
            ans += m
            continue
        }
        ans += m + (10 - (m % 10))
    }
    ans -= max

    println(ans)
}

Measured memory_bytes: 33656
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll k;
set<int> s;
ll bm(ll a,ll b)
{
	if(b==0) return 1;
	ll t=bm(a,b/2);
	if(b%2==0) return t*t%k;
	else return a*(t*t%k)%k;
}
int main()
{
	cin>>k;
	if(k%2==0)
	{
		cout<<"-1"<<endl;
		return 0;
	}
	if(k%7==0) k/=7;
	k*=9;
	ll i=1;
	while(i)
	{
		ll now=bm(10,i);
		if(s.count(now))
		{
			cout<<"-1"<<endl;
			return 0;
		}
		if(now==1) 
		{
			cout<<i<<endl;
			return 0;
		}
		s.insert(now);
		i++;
	}
}

Measured memory_bytes: 50472
def resolve():
    n, k = map(int, input().split())
    if n >= k:
        ans1 = n%k
        if ans1 <= abs(ans1-k):
            print(ans1)
        else:
            print(abs(ans1-k))
    else:
        if abs(n-k) <= n:
            print(abs(n-k))
        else:
            print(n)
resolve()

Measured memory_bytes: 3060
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>

using namespace std;

string solve(string str, int a, int b) {
	int cnt = 0;
	for (int i = 0; i < str.size(); i++) {
		if (str[i] >= '0' && str[i] <= '9')
			cnt++;
		else if (str[i] == '-') {
			if (cnt != a) return "No";
			cnt = 0;
		}
	}
	if (cnt != b) return "No";
	return "Yes";
}

int main() {
	int a, b;
	string str;
	cin >> a >> b;
	cin >> str;
	cout << solve(str, a, b) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <string>
#include <cstdlib> //絶対値利用のため
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)

//const int INF = INT_MAX / 2;

int main() {
	int n;
	cin >> n;
	double x[11];
	string u[11];
	double sum = 0;
	for (int i = 1; i <= n; i++){
		cin >> x[i] >> u[i];
		if (u[i] == "JPY") sum += x[i];
		else sum += 380000 * x[i];
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int n;
  cin >> n;
  
  vector<int>num;
  int sum = 0;
  int p = 1;
  
  while(sum < n){
      num.push_back(p);
      sum += p;
      p++;
  }
  
  int s = num.size();
  
  for(int i=0;i<s;i++){
      if(sum - n != num[i])
      cout << num[i] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 1e3;
const lli INF = 1e18;
const lli MOD = 1e9+7;

vi m;
vi primes(1,2);
vector<vector<ld>>nk;
void sieve(){
	m = vi(N+1,0);
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
}

void pascal(){
	nk =vector<vector<ld>>(N,vector<ld>(N,0.0));
	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;
	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];
}

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}

// ---- コーディングはここから！ ('-')7

void solve(){
	string s; cin>>s;
	lli sum = 0;
	for(auto i:s)sum=(sum+(i-'0'))%9;
	cout<<(sum?"No":"Yes")<<ENDL;
}

int main(){_
	//int t; cin>>t; while(t--)
	solve();
}


Measured memory_bytes: 3784
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int a=0,x=0,y=0,z=0;
  int s=1;
  scanf("%d",&a);
  scanf("%d",&x);
  if (a>x) {
    y=x;
  }else{
    y=a;
  }
  if (y==a) {
    for (int i = 0; i < x; i++,s=s*10) {
      y=y+(a*s);
      if(i==0){
        y=y-a;
      }
    }
  }else{
  s=1;
  for (int i = 0; i < a; i++,s=s*10) {
    y=y+(x*s);
    if(i==0){
      y=y-x;
    }
  }
}
  printf("%d\n",y);

  return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp72 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int H = st[0];
            int W = st[1];

            var C = new string[H];

            for (int i = 0; i < H; i++) {
                C[i] = Console.ReadLine();
            }

            for (int i = 0; i < H; i++) {
                Console.WriteLine(C[i]);
                Console.WriteLine(C[i]);
            }

        }
    }
}


Measured memory_bytes: 13396
from itertools import permutations

n,m=map(int,input().split())
G=[[] for _ in range(n)]
for _ in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  G[a].append(b)
  G[b].append(a)
ans=0
for P in permutations(range(n),n):
  f=1
  if P[0]!=0:
    continue
  for i in range(n-1):
    if  P[i+1] in G[P[i]]:
      f*=1
    else:
      f*=0
  if f==1:
    ans+=1
print(ans)

Measured memory_bytes: 73720
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    int a,b;
    cin>>a>>b;
    if(a+b<10){
        cout<<a+b;
    }else{
        cout<<"error";
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
AB = [tuple(map(int,input().split())) for i in range(N)]
CD = [tuple(map(int,input().split())) for i in range(N)]

P = 2*N+2
es = [[] for i in range(P)] # [[to1,cap1,rev1], ...]

def add_edge(fr,to,cap):
    es[fr].append([to,cap,len(es[to])])
    es[to].append([fr,0,len(es[fr])-1])

for i in range(N):
    add_edge(2*N,i,1)
    add_edge(N+i,2*N+1,1)
for i,(a,b) in enumerate(AB):
    for j,(c,d) in enumerate(CD):
        if a<c and b<d:
            add_edge(i,j+N,1)

INF = float('inf')
level = [0] * P
iters = [0] * P
from collections import deque
def dinic_max_flow(s,t):
    global iters

    def _bfs(s):
        global level
        level = [-1] * P
        level[s] = 0
        q = deque([s])
        while q:
            v = q.popleft()
            for to,cap,rev in es[v]:
                if cap > 0 and level[to] < 0:
                    level[to] = level[v] + 1
                    q.append(to)

    def _dfs(v,t,f):
        if v == t: return f
        for i in range(iters[v],len(es[v])):
            iters[v] += 1
            to,cap,rev = es[v][i]
            if es[v][i][1] > 0 and level[v] < level[to]:
                d = _dfs(to,t,min(f,es[v][i][1]))
                if d > 0:
                    es[v][i][1] -= d #cap
                    es[to][rev][1] += d
                    return d
        return 0

    flow = 0
    while True:
        _bfs(s)
        if level[t] < 0: return flow
        iters = [0] * P
        f = 0
        while True:
            f = _dfs(s,t,INF)
            if f <= 0: break
            flow += f

print(dinic_max_flow(2*N,2*N+1))

Measured memory_bytes: 3956
#include<stdio.h>

int main(){
    int a,b,c;
    int temp;

    scanf("%d%d%d",&a,&b,&c);
    temp = a;
    a = b;
    b = temp;
    temp = a;
    a = c;
    c = temp;
    printf("%d %d %d", a, b, c);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main() {
    int i;
    int A[3];

    for (i = 0; i < 3; i++) scanf("%d", &A[i]);

    if(A[0] + A[1] + A[2] >= 22) printf("bust\n");
    else printf("win\n");

    return 0;
}

Measured memory_bytes: 128
S = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
]

K = int(input())
print(S[K-1])

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

int main(){
	int n;
	cin>>n;
	
	vector<int> pri(n+1,1);
	pri[0]=0;
	pri[1]=0;
	for(int i=2;i<n+1;i++){
		if(pri[i]==1){
			for(int j=i*2;j<n;j+=i)pri[j]=0;
		}
	}
	
	vector<int> ans(n+1,0);
	
	for(int i=2;i<n+1;i++){
		int x=i;
		for(int j=2;j<x+1;j++){
			if(pri[j]==1){
				while(x%j==0){
					x/=j;
					ans[j]++;
				}
			}
		}
	}
	
	long long int anse=1;
	int mod=1e9+7;
	for(int i=2;i<=n;i++){
		if(ans[i]!=0){
			//cout<<ans[i]<<" "<<i<<endl;
			anse*=(ans[i]+1);
		}
		anse%=mod;
	}
	
	cout<<anse<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>

typedef long long ll;
using std::vector;
using std::string;
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}

//////////////////////////////////////



//////////////////////////////////////

int main() {
    //std::ifstream in("0_normal_2");
    //std::cin.rdbuf(in.rdbuf());
    
    ll N;
    std::cin >> N;
    ll ans = N*(N-1)/2;
    std::cout << ans << std::endl;
    
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;

int main(){
    int n,a,cnt=0,ans=0;
    cin>>n;
    lol(i,n){
	cin>>a;
	if(a==1)cnt++;
	if(a==0)ans=max(ans,cnt),cnt=0;
    }
    cout<<max(ans,cnt)+1<<endl;
    return 0;
}



Measured memory_bytes: 3104
//I_also_love_tanya_romanova
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
const int mx=1e5+10;
uli a[mx];
int main(){
   int n;
   uli l;
   scanf("%d %lld",&n,&l);
   for(int i=0;i<n;i++){
      scanf("%lld",a+i);
   }
   int idx=-1;
   for(int i=0;i+1<n;i++){
      if(a[i]+a[i+1]>=l){
         idx=i;
      }
   }
   if(idx==-1){
      puts("Impossible");
      return 0;
   }
   puts("Possible");
   for(int i=1;i<=idx;i++){
      printf("%d\n",i);
   }
   for(int i=n-1;i>=idx+1;i--){
      printf("%d\n",i);
   }
// printf("%d\n",idx+1);   
   return 0;
}


Measured memory_bytes: 1536