akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
    /*A
    int n,k;
    cin>>n>>k;
    vector <char> a(n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }

    a[k-1]=tolower(a[k-1]);

    for(int i=0;i<n;i++)
    {
        cout<<a[i];
    }
    cout<<endl;
    */
    
    int x;
    cin>>x;

    int L = x/100;
    int R = x%100;

    if(1<=L && L<=12)
    {
        if(1<=R && R<=12)
        {
            cout<<"AMBIGUOUS"<<endl;
        }
        else
        {
            cout<<"MMYY"<<endl;
        }
    }
    else
    {
        if(1<=R && R<=12)
        {
            cout<<"YYMM"<<endl;
        }
        else
        {
            cout<<"NA"<<endl;
        }
        
    }
    
    return 0;
}

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define endl '\n'

vector<int> v[2005];
int vis[2005];
int ans[2005];

void bfs(int r)
{
    vis[r]=1;
    queue <int> q;
    q.push(r);
    int dist[2005]={0};
    dist[r]=0;
    while(!q.empty())
    {

        int x=q.front();
      //  cout<<x<<endl;
        q.pop();
        ffor(i,0,(int)v[x].size())
        {
            if(vis[v[x][i]]!=1)
            {
                /* perform operations */
                dist[v[x][i]]=dist[x]+1;
                vis[v[x][i]]=1;
                q.push(v[x][i]);
            }
        }
    }
   // ffor(i,1,6) cout<<dist[i]<<" ";
   // cout<<endl;
    ffor(i,1,2005)
    {
        if(dist[i]) ans[dist[i]]++;
    }
}

int main()
{


    int n,p,q;
    cin>>n>>p>>q;
   // cout<<n<<p<<q<<endl;
    v[p].pb(q);
    v[q].pb(p);
  //  cout<<"a";
    ffor(i,1,n)
    {
        v[i].pb(i+1);
        v[i+1].pb(i);
    }

    ffor(i,1,n+1)
    {
      //  cout<<i<<endl;
        mem(vis,0);
        bfs(i);
    }

    ffor(i,1,n) cout<<ans[i]/2<<endl;

    return 0;
}



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

long long n, k;
vector<long long> h;

int main() {
  cin >> n >> k;
  h.resize(n);
  for(int i = 0; i < n; ++i) cin >> h[i];
  int cnt = 0;
  for(int i = 0; i < n; ++i)
    if(h[i] >= k) ++cnt;

  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 1024
#import<stdio.h>
#import<queue>
int main(){std::queue<int>q;int w,h,f[484],i,j,a,b,t,x,z;char p[15];for(;scanf("%d%d ",&h,&w),h;){for(j=0;j<w+2;j++)f[j]=f[j-~h*22]=-9;for(i=1;i<=h;i++){for(j=1;j<=w;j++)f[x=i*22+j]=-1,z=getchar(),z-35?z>65?b=x:z>64?a=x:1:--f[x];f[i*22]=f[i*22-~w]=-9;getchar();}f[a]=t=0;q.push(0);for(q.push(a);a=q.front(),q.size()>1;q.pop())if(!a)++t,q.push(0);else for(i=4;i--;)if(f[x=a+" 57L"[i]-54]==-1)f[x]=t,q.push(x);q.pop();scanf("%s",p);for(a=t=0;!a;){x=b;z=0;for(i=0;!a&&p[i];f[b]>=0&&++z)++t,f[j=b-54+"L65676 "[p[i++]-50]]>-3?b=j:0,f[b]>=0&t>=f[b]?a=b:0;!z&!a&!p[i]&b==x&f[b]<0&&--a;}printf(a<0?"impossible\n":"%d %d %d\n",t,a/22-1,a%22-1);}}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;


int main() {
    ll N,K;
    cin >> N >> K;
    ll A[N];
    for (ll i = 0;i<N;i++) {
        cin >> A[i];
    }
    for (ll i = K;i<N;i++) {
        if (A[i-K] < A[i]) {
            cout << "Yes" << endl;
        }
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 5168
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    char C;
    cin >> C;
    cout << char(C + 1) << endl;
    return 0;
}

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

int main() {
  int n,m; cin >> n >> m;
  vector<pair<int,int>> lr(m);
  rep(i,m){
    cin >> lr[i].first >> lr[i].second;
    //cout << lr[i].first << lr[i].second;
  }

  pair<int,int> ans;
  ans.first = 1, ans.second = n;

  rep(i,m){
    ans.first = max(ans.first , lr[i].first);
    ans.second = min(ans.second , lr[i].second);
    //cout << ans.first <<" "<< ans.second << endl;
  }

  if(ans.second < ans.first){
    cout << 0 << endl;
  }
  else{
    cout << ans.second - ans.first + 1 << endl;
  }

}


Measured memory_bytes: 1024
#include "bits/stdc++.h"

using namespace std;

void solve()
{
	int N;
	cin >> N;
	vector<int> dp(N+2, 1e9), hs(N);

	for (int i = 0; i < N; i++)
	{
		cin >> hs[i];
	}

	dp[0] = 0;

	for (int i = 0; i < N-1; i++)
	{
		dp[i + 2] = min(dp[i + 2], dp[i] + abs(hs[i] - hs[i + 2]));
		dp[i + 1] = min(dp[i + 1], dp[i] + abs(hs[i] - hs[i + 1]));
	}

	cout << dp[N-1] << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
main(){
  int n,m,x,y;
  cin>>n>>m;
  while(m--){
    cin>>x>>y;
    x--;y--;
    x=min(abs(0-x),abs(n-1-x));
    y=min(abs(0-y),abs(n-1-y));
    if(y>x)cout<<x%3+1<<endl;
    else cout<<y%3+1<<endl;
  }
}

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

int main(){
	int n;cin>>n;
	vector<int> h(n);
	for(int i = 0; i < n; i++)
		cin>>h[i];
	vector<int> dp(n);
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	for(int i = 2; i < n; i++){
		dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));

	}
	cout<<dp[n-1]<<endl;
	return 0;
}

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

struct edge { int from, to; };

class UnionFind {
private:
    vector<int> par; // plus: parent node, minus: node size
    int group; // group count
public:
    UnionFind(int n) : par(n, -1), group(n) {}

    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(-par[x] < -par[y]) std::swap(x, y);

        par[x] += par[y];
        par[y] = x;

        group--;
    }

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

    int find(int x) {
        return par[x] < 0 ? x : par[x] = find(par[x]);
    }

    int size(int x){
        return -par[find(x)];
    }

    int count() {
        return group;
    }
};


int main(void){
    int  N, M;
    cin >> N >> M;
    vector<edge> v(M);
    for(auto& it : v) {
        cin >> it.from >> it.to;
        it.from--; it.to--;
    }

    int ans = 0;
    for(int i=0;i<M;i++){
        UnionFind u(N);
        for(int k=0;k<M;k++){
            if(i != k){
                u.unite(v[k].from, v[k].to);
            }
        }

        if(u.count() >= 2) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

int main(){

	char w[15];
	scanf("%s",w);

	vector <int> v;
	int num=0;
	
	
	for(int i=0; i<15; i++) {
		if(w[i]=='0')v.push_back(0);
		if(w[i]=='1')v.push_back(1);
		if(v.size()!=0){
			if(w[i]=='B')v.pop_back() ;
		}
	}

	for(int i=0; i<v.size(); i++) {
	printf("%d",v[i]);
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
#include <random>
using namespace std;

/////////////////////////////////////////////////////////////////////////////////////////////
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main()
{
    ll n;cin >> n;
    set<ll> v;
    n--;
    for (ll i = 1; i * i <= n; i++) {
        if (!(n % i)) {
            v.insert(i);
            if (i * i != n) v.insert(n / i);
        }
    }
    //cout << v.size() + 1 << endl;
    n++;

    //sort(v.begin(), v.end());

    //int x = sqrt(3141);
    //ll n; cin >> n;
    ll ans = 2;

    repe(k, 2, (ll)sqrt(n)) {
        ll p = n;
        while (p % k == 0) {
            p /= k;
        }
        if (p == 1) {
            v.insert(k);
            //ans++;
            continue;
        }
      
        ll q = p - (p / k) * k;

        if (q == 1) {
            v.insert(k);
            //ans++;
            continue;
        }
    }
    cout << v.size() << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
	Scanner sc = new Scanner(System.in);

	public void run() {
		Stack<Integer> st=new Stack<Integer>();
		while(sc.hasNext()){
			int val=sc.nextInt();
			if(val!=0){
				st.add(val);
			}else{
				ln(st.pop());
			}
		}
	}	
	public static void main(String[] args) {
		new Main().run();
	}

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}

Measured memory_bytes: 12000
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	X = inputInt()

	tmp = X % 100
	kai = X // 100

	tmptmp = -(-tmp // 5)

	if tmptmp <= kai:
		print(1)
	else:
		print(0)

	#print(tmptmp)
	#print(kai)



if __name__ == "__main__":
	main()


Measured memory_bytes: 38484
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
	int a, b;
	
	cin>>a>>b;
	int d = a/b;
	int r = a%b;
	double f = double(a)/double(b);
	printf("%d %d %.5f\n",d,r,f);
}


Measured memory_bytes: 3208
#  --*-coding:utf-8-*--


def getNumOfEmptyCell(L):
    for i, c in enumerate(L):
        if c == '#':
            return i
        
    return len(L)


def main():
    H,W,K = map(int, input().split())
    
    C = 0
    emptyLine = 0

    for _ in range(H):
        L = input()

        n = sum(1 if c == '#' else 0 for c in L)
        if n == 0:
            emptyLine += 1
            continue

        emptyCell = getNumOfEmptyCell(L)
        C += 1
        X = [C]*(emptyCell + 1)

        for i in range(emptyCell+1, len(L)):
            c = L[i]
            if c == '#':
                C += 1

            X.append(C)

        for __ in range(emptyLine+1):
            print(' '.join(map(str,X)))

        emptyLine = 0

    for __ in range(emptyLine):
        print(' '.join(map(str,X)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
N,K=map(int,input().split())
n=[i for i in range(N+1)]
mod=10**9+7

min_value=[0]*(N+1)
max_value=[0]*(N+1)
min_value[0]=0
max_value[0]=N
for i in range(1,N+1):
  min_value[i]=min_value[i-1]+n[i]
  max_value[i]=max_value[i-1]+n[-(i+1)]

ans=0
for i in range(K-1,N+1):
  ans+=max_value[i]-min_value[i]+1
  ans%=mod
print(ans)

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

double dp[301][301][301];
int n,c[5],X;

double dfs(int a,int b,int c){
  if(a+b+c==0)return 0;
  if(dp[a][b][c]!=-1)return dp[a][b][c];

  double res=0,off=1.0*n/(a+b+c);

  if(c)res+=(dfs(a,b+1,c-1)+off)*c/(a+b+c);
  if(b)res+=(dfs(a+1,b-1,c)+off)*b/(a+b+c);
  if(a)res+=(dfs(a-1,b,c)+off)  *a/(a+b+c);

  return dp[a][b][c] = res;
}

int main(){
  r(i,301)r(j,301)r(k,301)dp[i][j][k]=-1;
  cin>>n;
  r(i,n){
    cin>>X;
    c[X]++;
  }
  printf("%.9f\n",dfs(c[1],c[2],c[3]));
}

Measured memory_bytes: 213376
#include <stdio.h>

int main(void){
int N,M,city[50]={0},i,a,b;
scanf("%d%d",&N,&M);
for(i=0;i<M;i++){
scanf("%d%d",&a,&b);
city[a-1]++;
city[b-1]++;
}
for(i=0;i<N;i++)
printf("%d\n",city[i]);
 return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,j,k,sum,temp;
  cin >> n;
  sum=0;
  for(i=1;i<=n;++i)
  {
   for(j=1;j<=n;++j)
   {temp=gcd(i,j);
    for(k=1;k<=n;++k)
    {
    sum=sum+gcd(temp,k);
    }
   }
  }

 cout << sum;

return 0;}

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

class Node{
public:
    int location;
    int p, l, r;
    Node(){}
};

class Point{
public:
    int id, x, y;
    Point(){}
    Point(int id, int x, int y): id(id), x(x), y(y){}
    bool operator <(const Point &p) const {
        return id < p.id;
    }

    void print(){
        printf("%d\n", id);
    }

};

static const int MAX = 1000000;
static const int NIL = -1;

int N;
Point P[MAX];
Node T[MAX];
int np;

bool lessX(const Point &p1, const Point &p2){
    return p1.x < p2.x;
}

bool lessY(const Point &p1, const Point &p2){
    return p1.y < p2.y;
}

int makeKDTree(int l, int r, int depth){
    if( !(l < r) ) return NIL;
    int mid = (l + r) / 2;
    int t = np++;
    if(depth % 2 == 0){
        std::sort(P + l, P + r, lessX);
    }else{
        std::sort(P + l, P + r, lessY);
    }

    T[t].location = mid;
    T[t].l = makeKDTree(l, mid, depth + 1);
    T[t].r = makeKDTree(mid + 1, r, depth + 1);

    return t;
}

void find(int v, int sx, int tx, int sy, int ty, int depth, std::vector<Point> &ans){
    int x = P[T[v].location].x;
    int y = P[T[v].location].y;

    if(sx <= x && x <= tx && sy <= y && y <= ty){
        ans.push_back(P[T[v].location]);
    }

    if(depth % 2 == 0){
        if(T[v].l != NIL){
            if(sx <= x) find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
        }
        if(T[v].r != NIL){
            if(x <= tx) find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
        }
    }else{
        if(T[v].l != NIL){
            if(sy <= y) find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
        }
        if(T[v].r != NIL){
            if(y <= ty) find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
        }
    }
}

int main(void){
    int x, y;
    scanf("%d", &N);
    for(int i = 0; i < N; i++){
        scanf("%d %d", &x, &y);
        P[i] = Point(i, x, y);
        T[i].l = T[i].r = T[i].p = NIL;
    }

    np = 0;

    int root = makeKDTree(0, N, 0);

    int q;
    scanf("%d", &q);
    int sx, tx, sy, ty;
    std::vector<Point> ans;
    for(int i = 0; i < q; i++){
        scanf("%d %d %d %d", &sx, &tx, &sy, &ty);
        ans.clear();
        find(root, sx, tx, sy, ty, 0, ans);

        std:sort(ans.begin(), ans.end());

        for(int j = 0; j < ans.size(); j++){
            ans[j].print();
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 16428
import sys
import collections


def main():
    input = sys.stdin.readline
    N = int(input())
    S = input().strip()
    A = S.count('R')*S.count('G')*S.count('B')
    total = 0
    for j in range(1, N-1):
        for i in range(j):
            k = 2*j-i
            if k < len(S):
                if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                    total += 1
    print(A - total)


def main2():
    N = int(input())
    S = input()
    A = S.count('R')*S.count('G')*S.count('B')
    order = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            order += 1
            if 2*j-i < N:
                if S[i] != S[j] and S[i] != S[2*j-i] and S[j] != S[2*j-i]:
                    A -= 1
    print(A)
    print(order)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9416
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(true) {
        int n, nmin, nmax;
        cin >> n >> nmin >> nmax;
        if(n == 0) break;
        int a[205];
        for(int i = 1; i <= n; i++) cin >> a[i];
        int gap = 0;
        int ans = 0;
        for(int i = nmin; i <= nmax; i++) {
            if(a[i] == a[i+1]) continue;
            if(gap <= a[i] - a[i+1]) {
                gap = a[i] - a[i+1];
                ans = i;
            }
            //cerr << i << " " << gap << endl;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3072
import sys
from collections import deque

n,m=map(int,input().split())
arr=[[]*n for _ in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    arr[a-1].append(b-1)
    arr[b-1].append(a-1)

for i in range(n):
    if len(arr[i])==0:
        print('No')
        sys.exit()

def bfs(d):
    que=deque()
    que.append(0)
    ans=[0]*n
    while que:
        x=que.popleft()
        if x==0:
            for i in arr[x]:
                ans[i]=1
                que.append(i)
        else:
            for i in arr[x]:
                if ans[i]==0 and i!=0:
                    ans[i]=x+1
                    que.append(i)
    print('Yes')
    for i in range(1,n):
        print(ans[i])        

bfs(arr)

Measured memory_bytes: 36928
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int N;
int sqrtN;
bool isprime[100004];
void sieve_of_atkin() {
  int n;
  for (int z = 1; z <= 5; z += 4) {
    for (int y = z; y <= sqrtN; y += 6) {
      for (int x = 1; x <= sqrtN && (n = 4*x*x+y*y) <= N; ++x)
        isprime[n] = !isprime[n];
      for (int x = y+1; x <= sqrtN && (n = 3*x*x-y*y) <= N; x += 2)
        isprime[n] = !isprime[n];
    }
  }
  for (int z = 2; z <= 4; z += 2) {
    for (int y = z; y <= sqrtN; y += 6) {
      for (int x = 1; x <= sqrtN && (n = 3*x*x+y*y) <= N; x += 2)
        isprime[n] = !isprime[n];
      for (int x = y+1; x <= sqrtN && (n = 3*x*x-y*y) <= N; x += 2)
        isprime[n] = !isprime[n];
    }
  }
  for (int y = 3; y <= sqrtN; y += 6) {
    for (int z = 1; z <= 2; ++z) {
      for (int x = z; x <= sqrtN && (n = 4*x*x+y*y) <= N; x += 3)
        isprime[n] = !isprime[n];
    }
  }
  for (int n = 5; n <= sqrtN; ++n)
    if (isprime[n])
      for (int k = n*n; k <= N; k+=n*n)
        isprime[k] = false;
  isprime[2] = isprime[3] = true;
}

int main() {
    N = 100004;
    sqrtN = sqrt(100004);
    sieve_of_atkin();
    int X; cin >> X;
    for (;X < 100004; X++) {
        if (isprime[X]) break;
    }
    cout << X << endl;
}

Measured memory_bytes: 384
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		int n=sc.nextInt();
		for(int i=0; i<n; i++){
			BigInteger b1=sc.nextBigInteger();
			BigInteger b2=sc.nextBigInteger();
			BigInteger b=b1.add(b2);
			if(b.toString().length()>80)
				println("overflow");
			else
				println(b.toString());
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

double pi = 3.1415926536   ;

int main() {
  double a , b , h , m ;
  cin >>  a >> b >> h >> m ;
  
  double H = h * 30 + (m /2) ;
  double M = m * 6 ;
  double ang = abs(H-M);
  ang = min(ang,360-ang) ;
  double x = ang /180 * pi  ;
 
   
    
  double N = a*a + b*b- 2*a*b*cos(x) ;
  
  
   printf("%.20lf\n", sqrt(N)  );
  
}


Measured memory_bytes: 4224
#include <iostream>
using namespace std;
int r,c,n,x,y,ans[200][200];
int main()
{
    cin>>r;
    cin>>c;
    cin>>n;
    x=1,y=1;
    for(int i=1; i<=n; i++)
    {
        int cnt;
        cin>>cnt;
        while(cnt--)
        {
            ans[x][y]=i;
            if(y==c&&x%2==1)
            {
                y=c;
                x++;
            }
            else if(y==1&&x%2==0)
            {
                y=1;
                x++;
            }
            else if(x&1) y++;
            else y--;
        }
    }
    for(int i=1; i<=r; i++) for(int j=1; j<=c; j++)
        {
            cout<<ans[i][j];
            if(j==c) cout<<endl;
            else cout<<' ';
        }
    return 0;
}


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

int main(){
  string s; cin>>s;
  string ans;
  for(int i=0;i<s.size();i++){
    if(s[i]=='B'){
      if(!ans.empty())ans.pop_back();
    }else ans.push_back(s[i]);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
S = input()
N = len(S)
tmp = 1
List = []
for i in range(1, N):
    if S[i] != S[i-1]:
        List.append(tmp)
        tmp = 1
    else:
        tmp+=1
List.append(tmp)
def solve(ans, List):
    for i in range(0, len(List)-1, 2):
        r = List[i]
        l = List[i+1]
        ans+=r*(r-1)//2
        ans+=max(r, l)
        ans+=l*(l-1)//2
    if len(List)%2 == 1:
        l = List[-1]
        ans+=l*(l+1)//2
    print(ans)
if S[0] == '<':
    solve(0, List)
else:
    l = List[0]
    solve(l*(l+1)//2,List[1:])


Measured memory_bytes: 60364
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long min = sc.nextLong();
		long max = sc.nextLong();
		if(min / 2019 != max / 2019) {
			System.out.println(0);
			return;
		}
		long ans = 2200;
		for(long i = min; i <= max; i ++) {
			for(long j = i + 1; j <= max; j ++) {
				ans = Math.min(ans , (i * j) % 2019);
			}
		}
		System.out.println(ans);
	}
}

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

int main() {
    int x,y,z;
    cin >> x >> y >> z;
    cout << (x-z)/(y+z) << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
const int MAX_N = 2010;
long long N,X;
long long dp[MAX_N][MAX_N];
vector<long long> slimes;
long long ans;
 
int main(){
  ans = 1LL << 60;
  cin >> N >> X;
  slimes.resize(N);
  for (auto &val : slimes){
    cin >> val;
  }
  for (int i = 0; i < MAX_N; i++){
    for (int j = 0; j < MAX_N; j++){
      dp[i][j] = 1LL << 60;
    }
  }
  for (int i = 0; i < N; i++){
    dp[i][0] = slimes[i];
  }
  for (int i = 0; i < N; i++){
    for (int j = 1; j < N; j++){
      int pre_node = (i - j + N) % N;
      dp[i][j] = min(dp[i][j - 1], slimes[pre_node]);
    }
  }
 
  
  for (int K = 0; K < N; K++){
    long long tmp = 0;
    for (int i = 0; i < N; i++){
      tmp += dp[i][K];
    }
    ans = min(ans, tmp + K * X);
  }
  cout << ans << endl;
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int ans = c;
    if (a == c) ans = b;
    if (b == c) ans = a;
    cout << ans << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int64_t,int64_t> pll;
typedef vector<int64_t> vl;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
const long double PI = acos(-1);
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define ALL(a) begin(a),end(a)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

void solve() 
{
    ll n;cin>>n;
    vector<ll>a(n);REP(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    ll sqr[n+1];sqr[0]=1;
    REP(i,n)sqr[i+1]=sqr[i]*2%mod;
    ll ans=0;
    REP(i,n){
        ll l=i,r=n-1-i;
        ll sum=sqr[r];
        if(r!=0)sum+=sqr[r-1]*r%mod;
        sum=sum*sqr[l]%mod;
        sum=sum*a[i]%mod;
        ans=(ans+sum)%mod;
    }
    ans=ans*sqr[n]%mod;
    cout<<ans<<endl;
}
int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
typedef  long long ll;
using namespace std;

int main(void) {
	string s;
	ll n, h;

	while (true)
	{
		cin >> s;
		if ( s == "-") break;
		cin >> n;
		for (int i = 0; i < n; i++)
		{
			cin >> h;
			s += s.substr(0, h);
			s.erase(0, h);
		}
		cout << s << endl;
	}

	return 0;
}


Measured memory_bytes: 3204
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
#define first fi
#define second se
using namespace std;
int sdkys(int a,int b){
    if(b==0) return a;
    return sdkys(b,a%b);
}
int sskbs(int a,int b){
    return a*b/sdkys(a,b);
}
int sosu(int a){
    if(a==2){
        return 1;
    }
    for(int i=2;i<sqrt(a)+1;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}
vector<int> v;
int n,m,cnt=0,ans=0,aa[220000],ab[220000];
pair<int,int> pp[220000];
string s,ss[220000],sa;
char ch[110][110];
queue<int> que;
signed main(){
    cin>>n;
    rep(i,n){
        cin>>aa[i];
        ab[aa[i]-1]++;
        ab[aa[i]]++;
        ab[aa[i]+1]++;
    }
    rep(i,100000){
        cnt=max(cnt,ab[i]);
    }
    cout<<cnt;
}

Measured memory_bytes: 12016
n,y = map(int,input().split())

ok = 0

for i in range(n+1):
    for j in range(n+1-i):
            k = n - i - j
            if k < 0:
                k = 0

            price = 10000 * i + 5000 * j + 1000 * k   
            
            if price == y and i+j+k == n:
                print(i, j, k)
                ok = 1
                break

    if ok == 1:
        break

if ok == 0:
    print(-1, -1, -1 )

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<random>
#include<map>
#include<queue>
using namespace std;


int main(){

  int n, m;
  cin >> n >> m;

  vector<string> a(n);
  vector<string> b(m);
  for(int i=0; i<n; i++) cin >> a[i];
  for(int i=0; i<m; i++) cin >> b[i];

  for(int ai=0; ai<n; ai++){
    for(int aj=0; aj<n; aj++){

      if( ai + m > n ) continue;
      bool f = true;
      for(int bi=0; bi<m; bi++){
        for(int bj=0; bj<m; bj++){
          if( a[ai+bi][aj+bj] != b[bi][bj] ){
            f = false;
            break;
          }
        }
        if( !f ) break;
      }
      if( f ){
        cout << "Yes" << endl;
        return 0;
      }

    }
  }

  cout << "No" << endl;

  return 0;
}








// EOF


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define MAXN 100005
#define ll long long
using namespace std;

int main()
{
    //freopen("data","r",stdin);
    string s;
    cin >> s;
    int win;
    int len = s.length();
    if(s[0] == s[len-1])
    {
        if(len%2){
            win = 2;
        }else{
            win = 1;
        }
    }
    else{
        if(len%2){
            win = 1;
        }else{
            win = 2;
        }
    }
    printf("%s\n",win==1?"First":"Second");
    return 0;
}


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

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	if (A >= B && A >= C) {
		cout << (A * 10) + B + C << endl;
	}
	else if (B >= A && B >= C) {
		cout << (B * 10) + A + C << endl;
	}
	else if (C >= A && C >= B) {
		cout << (C * 10) + A + B << endl;
	}
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

int n;

int main()
{
  while(cin >> n){
    for(int i=0; n; n>>=1, i++) if(n & 1) cout << (1 << i) << (n >> 1 ? " " : "\n");
  }

  return 0;
}

Measured memory_bytes: 1164
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Ans[2] = {"No", "Yes"};
string ANS[2] = {"NO", "YES"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int Root(int x, vector<int> &root)
{
    if (x == root[x]) return x;
    return root[x] = Root(root[x], root);
}

void Merge(int v, int u, vector<int> &root, vector<int> &sz)
{
    v = Root(v, root), u = Root(u, root);
    if (v == u) return;
    if (sz[v] < sz[u])
    {
        sz[u] += sz[v];
        root[v] = u;
    }
    else
    {
        sz[v] += sz[u];
        root[u] = v;
    }
}

int ok(int x, int n)
{
    return 0 <= x && x < n;
}

void bfs(int v, vi &dist, vector<vi> &graph)
{
    fill(all(dist), -1);
    dist[v] = 0;
    vi q = {v};
    for (int i = 0; i < q.size(); i++)
    {
        for (auto u : graph[q[i]])
        {
            if (dist[u] == -1)
            {
                dist[u] = dist[q[i]] + 1;
                q.push_back(u);
            }
        }
    }
}


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) cout << "Yes";
    else cout << "No";
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};


int main() {
    int n; cin >> n;
    vector<pair<ll,ll>> p(n);
    ll x, l;
    rep(i,n) {
        cin >> x >> l;
        p[i].first = x+l;
        p[i].second = x-l;
    }

    sort(all(p));

    int ans = 0;
    ll T = -INF;
    rep(i,n) {
        if (T <= p[i].second) {
            T = p[i].first;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4788
using System;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                char[] dlm = " ".ToCharArray();
                string[] data = Console.ReadLine().Split(dlm);

                int x = int.Parse(data[0]);
                int y = int.Parse(data[1]);

                if (x == 0 && y == 0) break;
                else if (x <= y)
                    Console.WriteLine("{0} {1}", x, y);
                else
                    Console.WriteLine("{0} {1}", y, x);
            }

        }
    }
}


Measured memory_bytes: 15940
fun main(args: Array<String>) {
    Integer.parseInt(readInputLine())
    val vas = readInputLine().split(" ").map { it.toLong() }
    
    // 負数の数をカウント
    val minusNum = vas.count { it < 0 }
    
    // 負数の数が偶数 -> 全数値の絶対値を加算
    // 負数の数が奇数 -> 絶対値の最も低い要素を除く全要素の絶対値を加算し、その後絶対値の最も低い要素で減算

    var abss = (vas.map { if (it < 0) { it * -1 } else { it }}).sorted()
    var minusnum:Long = 0
    
    if (minusNum % 2 == 1) {
        minusnum = abss[0]
        abss = abss.drop(1)
    }
    
    println(abss.sum() - minusnum)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 62040
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
string s;
ll d,p=1e9+7,dp[10010][2][110];

ll dfs(int si=0,int mx=1,int re=0){
  // cout<<si<<" "<<mx<<" "<<re<<endl;
  if(dp[si][mx][re]!=-1)return dp[si][mx][re];
  ll sum=0;
  if(si==(int)s.size())return re==0;
  if(mx==1){
    int r=s[si]-'0';
    sum+=dfs(si+1,1,(re+r)%d);
    sum%=p;
    for(int i=0;i<r;i++){
	 sum+=dfs(si+1,0,(re+i)%d);
	 sum%=p;
    }
    return dp[si][mx][re]=sum;
  }
  
  for(int i=0;i<10;i++){
    sum+=dfs(si+1,0,(re+i)%d);
    sum%=p;
  }
  return dp[si][mx][re]=sum;  
}

int main(){
  cin>>s>>d;
  fill_n(**dp,10010*2*110,-1);
  cout<<(p+dfs()-1)%p<<endl;
  return 0;
}


Measured memory_bytes: 18048
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define pi 3.14
using namespace std;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef pair<long long,int> pli;
typedef pair<int,long long> pil;
const int INF=1000000007;
const int MOD=1000000007;
const int nmax=201234;

int a;

int main()
{
    scanf("%d",&a);
    int b=(int)((double)a/1.08);
    if((int)(b*1.08)==a)
        printf("%d\n",b);
    else if((int)((b+1)*1.08)==a)
        printf("%d\n",b+1);
    else
        puts(":(");
    return 0;
}


Measured memory_bytes: 256
#pragma region include
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstdio>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define MOD 1000000007
#define INF 1000000000
#define LLINF 4000000000000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#pragma endregion

//#define __DEBUG__
#ifdef  __DEBUG__
#define dump(x) cerr << #x << " = " << (x) << " [" << __LINE__ << ":" << __FUNCTION__ << "] " << endl;
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    REP(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
// pair出力
template<typename T, typename U>
ostream& operator << (ostream& os, pair<T, U>& p) {
    return os << "(" << p.first << ", " << p.second << ")";
}
// map出力
template<typename T, typename U>
ostream& operator << (ostream& os, map<T, U>& map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set 出力
template<typename T>
ostream& operator << (ostream& os, set<T>& set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
#endif

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N;
    VVI dp(N, VI(3,-1));
    REP(i, N) {
        int v[3]; cin >> v[0] >> v[1] >> v[2];
        if (i == 0) {
            dp[i][0] = v[0];
            dp[i][1] = v[1];
            dp[i][2] = v[2];
            continue;
        }
        REP(j, 3) {
            REP(k, 3) {
                if (j != k) dp[i][j] = max(dp[i][j],dp[i-1][k] + v[j]);
            }
        }
    }
    cout << max({dp[N - 1][0],dp[N - 1][1],dp[N - 1][2]}) << endl;
    getchar(); getchar();
}

Measured memory_bytes: 5760
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
																								   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
		
const double eps = 1e-9;																							   
const int INF = 1000000001;																						   
const float PI = 3.14;																								   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra	   
																													   																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////

int k, l, r;
int f[105];
int g[105];
char a[105][105];
int n, m;
///////////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   
	cin >> n >> m;
	for(int i = 1; i <= n; i++) cin >> a[i] + 1;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			if(a[i][j] == '#') f[i] = g[j] = 1;
		}
	}
	
	for(int i = 1; i <= n; i++){
		if(f[i]){
			for(int j = 1; j <= m; j++){
				if(g[j]) cout << a[i][j];
			}
			cout << endl;
		}
	}
  
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int a, b;
    char op;
    while(1){
        scanf("%d %c %d", &a, &op, &b);
        if(op == '+') printf("%d\n", a+b);
        else if(op == '-') printf("%d\n", a-b);
        else if(op == '*') printf("%d\n", a*b);
        else if(op == '/') printf("%d\n", a/b);
        else break;
    }
    return 0;
}


Measured memory_bytes: 2080
N,Q = map(int,input().split())
S = list(input())

lr = []
for i in range(Q):
    _ = list(map(int,input().split()))
    lr.append(_)

AC = [0]
counter = 0

for j in range(1,N):
    if S[j-1] == 'A' and S[j] == 'C':
        counter += 1
    AC.append(counter)

for j in range(Q):
    right = lr[j][1]-1
    left = lr[j][0]-1
    print(AC[right]-AC[left])

Measured memory_bytes: 31368
//Bismillah hirrahmanir Rahim
    #include<bits/stdc++.h>
    #define ll long long
    #define pb push_back
    #define dbug printf("I am here\n");
    #define Fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    using namespace std;

main() {
  ll int a;
 cin>>a;
ll sum=0;
 for(int i=1;i<=a;i++){
   if(i%3!=0 && i%5!=0){
      // cout<<i<<endl;
        sum+=i;
   }
 }
   cout<<sum<<endl;
	return 0;
}


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

struct Book{
    string str;
    int num;

    Book(string s,int n){
        str = s;
        num = n;
    }

    Book(){
        str ="";
        num = 0;
    }

    bool operator < (const Book &book) const{
       if(str == book.str){
           if(num < book.num)return true;
           else return false;
       }else{
           if(str < book.str)return true;
           else return false;
       }
    }
};


int main(){


    Book array[10000];

    int cou=0;
    string name;
    int page;

      while(cin >> name >> page){
        array[cou++]=Book(name, page);
    }

    sort(array,array+cou);

    string key="";

    for(int i=0;i<cou;i++){
        Book c = array[i];
        if(key!=c.str){
            key=c.str;
            if(i>0)cout << endl;
            cout << key << endl;
            cout << c.num;
        }else{
            cout << ' ' << c.num;
        }
    }

    cout << endl;
    
}

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

int main() {
  string s;
  cin >> s;
  map<string, int> mp =
  {
    {"SUN",7},{"MON",6},{"TUE",5},{"WED",4},
    {"THU",3},{"FRI",2},{"SAT",1}
  };
  cout << mp[s] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>
#include <fstream>
#include <cassert>
using namespace std;

//common

typedef int  i32;
typedef long long i64,ll;
typedef long double ld;

#define BR "\n"
#define ALL(c) (c).begin(),(c).end()
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,r) for(int i=(int)l;i<(int)(r);++i)
#define EACH(it,o) for(auto it = (o).begin(); it != (o).end(); ++it)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))

//config
//#define NDEBUG
//#define INF 1<<30
//#define EPS 1e-8
//const ll MOD =100000007;

//debug
#ifdef NDEBUG
#define DUMP(x)
#define DUMPLN(x)
#define DEBUG(x)
#define DEBUGLN(x)
#define LINE()
#define LINELN()
#define CHECK(exp,act)
#define STOP(e)
#else
#define DUMP(x)  cerr << #x << " = " << (x)
#define DUMPLN(x)  DUMP(x) <<endl
#define DEBUG(x) DUMP(x) << LINE() << " " << __FILE__
#define DEBUGLN(x) DEBUG(x)<<endl
#define LINE()    cerr<< " (L" << __LINE__ << ")"
#define LINELN()    LINE()<<endl
#define CHECK(exp,act)  if(exp!=act){DUMPLN(exp);DEBUGLN(act);}
#define STOP(e)  CHECK(e,true);if(!(e)) exit(1);
#endif

template<class T> inline string toString(const vector<T>& x) {
	stringstream ss;
	REP(i,x.size()){
		if(i!=0)ss<<" ";
		ss<< x[i];
	}
	return ss.str();
}

template<class T> inline string toString(const vector<vector<T> >& map) {
	stringstream ss;
	REP(i,map.size()){
		if(i!=0)ss<<BR;
		ss<< toString(map[i]);
	}
	return ss.str();
}
template<class K,class V>  string toString(map<K,V>& x) {
	string res;stringstream ss;
	for(auto& p:x)ss<< p.first<<":" << p.second<<" ";
	return ss.str();
}

string BITtoString(int bit){
    stringstream ss;
    while(bit!=0){ss<<(bit%2);bit/=2;}
    string res=ss.str();reverse(ALL(res));
    return res;
}

template<typename T,typename V> inline T pmod(T v,V MOD){
	return (v%MOD+MOD)%MOD;
}
#define nextInt(n) scanf("%d",&n)
#define defInt(n) int n;nextInt(n)
#define nextLong(n) scanf("%lld",&n)
#define defLong(n) ll n;nextLong(n)
#define nextDouble(n) scanf("%lf",&n)

ll INF=1LL<<58;

class Main{
public:
	void run(){
	//	ifstream cin("in");
	//	ofstream cout( "out" );
		int N;nextInt(N);
		vector<ll> as(N-1);
		REP(i,N-1)nextLong(as[i]);

		vector<vector<ll>> dp(N+1,vector<ll>(2,INF)),next(N+1,vector<ll>(2,INF));
		dp[1][0]=0;
		REP(i,N-1){
			REP(j,N+1){
				if(j>=1) next[j][0]=min(next[j][0],dp[j-1][0]);//0→0 カット無し
				if(j>=1)next[j][0]=min(next[j][0],dp[j-1][1]+as[i]);//1→0 カット有り
				next[j][1]=min(next[j][1],dp[j][1]);//1→1 カット無し
				next[j][1]=min(next[j][1],dp[j][0]+as[i]);//0→1 カット有り
			}
			dp=next;
			REP(j,N+1)fill(ALL(next[j]),INF);
		}
		cout << min(dp[N/2][0],dp[N/2][1])<<endl;
	}
};
int main(){
	cout <<fixed<<setprecision(3);	
	ios::sync_with_stdio(false);
	Main().run();
	return 0;
}

Measured memory_bytes: 2320
import sys
n = int(sys.stdin.readline())
data = [[None]*3 for i in range(n)]
for i in range(n):
    s = sys.stdin.readline().split()
    data[i][0] = "*"+s[0]
    data[i][1] = "*"+s[1]
    data[i][2] = s[2]

q = int(sys.stdin.readline())
for i in range(q):
    qb,qa,f,t = sys.stdin.readline().split()
    if t == "*":
        t = "9"+t
    for b,a,d in data:
        if qb in b and qa in a and f <= d <= t:
            print(b[1:])
    if i < q-1:
        print()



Measured memory_bytes: 5668