akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

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

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

const ll mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  std::vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

ll K;
std::string S;
std::map<ll, ll> mp;
combination comb( 5000010 );

int main()
{
  std::cin >> K >> S;

  ll N = S.size();
  mint ans = 0;

  repi( l, N, N+K+1 ) {
    ans += mint(25).pow(l-N)*comb( l-1, N-1 )*mint(26).pow( N+K-l );
  }

  std::cout << ans.x << std::endl;

  return 0;
}

Measured memory_bytes: 83420
// AGC 35 A
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define MAX 100000
void inarray(int a[], int n){
    for(int i = 0; i < n; i++) cin >> a[i];
}

int main(){
    int n; cin >> n;
    int a[n]; 
    inarray(a,n);
    sort(a,a+n);
    int c, zero = 0;
    vector<int> v;
    v.push_back(a[0]);
    if(a[0] == 0) zero++;
    for(int i = 1; i < n; i++){
        if(a[i] == 0) zero++;
        if(a[i-1] != a[i]){
            v.push_back(a[i]);
        }
    }
    c = v.size();
    if(c == 1){
        if(zero == n) cout << "Yes" << endl;
        else cout << "No" << endl; 
    }else if(c == 2){
        if(zero == n/3 && n-(zero) == 2*n/3){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else if(c == 3){
        int w  = (v[0]^v[1]);
        w ^= v[2];
        if(w == 0){
            int c1 = 0, c2 = 0, c3 = 0;
            for(int i = 0; i < n; i++){
                if(a[i] == v[0]) c1++;
                else if(a[i] == v[1]) c2++;
                else if(a[i] == v[2]) c3++;
            }
            if(c1 == c2 && c2 == c3) cout << "Yes" << endl;
            else cout << "No" << endl;
        }else{
            cout << "No" << endl;    
        }
    }else{
        cout << "No" << endl;
    }

    return 0;
}

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

class Program
{
    static void Main()
    {
        var MOD = 1000000007L;

        var input = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var N = input[0];
        var K = input[1];

        var result = 0L;
        for (var i = K; i < N + 2; i++)
        {
            var min = i * (i - 1) / 2;
            var max = i * (2 * N - i + 1) / 2;
            result += (max - min + 1) % MOD;
        }
        Console.WriteLine(result % MOD);
    }
}


Measured memory_bytes: 28244
// 00/01/20 // 00:00 XM //

#include <bits/stdc++.h>

using namespace std;

#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long

const int INF = 0x3f3f3f3f3f3f3f3f;
const int MAXN = (int)(4e2) + 10;

int n;
int memo[MAXN][MAXN], prefix[MAXN];

int solve(int i, int j){
    if(memo[i][j]!=-1) return memo[i][j];

    if(i==j) return memo[i][j] = 0;

    memo[i][j] = INF;
    for(int k=i; k<j; k++)
        memo[i][j] = min(memo[i][j], solve(i, k) + solve(k+1, j)+prefix[j]-prefix[i-1]);

    return memo[i][j];
}

int32_t main(){
    fastio;

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

    memset(memo, -1, sizeof(memo));
    cout << solve(1, n) << endl;

    return 0;
}


Measured memory_bytes: 1664
import sys
input = map(int, raw_input().split())
group1 = [1,3,5,7,8,10,12]
group2 = [4,6,9,11]
group3 =  [2]

syozoku = [0,0]

for i in range(2):
	if input[i] in group1:
		syozoku[i] = 1
	elif input[i] in group2:
		syozoku[i] = 2
	elif input[i] in group3:
		syozoku[i] = 3

#print(syozoku[0])
#print(syozoku[1])
if syozoku[0] == syozoku[1]:
	print("Yes")
else:
	print("No")


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

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> f(h+2, vector<char>(w+2, '#'));
  rep(i,h) rep(j,w) cin >> f[i+1][j+1];

  rep(i,h+2) {
    rep(j,w+2) cout << f[i][j];
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 3612
import heapq
import sys

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

short = 0
marge = []
ans = 0
for i in range(n):
	dif = a[i] - b[i]
	if dif < 0:
		ans += 1
		short += dif
	else:
		heapq.heappush(marge,dif*(-1))

if ans == 0:
	print(ans)
	sys.exit()

while marge != []:
	add = heapq.heappop(marge)*(-1)
	ans += 1
	short += add
	if short >= 0:
		print(ans)
		sys.exit()

print(-1)

Measured memory_bytes: 19384
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)

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


Measured memory_bytes: 256
import java.util.Scanner;

//best pizza
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(); //??????????????°????¨????
		int a = sc.nextInt(); //?????°?????????
		int b = sc.nextInt(); //??????????????°?????????
		int calorie[] = new int [n+1];
		for(int i = 0;i<n+1;i++){
			calorie[i] = sc.nextInt(); 
		}
		int box,work;
		for(int i = 1; i < n+1; i++) { //??????????????????
			box = i;
			for(int m = i + 1; m < n+1; m++) {
				if(calorie[m] > calorie[box]){
					box = m;
				}
			}
			work = calorie[i]; 
			calorie[i] = calorie[box]; 
			calorie[box] = work;
		}
		/*for(int i = 0;i<n+1;i++){
			System.out.println(calorie[i]);
		}*/
		int allcalorie = calorie[0],allcalorie2 = calorie[0];
		int nedan = a,nedan2 = a;
		int result = allcalorie / nedan,result2;
		for(int i = 1;i<n+1;i++){
			nedan2 = a + b*i;
			allcalorie2 = allcalorie2 + calorie[i];
			result = allcalorie / nedan;
			result2 = allcalorie2 / nedan2;
			if(result < result2){
				nedan = nedan2;
				allcalorie = allcalorie2;
				result = result2;
			}
		}
		System.out.println(result);
	}
}
			

Measured memory_bytes: 18156
n=int(input())
lists=list(map(int,input().split()))
counter=1
uselist=[0,0,0]
for j in range(n):
    human=lists[j]
    sub=0
    for p in range(3):
        if uselist[p]==human:
            sub+=1
    for q in range(3):
        if uselist[q]==human:
            uselist[q]+=1
            break
    counter=counter*sub
    counter=counter%(10**9+7)
if lists[0]==0:
    print(counter)
else:
    print(0)


Measured memory_bytes: 52952
#include <iostream>

typedef long long ll;
using namespace std;

ll dp[1001][1001];

ll solve(ll n, ll k, ll m) {
  dp[0][0] = 1;
  for(int i=1;i<=n;++i) {
    for(int j=1;j<=i;++j) {
      dp[i][j] = j*(dp[i-1][j-1] + dp[i-1][j]) % m;
    }
  }
  return dp[n][k];
}

int main() {
  ll n,k,mod=1e9+7;
  cin>>n>>k;
  cout<<solve(n,k,mod)<<endl;
  return 0;
}



Measured memory_bytes: 9964
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fivecxed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; } value
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  bool ans = true;
  vector<int> vec(n);
  REP(i,n) {
    cin >> vec[i];
    if(vec[i] % 2 == 0 && vec[i] % 3 != 0 && vec[i] % 2 == 0 && vec[i] % 5 != 0) {
      cout << "DENIED" << endl;
      return 0;
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define INF (1<<20)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int main()
{
	int w;
	cin >> w;
	cout << w * 32 << endl;
	return 0;
}

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

int main(void){
    long long n;
    cin >> n;
    
    if (n % 2 == 1){
        cout << 0 << endl;
        return 0;
    }
    
    n /= 2;
    long long ans = 0;
    
    while(n){
        ans += n / 5;
        n /= 5;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
use std::io;
fn read<T: std::str::FromStr>() -> T{
    let mut n = String::new();
    io::stdin().read_line(&mut n).unwrap();
    n.trim().parse().ok().unwrap()
}
fn main() {
    let n : u32 = read();
    println!("{}",n*n*n);
}



Measured memory_bytes: 5028
/* ***********************************************
Author        :yang12138
Created Time  :2017年04月19日 星期三 15时34分04秒
File Name     :B.cpp
************************************************ */
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef pair<int,int>pii;
#define lson (root<<1)
#define rson (root<<1|1)

const int N=1e5+10;

struct Edge{
	int to,nex;
}e[N<<1];

int head[N],cnt;
void add_edge(int u,int v){
	e[cnt].to=v,e[cnt].nex=head[u],head[u]=cnt++;
}

pii tmp[11][N],ans[N];

int main(){
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
   	int n,m,q; 
	scanf("%d%d",&n,&m);
	mem(head,-1);
	mem(tmp,0),mem(ans,0);
	for(int i=1;i<=m;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		add_edge(u,v);
		add_edge(v,u);
	}

	scanf("%d",&q);
	for(int i=1;i<=q;i++){
		int v,d,c;
		scanf("%d%d%d",&v,&d,&c);
		pii cur=pii(i,c);
		tmp[d][v]=max(tmp[d][v],cur);
		ans[v]=max(ans[v],cur);
	}

	for(int i=10;i>=1;i--){
		for(int u=1;u<=n;u++){
			if(tmp[i][u].first==0) continue;
			for(int j=head[u];~j;j=e[j].nex){
				int v=e[j].to;
				tmp[i-1][v]=max(tmp[i-1][v],tmp[i][u]);
				ans[v]=max(ans[v],tmp[i][u]);
			}
		}
	}

	for(int i=1;i<=n;i++) printf("%d\n",ans[i].second);

    return 0;
}


Measured memory_bytes: 12032
n = int(input())
b = [ int(x) for x in input().split() ]
res = [ float("inf") for _ in range(n) ]

for k, v in enumerate(b):
    if res[k] > v:
        res[k] = v

    if res[k+1] > v:
        res[k+1] = v

print(sum(res))



Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public long MOD = 1000000007;

        public void Run()
        {
            N = Input.ReadInt();
            int[] H = Input.ReadIntArray();

            int ret = 0;
            for (int h = 100; h >= 1; h--)
            {
                int a = 0;
                for (int i = 0; i < N; i++)
                {
                    if (H[i] == h)
                    {
                        if (a == 0) ret++;
                        H[i]--;
                        a = 1;
                    }
                    else
                    {
                        a = 0;
                    }
                }
            }

            Console.WriteLine(ret);
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

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

int main(){
  int h[6],m[6],s[6],tt[3]={};
  for(int i=0;i<6;i++){
    cin >> h[i] >> m[i] >> s[i];
  }
  for(int i=0;i<6;i+=2){
    while(1){
      if(h[i]==h[i+1]&&m[i]==m[i+1]&&s[i]==s[i+1])break;
      s[i]++;
      tt[i/2]++;
      if(s[i]==60){
	s[i]=0;
	m[i]++;
      }
      if(m[i]==60){
	m[i]=0;
	h[i]++;
      }
    }
  }
  for(int i=0;i<3;i++){
    cout << tt[i]/3600 << " " ;
    tt[i]%=3600;
    cout << tt[i]/60 << " ";
    tt[i]%=60;
    cout << tt[i] << endl;
  }
  return 0;
}

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

int main()
{
    int X,Y,A,B,C;
    cin >> X >> Y >> A >> B >> C;
    long long a;
    priority_queue<pair<long long,int>> que;
    for (int i=0;i<A;i++)
    {
        cin >> a;
        que.push(make_pair(a,1));
    }
    for (int i=0;i<B;i++)
    {
        cin >> a;
        que.push(make_pair(a,2));
    }
    for (int i=0;i<C;i++)
    {
        cin >> a;
        que.push(make_pair(a,3));
    }
    vector <long long> graya;
    int red=0,green=0,gray=0;
    long long s=0;
    pair<long long,int> pa;
    while (red+green+gray!=X+Y) 
    {
        pa=que.top();
        que.pop();
        if ((pa.second==1) & (red<X))
        {
            red++;
            s+=pa.first;
        }
        if ((pa.second==2)& (green<Y))
        {
            green++;
            s+=pa.first;
        }
        if (pa.second==3)
        {  
            gray++;
            graya.push_back(pa.first);
        }
    }
    if (red==X)
    {
        for (int i=0;i<Y-green;i++) s+=graya[i];
    }
    if (green==Y)
    {
        for (int i=0;i<X-red;i++) s+=graya[i];
    }
    if ((red<X) &(green<Y))
    {
        for (int i=0;i<gray;i++) s+=graya[i];
    }
    cout << s << endl;
return 0;
}

Measured memory_bytes: 12012
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
const int mod = 1e9+7, A = 1e3+5;
set<ll> st;
vector<ll> v;
vector<ll> get_devisors(ll x)
{
	vector<ll> v;
	for (ll i = 2; i * i <= x; i++)
	{
		if (x % i == 0)
			v.pb(i), v.pb(x / i);
	}
	if (x != 1)
		v.pb(x);
	return v;
}
bool valid(ll x, ll n)
{
	while(n % x == 0)
		n /= x;
	return (n % x == 1);
}
int main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	ll n;
	cin >> n;
	v = get_devisors(n - 1);
	for (auto i : v)
	{
		if (n % i == 1)
			st.insert(i);
	}
	v = get_devisors(n);
	for (auto i : v)
	{
		if (valid(i, n))
			st.insert(i);
	}
	cout << st.size();
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
#include<math.h>

using namespace std;

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

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int main(){
	ll N, M;
	cin >> N >> M;
	if (2 * N >= M){
		cout << ll(M / 2) << endl;
	}
	else{
		ll ans;
		ans = N;
		ans += ll((M - N * 2) / 4);
		cout << ans << endl;
	}
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;	
int main()
{ 
	int MOD=1000000007;
	long long n;
	cin>>n;
	int k;
	cin>>k;
	long long cnt=0;
	for(long long i=k;i<=n+1;i++)
	{
		cnt+=(i*(n-i+1)+1)%MOD;
		cnt=cnt%MOD;
	}
	cout<<cnt<<endl;
	return 0;
}

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

int main() {
    int r, g, b, n;
    cin >> r >> g >> b >> n;
    int ans = 0;
    rep(i,n+1) {
        rep(j,n+1) {
            if ((n - i*r - j*g) >= 0 && (n - i*r - j*g) % b == 0) {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc164/abc164_a.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N, M;
  cin >> N >> M;
  
   cout << (N > M ? "safe" : "unsafe") << endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



string s;
int n;

signed main() {
	cin >> s;
	n = s.size();
	cout << ((n%2==0 && s[0]!=s[n-1]) || (n%2==1 && s[0]==s[n-1]) ? "Second" : "First") << ln;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    ll N;
    cin >> N;
    ll path[5] = {0};
    ll minPath = 1000000000000000;
    rep(i, 5) {
        cin >> path[i];
        minPath = min(minPath, path[i]);
    }
    ll result = (N / minPath) + 4;
    if (N % minPath != 0) result += 1;

    cout << result << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
typedef pair<ll,ll> l_l;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back


ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}
ll gcd(ll x,ll y){
    if(x<y) return gcd(y,x);
    if(y==0) return x;
    return gcd(y,x%y);
}

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




Measured memory_bytes: 1792
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    int a,b;
    char op;
    while (true){
        cin >> a >> op >> b;
        int c;
        if(op=='?') break;
        else if(op=='+') c=a+b;
        else if(op=='-') c=a-b;
        else if(op=='*') c=a*b;
        else if(op=='/') c=a/b;
        cout<<c<<endl;
    }return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

constexpr auto INF = INT_MAX/2;
constexpr auto MOD = 1000000007;

int main() {
	int n;
	cin >> n;
	vi x(n), y(n), h(n);

	rep(i, n)cin >> x[i] >> y[i] >> h[i];

	int ansx=INF, ansy=INF, ansh=INF;

	rep(cx, 101)rep(cy, 101) {
		
		bool dame = false;
		int H = 0;

		rep(i, n) {
			if (h[i] == 0)continue;

			int k = abs(x[i] - cx) + abs(y[i] - cy);

			if (H) {
				if (H == k + h[i])continue;
				else dame=true;
			}
			else H = k + h[i];
		}

		int mxh = INF;

		rep(i, n) {
			if (h[i])continue;

			int k = abs(x[i] - cx) + abs(y[i] - cy);

			if (H) {
				if (H > k)dame = true;
			}
			else mxh = min(mxh,k);
		}

		if (H == 0) {
			if (mxh == 0)dame = true;
			else H = mxh;
		}
		
		if (!dame) {
			ansx = cx;
			ansy = cy;
			ansh = H;
			break;
		}
	}

	cout << ansx << " " << ansy << " " << ansh << endl;

}

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



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef pair<ll, ll> pint;


#define rep(i,n) for(ll i=0;i<n;i++)



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

ll gcd(ll x, ll y){
  if(x < y) swap(x, y);

  while(x%y != 0){
    x = x%y;
    swap(x, y);
  }

  return y;
}

int main() {


  cout<<fixed<<setprecision(10);

  ll x,y; cin>>x>>y;

  cout<<gcd(x,y)<<endl;
}





//




Measured memory_bytes: 3100
#include<iostream>
  #include<math.h>
  using namespace std;
  int main()
  {
    int N;
    cin>>N;
    int a[N + 1];
    for(int i = 0; i < N; i++) {
      int d;
      cin>>d;
      a[i] = d;
    }
    int ans;
    int same = 0;
    for(int j = 0; j < N; j++) {
      for(int k = 0; k < j; k++) {
        if(a[k] == a[j] ) {
          same = 1;
        }
      }
      if(same == 0) {
        ans++;
      }
      same = 0;
    }
    cout<<ans<<endl;
    return 0;
  }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    long long A[N];
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    sort(A, A + N);
    long long ans = 1.0;
    for (int i = 0; i < N; i++)
    {
        if (A[i] == 0)
        {
            cout << "0" << endl;
            return 0;
        }
        long long tmp = ceil((long long)1e+18 / ans);
        if (A[i] > tmp)
        {
            cout << "-1" << endl;
            return 0;
        }
        ans *= A[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4412
#include<stdio.h>
 
int main(void)
{
  int N,i,j,b,c,d,e,f=0,r,k;

  int a[3000];
  scanf("%d",&N);
  for(i = 0;i<N;i++)
  	scanf("%d",&a[i]);

  for(k=0;k<N;k++)
  	f=f+a[k]-1;
  printf("%d\n",f);
  
  return 0;
}

Measured memory_bytes: 128
//四則演算 #pragma GCC target("avx")
//並列計算 #pragma GCC optimize("O3")
//条件分岐を減らす #pragma GCC optimize("unroll-loops")
//浮動小数点演算 #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define eFOR(i,a,n) for(int i=(a);i<=(n);++i)
#define rFOR(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define erFOR(i,a,n) for(int i=(n);i>=(a);--i)
#define each(i, a) for(auto &i : a)
#define SORT(a) sort(a.begin(),a.end())
#define rSORT(a) sort(a.rbegin(),a.rend())
#define fSORT(a,f) sort(a.begin(),a.end(),f)
#define all(a) a.begin(),a.end()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#define tp(a,i) get<i>(a)
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& a : v)is >> a; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }
template<class T>inline void print(const T& a) { cout << a << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
inline string reversed(const string& s) { string t = s; reverse(all(t)); return t; }

void testcase() {
    int n, d; cin >> n >> d;
    print(127 * (n - 1) + (d ^ (127 * ((n & 1) ^ 1))));
}

void multicases() {
    int t; cin >> t;
    while (t--)testcase();
}

int main() {
    init();

    multicases();

    return 0;
}

Measured memory_bytes: 3588
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		string[] str = Console.ReadLine().Split();
		int[]A = new int[N];
		var dic = new Dictionary<int,int>();
		long ans = 0;
		for(var i=N-1;i>=0;i--){
			A[i] = int.Parse(str[i]);
			int b = A[i]-i-1;
			if(dic.ContainsKey(-(A[i]+i+1))){
				ans += dic[-(A[i]+i+1)];
			}
			if(dic.ContainsKey(b)){
				dic[b]++;
			} else {
				dic[b]=1;
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 46516
#include <iostream>
#include <cmath>
#include <string.h>
#include <string>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    char a;
    cin>>a;
if(a=='A'){
    cout<<'T';
}
else if(a=='T'){
    cout<<'A';
}
else if(a=='C'){
    cout<<'G';
}
else if(a=='G'){
    cout<<'C';
}
    return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n, k;
  cin >> n >> k;
  
  vl cnt(1e5+1);
  ll a, b;
  rep(i, n) {
    cin >> a >> b;
    cnt[a] += b;
  }
  
  rep2(i, 1e5) {
    if(k <= cnt[i]) {cout << i << newl; return 0;}
    else k -= cnt[i];
  }
}

Measured memory_bytes: 3996
#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define va vector<long long int> a 
#define vb vector<long long int> b
#define M 1000000007
using namespace std;
ll t;
void fast(){cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);}
ll power(ll x,ul y,ll p){ll res = 1;x = x % p;if(x == 0)return 0;while (y > 0){if (y & 1)res = (res*x) % p;y = y>>1;x = (x*x) % p;}return res;}
void solve(){
	ll k;
	cin>>k;
	ll a,b;
	cin>>a>>b;
	if(a%k!=0 && b%k!=0 && (a/k==b/k))cout<<"NG\n";
	else cout<<"OK\n";
 }
int main(){
	fast();
	solve();
	return 0;
}



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

#define MAX 100001
typedef struct {
	char name[11];
	int time;
} process;

process Q[MAX] = {0};
int head, tail;

void initialize();
int isEmpty();
int isFull();
void enqueue(process x);
process dequeue();

void showQue(process Que[], int n) {
	int i;
	for (i = 0; i < n; ++i) {
		printf("%s %d\n", Que[i].name, Que[i].time);
	}
	return;
}

int main(void) {
	int n, q, i;
	int stime = 0;
	process tmp_p;
	scanf("%d %d", &n, &q);

	for (i = 0; i < n; ++i) {
		scanf("%s %d", tmp_p.name, &tmp_p.time);
		enqueue(tmp_p);
	}
//	showQue(Q, n);
	while (!isEmpty()) {
		tmp_p = dequeue();
		if (tmp_p.time <= q) {
			stime += tmp_p.time;
			printf("%s %d\n", tmp_p.name, stime);
			continue;
		}

		stime += q;
		tmp_p.time = tmp_p.time - q;

		enqueue(tmp_p);
	}

	return 0;
}

void initialize() {
	head = tail = 0;
}

int isEmpty() {
	return head == tail;
}

int isFull() {
	return head == (tail + 1) % MAX;
}

void enqueue(process x) {
	if (isFull()) {
		printf("Over Flow\n");
		exit(1);
	}

	Q[tail] = x;
	if (tail + 1 == MAX) {
		tail = 0;
	} else {
		tail++;
	}
	
	return;
}

process dequeue() {
	process x;
	if (isEmpty()) {
		printf("Under Flow\n");
		exit(1);
	}
	x = Q[head];
	if (head + 1 == MAX) {
		head = 0;
	} else {
		head++;
	}
	return x;
}

Measured memory_bytes: 2156
import math

def isprime(x):
        if x == 2:
                return True
        if x < 2 or x % 2 == 0:
                return False
        i = 3
        while(i <= math.sqrt(x)):
                if x % i == 0:
                        return False
                i += 2

        return True

num = raw_input()

count = 0
for i in range(int(num)):
        x = raw_input()
        if isprime(int(x)):
                count += 1

print count

Measured memory_bytes: 6536
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int x[101010];
long long p[101010];
int main()
{
	int n,s,st,ed;
	int dir=0;
	long long ans=0;
	scanf("%d%d",&n,&s);
	st=1;
	ed=n;
	for(int i=1;i<=n;i++)
		scanf("%d%lld",&x[i],&p[i]);
	while(x[st]<s&&x[ed]>s)
	{
		if(p[st]>=p[ed])
		{
			if(dir!=1)
			{
				ans+=x[ed]-x[st];
				dir=1;
			}
			p[st]+=p[ed];
			ed--;
		}
		else
		{
			if(dir!=2)
			{
				ans+=x[ed]-x[st];
				dir=2;
			}
			p[ed]+=p[st];
			st++;
		}
	}
	if(x[ed]>s)
		ans+=x[ed]-s;
	else
		ans+=s-x[st];
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1408
a = [0]*5
a[0] = int(input())
a[1] = int(input())
a[2] = int(input())
a[3] = int(input())
a[4] = int(input())
b = 10**10
t = 0
for i in range(5):
    c = a[i]%10
    t += -1*(-1*a[i]//10)*10
    if c == 0:
        pass
    else:
        b = min(b,c)
if b == 10**10:
    print(t)
else:
    print(t+b-10)

Measured memory_bytes: 3064
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	S := make([]string, N)
	for i := 0; i < N; i++ {
		S[i] = sc.nextStr()
	}
	ans := []rune{}
	for i := 0; i < 26; i++ {
		target := rune('a' + i)
		mi := 50
		for _, s := range S {
			count := 0
			for _, r := range s {
				if r == target {
					count++
				}
			}
			mi = min(mi, count)
		}
		for i := 0; i < mi; i++ {
			ans = append(ans, target)
		}
	}

	fmt.Fprintln(wtr, string(ans))
	wtr.Flush()
}


Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAX 1400

int dp[MAX][MAX], G[MAX][MAX];

int getLargestSquare(int H, int W) {
    int maxWidth = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            dp[i][j] = (G[i][j] + 1) % 2;
            maxWidth |= dp[i][j];
        }
    }
    
    for (int i = 1; i < H; i++) {
        for (int j = 1; j < W; j++) {
            if (G[i][j]) {
                dp[i][j] = 0;
            } else {
                dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
                maxWidth = max(maxWidth, dp[i][j]);
            }
        }
    }
    
    return maxWidth * maxWidth;
}

int main(void) {
    int H, W;
    scanf("%d %d", &H, &W);
    
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) scanf("%d", &G[i][j]);
    }
    
    printf("%d\n", getLargestSquare(H, W));
    
    return 0;
}


Measured memory_bytes: 18056
l = list(map(int, "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".split(", ")))
k = int(input())
print(l[k-1])


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

int main(){

    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<int> a(n,0);
    vector<int> b(n,0);

    for(int i=0;i<n-1;i++){
        a[i+1]=a[i];
        if(s[i]=='W'){
            a[i+1]++;
        }
    }

    for(int j=n-1;j>0;j--){
        b[j-1]=b[j];
        if(s[j]=='E'){
            b[j-1]++;
        }
    }

    int ans=n;
    for(int i=0;i<n;i++){
        ans=min(ans,a[i]+b[i]);
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<float> v(N,0);
    for(int i = 0; i < N; i++) cin >> v[i];
    sort(v.begin(), v.end());
    for(int i = 0; i < N-1; i++){
        v[i+1] = (v[i] + v[i+1]) / 2;
    }

    cout << v[N-1] << endl;
    return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val a, b, c = Array.fill(n)(sc.nextInt()).sorted

  val bCount = Array.fill(n)(0L)
  var pc = 0
  for (pb <- 0 until n) {
    while (pc < n && c(pc) <= b(pb)) {
      pc += 1
    }
    bCount(pb) = n - pc
  }

  val bCountRSum = bCount.scanRight(0L)(_ + _)

  var pb = 0
  var ans = 0L
  for (pa <- 0 until n) {
    while (pb < n && b(pb) <= a(pa)) {
      pb += 1
    }
    ans += bCountRSum(pb)
  }

  println(ans)
}


Measured memory_bytes: 64284
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
const string YES = "Yes";
const string NO = "No";
   
void solve(long long a, long long b, long long c){
  if((c-a-b) < 0){cout << NO << endl; return;}
else cout << ((long long)4*a*b < (long long)(c-a-b)*(c-a-b) ? YES : NO) << endl;
}  

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    long long c;
    scanf("%lld",&c);
    solve(a, b, c);
}


Measured memory_bytes: 256
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
// #include<deque>
// #include<multiset>
// #include<bitset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n, m;
  cin >> n >> m;
  int f[50] = {};
  for(int i = 0; i < n; i++) {
    int k;
    cin >> k;
    while(k--) {
      int t;
      cin >> t;
      f[t]++;
    }
  }
  int ans = 0;
  for(int i = 1; i <= m; i++) ans += f[i] == n;
  cout << ans << endl;
  return 0;
}


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

int main(){

    int n = 0;
    int p[21];
    
    std::cin >> n;
    for(int i = 0; i < n; i++){
        std::cin >> p[i];
    }

    int ans = 0;

    for(int i = 1; i < n-1; i ++){
        if((p[i-1] < p[i] && p[i] < p[i+1]) || (p[i-1] > p[i] && p[i] > p[i+1]) )
            ans++;
    }

    std::cout << ans << std::endl;
}

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

int main() {

    int a,b,c,k;

    cin >> a >> b >> c >> k;

    if(a >= b && a >= c){
        for(int i=0; i<k; i++){
            a *= 2;
        }
    }
    else if(b >= a && b >= c){
        for(int i=0; i<k; i++){
            b *= 2;
        }
    }
    else{
        for(int i=0; i<k; i++){
            c *= 2;
        }
    }

    cout << a + b + c << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long int;
using namespace std;
ll mod=1e9+7;
      
      
int main(){
  int n;
  cin >> n;
  int a[n];
  int l=0;
  int ans=0;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=0; i<100000;i++){
    int q=l;
    l=a[q]-1;
    ans++;
    if(l==1){
      cout << ans << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<string>
#include<cstdio>
#include<stack>
#include<cmath>
#include<bitset>
#include<memory>
#include<utility>
using namespace std;
#define FOR(i,m,n) for(i=m;i<n;i++)
#define CLR(a,b) memset(a,b,sizeof(a))
#define ROF(i,m,n) for(i=m;i>=n;i--)
#define BUG cout<<"debug"<<endl;
#define RT return
#define BK break
#define HEAP priority_queue
#define SP " "
#define lowf(a,b,c) lower_bound(a,b,c)
#define upf(a,b,c) upper_bound(a,b,c)
typedef long long LL;
typedef vector<int> VI;
const int INF = 2147483647;
const int NEN = -INF - 1;
const LL LINF = 9223372036854775807;
LL gcd(LL a, LL b)
{
	return b ? gcd(b, a%b):a;
}
int main()
{
	LL a, b,c;
	while (cin >> a >> b)
	{
		c = gcd(a, b);
		cout << c << " " << a*b / c << endl;
	}
    return 0;
}



Measured memory_bytes: 3072
function main(input) {
  const args = input.split('\n');
  num = Number(args[0])

  arr = args[1].split(' ').map(n => Number(n))

  console.log(arr.join(' '))
  insertionSort(num, arr)

}

function insertionSort(length, arr) {

  for (let i = 1; i < length; i++) {
    let v = arr[i]
    let j = i - 1
    while (j >= 0 && arr[j] > v) {
      arr[j+1] = arr[j]
      j--
    }
    arr[j+1] = v
    console.log(arr.join(' '))
  }
}


main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 16568
/*
貪欲
後ろから見る
DP
順位表をチェック
二分探索
不変なもの・偶奇に注目

*/
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include<tuple>
#include<set>
using namespace std;
#define INF 1LL<<60
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,bool> P;
//typedef pair< pair<int,int>,pair<int,int> > p;
//#define int ll int main->signed main
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());

vector<int> V[110000],R[110000];
bool visit[110000];
vector<int> order;
int d[110000];
int ans[110000];

void dfs(int x){
    visit[x]=true;
    for(int i=0;i<(int)V[x].size();i++){
        int next=V[x][i];
        if(visit[next]) continue;
        dfs(next);
    }
    order.push_back(x);
}

int main(){
    int N,M;
    cin>>N>>M;
    for(int i=0;i<N-1+M;i++){
        int a,b;
        cin>>a>>b;
        a--; b--;
        V[a].push_back(b);
        R[b].push_back(a);
    }
    for(int i=0;i<110000;i++){
        visit[i]=false;
    }
    for(int i=0;i<N;i++){
        if(visit[i]) continue;
        dfs(i);
    }
    reverse(order.begin(),order.end());

    for(int i=0;i<N;i++){
        int x=order[i],a;
        if(i==0){
            ans[x]=-1; continue;
        }
        for(int j=0;j<(int)R[x].size();j++){
            int r=R[x][j];
            if(d[x]<d[r]+1){
                a=r;
                d[x]=d[r]+1;
            }
        }
        ans[x]=a;
    }
    for(int i=0;i<N;i++){
        cout<<ans[i]+1<<endl;
    }

    


}


Measured memory_bytes: 16764