akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
int Q;
ll A,M;
ll mpw(ll n,ll m,ll md){
	ll ret=1;
	while(m){
		if(m&1){
			ret*=n;
			ret%=md;
		}
		n*=n;
		n%=md;
		m>>=1;
	}
	return ret;
}
ll gcd(ll a,ll b){
	if(b==0) return a;
	return gcd(b,a%b);
}
ll euler(ll x){
	ll ret=x;
	for(ll i=2;i*i<=x;i++){
		if(x%i==0){
			ret/=i;
			ret*=i-1;
			while(x%i==0){
				x/=i;
			}
		}
	}
	if(x!=1){
		ret/=x;
		ret*=x-1;
	}
	return ret;
}
typedef pair<ll,ll> P;
void extgcd(ll a,ll b,ll &x,ll &y){
	if(b==0){
		x=1;
		y=0;
	}else{
		ll x2,y2;
		extgcd(b,a%b,x2,y2);
		x=y2;
		y=-a/b*y2+x2;
	}
}
ll minv(ll a,ll m){
	//gcd(a,m)=1
	ll x,k;
	extgcd(a,m,x,k);
	x=(x+m)%m;
	return x;
}
P godoshiki(ll a,ll b,ll m){
	//gcd(a,m)|b
	P ret;
	ret.second=m/gcd(a,m);
	ret.first=minv(a/gcd(a,m),ret.second)*(b/gcd(a,m))%ret.second;
	return ret;
}
ll dfs(ll m){
	if(m==1){
		return 100;
	}
	ll eum=euler(m);
	ll y=dfs(gcd(m,eum));
	P p=godoshiki(eum,(mpw(A,y,m)-y+m)%m,m);
	ll x=y+p.first*eum,md=eum/gcd(m,eum)*m;
	x%=md;
	while(x<100)x+=md;
	return x;
}
	
int main(){
	cin>>Q;
	REP(qry,Q){
		cin>>A>>M;
		cout<<dfs(M)<<endl;
	}
}

Measured memory_bytes: 256
s = input()

a_cnt = 0
b_cnt = 0
c_cnt = 0
for i in range(len(s)):
    if s[i] == 'a':
        a_cnt += 1
    elif s[i] == 'b':
        b_cnt += 1
    else:
        c_cnt += 1
        
abc_max = max(a_cnt, b_cnt, c_cnt)
abc_min = min(a_cnt, b_cnt, c_cnt)

if abc_max < abc_min + 2:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<ll> vll;
const int MN = 21, MOD=1e9+7;
ll lcm (ll a, ll b) {return a*b/__gcd(a,b);}
ll multiplyMod(ll a, ll b) { return (a % MOD * b % MOD) % MOD; }
ll addMod(ll a, ll b) { return (a % MOD + b % MOD) % MOD; }
ll subMod(ll a, ll b) { return (a % MOD - b % MOD) % MOD; }
ll fpow(ll b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}
//remember to pop from your queues idot
int dist[MN][MN][MN][MN];
int grid[MN][MN];
int h, w;
char temp;
vpii dirs;
void traverse(int sx, int sy) {
    queue<pii> q;
    q.push({sx, sy});
    dist[sx][sy][sx][sy] = 0;
    while (!q.empty()) {
        int x = q.front().f, y = q.front().s;
        q.pop();
        for (pii moves : dirs) {
            int a = moves.f, b = moves.s;
            int nx = a + x, ny = y + b;
            if (nx > h || nx == 0 || ny > w || ny == 0 || grid[nx][ny]) {
                continue;
            }
            if (dist[sx][sy][x][y] + 1 < dist[sx][sy][nx][ny]) {
                dist[sx][sy][nx][ny] = 1 + dist[sx][sy][x][y];
                q.push({nx, ny});
            }
        }
    }
}
int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> h >> w;
    dirs.pb({1, 0}); dirs.pb({0, 1}); dirs.pb({-1, 0}); dirs.pb({0, -1});
    for (int i = 1; i<=h;i++) {
        for (int j = 1; j<=w;j++) {
            cin >> temp;
            grid[i][j] = (temp == '#');
        }
    }
    for (int i = 1; i<=h;i++) {
        for (int j = 1; j<=w;j++) {
            for (int k = 1; k<=h;k++) {
                for (int l = 1; l<=w;l++) {
                    dist[i][j][k][l] = INT_MAX;
                }
            }
        }
    }
    for (int i = 1; i<=h;i++) {
        for (int j = 1; j <= w; j++) {
            if (grid[i][j]) { continue; }
            traverse(i, j);
        }
    }
    int res = 0;
    for (int i = 1; i<=h;i++) {
        for (int j = 1; j<=w;j++) {
            for (int k = 1; k<=h;k++) {
                for (int l = 1; l<=h;l++) {
                    if (dist[i][j][k][l] == INT_MAX) {
                        continue;
                    }
                    res = max(res, dist[i][j][k][l]);
                }
            }
        }
    }
    cout << res << "\n";

    return 0;
}
//lol

Measured memory_bytes: 1024
MOD = 10 ** 9 + 7
N, K = gets.split.map(&:to_i)

res = 0
min = (0..(K-1)).sum
max = ((N+1-K+2)..(N+1)).sum
K.upto(N+1) do |k|
  min += k
  max += N+1-k+1
  res += (max - min + 1)
  res %= MOD
end

puts res


Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define For(i,n) rep(i,0,n)
#define int long long
const int INF=1e18;
const int MOD=1000000007;
typedef pair<int,int> P;
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    double ans=0;
    cin>>n;
    vector<double>p(n+1);
    rep(i,1,n+1){cin>>p[i];}
    double dp[n+1][n+1];//i番コインまで見てj枚が表な確率
    dp[0][0]=1;
    rep(i,1,n+1){
        for(int j=0;j<=i;j++){
            dp[i][j]=dp[i-1][j-1]*p[i]+dp[i-1][j]*(1-p[i]);
        }
    }
    rep(i,(n+1)/2,n+1){ans+=dp[n][i];}
    cout<<setprecision(20)<<ans;
    return 0;
}

Measured memory_bytes: 70144
n=gets.to_i
a=gets.split.map(&:to_i)

h={}
a.each do |e|
  if h.key?(e)
    h[e]+=1
  else
    h[e]=1
  end
end

ok=false
x=0
a.sort.reverse.each do |e|
  if ok and x!=e
    if h[e]>=2
      puts x*e
      exit 0
    end
  else
    if h[e]>=2
      if h[e]>=4
        puts e*e
        exit 0
      else
        x=e
        ok=true
      end
    end
  end
end

puts 0

Measured memory_bytes: 16512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n,m;
  cin >> n >> m;
  vector<pair<int,int>> a(n);
  rep(i,n) cin >> a.at(i).first >> a.at(i).second;
  sort(ALL(a));
  int num = 0;
  ll ans = 0;
  rep(i,n){
    if(num>=m) break;
    ll cur = 0;
    cur = min(a.at(i).second,m-num);
    ans += a.at(i).first*cur;
    num += cur;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
h,w,k=map(int,input().split())
s=[]
for i in range(h):
    s.append(input())
ans=[]
strawc=0
reexe=False
for i in range(h):
    if(s[i].count("#")==0):
        if(i==0):
            reexe=True
            ans.append(s[i])
        else:
            ans.append(ans[i-1])
    elif(s[i].count("#")==1):
        strawc+=1
        ans.append([str(strawc) for _ in range(w)])
    else:
        nocount=0
        ans_i=[]
        for j in range(w):
            if(s[i][j]=="#"):
                strawc+=1
                for _ in range(nocount+1):
                    ans_i.append(str(strawc))
                nocount=0
            else:
                nocount+=1
        for _ in range(nocount):
            ans_i.append(str(strawc))
        ans.append(ans_i)

if(reexe):
    for i in range(h):
        j=h-1-i
        if(ans[j].count(".")>0):
            ans[j]=ans[j+1]

for i in range(h):
    for j in range(w):
        print(ans[i][j],end=" ")
    print()

Measured memory_bytes: 9768
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e11;
const long double PI = (acos(-1));


int A, B, N;
 
int f(int n) {
	int a = A * n / B;
	int b = n / B;
	int c = A * b;
	return a - c;
}
 
signed main() {
	cin >> A >> B >> N;
	int num;
	if (N >= B - 1)num = B - 1;
	else num = N;
	int ans = f(num);
	cout << ans;
}

Measured memory_bytes: 3632
from heapq import*

x,y,z,K=map(int,input().split())
a=(list(map(int,input().split())))
b=(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))[::-1]

d=sorted([q+p for q in a for p in b],reverse=True)[:K]

e=sorted([q+p for q in d for p in c],reverse=True)[:K]
for i in e:
  print(i)

Measured memory_bytes: 230124
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s[n];
  int ct[n][26]={0};
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    int len = s[i].size();
    for (int j = 0; j < len; j++)
      ct[i][s[i][j] - 'a']++;
  }
  for (int i = 0; i < 26; i++) {
    int tmp = 100;
    for (int j = 0; j < n; j++)
      if (ct[j][i] < tmp)
        tmp = ct[j][i];
    for (int k = 0; k < tmp; k++)
      cout << char('a' + i);
  }
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = int64_t;
using P = pair<ll,ll>;
ll INF = 1000000007;
// ll INF = 9223372036854775807;
// ll INF = 998244353;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    string s;
    cin >> s;
    string key = "keyence";
    string key2 = "keyence";
    string res = "NO";
    ll count = 0;
    rep(i,7){
        if(s.at(i)!=key.at(i)) break;
        count++;
    }
    rep(i,7){
        if(s.at(s.size()-1-i)!=key.at(6-i)) break;
        count ++;
    }
    if(count >= 7) res = "YES";
    cout << res << endl;
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main()
{
    int a,b ;
    string  u,s,t;
    cin >> s>>t ;
    cin >>a>>b ;
    cin >>u ;
    if (u==s)
    {
        cout << a-1 <<" "<< b ;
    }
    else {cout << a<<" " <<b-1 ;}
}


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

using namespace std;

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int64_t a, b;
  std::cin >> a >> b;
  std::cout << ((b % a == 0) ? a + b : b - a) << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

using namespace std;

struct  Pos{
    int x;
    int y;
};

/* Inputs */
int N;
vector<Pos> R, B;


int main() {
    cin >> N;

    vector<bool> b_bair_flag;

	for(int i=0; i<N; i++) {
		int x, y;
		cin >> x >> y;
		R.push_back(Pos{x,y});
	}


	for(int i=0; i<N; i++) {
		int x, y;
		cin >> x >> y;
        B.push_back(Pos{x,y});
        b_bair_flag.push_back(false);
	}

    sort(R.begin(), R.end(),
        [](Pos i1, Pos i2) { return i1.y > i2.y; });

    sort(B.begin(), B.end(),
        [](Pos i1, Pos i2) { return i1.x < i2.x; });

    int ans = 0;
    for(int i=0; i<N; i++) {
        for(int j=0; j<N; j++) {
            if(R[i].x < B[j].x && R[i].y < B[j].y) {
                if(!b_bair_flag[j]) {
                    b_bair_flag[j] = true;
                    ans++;
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import itertools

d,g=map(int,input().split())
pc=[[0]*2 for i in range(d)]
for i in range(d):
    pc[i]=list(map(int,input().split()))

icntmin=10*100+1
for j in itertools.product([0,1], repeat=d):
    icnt=0
    gcnt=0
    for i in range(d):
        if j[i]==1:
            icnt+=pc[i][0]
            gcnt+=pc[i][0]*100*(i+1)+pc[i][1]
        else:
            ii=i
            
#    print("1",icnt,gcnt,j)
    if gcnt>=g:
        icntmin=min(icnt,icntmin)
        continue
    else:
        gr=g-gcnt
        k=(gr-1)//(100*(ii+1))+1
        if k<pc[ii][0]:
            icnt+=k
            gcnt+=k*100*(ii+1)
            icntmin=min(icnt,icntmin)
#    print("2",icnt,gcnt,ii,gr,k,j)
        
print(icntmin)



Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define pb push_back
#define sz(v) (v).size()
#define all(v) (v).begin(),(v).end()
#define mp make_pair
#define fi first
#define se second
#define inf 1000000000
#define mod 998244353
using namespace std;
template <typename T> void chmax(T &x,T y){x=x>y?x:y;return;}
template <typename T> void chmin(T &x,T y){x=x<y?x:y;return;}
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pi;

int n,k,l[15],r[15];
int f[200005],sum[15];

int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=k;i++)
		scanf("%d%d",&l[i],&r[i]);
	for(int i=1;i<=k;i++)
		if(l[i]<=1&&r[i]>=1)
			sum[i]=1;
	f[1]=1;
	for(int i=2;i<=n;i++)
	{
		for(int j=1;j<=k;j++)
			f[i]+=sum[j],f[i]%=mod;
		for(int j=1;j<=k;j++)
		{
			int num1=i-l[j]+1,num2=i-r[j];
			if(num1>0)
				sum[j]+=f[num1],sum[j]%=mod;
			if(num2>0)
				sum[j]-=f[num2],sum[j]+=mod,sum[j]%=mod;
		}
	}
	printf("%d\n",f[n]);
	return 0;
}

Measured memory_bytes: 4628
class BIT:
    def __init__(self, n):
        self.n = n
        self.bit = [0]*(self.n+1) # 1-indexed

    def init(self, init_val):
        for i, v in enumerate(init_val):
            self.add(i, v)

    def add(self, i, x):
        # i: 0-indexed
        i += 1 # to 1-indexed
        while i <= self.n:
            self.bit[i] += x
            i += (i & -i)

    def sum(self, i, j):
        # return sum of [i, j)
        # i, j: 0-indexed
        return self._sum(j) - self._sum(i)

    def _sum(self, i):
        # return sum of [0, i)
        # i: 0-indexed
        res = 0
        while i > 0:
            res += self.bit[i]
            i -= i & (-i)
        return res

import sys
import io, os
#input = sys.stdin.buffer.readline
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

n, m, Q = map(int, input().split())
X = []
A = []
for i in range(m):
    l, r = map(int, input().split())
    l, r = l-1, r-1
    A.append(l)
    A.append(r)
    X.append((l, r, 0, i))
for i in range(Q):
    p, q = map(int, input().split())
    p, q = p-1, q-1
    A.append(p)
    A.append(q)
    X.append((p, q, 1, i))
X.sort(key=lambda x: (x[1], x[2]))

A = list(set(A))
A.sort()
d = {}
for i, a in enumerate(A):
    d[a] = i

bit = BIT(550)
ans = [-1]*Q
for l, r, t, i in X:
    l, r = d[l], d[r]
    if t == 0:
        bit.add(l, 1)
    else:
        ans[i] = bit.sum(l, r+1)
print(*ans, sep='\n')


Measured memory_bytes: 169408
import math
x1, y1, x2, y2 = list(map(lambda a: int(a), input().split(" ")))
P1 = [x1, y1]
P2 = [x2, y2]
L12 = [P2[0] - P1[0], P2[1] - P1[1]]
L23 = [-L12[1], L12[0]]
P3 = [P2[0] + L23[0], P2[1] + L23[1]]
P4 = [P3[0] - L12[0], P3[1] - L12[1]]

print(" ".join([str(P3[0]), str(P3[1]), str(P4[0]), str(P4[1])]))

Measured memory_bytes: 9108
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    char b;
    cin >> b;
    if (b == 'A'){
        cout << 'T' << endl;
    }
    if (b == 'C'){          
        cout << 'G' << endl; 
    }
    if (b == 'G'){             
        cout << 'C' << endl;
    }

    if (b == 'T'){          
        cout << 'A' << endl;
    }                       

    return 0;
}                       




Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    long long int n,m,total=0;
    scanf("%lld%lld",&n,&m);
    if(m>=2*n)
    {
        total+=n;
        m-=2*n;
        n=0;
    }
    else
    {
        total+=m/2;
        m=m-total*2;
        n-=total;
    }
    if(m==0)
    {
        printf("%lld\n",total);
    }
    else
    {
        printf("%lld\n",total+m/4);
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main(){
  int h,w,n;cin>>h>>w>>n;vector<pair<int,int>> p;
  rep(i,n){
    int a,b;cin>>a>>b;
    pair<int,int> d[] = {
      make_pair(0,0),make_pair(-1,0),make_pair(-2,0),make_pair(0,-1),make_pair(-1,-1),make_pair(-2,-1),make_pair(0,-2),make_pair(-1,-2),make_pair(-2,-2)
    };
    rep(j,9){
      if(a+d[j].first >= 1 && b+d[j].second >= 1 && a+d[j].first < h-1 && b+d[j].second < w-1){
        p.push_back(make_pair(a+d[j].first, b+d[j].second));
      }
    }
  }
  sort(p.begin(), p.end());

  int ans[10];rep(i,10)ans[i] = 0;
  pair<int,int> pre = make_pair(-1,-1);int count;
  for(auto i = p.begin(); i != p.end(); i++){
    if(pre == *i){
      count++;
    }else{
      pre = *i;ans[count]++;count = 1;
    }
  }
  ans[count]++;
  ans[0] = (h-2) * (w-2);
  repd(i,1,10){
    ans[0] -= ans[i];
  }
  rep(i,10){
    cout << ans[i] << endl;
  }
}


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

#define debug(x) (cerr << #x << " = " << x << endl;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define FOR(it, b, e) for (typeof(b) it = (b); it != (e); ++it)
#define MSET(c, v) memset(c, v, sizeof(c))

const int INF = 0x3F3F3F3F; 
const int NEGINF = 0xC0C0C0C0;
const int NULO = -1;
const double EPS = 1e-10;

inline int cmp(double x, double y = 0) 
{  
  if(fabs(x - y) < EPS)
    return 0;
  return x > y ? 1 : -1;
}


int main()
{
  string s;
  ios::sync_with_stdio(0);
  cin >> s;
  int n = s.size();
  vector<ll>dp(2020, 0);
  ll ans = 0;
  for(const auto &c : s)
  {
    vector<ll>newDp(2020, 0);
    newDp[c - '0']++;
    for(int i = 0 ; i < 2019; i++)
    {
      newDp[(i * 10 + c - '0') % 2019] += dp[i];
    }
    dp = newDp;
    ans += dp[0];
  }
  cout << ans << endl;
  return 0;
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll N;
    cin >> N;
    cout << 48 - N << "\n";
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

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

int main()
{
    int n, li, m = 0, s = 0; cin >> n;
    for(int i = 0; i < n; i++){
        cin >> li;
        s += li;
        if(m < li) m = li;
    }
    cout << (m * 2 < s ? "Yes": "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
 
int main() {
	int a,b;
	cin >> a >> b;
	for (int i = 0; i< 20; i++) {
		if (((a-1)*i +1) >= b) {
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 888
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if(N%2 == 0) {
			System.out.println(N/2);
		} else {
			System.out.println(N/2 + 1);
		}

	}
}

Measured memory_bytes: 22996
#include<iostream>

using namespace std;

int main(){
	int N;
	unsigned long long int a;
	unsigned long long int ans = 0;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> a;
		while(a % 2 == 0){
			ans++;
			a /= 2;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#0:中央 1:南 2:東 3:西 4:北 5:裏側
class Dice():
    def __init__(self):
        self.number = [i for i in range(6)]
        self.work = [i for i in range(6)]
        self.order = "NNNNWNNNWNNNENNNENNNWNNN"

    def setNumber(self,n0,n1,n2,n3,n4,n5):
        self.number[0] = n0
        self.number[1] = n1
        self.number[2] = n2
        self.number[3] = n3
        self.number[4] = n4
        self.number[5] = n5

    def roll(self,loc):
        for i in range(6):
            self.work[i] = self.number[i]

        if loc == "E":
            self.setNumber(self.work[3],self.work[1],self.work[0],self.work[5],self.work[4],self.work[2])
        elif loc == "N":
            self.setNumber(self.work[1],self.work[5],self.work[2],self.work[3],self.work[0],self.work[4])
        elif loc == "S":
            self.setNumber(self.work[4],self.work[0],self.work[2],self.work[3],self.work[5],self.work[1])
        elif loc == "W":
            self.setNumber(self.work[2],self.work[1],self.work[5],self.work[0],self.work[4],self.work[3])
    
    def query(self,top_num,front_num):
        self.save_data =[i for i in range(6)]

        for i in range(len(self.number)):
            self.save_data[i] = self.number[i]

        ret = -1
        
        for i in range(len(self.order)):
            self.roll(self.order[i])
            if self.number[0] == top_num and self.number[1] == front_num:
                ret = self.number[2]
                break

        for i in range(len(self.number)):
            self.number[i] = self.save_data[i]
        
        return ret
    def get_Top(self):
        return self.number[0]

dice = Dice()
table = list(map(int,input().split()))
dice.setNumber(table[0],table[1],table[2],table[3],table[4],table[5])

num_query = int(input())
for loop in range(num_query):
    top_num,front_num = map(int,input().split())
    print(dice.query(top_num,front_num))


Measured memory_bytes: 5620
#include<stdio.h>
#define MAX 9999
int main(void)
{
	int n,m;
	int i,j,l;
	int a,b,c,t;
	int k,p,q,r;
	int kin[101][101],zikan[101][101];
	int leng[101],flg[101];
	int min,mink;
	int syo,tan;
	
	scanf("%d %d",&n,&m);
	while(n!=0 || m!=0){
		for(i=1;i<=m;i++){
			for(j=1;j<=m;j++){
				kin[i][j]=MAX;
				zikan[i][j]=MAX;
			}
		}
		for(i=0;i<n;i++){
			scanf("%d %d %d %d",&a,&b,&c,&t);
			kin[a][b]=c;
			kin[b][a]=c;
			zikan[a][b]=t;
			zikan[b][a]=t;
		}
		scanf("%d",&k);
		for(i=0;i<k;i++){
			scanf("%d %d %d",&p,&q,&r);
			if(r==0){
				for(j=1;j<=m;j++){
					leng[j]=MAX;
					flg[j]=0;
				}
				leng[p]=0;
				for(j=1;j<=m;j++){
					min=MAX;
					for(l=1;l<=m;l++){
						if(flg[l]==0 && leng[l]<min){
							mink=l;
							min=leng[l];
						}
					}
					flg[mink]=1;
					if(mink==q){
						printf("%d\n",leng[mink]);
					}
					for(l=1;l<=m;l++){
				
						if(leng[mink]+kin[mink][l]<leng[l]){
							leng[l]=leng[mink]+kin[mink][l];
						}
					}
				}
			}
			else {
				for(j=1;j<=m;j++){
					leng[j]=MAX;
					flg[j]=0;
				}
				leng[p]=0;
				for(j=1;j<=m;j++){
					min=MAX;
					for(l=1;l<=m;l++){
						if(flg[l]==0 && leng[l]<min){
							mink=l;
							min=leng[l];
						}
					}
					flg[mink]=1;
					if(mink==q){
						printf("%d\n",leng[mink]);
					}
					for(l=1;l<=m;l++){
						if(leng[mink]+zikan[mink][l]<leng[l]){
							leng[l]=leng[mink]+zikan[mink][l];
						}
					}
				}
			}
		}
		scanf("%d %d",&n,&m);
	}
	return 0;
}

Measured memory_bytes: 680
#include<queue>
#include<cstdio>

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

using namespace std;

const int INF=1<<29;
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int bfs(int h,int w,const bool B[99][99],int sy,int sx,int ty,int tx){
	int d[99][99];
	rep(i,h) rep(j,w) d[i][j]=INF;
	d[sy][sx]=0;

	queue<int> Q; Q.push(sy*w+sx);
	while(!Q.empty()){
		int y=Q.front()/w,x=Q.front()%w; Q.pop();
		rep(k,4){
			int yy=y+dy[k],xx=x+dx[k];
			if(0<=yy && yy<h && 0<=xx && xx<w && !B[yy][xx] && d[yy][xx]>d[y][x]+1){
				d[yy][xx]=d[y][x]+1;
				Q.push(yy*w+xx);
			}
		}
	}
	return d[ty][tx];
}

int main(){
	int w,h,n; scanf("%d%d%d",&w,&h,&n);
	int wall[1000][4];
	rep(i,n) rep(j,4) scanf("%d",wall[i]+j);
	int sx,sy,tx,ty; scanf("%d%d%d%d",&sx,&sy,&tx,&ty); sx*=2; sy*=2; tx*=2; ty*=2;

	bool B[99][99]={};
	rep(i,h-1) rep(j,w-1) B[2*i+1][2*j+1]=true;
	rep(i,n){
		if(wall[i][0]==wall[i][2]){ // ツ縦ツづ個陛?
			for(int y=min(wall[i][1],wall[i][3]);y<max(wall[i][1],wall[i][3]);y++){
				if(0<wall[i][0] && wall[i][0]<w){
					B[2*y][2*wall[i][0]-1]=true;
				}
			}
		}
		else{ // ツ可。ツづ個陛?
			for(int x=min(wall[i][0],wall[i][2]);x<max(wall[i][0],wall[i][2]);x++){
				if(0<wall[i][1] && wall[i][1]<h){
					B[2*wall[i][1]-1][2*x]=true;
				}
			}
		}
	}
	h=2*h-1;
	w=2*w-1;

	int d0=bfs(h,w,B,sy,sx,ty,tx),d=d0;
	rep(i,h) rep(j,w) if((i%2==1 || j%2==1) && !B[i][j]) {
		B[i][j]=true;
		int tmp=bfs(h,w,B,sy,sx,ty,tx);
		if(tmp<INF) d=max(d,tmp);
		B[i][j]=false;
	}
	printf("%d\n",(d-d0)/2);

	return 0;
}

Measured memory_bytes: 1120
#include<bits/stdc++.h>
using namespace std;
string s,t;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>s>>t;
	string mmin;
	if(t.size()>s.size()){
		cout<<"UNRESTORABLE"<<endl;
		return 0;
	}
	for(int i=0;i<s.size();i++)
		mmin+="}";
	for(int i=0;i<=s.size()-t.size();i++){
		string tmp=s.substr(i,t.size());
		string tt=s;
		for(int j=0;j<tmp.size();j++)
			if(tmp[j]=='?')
				tmp[j]=t[j];
		if(tmp==t){
			tt.replace(i,t.size(),t);
			for(int j=0;j<tt.size();j++)
				if(tt[j]=='?')
					tt[j]='a';
			mmin=min(mmin,tt);
		}
	}
	if(mmin[0]!='}')
		cout<<mmin<<endl;
	else
		cout<<"UNRESTORABLE"<<endl;
	return 0;
}


Measured memory_bytes: 256
# 3*5*7=105, 3*5*11=165, 3*5*13=195, 3^3*5=135, 3^3*7=189
n=int(input())
if n<105:
  print(0)
elif n<135:
  print(1)
elif n<165:
  print(2)
elif n<189:
  print(3)
elif n<195:
  print(4)
else:
  print(5)

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

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

    bool A = false;
    bool B = false;
    for (char c : s){
        if (c == 'A'){
            A = true;
        }
        else if (c == 'B')
        {
            B = true;
        }
        
    }

    if (A && B){
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    public static void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        for (int i = 1; i <= b; i++) {
            if ((a * i) % b == c) {
                System.out.println("YES");
                return;
            }
        }

        System.out.println("NO");
    }
}

Measured memory_bytes: 21712
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	cnt := 0
	s := nextLine()
	t := nextLine()

	for i := 0; i < 3; i++ {
		if s[i] == t[i] {
			cnt++
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=1050;
//ここまでテンプレ
int main(){
	string S,T;
	cin>>S>>T;
	for(int i=0;i<S.length();i++){
		bool flag=0;
		for(int j=0;j<S.length();j++)
			if(S[(j+i)%S.length()]!=T[j])
				flag=1;
		if(!flag){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys

def main():
    X = int(input())
    for a in range(-200, 200):
        a5 = pow(a,5)
        for b in range(-200, 200):
            b5 = pow(b,5)
            if a5-b5 == X:
                print(a,b)
                sys.exit()

if __name__ == '__main__':
    main()

Measured memory_bytes: 9192
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] nx = scanner.nextLine().split(" ", 2);
        int n = Integer.parseInt(nx[0]);
        int x = Integer.parseInt(nx[1]);

        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(scanner.nextLine());
        }
        Arrays.sort(arr);

        int donutsCount = 0;
        for (int i = 0; i < n; i++) {
            if (arr[i] <= x) {
                donutsCount++;
                x -= arr[i];
            } else {
                System.out.println(donutsCount);
                return;
            }
        }

        System.out.println(donutsCount + (x / arr[0]));
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
long long gcd(long long a, long long b) 
{
	if (a < b) return gcd(b, a);
	if (b == 0) return a;
	return gcd(b, a % b);
}
bitset<1000001> bs;
vector<long long> primes;
void sieve() 
{
	bs.set();
	bs[0] = bs[1] = 0;
	for (long long i = 2; i <= 1000000; ++i) 
	{
		if (bs[i]) 
		{
			primes.push_back(i);
			for (long long j = i * i; j <= 1000000; j += i) bs[j] = 0;
		}
	}
}
int main()
{
	SPEED
	sieve();
	ll A, B;
	cin >> A >> B;
	A = gcd(A, B);
	ll ans =  1;
	for (long long i: primes) 
	{
		if (A % i == 0) ++ans;
		while (A % i == 0) A /= i;
	}
	if (A != 1) ++ans;
	cout << ans;
	return 0;
}

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

using namespace std;

vector< vector<int> > construct(int k) {
    vector< vector<int> > ret(k);

    int num = 1;
    for(int i=0;i<k-1;++i) {
        for(int j=i+1;j<k;++j) {
            ret[i].push_back(num);
            ret[j].push_back(num);
            ++num;
        }
    }

    return ret;
}

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

    if(n == 1) {
        cout << "Yes\n2\n1 1\n1 1\n";
        return 0;
    }

    for(int k=3;k<=447;++k) {
        if(k*(k-1)/2 == n) {
            vector< vector<int> > ans = construct(k);
            cout << "Yes\n" << k << "\n";
            int m = 2*n/k;
            for(vector<int> s: ans) {
                cout << m;
                for(int x: s) {
                    cout << " " << x;
                }
                cout << "\n";
            }
            return 0;
        }
    }

    cout << "No\n";
    return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
using namespace std;
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))
 
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)
 
#define nl '\n'
#define ioi exit(0);
 
 
#define PI 3.14159265
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;
const ll limit = 2e9;

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};
 
//const int mod = 998244353;
 
struct dsu{
	int parent[N];
	int cont;
	void make_set(int n){
		for(int i = 1; i <= n; i++)
			parent[i] = i;
		cont = n;
	}
	
	int find_set(int v){
		if(v == parent[v])
			return v;
		return find_set(parent[v]);
	}
	
	void union_sets(int a, int b){
		a = find_set(a);
		b = find_set(b);	
		if(a != b){
			parent[b] = a;
			cont--;
		}
	}
};


struct nod{
	int x, y, d;
	nod(int x_, int y_, int d_){
		x = x_;
		y = y_;
		d = d_;
	}
	void set(int x_, int y_, int d_){
		x = x_;
		y = y_;
		d = d_;
	};
};
char tab[25][25];
bool vis[25][25];
int n , m;
int nx, ny, nd;
bool ok(int x, int y){
	return 1 <= x && x <= n && 1 <= y && y <= m;
}

void bfs(int i, int j){
	clr(vis,false);
	queue<nod> q;
	q.push(nod(i,j,0));
	vis[i][j] = true;
	nod tmp(-1,-1,-1);
	while(!q.empty()){
		int u = q.front().x;
		int v = q.front().y;
		int d = q.front().d;
		
		tmp.set(u,v,d);
		q.pop();
		for(int k = 0; k < 4; k++){
			int a = u + dx[k];
			int b = v + dy[k];
			if( ok(a,b) && tab[a][b] == '.' && !vis[a][b]){
				q.push(nod(a,b,d+1));
				vis[a][b] = true;
			}
		}
	}
	nx = tmp.x; ny = tmp.y; nd = tmp.d;
	//~ cout<<last.x<<" "<<last.y<<" "<<last.d<<endl;
}

int main()
{	
	
	int r, c; cin>> r >> c;
	n = r, m = c;
	int sx, sy, sd;
	for(int i = 1; i <= r; i++){
		for(int j = 1; j <= c; j++){
			cin>>tab[i][j];
			
		}
	}
	int ans = 0;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			if(tab[i][j] == '.'){
				bfs(i,j);
				sx = nx; sy = ny; sd = nd;
				ans = max(ans,nd);
			}
		}
	}
	
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
#define myfor(i,N) for(i=0;i<N;i++)
#define myforFL(i,f,l) for(i=f;i<l;i++)
#define myforInv(i,N) for(i=N;i>=0;i--)
#define myforFLInv(i,f,l) for(i=f;i>l;i--)
#define MAXVALUE 100*1000
#define INF pow(10,16)
using namespace std;

int main(){
	long N,W,i,j;
	long w[100],v[100],dp[MAXVALUE+1];

	cin >> N >> W;
	myfor(i,N){
		cin >> w[i]>>v[i];
	}
	myfor(j,MAXVALUE+1)dp[j] = INF;
	myfor(i,N)myforInv(j,MAXVALUE){
		if(j-v[i] == 0)dp[j] = min(dp[j],w[i]);
		else if (j-v[i] > 0)dp[j] = min(dp[j-v[i]] + w[i],dp[j]);
	}
	myforInv(i,MAXVALUE){
		if(dp[i] <= W){
			cout << i << endl;
			break;
		}
	}
	return 0;
}

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



int go(int *a,int n,int k){
  vector<int> dp(n,INT_MAX);
  dp[0]=0;
  for(int i=0;i<n;i++)
    for(int j=i+1;j<=i+k;++j)
      if(j<n)
       dp[j]=min(dp[j],dp[i]+abs(a[i]-a[j]));
  return dp[n-1];
}

int main(){
 int n,k;
 cin>>n>>k;
 int a[n];
 for(int i=0;i<n;i++) cin>>a[i];
 cout<<go(a,n,k)<<endl;
 return 0; 
}

Measured memory_bytes: 3944
#include <iostream>

using namespace std;

typedef long long ll;

int main(){
    
    int A,B;
    
    cin>>A>>B;
    

    int C;
    if(A%2==1){
        C=A/0.08+1;
    }else{
        C=A/0.08;
    }
    int i=0;
    for(;i<=12;++i){
        
        
        
        int D=0.1*C;
        int E=0.08*C;
        if(D==B&&E==A){
            //cout<<C<<endl;
            break;
        }
        ++C;
    }
    if(i==13)
        cout<<-1<<endl;
    else
        cout<<C<<endl;
    
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int b,z[60],i,m,n;
int main()
{
	scanf("%d%d",&n,&m);
    for(i=1;i<=n;i++)
    	scanf("%d",&z[i]);
    sort(z+1,z+n+1);
	for(i=1;i<=m;i++)
		b+=z[n-i+1];
	printf("%d\n",b);
    return 0;
}

Measured memory_bytes: 256
// [AT2001 Wanna go back home] https://www.luogu.org/problemnew/show/AT2001
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

string s;
int slen;
map<char, char> m;

bool check(char c)
{
    for (int i = 0; i < slen; i++)
        if (s[i] == m[c])
            return true;
    return false;
}

int main()
{
    m['N'] = 'S';
    m['S'] = 'N';
    m['E'] = 'W';
    m['W'] = 'E';

    cin >> s;

    bool flag = false;

    slen = s.length();
    for (int i = 0; i < slen; i++)
    {
        if (s[i] == 'N')
            flag = check('N');
        else if (s[i] == 'S')
            flag = check('S');
        else if (s[i] == 'W')
            flag = check('W');
        else if (s[i] == 'E')
            flag = check('E');
        
        if (!flag)
        {
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";
    return 0;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){ cin >> a[i];}
  int pre = -999;
  for(int i=0;i<n;i++){
    if (pre <= a[i]-1) {
      pre = a[i]-1;
    } else if (pre <= a[i]) {
      pre = a[i];
    } else {
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
ll ans;
ll A,B,C;
ll N;
ll dp[2005][2005];
bool nyukoku;




int main(){
    cin >> N;
    nyukoku = true;
    for (int i=0;i<N;i++){
        int a;
        cin >> a;
        if(a%2==0&&(a%3!=0&&a%5!=0)){
            nyukoku = false;
        }
    }
    if(nyukoku){
        cout << "APPROVED" << endl;
    } else {
        cout << "DENIED" << endl;
    }

}



Measured memory_bytes: 256
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
k = gets.chomp.to_i

ans = 0
1.upto(k) do |a|
  1.upto(k) do |b|
    1.upto(k) do |c|
      ans += a.gcd(b).gcd(c)
    end
  end
end

puts ans

Measured memory_bytes: 14644
#include <iostream>

using namespace std;


int main()
{
      int N,A,B;
      int pass=0;
      int passB=0;
      char *S =new char[N+1];
      cin >> N>>A>>B;
      cin >> S;
      for(int i=0;i<N;i++){
        if(S[i]=='a'){
          if(A+B>pass){
            cout<<"Yes"<<endl;
            pass++;
          }else{
            cout<<"No"<<endl;
          }

        }else if(S[i]=='b'){
          if(A+B>pass && B>passB ){
            cout<<"Yes"<<endl;
            pass++;
            passB++;

          }else{
            cout<<"No"<<endl;
          }
        }else{
          cout<<"No"<<endl;
        }
      }
      return 0;
}


Measured memory_bytes: 768
//Daydream.cpp (C)
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  string S;
  cin >> S;
  reverse(S.begin(),S.end());
  string A[] = {"dream","dreamer","erase","eraser"};
  for(int i = 0; i < 4; i++) reverse(A[i].begin(), A[i].end());
  bool flag = true;
  while(S.size()>0){
    flag = false;
    for(int i = 0; i < 4; i++){
      if(S.substr(0,A[i].size())==A[i]){
        S.erase(S.begin(),  S.begin()+A[i].size());
        flag = true;
        break;
      }
    }
    if(S.size() == 0) break;
    if(!flag) break;
  }
  if(flag) printf("YES\n");
  else printf("NO\n");
  return 0;
}


Measured memory_bytes: 512
import static java.util.Arrays.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	void solve() {
		int n = sc.nextInt();
		if (n == 0) return;
		long[] a = new long[n+1];
		a[0] = 1;
		for (int i = 0; i < n; i++) {
			for (int j = 1; j <= 3; j++) {
				if (i + j <= n) {
					a[i + j] += a[i];
				}
			}
		}
		long ans = (((a[n] + 9) / 10) + 364) / 365;
		out.println(ans);

	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}

Measured memory_bytes: 16896
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

int main(){
    int n;
    string s;
    cin>>n>>s;
    int ans=200000000;
    vector<int> w(n),b(n);
    if(s[0]=='#')b[0]=1;
    if(s[n-1]=='.')w[n-1]=1;
    for(int i=1;i<n;i++){
        if(s[i]=='#')b[i]=b[i-1]+1;
        else b[i]=b[i-1];
    }
    for(int i=n-2;i>=0;i--){
        if(s[i]=='.')w[i]=w[i+1]+1;
        else w[i]=w[i+1];
    }
    for(int i=0;i<n-1;i++){
        ans=min(ans,b[i]+w[i+1]);
    }
    int ww=0;int bb=0;
    for(int i=0;i<n;i++){
        if(s[i]=='.')ww++;
        else bb++;
    }
    ans=min({ans,bb,ww});
    cout<<ans<<endl;
}

   


Measured memory_bytes: 2804
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};

int A,B;
char c[101][101];

signed main(){
  cin>>A>>B;
  for(int h=0;h<100;h++){
    for(int w=0;w<100;w++){

      if(h<50) c[h][w]='#';
      if(50<=h)c[h][w]='.';

    }
  }

  int cont_a=0,cont_b=0;
  for(int h=0;h<100;h+=2){
    if(h==49||h==50)continue;
    for(int w=(h+1)%2;w<100;w+=2){

      if(h<50&&cont_a<A-1){
        c[h][w]='.';
        cont_a++;
      }
      if(50<=h&&cont_b<B-1){
        c[h][w]='#';
        cont_b++;
      }

    }
  }

  cout<<100<<" "<<100<<"\n";
  for(int h=0;h<100;h++){
    for(int w=0;w<100;w++){
      cout<<c[h][w];
    }
    cout<<"\n";
  }
  return 0;
}


Measured memory_bytes: 256
fn main() {
    proconio::input! {
        mut v: [i64; 4],
    }
    let ans = loop {
        v[2] -= v[1];
        if v[2] <= 0 {
            break "Yes";
        }
        v[0] -= v[3];
        if v[0] <= 0 {
            break "No";
        }
    };
    println!("{}", ans);
}


Measured memory_bytes: 2100
N, K = map(int,input().split())
R, S, P = map(int,input().split())
T = [str(x) for x in input()]
ans = 0


for k in range(K):
    if T[k] == "r":
        ans += P
    elif T[k] == "p":
        ans += S
    else:
        ans += R

for k in range(K,N):
    if T[k] == "r":
        if T[k-K] != "r":
            ans += P
        else:
            T[k] = "_"
    elif T[k] == "p":
        if T[k-K] != "p":
            ans += S
        else:
            T[k] = "_"
    else:
        if T[k-K] != "s":
            ans += R
        else:
            T[k] = "_"


print(ans)


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

using namespace std;

const int N = 2345;

int n, a[N], b[N], degree[N];
vector<int> adj[N], new_adj[N];
bool visit[N];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j < i; ++j) {
      if (__gcd(a[i], a[j]) != 1) {
        adj[i].push_back(j);
        adj[j].push_back(i);
      }
    }
  }
  function<void (int)> dfs = [&] (int x) {
    visit[x] = true;
    for (auto y : adj[x]) {
      if (!visit[y]) {
        new_adj[x].push_back(y);
        ++degree[y];
        dfs(y);
      }
    }
  };
  for (int i = 1; i <= n; ++i) {
    if (!visit[i]) {
      dfs(i);
    }
  }
  int t = 0;
  priority_queue<int> q;
  for (int i = 1; i <= n; ++i) {
    if (!degree[i]) {
      q.push(i);
    }
  }
  while (!q.empty()) {
    int x = q.top();
    q.pop();
    b[++t] = a[x];
    for (auto y : new_adj[x]) {
      if (--degree[y] == 0) {
        q.push(y);
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << b[i] << " \n"[i == n];
  }
  return 0;
}

Measured memory_bytes: 16896
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
#include <stack>
#include <map> // pair
#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
typedef std::stack<int> IntStack;
typedef std::stack<char> charStack;

using namespace std;
using ll = long long;
typedef pair <ll, ll > pll;

int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll n, m, K;
	ll memo[1003][1003] = { {} };
	ll memox[1003] = {};
	ll memoy[1003] = {};
	ll x[1000006] = {};
	ll y[200005] = {};
	ll z[200005] = {};
	string s;

	//IntStack yStack;
	//charStack Stack;

	cin >> a;
	for (int i = 0; i < a; i++)
	{
		cin >> x[i];
		b += x[i];
	}
	ans = 99999999999;

	for (int i = 0; i < a-1; i++)
	{
		b -= x[i];
		c += x[i];
		e = abs(c - b);
		ans = min( abs(c - b) ,ans);
	}
	cout << ans << endl;


	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}

//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

Measured memory_bytes: 8064
### D - 井井井 / ###　やりなおし
x, y = [int(i) for i in input().split()]
xl = [int(i) for i in input().split()]
yl = [int(i) for i in input().split()]

xx = sum(  [ i*xl[i] - (x-i-1)*xl[i] for i in range(len(xl)) ]  )
yy = sum(  [ i*yl[i] - (y-i-1)*yl[i] for i in range(len(yl)) ]  )
ans = (xx * yy) % (10**9 + 7)
print(ans)

Measured memory_bytes: 19580