akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <math.h>

using namespace std;

int main(){
	int n;
	double students[1000] = {0},sum,m,div;

	while(true){
		scanf("%d",&n);
		if(n == 0) break;
		div = sum = 0;
		for(int i = 0; i < n; i++){
			scanf("%lf",&students[i]);
			sum += students[i];
		}
		m = sum/n;
		for(int i = 0; i < n;i++){
			div += (students[i] - m)*(students[i] - m);
			students[i] = 0;
		}
		printf("%.8lf\n",sqrt(div/n));
	}
}



Measured memory_bytes: 2736
#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

    int time[100];
    for (int i = 0; i <= 100; ++i) {
        time[i] = 0;
    }


    for (int i = A; i < B; ++i) {
        ++time[i];
    }

    for (int i = C; i < D; ++i) {
        ++time[i];
    }

    int counter = 0;
    for (int i = 0; i <= 100; ++i) {

        if (time[i] == 2) {
            ++counter;
        }
    }

    cout << counter;
}



Measured memory_bytes: 256
def getWays(n, x):
  ways = []
  for i in xrange(1, n - 1):
    j = i + 1
    while j < n:
      # print "i = " + str(i) + ", j = " + str(j)
      remain = x - i - j
      if remain <= n and remain > j:
        list = [i, j, remain]
        ways.append(list)
      j+= 1
  return ways

while True:
  line = raw_input().split(" ")
  n = int(line[0])
  x = int(line[1])
  if n == 0 and x == 0:
    break
  else:
    print len(getWays(n, x))

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

#define MAXN (100010)
#define ll long long

int n;
ll a, b;
ll x[MAXN];

int main(){
	scanf("%d%lld%lld", &n, &a, &b);
	for(int i = 1; i <= n; ++ i){
		scanf("%lld", x + i);
	}
	ll ans = 0;
	for(int i = 2; i <= n; ++ i){
		ans += std::min((x[i] - x[i - 1]) * a, b);
	}
	printf("%lld\n", ans);
	return 0;
}

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

int main()
{
    // freopen("filename.in","r",stdin);
    // freopen("filename.out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    int h,w,k;
    cin>>h>>w>>k;
    int ans =0;
    char arr[h][w];
    for(int i=0; i<h; i++)
        for(int j=0; j<w; j++)
            cin>>arr[i][j];
        
    int black;
    for(int i=0; i<(1<<h) - 1; i++){
        for(int j=0; j<(1<<w) - 1; j++){
            black = 0;
            for(int k=0; k<h; k++){
                for(int l =0; l<w; l++){
                    if((i>>k & 1)==0 && (j>>l & 1)==0 && (arr[k][l]=='#'))
                        black++;
                }
            }
            if(black == k)
                ans++;
        }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<int, int>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }


int main() {
    string s; cin >> s;
    int slen = s.length();
    int fst = -1, snd = -1;
    for(int i = 0; i < slen-1; ++i) {
        if(i == slen-2) {
            if(s.at(i) == s.at(i+1)) {
                fst = i; snd = i+1;
            }
        }else {
            if(s.at(i) == s.at(i+1)) {
                fst = i; snd = i+1;
                break;
            }
            if(s.at(i) == s.at(i+2)) {
                fst = i; snd = i+2;
                break;
            }
        }
    }
    if(fst == -1 && snd == -1) cout << "-1 -1" << endl;
    else cout << fst+1 << " " << snd+1 << endl;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

int top, S[1000];

void push(int x) {
  top++;
  S[top] = x;
}

int pop() {
  top--;
  return S[top+1];
}

int main() {
  int a, b;
  top = 0;

  char s[100];

  while( scanf("%s", s) != EOF) {
    if (s[0] == '*' ) {
      a = pop();
      b = pop();
      push(a * b);
    }

    else if (s[0] == '-' ) {
      b = pop();
      a = pop();
      push(a - b);
    }

    else if (s[0] == '+' ) {
      a = pop();
      b = pop();
      push(a + b);
    }

    else {
      push(atoi(s));
    }
  }

  printf("%d\n", pop());

  return 0;

}

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

int main () {
  int N, A, B;
  scanf("%d%d%d",&N,&A,&B);
  
  printf("%d ",min(A,B));
  if (A + B <= N) {
    printf("%d\n",0);
  }
  else {
    printf("%d\n",A+B-N);
  }
}

Measured memory_bytes: 256
from heapq import heappop, heappush

def dijkstra(s):
    used = [1] * N
    dp = [INF] * N
    dp[s] = 0
    hq = []
    used[s] = 0
    for i in cost[s]:
        heappush(hq, i)

    while hq:
        minv = heappop(hq)
        if used[minv[1]] == 0:
            continue
        v = minv[1]
        dp[v] = minv[0]
        used[v] = 0
        for i in cost[v]:
            if used[i[1]]:
                heappush(hq, [i[0] + dp[v], i[1]])
    return dp

INF = 10 ** 18
N, M = map(int, input().split())
cost = [[] for _ in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    cost[a].append([1, b])
    cost[b].append([1, a])
dp1 = dijkstra(0)
for i in dp1:
    if i == INF:
        print('No')
        exit()
print('Yes')
for i in range(1, N):
    tmp = dp1[i] - 1
    for j in cost[i]:
        if dp1[j[1]] == tmp:
            print(j[1] + 1)
            break

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

int main()
{
  int n, m;
  string S;
  int i;
  int value;
  cin >> n;
  map<string,int> name;
  for(i=0; i<n; i++)
  {
    cin >> S;
    (name.count(S))? name[S]++: name[S] = 1;
  }
  cin >> m;
  for(i=0; i<m; i++)
  {
    cin >> S;
    (name.count(S))? name[S]--: name[S] = -1;
  }
  value = 0;
  for(auto p:name)
  {
    if(value <= p.second)
    {
      value = p.second;
    }
  }
  cout << value << endl;
  return 0;
}

Measured memory_bytes: 256
a, b, c = gets.split.map(&:to_i)

nums = [a, b, c].sort
count = 0
gap = nums[1] - nums[0]
if gap.even?
  count += gap / 2
else
  nums[0] += 1
  nums[2] += 1
  count += 1
  count += (gap - 1) / 2
end
count += nums[2] - nums[1]

puts count


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    int k[n],num[100][100]={0},a[n][100],b[100]={0},ans=0;
    for(int i=0;i<n;i++){
        cin>>k[i];
        for(int j=0;j<k[i];j++){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<k[i];j++){
            num[i][a[i][j]]++;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=1;j<=m;j++){
            b[j]+=num[i][j];
        }
    }
    for(int i=1;i<=m;i++){
        if(b[i]==n){
            ans++;
        }
    }
    cout << ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <map>
using namespace std;


#define prec(i) cout << fixed << setprecision(i)

const long long MOD = 1000000007;

long long fact(long long k) {
	long long sum = 1;
	for (long long i = 2; i <= k; i++)
		sum *= i;

	return sum;
}

int ctoi(char c) {
	if (c >= '0' && c <= '9')
		return c - '0';
	else
		return -1;
}

long long pow_mod(int a, int b) {
	long long ans = 1;
	for (int i = 0; i < b; i++)
		ans = (ans * a) % MOD;

	return ans;
}

long long powll(long long a, long long  b) {
	long long ans = 1;
	for (long long  i = 0; i < b; i++)
		ans = ans * a;

	return ans;
}

vector<int> prime(const int N)
{
	vector<int> P;

	for (int i = 2; i <= N; i++)
	{
		bool flag = true;
		for (int j = 2; j * j <= i; j++)
		{
			if (i % j == 0)
			{
				flag = false;
				break;
			}
		}
		if (flag)
		{
			P.emplace_back(i);
		}
	}

	return P;
}


int main()
{
	long long x, ans = 0;
	bool isPrime = false;

	cin >> x;
	
	vector <int> P;
	P = prime(100100);

	for (int i = 0; i < P.size(); i++) {
		if (P[i] >= x) {
			ans = P[i];
			break;
		}
			
	}

	cout << ans << endl;

	return 0;
}


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

int main(){
    int n; cin >> n;
    vector<ll> a(n);
    bool zero = false;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] == 0) zero = true;
    }
    if(zero){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1;
    for(int i = 0; i < n; i++){
        if(ans * a[i] > 1000000000000000000 || ans * a[i] < ans){
            ans = -1;
            break;
        }
        ans *= a[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4048
#include<bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define lson rt<<1,l,M
#define rson rt<<1|1,M+1,r
#define PI acos(-1)
#define MM int M=(l+r)>>1;
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define fh(i,be,e) for(int i=head[be];~i;i=e[i].next)
#define fa(i,V) for(auto i:V)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl '\n'
#define lcm(a,b) (a*b)/__gcd(a,b)
#define cp(i,ans) printf("%.if",ans);
#define cpp(i,ans) cout<<setprecision(i)<<fixed<<ans<<endl;
#define ppb pop_back
#define ppf pop_front
#define pb push_back
#define pf push_front
#define pq priority_queue
#define lowbit(x) (x)&(-x)
#define all(V) V.begin(),V.end()
#define ms multiset
#define mod(x) ((x+mo_num)%mo_num)
#define vc vector
#define vct vector<int>
#define out(i) cout<<(i)<<endl;
#define fi first
#define se second
#define fun(i) fu(i,1,n)
#define fut(i) fu(i,1,t)
#define fum(i) fu(i,1,m)
#define ld long double
#define umap unordered_map
#define P pair<int,int>
#define SET set<int>
#define mp map<int,int>
#define mk make_tuple
#define low lower_bound
#define upp upper_bound
#define yn(key) out(key?"YES":"NO")
#define in(i) i+1,i+1+n
#define im(i) i+1,i+1+m
#define bffs(i) __builtin_ffs(i)
#define bcount(i) __builtin_popcount(i)
#define bone(i) ((1<<i)-1)
#define got(container,num) get<num-1>(container)
using namespace std;
const int INF=LLONG_MAX/2;
const int dx[]={0,0,-1,1},dy[]={-1,1,0,0};//up down left right
const int maxn=1e6+1e5;
const int mo_num=1e9+7;
int n,m,t,a[maxn],b[maxn],ans;
int X[maxn],Y[maxn];
const int N=505;
int f[N][N],val[N][N];
void dfs(int x,int y)
{
    fu(i,0,3)
    {
        int tx=x+dx[i],ty=y+dy[i];
        if(val[tx][ty]>val[x][y]+f[x][y])
        {
            val[tx][ty]=val[x][y]+f[x][y];
            dfs(tx,ty);
        }
    }
}
main()
{
    IOS
    cin>>n;
    fu(i,1,n*n)
    {
        cin>>a[i];
    }
    fun(i)fun(j){
        f[i][j]=1;
        m++;
        X[m]=i;
        Y[m]=j;
        val[i][j]=min({i-1,j-1,n-i,n-j});
    }
    fu(i,1,n*n)
    {
        f[X[a[i]]][Y[a[i]]]=0;
        dfs(X[a[i]],Y[a[i]]);
        ans+=(val[X[a[i]]][Y[a[i]]]);
    }
    out(ans)
    return 0;
}

Measured memory_bytes: 28864
#include <stdio.h>

#define MAX(a,b) ((a > b) ? a : b)

int main ()
{
    int A,B,K;
    scanf("%d%d%d", &A, &B, &K);    

    int max_num = MAX(A, B);
    int div,ans;
    int cnt = 0;
    for (div = max_num; div >= 0; div--) {
        if (A % div == 0 && B % div == 0) {
            cnt++;
        }
        if (cnt == K) {
            ans = div;
            break;
        }
    }

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int BubbleSort(int *a,int n)
{
	int sw=0;
	bool flag=1;
	for(int i=0;flag;i++){
		flag=0;
		for(int j=n-1;j>=i+1;j--){
			if(a[j] < a[j-1]){
				swap(a[j],a[j-1]);
				flag=1;
				sw++;
			}
		}
	}
	return sw;
}

int main()
{
#ifdef CDZSC
	freopen("Text.txt","r",stdin);
#endif
	int a[150];
	int n,num;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	num=BubbleSort(a , n);
	for(int i=0;i<n;i++){
		if(i) cout<<" ";
		cout<<a[i];
	}
	cout<<endl;
	cout<<num<<endl;
	return 0;
}

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n, x;
    cin >> n >> x;
    int d = 0;
    int odp = 1;
    for (int i = 0; i < n; ++i)
    {
        int l;
        cin >> l;
        d += l;
        if (d <= x)
            ++odp;
    }
    cout << odp;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,a,b,y,x;
	scanf("%lld%lld%lld",&n,&a,&b);
	if(a==0)
	{
		printf("0\n");
		return 0;
	}
	if(n<(a+b))
	{
		if(n<a)
			printf("%lld\n",n);
		else
			printf("%lld\n",a);
		return 0;
	}
	y=n/(a+b);
	x=n%(a+b);
	if(x>a)
		x=a;
	printf("%lld\n",a*y+x);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int,int>> v;
int main(){
cin>>n;
for(int k=0;k<n;k++){
 int a;
 cin>>a;
 v.push_back({a,k+1});
}
sort(v.begin(),v.end());
for(int k=0;k<v.size();k++){
   cout<<v[k].second<<' ';
}
return 0;
}



Measured memory_bytes: 1780
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define TRACE(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << endl;}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "[" << *it << " = " << a << "]";
	err(++it, args...);
}

#define MAXN ((ll)2e5+5)
#define MOD ((ll)1e9 + 7)
#define INF ((ll)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define LOG(x) if(DEBUG) cerr << x << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<ll,ll>
#define mid ((l+r)/2)

string s;
vector <ll> v;
map <ll,ll> mp;
ll ans;

signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin >> s;
	v.resize(s.size());
	ll fac = 1;

	for (ll i = s.size()-1; i >= 0; --i)
	{
		v[i] = (fac*(s[i]-'0')) % 2019;
		fac = (fac * 10) % 2019;
	}

	mp[v[0]]++;
	for (ll i = 1; i < s.size(); ++i)
	{
		v[i] = (v[i-1] + v[i]) % 2019;
		mp[v[i]]++;
	}

	for (auto x : mp)
		ans += (x.second * (x.second-1)) / 2;

	ans += mp[0];

	cout << ans << endl;
}

/* stuff you should look for
	* ll overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/

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

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        int n=fsc.nextInt();
        long sum=0;
        boolean same=true;
        long bmin=Long.MAX_VALUE;
        for(int i=0;i<n;i++){
            long a=fsc.nextLong();
            long b=fsc.nextLong();
            sum+=a;
            if(a!=b){
                same=false;
            }
            if(a>b && b<bmin){
                bmin=b;
            }
        }
        fsc.close();
        if(same){
            System.out.println(0);
            return;
        }
        System.out.println(sum-bmin);
    }
    
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


Measured memory_bytes: 23496
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  int A[N];
  REP(i,N)cin>>A[i];
  multiset<int> s;
  s.insert(A[N-1]);
  int ans=1;
  for(int i=N-2;i>=0;i--){
    auto itr=s.lower_bound(A[i]+1);
    if(itr==s.end()){
      ans++;
    }else{
      s.erase(itr);
    }
    s.insert(A[i]);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 5376
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

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

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;

char s[100005];
int n;

void ng(){
  puts("-1");
  exit(0);
}
int main(){
  scanf("%s",s+1);
  s[0]='0';
  n=strlen(s)-1;

  REP(i,n+1) if(s[i]!=s[n-i]) ng();
  if(s[1]=='0') ng();
  dump(s);

  int n2=(n+1)/2;
  int m=1;

  vector<pi> es;
  auto addE=[&](int a,int b){
    es.pb({a,b});
  };
  for(int i=2;i<=n2;){
    int prev=m-1;
    int j=i;
    while(j<=n2 && s[j]=='0') ++j;
    if(j>n2) break;

    int cur=m+(j-i);
    REPN(k,j,i) addE(m+(k-i),cur);
    addE(prev,cur);

    m=cur+1;
    i=j+1;
  }
  dump(m);
  addE(m-1,m);
  for(int i=m+1;i<n;++i){
    addE(m,i);
  }

  for(auto e:es) printf("%d %d\n",e.fr+1,e.sc+1);
  return 0;
}



Measured memory_bytes: 2420
S=input()
a,b=int(S[:2]),int(S[2:])
if 0<a<13 and 0<b<13:
    print('AMBIGUOUS')
elif 0<a<13:
    print('MMYY')
elif 0<b<13:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 8996
#include<stdio.h>

int main()
{
  int i,A[251],n;
  scanf("%d",&n);
  for(i=1;i<n+1;i++)
    {
      scanf("%d",&A[i]);
    }

  for(i=1;i<n+1;i++)
    {
      printf("node %d: key = %d, ",i,A[i]);
      if(i!=1) printf("parent key = %d, ",A[i/2]);
      if(2*i<=n) printf("left key = %d, ",A[2*i]);
      if(2*i+1<=n) printf("right key = %d, ",A[2*i+1]);
      printf("\n");
    }

  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define For(i,m,n) for(int i=m;i<n;i++)
#define ll long long
#define l long
#define all(x) x.begin(),x.end()
#define pb push_back
#define len(x) x.len
int main()
{unordered_map<ll,ll> g;
ll n;
cin>>n;
ll a[n];
FOR(i,n)cin>>a[i];
FOR(i,n)g[a[i]]++;
ll max=a[0];ll min=a[0];
FOR(i,n)
{
    if(a[i]>max)max=a[i];
    

}
int k=0;
for(int i=0;i<n;i++)
{   
    int j=2;
    while(a[i]*j<=max)
    {if(g[a[i]*j])
        if(g.find(a[i]*j)!=g.end())
        {   
            g[a[i]*j]=0;
        }
        j++;
    }
}

for(auto it:g)
{
    if(it.second>1) it.second=0;
}

for(auto it:g)
{
    if(it.second==1)k++;
    else continue;
}

cout<<k;

return 0;}

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

using namespace std;

int main() {
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      printf("%dx%d=%d\n", i, j, i * j);
    }
  }
  return 0;
}



Measured memory_bytes: 3060
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
#define PB push_back
#define MP make_pair
#define F first
#define S second
bool cmp(const pair<int,string> &a,const pair<int,string> &b){
    return a.F!=b.F?a.F>b.F:a.S<b.S;
}
int main(){
    map<string,int> s[26];
    string c,temp;
    vector<pair<int,string>> ans;
    int n;
    while(true){
        getline(cin,c);
        n=0;
        for(int i=0;i<c.size();i++){
            n*=10;
            n+=c[i]-'0';
        }
        if(n==0)return 0;
        for(int i=0;i<26;i++)s[i].clear();
        while(n--){
            getline(cin,c);
            temp.clear();
            for(int i=0;i<c.size();i++){
                if(c[i]==' '){
                    if(s[temp[0]-'a'].find(temp)==s[temp[0]-'a'].end())s[temp[0]-'a'].insert(MP(temp,1));
                    else s[temp[0]-'a'][temp]++;
                    temp.clear();
                }
                else temp+=c[i];
            }
            if(s[temp[0]-'a'].find(temp)==s[temp[0]-'a'].end())s[temp[0]-'a'].insert(MP(temp,1));
            else s[temp[0]-'a'][temp]++;
        }
        getline(cin,c);
        if(s[c[0]-'a'].empty())cout<<"NA\n";
        else{
            ans.clear();
            for(auto u: s[c[0]-'a'])ans.PB(MP(u.S,u.F));
            sort(ans.begin(),ans.end(),cmp);
            cout<<ans[0].S;
            for(int i=1;i<min(static_cast<int>(ans.size()),5);i++)cout<<" "<<ans[i].S;
            cout<<"\n";
        }
    }
}


Measured memory_bytes: 3160
#include <algorithm>
int i;
#define rep2(i, a, b) for(i = a; i <= b; ++i)
#define rep(i, n) for(i = 0; i < n; ++i)
using namespace std;
// _________コーディングはここから！！___________
template <const int sz = 5 * 10000000, typename T = long long> struct IO {
    char reader[sz], writer[sz];
    char *now, *now2 = writer;
    IO() {
        reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
        now = reader;
    }
    inline T read() {
        while(*now && *now <= 32) now++;
        if(*now == '-') {
            now++;
            T res = 0;
            while('0' <= *now and *now <= '9') { res = res * 10 + *now++ - '0'; }
            return -res;
        } else {
            T res = 0;
            while('0' <= *now and *now <= '9') { res = res * 10 + *now++ - '0'; }
            return res;
        }
    }
    inline void write(T x, char margin = ' ') {
        if(x == 0) {
            putchar('0');
            putchar(margin);
            return;
        }
        if(x < 0) {
            putchar('-');
            x = -x;
        }
        while(x) {
            *now2 = '0' + x % 10;
            now2++;
            x /= 10;
        }
        do {
            now2--;
            putchar(*now2);
        } while(now2 != writer);
        putchar(margin);
    }
};
IO io;
inline int read() { return io.read(); }
inline void write(int x) { io.write(x); }
inline void write(int x, char c) { io.write(x, c); }
constexpr int N = 500003;
int c[N];
struct T {
    int l, r, idx;
    constexpr bool operator<(const T &rhs) const noexcept { return r < rhs.r; }
} q[N];
int ans[N], last[N], dat[N];

inline void dec(int k) {
    for(++k; k < N; k += k & -k) --dat[k];
}
inline int sum(int k) {
    int res = 0;
    for(++k; k > 0; k -= k & -k) res += dat[k];
    return res;
}
int n, Q, now = 1;

// 頑張れ！！
#pragma GCC target("avx2")
#pragma GCC optimize("unroll-loops")
// 頑張れ！！

int main() {
    n = read(), Q = read();
    rep2(i, 1, n) c[i] = read();
    rep(i, Q) q[i].l = read(), q[i].r = read() + 1, q[i].idx = i;
    sort(q, q + Q);
    rep(i, Q) {
        for(; now < q[i].r; ++now) {
            if(last[c[now]]) dec(last[c[now]]);
            last[c[now]] = now;
        }
        ans[q[i].idx] = sum(q[i].r - 1) - sum(q[i].l - 1) + q[i].r - q[i].l;
    }
    rep(i, Q) write(ans[i], '\n');
}


Measured memory_bytes: 26624
#include <iostream>
#include <string>
#include <array>
using namespace std;
 //Compiler version g++ 6.3.0

 int main()
 {
 	array<string,100>a={};
 	int N,x=0,y=0;
 	cin >> N;
 	for (int i = 0; i < N; i++) {  
 		cin >> a[i];
 	}
 	for (int i = 0; i < N; i++) {
 		for (int j = 0; j < N; j++) {
 			if(i!=j){
 				if (a[i] == a[j]){
 					x=1;
 				}
 			}
 		} 
 	}
 	for (int i = 0; i < N-1; i++) {
 		if (a[i].back() != a[i + 1].front()){
 			y=1;
 		}
 	}
 	if(x==1||y==1){
 		cout << "No" << endl;
 	}else if(x==0&&y==0){
 		cout << "Yes" << endl;
 	}
}

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

int a[1001];
int b[1001];

int np(int n)
{
  for(int i=n+1; i<1001; i++)
    if(a[i]==0)
      return i;
}

void pf(int n)
{
  int i=2;
  while(1)
    {
      if(n==1)break;
      if(n%i==0)
	{
	  b[i]++;
	  n=n/i;	  
	}
      else
	i=np(i);
    }
}

int main(void)
{
  int n;
  cin>>n;
  for(int i=2; i<1001; i++)
    {
      if(a[i]==0)
	for(int j=i; i*j<1001; j++)
	  a[i*j]=1;
    }

  if(n==1)
    {
      cout<<1<<endl;
      return 0;
    }

  for(int i=2; i<=n; i++)
    pf(i);

  long long ans=1;
  for(int i=2; i<=n; i++)
    {
      if(b[i]!=0)
  	ans=ans*(b[i]+1)%1000000007;
    }

  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import math
while True:
	n,m,p = map(int, input().split(" "))
	if n+m+p == 0:
		break
	total = 0
	winner = 0
	for i in range(1, n+1):
		x = int(input())
		total += x
		if i == m:
			winner = x
	print(math.floor(100 * total * (100 - p) / 100 / winner) if winner > 0 else 0)



Measured memory_bytes: 5680
input1 = gets.to_s

numOfPeople = input1.split(" ")[0].to_i
numOfFood = input1.split(" ")[1].to_i
arrayOfAnswers = []

for times in 0..numOfPeople-1 do
    arrayOfAnswer = []
    input2 = gets.to_s
    arrayOfAnswer = input2.split(" ")
    arrayOfAnswer = arrayOfAnswer.map!{|x| x.to_i}.drop(1)

    arrayOfAnswers << arrayOfAnswer
end

numOfFoodAllPeopleFavorite = 0

for food in 1..numOfFood do
    timesOfFavarite = 0

    arrayOfAnswers.each{ |arrayOfAnswer|
       if  arrayOfAnswer.include?(food) then
         timesOfFavarite = timesOfFavarite + 1  
       end         
    }

    if timesOfFavarite == numOfPeople then
        numOfFoodAllPeopleFavorite = numOfFoodAllPeopleFavorite + 1
    end
end

puts numOfFoodAllPeopleFavorite

Measured memory_bytes: 1916
#include <stdio.h>

int main(){
  int a[5],b,i,j;
  scanf("%d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4]);
  for(i=0;i<4;i++)for(j=i;j<5;j++)if(a[i]<a[j]){b=a[i];a[i]=a[j];a[j]=b;}
  printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
  return 0;
}

Measured memory_bytes: 0
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n):
    mini=i
    for j in range(i,n):
        if a[mini]>a[j]:
            mini=j
    if mini!=i:
        a[i],a[mini]=a[mini],a[i]
        cnt+=1
print(*a)
print(cnt)


Measured memory_bytes: 5608
#include <iostream>

using namespace std;

const long long base = 1000000007;

char chr[1003][1003];
long long sum[1003][1003];

int n, m;

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

	sum[1][1] = 1;

	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			cin >> chr[i][j];

			if (chr[i][j] == '#') continue;
			
			sum[i][j] = (sum[i][j] + sum[i - 1][j]) % base;
			sum[i][j] = (sum[i][j] + sum[i][j - 1]) % base;
		}
	}

	cout << sum[n][m] << endl;

	return 0;
}

Measured memory_bytes: 9088
#include <iostream>
#include <string>
#include <stack>
#include <cstdlib>

using namespace std;

int main() {
    string s;
    stack<int> St;

    while(cin >> s) {
        if (s == "+") {
            int n = St.top();
            St.pop();
            n += St.top();
            St.pop();
            St.push(n);
        }
        else if (s == "-") {
            int n = -St.top();
            St.pop();
            n += St.top();
            St.pop();
            St.push(n);
        }
        else if (s == "*") {
            int n = St.top();
            St.pop();
            n *= St.top();
            St.pop();
            St.push(n);
        }
        else {
            St.push(atoi(s.c_str()));
        }
    }
    cout << St.top() << endl;

    return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0) 
#define setbit0(n, i) ((n) & (~(1LL << (i)))) 
#define setbit1(n, i) ((n) | (1LL << (i))) 
#define togglebit(n, i) ((n) ^ (1LL << (i))) 
#define lastone(n) ((n) & (-(n))) 
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}

template <class T>
void read(T &x) {
    char c;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        ;
    for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
}
#define ll long long 
#define lll __int128_t
#define pb push_back
#define mp make_pair
typedef pair < int,int> ii;
typedef vector<ii> vii;
typedef vector<ll>vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll hashPrime = 1610612741;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll i, j, k, l,n, m;
    cin >> m >> l >> n;
    cin >> k;
    for (i = 0; i <= k;i++){
        if((l*(1LL<<i))>m){
            k -= i;
            l = l * (1LL << i);
            break;
        }
    }
    for (i = 0; i <= k;i++){
        if((n*(1LL<<i))>l){
            k -= i;
            n = n * (1LL << i);
            break;
        }
    }
    if(m<l&&l<n){
        cout << "Yes\n";
    }
    else{
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 3648
n, k = map(int, input().split())
p = list(map(int, input().split()))

kitaiti = [0 for _ in range(n)]
ruisekiwa = [0 for _ in range(n)]
r = k - 1
max = 0
now = 0
ans_list = []

for i in range(n):
    kitaiti[i] = (p[i]+1) / 2
    if i == 0:
        ruisekiwa[0] = kitaiti[0]
    else:
        ruisekiwa[i] = ruisekiwa[i-1] + kitaiti[i]
    if i == r:
        now = ruisekiwa[i]
    elif i > r:
        now = ruisekiwa[i] - ruisekiwa[i-r-1]
    if now > max:
        max = now
print(max)

Measured memory_bytes: 25052
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define int long long
#define sz(v) (int)(v).size()
#define mod 1000000007 // ((a- b)% mod+ mod)% mod


string str[11];

void solve() {
        int n, m, k; cin >> n>> m>> k;

        for (int i= 0; i< n; i++) cin >> str[i];

        int pw= n- 1, ans= 1e18;
        for (int i= 0; i< (1<< pw); i++) {
                vector<int> cuts;
                int cur= 0;
                cuts.push_back(0);

                for (int j= 0; j< pw; j++) {
                        if (i& 1<< j) {
                                cuts.push_back(j+ 1);
                        }
                }

                cuts.push_back(n);
                cur= cuts.size()- 2;


                vector<int> nmone(cuts.size()+ 1, 0);

                bool can= 0;

                for (int ii= 0; ii< m; ii++) {
                        bool findcut= 0;

                        for (int kk= 1; kk< cuts.size(); kk++) {
                                int pls= 0;
                                for (int j= cuts[kk- 1]; j< cuts[kk]; j++) {
                                        if (str[j][ii]== '1') {
                                                pls++;
                                        }
                                }

                                if (nmone[kk]+ pls> k) {
                                        findcut= 1;
                                } else nmone[kk]+= pls;

                                if (pls> k) {
                                        can= 1;
                                        break;
                                }
                        }

                        if (can) break;

                        if (findcut) {
                                cur++;
                                for (int kk= 1; kk< cuts.size(); kk++) {
                                        int pls= 0;
                                        for (int j= cuts[kk- 1]; j< cuts[kk]; j++) {
                                                if (str[j][ii]== '1') {
                                                        pls++;
                                                }
                                        }
                                        nmone[kk]= pls;
                                }
                        }
                }

                if (!can) ans= min(ans, cur);
        }

        cout << ans<< "\n";
}

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int T= 1;
        //cin >> T;
        while ( T-- ) solve();
return 0;
}


Measured memory_bytes: 3596
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <map>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>

#define Int long long
#define rep(i, n) for (Int i = 0; i < n; i++)
#define in(params) cin >> params;
#define p(params) cout << params << endl;
#define mod 1000000007LL

using namespace std;

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

  int last, current;

  cin >> last;
  last--;

  for (int i = 1; i < N; i++) {
    cin >> current;

    if (last + 1 <= current) {
      last = current - 1;
    } else if (last <= current) {
      last = current;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 256
A = list(reversed(input()))
B = list(reversed(input()))
C = list(reversed(input()))

d = {'a': A, 'b': B, 'c': C}
cur = 'a'

import sys

while True:
    if len(d[cur]) == 0:
        print(cur.upper())
        sys.exit()
    
    cur = d[cur].pop()


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

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

using namespace std;

typedef pair<int, int> ii;
string s;

int main() {
	getline(cin, s);
	deque<ii> ans;
	deque<int> deq;
	rep(i, s.size()) {
		if (s[i] == '\\') deq.push_back(i);
		else if (s[i] == '/' && !deq.empty()) {
			int sp = deq.back(); deq.pop_back();
			int area = i - sp;
			while (!ans.empty() && sp <= ans.back().first) {
				area += ans.back().second;
				ans.pop_back();
			}
			ans.push_back(ii(sp, area));
		}
	}
	int sum = 0;
	rep(i, ans.size()) sum += ans[i].second;
	cout << sum << endl << (int)ans.size();
	rep(i, ans.size())cout << ' ' << ans[i].second; puts("");
	return 0;
}


Measured memory_bytes: 3208
import sys
import bisect

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


class Bit:

    def __init__(self, a):
        if hasattr(a, "__iter__"):
            le = len(a)
            self.n = 1 << le.bit_length()  # le を超える最小の 2 冪
            self.values = values = [0] * (self.n + 1)
            values[1:le + 1] = a[:]
            for i in range(1, self.n):
                values[i + (i & -i)] += values[i]
        elif isinstance(a, int):
            self.n = 1 << a.bit_length()
            self.values = [0] * (self.n + 1)
        else:
            raise TypeError

    def add(self, i, val):
        n, values = self.n, self.values
        while i <= n:
            values[i] += val
            i += i & -i

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

    def bisect_left(self, v):  # self.sum(i) が v 以上になる最小の i
        n, values = self.n, self.values
        if v > values[n]:
            return None
        i, step = 0, n >> 1
        while step:
            if values[i + step] < v:
                i += step
                v -= values[i]
            step >>= 1
        return i + 1


def main():

    N, D, A = in_nn()
    XH = sorted(in_nl2(N))
    X = [0] * N
    H = [0] * N

    for i in range(N):
        x, h = XH[i]
        X[i] = x
        H[i] = h

    bit = Bit(N)

    ans = 0
    for i in range(N):

        x, h = X[i], H[i]
        j = bisect.bisect_right(X, x + 2 * D)
        cnt_bomb = bit.sum(i + 1)

        h -= A * cnt_bomb
        if h <= 0:
            continue

        cnt = -(-h // A)
        ans += cnt
        bit.add(i + 1, cnt)
        bit.add(j + 1, -cnt)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 56620
/*input
1
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793238462;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int r; cin >> r;
    cout << fixed << setprecision(20);
    cout << 2 * pi * r;

    return 0;
}

Measured memory_bytes: 3824
#include <stdio.h>          // printf(), scanf()
#include <stdbool.h>

#define MAX_V 100

const int INF = 100000000;
int cost[MAX_V][MAX_V];
int V;

int
prim()
{
	int d[MAX_V];
	int p[MAX_V];
	bool used[MAX_V];
	int minv;
	int u, v;
	int i;

	for (i = 0; i < V; ++i)
	{
		d[i] = INF;
		p[i] = -1;
		used[i] = false;
	}

	d[0] = 0;
	while (true)
	{
		minv = INF;
		v = -1;
		for (u = 0; u < V; ++u)
		{
			if (!used[u] && d[u] < minv)
			{
				v = u;
				minv = d[u];
			}
		}

		if (v == -1)
			break;

		used[v] = true;
		for (u = 0; u < V; ++u)
		{
			if (!used[u] && cost[v][u] < d[u])
			{
				d[u] = cost[v][u];
				p[u] = v;
			}
		}
	}

	int sum = 0;
	for (v = 0; v < V; ++v)
	{
		if (p[v] != -1)
			sum += cost[v][p[v]];
	}

	return sum;
}

int
main(int argc, char** argv)
{
	int c;
	int i, j;

	scanf("%d", &V);
	for (i = 0; i < V; ++i)
	{
		for (j = 0; j < V; ++j)
		{
			scanf("%d", &c);
			cost[i][j] = (c != -1) ? c : INF;
		}
	}

	printf("%d\n", prim());
	return 0;
}

Measured memory_bytes: 636
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Libraries --------------------------------//

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//akari : 1D, yukari : 2D, maki : 3D vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//akane : ascending order, aoi : decending order
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void solve()
{
    seika s;
    cin >> s;
    int n = s.size(), ans = 0;
    char c = '~';
    for (int i = 0; i < n; i++)
    {
        if (s[i] == c)
        {
            i++;
            c = '~';
        }
        else
        {
            c = s[i];
        }
        if (i < n)
            ans++;
    }
    cout << ans << endl;
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b)
{
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
//cout << 'H' << endl;
/*--------------------------------------------*/

int main()
{
    //cout << fixed << setprecision(10)
    cin.tie(0);
    ios::sync_with_stdio(false);

    rep(i, 5)
    {
        int a;
        cin >> a;
        if (a != i + 1) {
            cout << i + 1 << endl;
        }
    }
}


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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()

Int INF = 1e18;
Int mod = 1e9+7;
//Int mod = 998244353;

int main() {
    vector<Int> res;
    while (true) {
        Int n, p;
        cin >> n >> p;
        if (n == 0) break;
        vector<Int> v(n, 0);
        Int bowl = p;
        Int step = 0;
        while (true) {
            if (bowl != 0) {
                v[step]++;
                bowl--;
            }
            else {
                bowl += v[step];
                v[step] = 0;
            }
            if (v[step] == p) break;
            step = (step + 1) % n;
        }
        res.push_back(step);
    }
    for (Int i = 0; i < res.size(); i++) {
        dump(res[i]);
    }
    return 0;
}



Measured memory_bytes: 3172
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    N = readint()
    s = [readstr() for _ in range(N)]
    print(f"AC x {s.count('AC')}")
    print(f"WA x {s.count('WA')}")
    print(f"TLE x {s.count('TLE')}")
    print(f"RE x {s.count('RE')}")


if __name__ == "__main__":
    main()


Measured memory_bytes: 16168
import java.util.*

fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val map = HashMap<V, MutablePair<Long, Long>>()
    var zero = 0L
    repeat(N) {
        val (x, y) = readLine()!!.split(" ").map(String::toLong)
        if (x == 0L && y == 0L) {
            zero++
            return@repeat
        }
        var v = V(x, y)
        if (v.y < 0 || (v.y == 0L && v.x < 0)) {
            v = v.rot180()
        }
        val rot = v.x <= 0
        if (rot) {
            v = v.rot270()
        }
        v = v.gcd_normalized()
        val g = map.getOrPut(v) { MutablePair(0L, 0L) }
        if (rot) g.g1++
        else g.g2++
    }
    var ans = MInt(1)
    map.values.forEach { g ->
        var sum = MInt(1)
        sum += MInt(2).pow(g.g1) - 1
        sum += MInt(2).pow(g.g2) - 1
        ans *= sum
    }
    ans -= 1 // answer should select at lease 1 fish, so remove a patten that no fish selected
    ans += zero // fish(0,0) is only valid for a pattern in which only the fish is selected.
    println(ans)
}

data class MutablePair<A, B>(var g1: A, var g2: B)

data class V(val x: Long, val y: Long) {
    fun rot90() = V(-y, x)
    fun rot180() = V(-x, -y)
    fun rot270() = V(y, -x)
    fun gcd_normalized() = V(x / gcd(x, y), y / gcd(x, y))
}

tailrec fun gcd(a: Long, b: Long): Long {
    if (a < b) return gcd(b, a)
    if (b == 0L) return a
    if (a <= 0L) throw IllegalArgumentException()
    return gcd(b, a % b)
}

class MInt {
    private val MOD = 1000000007L
    var v: Long

    constructor(v: Long) {
        this.v = v % MOD
    }

    constructor(v: Int) {
        this.v = v.toLong() % MOD
    }

    operator fun plus(b: MInt): MInt {
        val a = MInt(v)
        a.v += b.v
        if (a.v >= MOD) a.v -= MOD
        return a
    }

    operator fun plus(b: Int) = plus(MInt(b))
    operator fun plus(b: Long) = plus(MInt(b))

    operator fun minus(b: MInt): MInt {
        val a = MInt(v)
        a.v -= b.v
        if (a.v < 0) a.v += MOD
        return a
    }

    operator fun minus(b: Int) = minus(MInt(b))
    operator fun minus(b: Long) = minus(MInt(b))

    operator fun times(b: MInt): MInt {
        val a = MInt(v)
        a.v *= b.v
        a.v %= MOD
        return a
    }

    operator fun div(b: MInt): MInt {
        return MInt(v) * b.inv()
    }

    fun inv(): MInt {
        var a = v
        var b = MOD
        var u = 1L
        var w = 0L
        while (b != 0L) {
            val t = a / b
            a -= t * b
            u -= t * w
            var tmp = a
            a = b
            b = tmp
            tmp = u
            u = w
            w = tmp
        }
        u %= MOD
        if (u < 0) u += MOD
        return MInt(u)
    }

    fun pow(N: Int) = pow(N.toLong())

    fun pow(N: Long): MInt {
        var ans = MInt(1)
        var a = this
        var n = N
        while (n > 0) {
            if (n.and(1) == 1L) {
                ans *= a
            }
            a *= a
            n = n.shr(1)
        }
        return ans
    }

    override fun toString(): String {
        return v.toString()
    }
}

Measured memory_bytes: 82940
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
			final String s = reader.readLine();
			int n = Integer.parseInt(s);
			System.out.println(solve(n));
			
		}catch (Exception e) {
			
		}
	}

	
    
    static String solve(int n) {
    	for (int i = 0; i < 26; i++) {
    		for (int j = 0; j < 20; j++) {
    			if (4*i + 7*j == n) {
    				return "Yes";
    			}
    		}
    	}
    	return "No";
    }
    
    
}


Measured memory_bytes: 23252