akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
using namespace std;
#define INF 1000000007
#define LINF 1000000000000000007
#define MOD 1000000007
#define int long// long
#define rep(i, n) for (int i = 0; i < n; i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout << #X << ": " << X << " ";
#define ARDEB(i, X) cout << #X << "[" << i << "]: " << X[i] << " ";
#define END cout << endl;
#else
#define DEB(X) \
    {          \
    }
#define ARDEB(i, X) \
    {               \
    }
#define END \
    {       \
    }
#endif
typedef pair<int, int> P;
struct edge{int to,cost;};
typedef long long ll;

int ans;
int a,b,c;
signed main(){
    
    cin>>a>>b>>c;
    int co=0;
    
    while(a%2==0 && b%2==0 && c%2==0){
        int e=a/2,f=b/2,g=c/2;
        a=f+g;b=e+g;c=e+f;
        co++;
        if(a==b && b==c){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<co<<endl;
    
}


Measured memory_bytes: 256
N=int(input())
s=[input() for i in range(N)]

a=s.count('AC')
b=s.count('WA')
c=s.count('TLE')
d=s.count('RE')

print("AC x %s"%a)
print("WA x %s"%b)
print("TLE x %s"%c)
print("RE x %s"%d)

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

int main() {
  int N;
  cin >> N;
  
  int sum = 0;
  int I = 1;
  
  int digits = 0;
  int n;
  n = N;
  while (n > 0) {
    n /= 10;
    digits++;
  }
  
  for (int i = 0; i < digits; i++) {
    I = 1;
  	for (int j = 0; j < i; j++)
      I = I * 10;
    sum += N / I - N / (I * 10) * 10;
  }
  
  if (N % sum == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
for i in rs():
    if i == '9':
        print('Yes')
        exit()
print('No')

Measured memory_bytes: 62956
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <set>
#include <map>
#include <list>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define MOD 1000000007
#define PI 3.1415926535897932
#define rep(i, n) for (int i = 0; i < n; i++)
#define repe(i, j, n) for (int i = j; i < n; i++)
#define repi(i, n) for (int i = 0; i <= n; i++)
#define repie(i, j, n) for (int i = j; i <= n; i++)
#define all(x) x.begin(), x.end()
#define println() cout << endl
#define P pair<int, int>
#define fi first
#define se second

typedef long long ll;

long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b)
    {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}

void solve1()
{
    ll n; cin >> n;

    ll ans = 0;
    ll div = 2;
    if(n%2 == 0) { 
       while(1) {
           div *= 5;
           if (n / div <= 0)
           {
               break;
          } else {
              ans += n/div;
         
          }
         
       }
    }

    cout << ans << endl;
}

int main()
{
    solve1();
}


Measured memory_bytes: 3516
#include<iostream>
#include<queue>
using namespace std;
int m[100][100],used[100][100];
int d[]={0,1,0,-1,0};
main()
{
	int w,h;
	while(cin>>w>>h,h)
	{
		for(int i=0;i<h;i++)for(int j=0;j<w;j++)used[i][j]=m[i][j]=0;
		int sx,sy,gx,gy;cin>>sy>>sx>>gy>>gx;
		sx--,sy--,gx--,gy--;
		int n;cin>>n;
		for(int i=0;i<n;i++)
		{
			int c,d,x,y;cin>>c>>d>>y>>x;
			x--,y--;
			if(d==0)
			{
				for(int j=0;j<2;j++)for(int k=0;k<4;k++)m[x+j][y+k]=c;
			}
			else
			{
				for(int j=0;j<4;j++)for(int k=0;k<2;k++)m[x+j][y+k]=c;
			}
		}
		if(m[sx][sy]==0)
		{
			cout<<"NG"<<endl;
			continue;
		}
		queue<pair<int,int> >P;
		P.push(make_pair(sx,sy));
		used[sx][sy]=1;
		while(!P.empty())
		{
			int x=P.front().first,y=P.front().second;
			P.pop();
			for(int r=0;r<4;r++)
			{
				int tx=x+d[r],ty=y+d[r+1];
				if(tx<0||ty<0||tx>=h||ty>=w||used[tx][ty]||m[tx][ty]!=m[sx][sy])continue;
				used[tx][ty]=1;
				P.push(make_pair(tx,ty));
			}
		}
		cout<<(used[gx][gy]?"OK":"NG")<<endl;
	}
}



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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const ll MOD = 998244353;

int main() {
  ll n, maxd = -1, d;
  cin >> n;
  // n = 4;
  unordered_map<ll, ll> um;
  vector<int> dv(n);

  rep(i, n) {
    cin >> d;
    um[d]++;
    dv[i] = d;
    maxd = max(maxd, d);
  }
  // um[0] = 1;
  // um[1] = 2;
  // um[2] = 3;
  // um[3] = 1;
  // maxd = 3;

  ll ans;
  bool flg = true;
  for (int i = 0; i <= maxd; ++i)
    if (um[i] < 0) flg = false;
  if (um[0] != 1) flg = false;
  if (!flg) {
    cout << 0 << endl;
    return 0;
  } else {
    ans = 1;
    for (int i = 1; i < n; ++i) {
      ans *= um[dv[i]-1];
//      cout << dv[i] << " " << um[dv[i] - 1] << " " <<ans <<endl;
      ans %= MOD;
    }
    cout << ans << endl;
    //     for (auto x : um) cout << x.first << ":" << x.second << endl;
    return 0;
  }
}

Measured memory_bytes: 4772
program abc160d
  implicit none
  integer :: n, x, y, i, j, k
  integer,allocatable :: a(:)
  read *, n, x, y
  allocate(a(n-1))
  a = 0
  do i = 1,n-1
     do j = i+1,n
        k = min(j-i,abs(i-x)+abs(j-y)+1)
        a(k) = a(k) + 1
     end do
  end do
  print *, a
end program abc160d


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

typedef long long ll;
const ll mod = 998244353;

#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define FOr(i, s, e) for (ll i = s; i >= e; i--)

#define PI acos(-1)
#define sz 100005

void fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

// int arr[1000006];

void solve()
{
	char a; cin >> a;

	if (a >= 'A' && a <= 'Z')
		cout << 'A' << '\n';
	else
		cout << 'a' << '\n';
}

int main()
{
	fastio();

	int t = 1; //cin >> t;
	while (t--)
		solve();

	return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.out



int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    int n,W;
    cin>>n>>W;

    vector<ll> w(n+1),v(n+1);
    rep(i,n){
        cin>>w[i+1]>>v[i+1];
    }
    ll dp[n+1][W+1];
    rep(i,W+1)dp[0][i]=0;
    for(ll i=1;i<=n;i++){
        for(ll j=0;j<=W;j++){
            if(j-w[i]>=0){
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
            }
            else{
                dp[i][j]=dp[i-1][j];
            }
        }
    }
    cout<<dp[n][W]<<endl;/*
    rep(i,n+1){
        rep(j,W+1)cout<<dp[i][j]<<" ";
        cout<<endl;
    }*/


//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 79232
#include <stdio.h>

#define WHITE 1
#define BLACK 0
#define GRAY -1
#define INF  10000
#define N 250

void bfs(int);
void enqueue(int);
int dequeue(void);

int d[N];
int color[N];
int str[N][N];
int n;
int Q[N];
int count1 = 0;
int count2 = 0;

int main(){

 int i;
 int j;
 int k;
 int num;
 int point;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
  scanf("%d%d",&num,&k);
  for(j=1;j<=k;j++){
  scanf("%d",&point);
  str[num][point] = 1;
    }
   }

   bfs(1);
  
  for(i=1;i<=n;i++){
    if(d[i]==INF) d[i] = -1; 
  printf("%d %d\n",i,d[i]);
   }   

  return 0;
}

void bfs(int s){

  int u;
  int v;
  
  for(u=1;u<=n;u++){
    color[u] = WHITE;
    d[u] = INF;
  }

  color[s] = GRAY;
  d[s] = 0;
  enqueue(s);

  while(1){
    u = dequeue();
  for(v=1;v<=n;v++){
    if(color[v]==WHITE && str[u][v]==1){
       color[v] = GRAY;
       d[v] = d[u] + 1;
       enqueue(v);
    }
   }
  color[u] = BLACK;
  if(count1==count2) break;
  }
}

void enqueue(int s){
  Q[count1] = s; 
  count1++;
}

int dequeue(void){
  int r;
  
  r = Q[count2];
  count2++;
  
  return r;
}

Measured memory_bytes: 696
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
char st[200010];
int main(){
	scanf("%s",st+1);
	int len=strlen(st+1);
	for (int i=1;i<=len;i++)
		if (st[i]!='?') printf("%c",st[i]); else printf("D");
}

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

using namespace std;

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl

int main(){
    int n;
    cin>>n;
    cout<<(n*800)-(n/15)*200<<endl;
    return 0;
}

Measured memory_bytes: 256
a,b,c=map(int,input().split())
if a==b and b==c and a%2==0:print(-1)
else:
  ans=0
  while a%2==0 and b%2==0 and c%2==0:
    a,b,c=b//2+c//2,a//2+c//2,b//2+a//2
    ans+=1
  print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <tuple>
 
using namespace std;
 
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define cina(s, n, a) for(int i = s; i < n; i++) cin >> a[i]
#define couta(n, a) for(int i = 0; i < n; i++) cout << a[i] << ' '
#define copy(s, n, a, b) for(int i = s; i < n; i++) b[i] = a[i]
#define yesno(ok) cout << (ok ? "YES" : "NO")
#define mod(a, b) (b + (a % b)) % b
#define MOD (int)1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

void add_self (int& a, int b){ a += b; if(a >= MOD) a -= MOD; }
//-------------------------------------------------------------------------------------------------------//

void solve(){
    ll n;
    cin >> n;
    ll ans = LONG_MAX;
    for(ll i = 1; i * i <= n; i++){
        if(n % i == 0){
            ans = min(n / i + i, ans);
        }
    }
    cout << ans - 2;
}
 
int main(){
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int q = 1;
    //cin >> q;
    for(int i = 1; i <= q; i++){
        solve();
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=1000000007;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };


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

	cin>>a>>b>>c;
	if(b>=c){
		cout<<"delicious"<<endl;
	}
	else if(c-b<=a){
		cout<<"safe"<<endl;
	}
	else{
		cout<<"dangerous"<<endl;
	}
}

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

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { 
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(){
  int N;
  cin >> N;
  
  int sum = findSumOfDigits(N);
  if( N % sum == 0){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
    
}

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

int main() {
	int n, a[1000],b;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	b = n - 1;
	for (int i = b; i >= 0; i--) {
	    if(i==b){
	        cout<<a[i];
	    }
	    else{
		cout << " " << a[i];
	    }
	}
	cout << endl;
}


Measured memory_bytes: 3100
//organize and stay in moment - Abhinav IIIT-A
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,x,n) for(int i=x;i<n;++i)
#define ar array
#define MAXN (int)2e5+5
#define pb push_back
int mod= 998244353;
int arr[MAXN];
int as;
void input(){
  cin>>as;
  f(i,0,as) cin>>arr[i];
}
int mod2=998244353;
void solve(){
  int a[]={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,};
  int k; cin>>k; --k;
  cout<<a[k]<<"\n";
}
int32_t main()
{
  int t; t=1; //cin>>t;
  while(t--) solve();
  return 0;
}


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

  ll depth[MAX_N];
  vl g[MAX_N];

void dfs(ll v,ll p,ll d) {
  depth[v]=d;
  rep(i, g[v].size()) if(g[v][i]!=p) dfs(g[v][i],v,d+1);
}

void add_edge(ll a,ll b) {
    g[a].push_back(b);
    g[b].push_back(a);
}

int main() {
  ll N;
  cin >> N;
  rep(i, N-1) {
    ll a,b;
    cin >> a >> b;
    add_edge(a-1,b-1);
  }
  dfs(0,-1,0);
  
  queue<ll> F0, F1, F2;
  ll t=0;
  while(3*t+1<=N) {F1.push(3*t+1); t++;} t=0;
  while(3*t+2<=N) {F2.push(3*t+2); t++;} t=0;
  while(3*t+3<=N) {F0.push(3*t+3); t++;}
  
  vl ans(N);
  ll even=0;
  rep(i, N) if(depth[i]%2==0) even++;
  
  if(even <= N/3) {
    rep(i, N) {
      if(depth[i]%2==0) {
        if(!F0.empty()) {ans[i]=F0.front(); F0.pop();}
      }
    }
    rep(i, N) {
      if(depth[i]%2==1) {
        if(!F0.empty()) {ans[i]=F0.front(); F0.pop();}
        else if(!F1.empty()) {ans[i]=F1.front(); F1.pop();}
        else if(!F2.empty()) {ans[i]=F2.front(); F2.pop();}
      }
    }
  }else if(even >= N-N/3) {
    rep(i, N) {
      if(depth[i]%2==1) {
        if(!F0.empty()) {ans[i]=F0.front(); F0.pop();}
      }
    }
    rep(i, N) {
      if(depth[i]%2==0) {
        if(!F0.empty()) {ans[i]=F0.front(); F0.pop();}
        else if(!F1.empty()) {ans[i]=F1.front(); F1.pop();}
        else if(!F2.empty()) {ans[i]=F2.front(); F2.pop();}
      }
    }
  }else {
    rep(i, N) {
      if(depth[i]%2==0) {
        if(!F1.empty()) {ans[i]=F1.front(); F1.pop();}
        else if(!F0.empty()) {ans[i]=F0.front(); F0.pop();}
      }else {
        if(!F2.empty()) {ans[i]=F2.front(); F2.pop();}
        else if(!F0.empty()) {ans[i]=F0.front(); F0.pop();}
      }
    }
  }
  
  rep(i, N) cout << ans[i] << " ";
  cout << endl;
  
  return 0;
}

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

typedef vector<int> 	vi;
typedef vector<vi>		vvi;
typedef long long int	ll;

int mpow(int base, int exp){
	int ans = 1;
	while(exp--)
		ans *= base;
	return ans;
}

int main(){

	ios::sync_with_stdio(false);
	cin.tie(NULL);

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

	if(k > mpow(2, m) - 1){
		cout << "-1";
		return 0;
	}

	if(m == 0 && k == 0){
		cout << "0 0";
		return 0;
	}

	if(m == 1 && k == 1){
		cout << "-1";
		return 0;
	}

	if(m == 1 && k == 0){
		cout << "0 1 1 0";
		return 0;
	}

	// m >= 2 holds
	int n = mpow(2, m) - 1;

	for(int i = 0; i <= n; i++){
		if(i == k)
			continue;
		cout << i << " ";
	}
	cout << k << " ";
	for(int i = n; i >= 0; i--){
		if(i == k)
			continue;
		cout << i << " ";
	}
	cout << k << " ";

	return 0;
}

Measured memory_bytes: 1792
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("o3")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2.0) //等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define addf(T) [](T a, T b){return (a + b);}
#define minf(T) [](T a, T b){return min(a, b);}
#define maxf(T) [](T a, T b){return max(a, b);}
#define nopf(T) [](T a){return a;}
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcm(ll number1, ll number2) {
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int n;
	scanf("%d", &n);
	printf("%d\n", (n + 1) / 2);

	Please AC;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int p[] = new int[N];
		int count = 0;
		
		for(int i=0;i<N;i++) {
			p[i] = sc.nextInt();
			if(p[i] != i+1) {
				count = count + 1;
			}
		}
		if(count == 2 || count ==0) {
			System.out.println("YES");			
		}else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
typedef long long LL;
typedef unsigned long long ULL;
using namespace std;

int main() {
	LL A, B;
	cin >> A >> B;
	if (A >= 13) {
		cout << B << endl;
	}
	else if (A <= 5) {
		cout << 0 << endl;
	}
	else {
		cout << B * 0.5 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string arr;
int d;
int mod=1e9+7;
long long getsum(int ind,int sum,int flag,vector<vector<vector<long long> > >&dp){
	if(ind==arr.size()) {
		if(sum%d==0) return 1;
		return 0;
	}
	if(dp[ind][sum][flag]!=-1) return dp[ind][sum][flag];
	int limit=9;
	if(!flag) limit=arr[ind]-'0';
	long long res=0;
	for(int i=0;i<=limit;i++){
		if(flag||i<limit){
			res+=getsum(ind+1,(sum+i)%d,1,dp);
		}
		else res+=getsum(ind+1,(sum+i)%d,0,dp);
	}
	dp[ind][sum][flag]=res%mod;
	return res%mod;
	
	
}
int main() {
	
		
		cin>>arr;
	    cin>>d;
	
		
		
		
			vector<vector<vector<long long> > >dp(arr.size()+1,vector<vector<long long> >(200,vector<long long>(2,-1)));
		long long u=getsum(0,0,0,dp);
		
		
		cout<<(u-1+mod)%mod<<endl;
		
		
	
	
	return 0;
}

Measured memory_bytes: 114032
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
#include <ctime>
#include <list>
using namespace std;
static const double EPS = 1e-6;
typedef long long ll;
typedef pair<int,int> PI;
#ifndef M_PI
const double M_PI=acos(-1);
#endif
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int((a).size()))
#define F first
#define S second
int dx[]={0,1,0,-1,0,0},dy[]={1,0,-1,0,0,0};
int dz[]={0,0,0,0,1,-1};

int n;
double sx[30],sy[30],sz[30];

double dist(double x,double y,double z,int id){
  double tx=x-sx[id];
  double ty=y-sy[id];
  double tz=z-sz[id];
  return sqrt(tx*tx+ty*ty+tz*tz);
}

double rad(double x,double y,double z){
  double ret=dist(x,y,z,n-1);
  rep(i,n-1)ret=max(ret,dist(x,y,z,i));
  return ret;
}

typedef struct _node{
  double x,y,z,r;
  int wh;
  _node(double x,double y,double z,int wh):
    x(x),y(y),z(z),wh(wh),r(rad(x,y,z)){};

  bool operator<(const _node& rn)const{
    if(rn.wh!=wh)return rn.wh<wh;
    return rn.r<r;
  }
}node;

int tx[]={1,1,1,1,-1,-1,-1,-1};
int ty[]={1,1,-1,-1,1,1,-1,-1};
int tz[]={1,-1,1,-1,1,-1,1,-1};
double len[1000];

void solve(){
  rep(i,n)scanf("%lf%lf%lf",sx+i,sy+i,sz+i);
  len[0]=100;
  for(int i=1;i<1000;++i)
    len[i]=len[i-1]/2;
  double ans=10000;
  rep(i,n)rep(j,i)
    ans=min(ans,rad((sx[i]+sx[j])/2,
                    (sy[i]+sy[j])/2,
                    (sz[i]+sz[j])/2));

  priority_queue<node> q;
  q.push(node(50,50,50,0));
  int cu=0;
  int bwh=-1;
  while(!q.empty()){
    node cur=q.top();
    q.pop();
    if(cu==1000 && cur.wh==bwh)continue;
    if(cu==1000)cu=0,bwh=cur.wh;
    ++cu;
    double rr=len[cur.wh];    
    if(ans<cur.r-rr*sqrt(3)*2+EPS)continue;
    ans=min(ans,cur.r);
    if(cur.wh>25)continue;
    //printf("%.5f %.5f %.5f %.5f %.7f %d\n",cur.x,cur.y,cur.z,cur.r,ans,cur.wh);

    rep(i,8)
      q.push(node(cur.x+rr*tx[i],cur.y+rr*ty[i],cur.z+rr*tz[i],cur.wh+1));
  }

  printf("%.5f\n",ans);
}

main(){
  while(cin>>n,n)
    solve();
}

Measured memory_bytes: 0
import numpy as np
N, M = map(int, input().split())

A = []
for i in range(N):
    tmp = input()
    A.append([0 if s=="." else 1 for s in tmp])
B = []
for i in range(M):
    tmp = input()
    B.append([0 if s=="." else 1 for s in tmp])
    
A = np.array(A)
B = np.array(B)

def is_match(a, b):
    return (a==b).all()
flag = False
for i in range(N):
    for j in range(N):
        x_left = i
        x_right = i + M
        y_up = j
        y_under = j + M
        if x_right > N or y_under > N:
            continue
        if is_match(B, A[x_left:x_right, y_up:y_under]):
            flag = True
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 21656
/*
0: S
1: H
2: C
3: D
 
[][0]????????? [][1]??????
*/
 
#include <stdio.h>
 
int main(void) {
    int i,j, n, num;
    char picture, buf;
    int cards[4][13];
    
    for(i=0;i<4;i++){
        for(j=0;j<13;j++){
            cards[i][j]=0;            
        }
    }
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        //scanf("%s %d", &picture,&num); // %c??則????????????%s??則?????贈????????????\0?????????????????贈???????其??????????????????即??????????????????????即??即?
        scanf("%c", &buf); // \n????????即????????????????????????n???47??\???????\卒)??????????????則??????????????????
        scanf("%c", &picture);
        scanf("%d", &num);
        if(picture=='S') cards[0][num-1]=1;
        else if(picture=='H') cards[1][num-1]=1;
        else if(picture=='C') cards[2][num-1]=1;
        else cards[3][num-1]=1;
    }
    
    for(i=0;i<4;i++){
        for(j=0;j<13;j++){
            if(cards[i][j]==0){
                if(i==0) printf("%c %d",'S',j+1);
                else if(i==1) printf("%c %d",'H',j+1);
                else if(i==2) printf("%c %d",'C',j+1);
                else printf("%c %d",'D',j+1);
                printf("\n");
            }
        }
    }
     
        return 0;
}
 

Measured memory_bytes: 600
k = int(input())
x = [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]

print(x[k-1])

Measured memory_bytes: 3060
#include <iostream>
#include <string>
using namespace std;
int main() {
 int A;
 int B;
 int C;
 int D;
 
 cin >>A >>B >>C >>D;
 
 if(A*B < C*D){
 	cout << C*D << endl;}
 	
 	else {cout <<A*B << endl;}
 
 
 
 	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <vector>
#include <algorithm>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<string>
#include<map>
#include<set>
#include<cmath>
using namespace std;
#define ll long long
#define ull unsigned long long
#define INF 1e9
#define eps 1e-6
#define PI acos(-1.0)
#define M 10010
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
const int maxn = 3e5 + 10;



int main() {
  //freopen("in.txt", "r", stdin);
  //freopen("out.txt","w",stdout);
  std::ios::sync_with_stdio(false);
  int n,i;
  cin >> n >> i;
  cout << n-i+1 <<endl;

  //system("pause");
  return 0;
}

Measured memory_bytes: 768
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val s = sc.next()
  lazy val reverses: LazyList[Char] = '1' #:: '0' #:: reverses
  val mismatched: PartialFunction[(Char, Char), Boolean] = {
    case (l, r) => l != r
  }
  println(reverses.zip(s).count(mismatched) min reverses.tail.zip(s).count(mismatched))
}


Measured memory_bytes: 66740
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    long long int N,ans=0;
    cin >> N;
    string S;
    cin >> S;

    for(int i=0;i<1000;i++){
        vector<int> count(10,0),num(3);
        vector<bool> B(3);
        int now=0;
        num[0] = i/100;
        num[1] = (i%100)/10;
        num[2] = i%10;
        for(int j=0;j<S.size();j++){
            if(num[now]==S[j]-'0'){
                now++;
            }

            if(now==3){
                ans++;
                break;
            }
        }
    }

    cout << ans << endl;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

struct DisjointSet {
  vector<int> parent, rank;

  DisjointSet(int N) {
    parent.resize(N), rank.resize(N, 0);
    for (int i = 0; i < N; i++) parent[i] = i;
  }

  int find(int x) {
    if (parent[x] == x) {
      return x;
    } else {
      return parent[x] = find(parent[x]);
    }
  }

  void unite(int x, int y) {
    x = find(x), y = find(y);
    if (x == y) return ;
    if (rank[x] < rank[y]) {
      parent[x] = y;
    } else {
      parent[y] = x;
      if (rank[x] == rank[y]) rank[x]++;
    }
  }

  bool same(int x, int y) { return find(x) == find(y); }
};

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int N, Q; cin >> N >> Q;
  DisjointSet uf(N);
  REP(_, Q) {
    int com, x, y; cin >> com >> x >> y;
    if (com == 0) {
      uf.unite(x, y);
    } else {
      cout << uf.same(x, y) << endl;
    }
  }
  return 0;
}

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

int main() {
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    double a_r = 360.0/12.0*h + 30.0/60.0*m;
    double b_r = 360.0/60.0*m;
    double a_b_abs = abs(a_r - b_r);
    double rad = a_b_abs * PI /180.0;
    // double rad = (360-a_b_abs) < a_b_abs
    //     ? (360-a_b_abs)* PI/180.0
    //     : a_b_abs * PI / 180.0;
    double z = sqrt( pow(a, 2) + pow(b, 2) -2*a*b*cos(rad));
    cout << fixed << setprecision(20) <<  z;
    return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

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

	for (int i = A; i <= B; i++) {
		if (i % K == 0) {
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;
	
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
string s,s1;
int n;
bool check(int l) {
	for(int i=0;i<=n-l;++i) {
		s1=s.substr(i,l);
		if(s.find(s1,i+l)!=string::npos) return true;
	}
	return false;
}
int main()
{
	cin>>n>>s;
	int l=1,r=n;
	while(l<=r) {
		int mid=(l+r)/2;
		if(check(mid)) l=mid+1;
		else r=mid-1;
	}
	printf("%d",r);
	return 0;
}

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

int g[15][15];

int main(){
    int n;
    cin >> n;
    rep(i, n) rep(j, n) g[i][j] = -1;
    rep(i, n) {
        int m;
        cin >> m;
        rep(j, m) {
            int a, y;
            cin >> a >> y;
            --a;
            g[i][a] = y;
        }
    }
    int ans = 0;
    rep(i, 1<<n) {
        vector<int> d(n);
        rep(j, n) {
            if ( (i>>j) & 1 ) d[j] = 1;
        }
        bool ok = true;
        rep(j, n) {
            if ( d[j] ) {
                rep(k, n) { 
                    if ( g[j][k] == -1 ) continue;
                    if ( g[j][k] != d[k] ) ok = false;
                }
            }
        }
        if ( ok ) ans = max(ans, __builtin_popcount(i));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner  = new Scanner(System.in);
		final var r = scanner.nextInt();
		final var D = scanner.nextInt();
		var x = scanner.nextInt();
		for(var i = 0; i < 10; i++) {
			x =  r * x - D;
			System.out.println(x);
		}
		scanner.close();
	}

}


Measured memory_bytes: 35788
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int>A(N), B(N);
	rep(i, N - 1) cin >> B.at(i);
	A.at(0) = B.at(0);
	A.at(N - 1) = B.at(N - 2);
	rep2(i,1,N-1)  A.at(i) = min(B.at(i - 1), B.at(i));
	int count = 0;
	rep(i, N) count += A.at(i);
	cout << count << endl;
}

Measured memory_bytes: 256
///ABC_127_C
#include <iostream>
#include <cstdio>
using namespace std;
bool can[100000] = {0};
main()
{
    int n,m;
    cin >> n >> m;
    int l[100000],r[100000];
    for( int i = 0; i < m; i++ )
    {
        cin >> l[i] >> r[i] ;
    }
    int lb = 0, ub = 10000000;
    for( int i = 0; i < m; i++ )
    {
        if( lb < l[i] ) lb = l[i];
        if( ub > r[i]) ub = r[i];
    }
    if( ub < lb )puts("0\n");
    else cout << ub - lb + 1 << endl;
    return 0;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (ll i=0; i<(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
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; }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){fastio
    string s;cin>>s;
    ll n=s.size();
    if(n==1){
        cout<<1<<endl;
        return 0;
    }
    if(n%2==0){
        ll k=-1;
        rep(i,n/2,n-1){
            ll j=n-1-i;
            if(s[i]!=s[i-1] || s[j]!=s[j+1]){
                k=i;
                break;
            }
        }
        if(k==-1){
            cout<<n<<endl;
        }else{
            cout<<k<<endl;
        }
    }else{
        ll k=-1;
        rep(i,n/2+1,n-1){
            ll j=n-1-i;
            if(s[i]!=s[i-1] || s[j]!=s[j+1]){
                k=i;
                break;
            }
        }
        if(k==-1){
            cout<<n<<endl;
        }else{
            cout<<k<<endl;
        }
    }
    
    return 0;
}





Measured memory_bytes: 3788
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}
///////////////////////////////////////
ll A, B, C, D;
ll Gcd(ll x, ll y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return Gcd(y, x%y);
}
ll lcm(ll a, ll b) {
	ll g = Gcd(a, b);
	return a / g * b;
}
int main() {
	cin >> A >> B >> C >> D;
	ll m = lcm(C, D);
	ll bc = B / C + B / D - B / lcm(C, D);
	ll ac = (A - 1) / C + (A - 1) / D - (A - 1) / lcm(C, D);
	ll ans = B - A + 1 - (bc - ac);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;


void solve(){
    vi v(3);
    for(int i = 0; i < 3; i++) cin >> v[i];
    sort(all(v));
    int ans = (v[0]*v[1])/2;
    cout << ans << endl;
}

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

    solve();
    return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 110
#define MAX_K 5

string N;
int K;

ll dp[MAX_N][MAX_K][2];

ll dfs(int i, int j, int tight) {
    if(i >= N.length()) {
        if(j == K) { return 1; }
        return 0;
    }

    ll& ret = dp[i][j][tight];
    if(~ret) { return ret; }
    ret = 0;

    int r = 9;
    if(tight == 1) { r = N[i] - '0'; }

    for(int num = 0; num <= r; ++num) {
        int next_tight = 0;
        if(tight == 1 && num == r) {
            next_tight = 1;
        }
        if(j == K && num != 0) { continue; }
        ret += dfs(i+1, (num != 0) ? j + 1 : j, next_tight);
    }

    return ret;
}

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

    cin >> N >> K;

    MINUS(dp);
    ll ans = dfs(0, 0, 1);
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    size_t n, m;
    cin >> n >> m;
    bool as[n] = { false };
    bool bs[n] = { false };
    for (size_t i = 0; i < m; ++i) {
        size_t a, b;
        cin >> a >> b;
        if (a == 1) {
            as[b - 1] = true;
        } else if (b == n) {
            bs[a - 1] = true;
        }
    }
    for (size_t i = 1; i < n; ++i) {
        if (as[i] && bs[i]) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}


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

#define ll long long
#define N 10000000007

using namespace std;

int main()
{
    /*
    string s;
    cin >> s;
    bool ok = true;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'R' && ((i+1) % 2 == 0)){
            ok = false;
            break;
        }
        else if(s[i] == 'L' && ((i+1) % 2 != 0)){
            ok = false;
            break;
        }
        else ok = true;
    }
    if(ok == false)cout << "NO" << endl;
    else cout << "YES" << endl;
        */
    string s;
    cin >> s;
    vector<string> w;
     w.push_back("Sunny");
     w.push_back("Cloudy");
     w.push_back("Rainy");
    int x = 0;
    for(int i = 0; i < w.size(); i++){
        if(s == w[i]){
            x = i;
        }
    }

    if(x == 2)cout << w[0] << endl;
    else cout << w[x+1] << endl;

    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	int a, b, h, ans;
	cin >> a >> b >> h;
	ans = (a + b) * h / 2;
	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    
    public static void main(String[] args) {
        Main main = new Main();
        main.solv();
    }
    
    private void solv() {
        Scanner input = new Scanner(System.in);
        
        int n = input.nextInt();
        Integer[] A = new Integer[n];
        for (int i = 0; i < n; i++) A[i] = input.nextInt();
        int q = input.nextInt();
        int[] M = new int[q];
        for (int i = 0; i < q; i++) M[i] = input.nextInt();
        
        Arrays.sort(A, new Comparator<Integer>() {
            @Override
            public int compare(Integer x, Integer y) {
                return y.compareTo(x);
            }
        });
        
        for (int m : M) {
            if (check(m, A)) {
                System.out.println("yes");
            } else {
                System.out.println("no");
            }
        }
        
    }
    
    private boolean check(int x, Integer[] ns) { return check(x, ns, 0, 0);}
    private boolean check(int x, Integer[] ns, int index, int sum) {
        if (x < sum) return false;
        if (x == sum) return true;
        for (int i = index; i < ns.length; i++) {
            if (check(x, ns, i + 1, sum + ns[i])) {
                return true;
            }
        }
        return false;
    }
    
    private void print(Object[] xs) {
        StringBuilder sb = new StringBuilder();
        for (Object x : xs) sb.append(x.toString()).append(' ');
        System.out.println(sb.toString().trim());
    }
    
    private static class Scanner {
        BufferedReader r;
        StreamTokenizer st;
        
        public Scanner(InputStream in) {
            r = new BufferedReader(new InputStreamReader(in));
            st = new StreamTokenizer(r);
        }
        
        public String next() {
            nextToken();
            return st.sval;
        }
        
        public Integer nextInt() {
            nextToken();
            return (int)st.nval;
        }
        
        private int nextToken() {
            int token = st.TT_EOF;
            try {
                token = st.nextToken();
            } catch (IOException e) {
            }
            return token;
        }
    }
}

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define all(x) x.begin(),x.end()

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

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main()
{
	int x,y,s;
	while(cin>>x>>y>>s,x!=0&&y!=0&&s!=0){
		int ans=0;
		repi(i,1,s){
			repi(j,1,s){
				if(i*(100+x)/100+j*(100+x)/100==s){
					ans=max(ans,i*(100+y)/100+j*(100+y)/100);
				}
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>

int main()
{
  int n; char s[100];

  scanf("%d",&n);
  scanf("%s",s);

  int a=0,i;

  for(i=0;i<n;i++)
    if(s[i] == 'R')
      a++;

  if(n-a < a)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}



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

int main() {
  int n, m;
  bool key = 1;
  cin >> n;
  string A[n];
  rep(i, n) cin >> A[i];
  cin >> m;
  rep(i, m) {
    string S;
    cin >> S;
    rep(i, n) if (A[i] == S) {
      cout << (key ? "Opened" : "Closed") << " by " << S << endl;
      if (key)
        key = 0;
      else
        key = 1;
      goto end;
    }
    cout << "Unknown " << S << endl;
  end:;
  }
  return 0;
}

Measured memory_bytes: 3212
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split(" ");
        int A = getInt(s[0]);
        int B = getInt(s[1]);
        int X = getInt(s[2]);
        boolean result = X-A < B && X >= A;
        if(result){
            println("YES");
        }else{
            println("NO");
        }
        return;
    }
    static long getLong(String val) {return Long.parseLong(val);}
    static int getInt(String val) {return Integer.parseInt(val);}
    static String[] split(String val) {return val.split(" ");}
    static List<String> toSortedList(String[] s){ return sortList(Arrays.asList(s));}
    static List<String> sortList(List<String> list){
        Collections.sort(list, Comparator.comparingInt(val -> Integer.parseInt(String.valueOf(val))));
        return list;
    }

    static void println(String val){System.out.println(val);}
    static void println(int val){System.out.println(val);}
    static void println(long val){System.out.println(val);}
    static void println(boolean val){System.out.println(val);}
}


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

using namespace std;
const int maxn = 410;
const long long inf = (1LL << 50);

int n;
int niz[maxn];
long long pref[maxn];
long long dp[maxn][maxn];

inline long long get(int x, int y) {
	return pref[++y] - pref[x];
}

long long rek(int x, int y) {
	if (x == y) return 0;
	long long &ret = dp[x][y];
	if (ret != -1) return ret;
	
	ret = inf;
	for (int i = x; i < y; i++) 
		ret = min(ret, rek(x, i) + rek(i + 1, y));
	ret += get(x, y);
	return ret;
}

int main() {
	memset(dp, -1, sizeof dp);
	scanf("%d", &n);
	for (int i = 0; i < n; i++) 
		scanf("%d", niz+i);
		
	for (int i = 1; i <= n; i++)
		pref[i] = pref[i - 1] + niz[i - 1];
	printf("%lld\n", rek(0, n - 1));
	return 0;
}


Measured memory_bytes: 1536
n=int(input())
from collections import defaultdict
d=defaultdict(int)
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            d[i**2+j**2+k**2+i*j+j*k+k*i]+=1
for i in range(1,n+1):
    print(d[i])

Measured memory_bytes: 79980
#include <queue>
#include <cstdio>
#include <vector>
#pragma warning(disable : 4996)
using namespace std;
int N, R, L, D, T, X, M[100000], A[100000]; vector<pair<int, int> > F[1000000]; // (team, score)
int main() {
	scanf("%d%d%d", &N, &R, &L);
	for (int i = 0; i < R; i++) {
		scanf("%d%d%d", &D, &T, &X);
		F[T].push_back(make_pair(D - 1, X));
	}
	priority_queue<pair<int, int> > que;
	for (int i = 0; i < N; i++) {
		que.push(make_pair(0, -i));
	}
	for (int i = 0; i < L; i++) {
		for (int j = 0; j < F[i].size(); j++) {
			M[F[i][j].first] += F[i][j].second;
			que.push(make_pair(M[F[i][j].first], -F[i][j].first));
		}
		pair<int, int> p;
		while (!que.empty()) {
			p = que.top();
			if (p.first == M[-p.second]) {
				break;
			}
			else {
				que.pop();
			}
		}
		A[-p.second]++;
	}
	int ret = 0;
	for (int i = 0; i < N; i++) {
		if (A[i] > A[ret]) {
			ret = i;
		}
	}
	printf("%d\n", ret + 1);
	return 0;
}

Measured memory_bytes: 51776
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  string S;
  cin >> S;
  int count=0;
  
  rep(i,4) {
if (S.at(i)=='+') {
count++;
}
    else {
count--;
    }
  }
cout << count << endl;
}


Measured memory_bytes: 256