akhauriyash/Code-Regression huggingface dataset:
using System;

namespace ITP1_1_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            for (int i = 1; i <= n; i++)
            {
                if (i % 3 == 0)
                {
                    Console.Write(" " + i);
                }
                else if (i.ToString().Contains("3"))
                {
                    Console.Write(" " + i);
                }
            }
            Console.WriteLine();
        }
    }
}



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

#define IOS  ios_base::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed; 
#define fi first
#define mp make_pair
#define se second
#define pb push_back
#define be(x) (x).begin(), (x).end()
#define rbe(x) (x).rbegin(), (x).rend()
#define forn(i, a, n) for(int i = (int)(a); i < (int)(n); i++)   
#define endl "\n"

typedef long long ll;
typedef vector<ll> vl; 
typedef pair<int, int> pii;

int main(){
    IOS;
    #ifndef LOCAL_DEFINE
      time_t starttime = clock();
    #endif 
   
    float n; cin >> n;
    float res = 2*(3.14)*n;
    cout<<res;

    return 0;
}



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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define ws(x) cerr << #x << " is " << x << endl
#define pb push_back
#define ats(x) cout << x << "\n"
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef pair <int, int> pii;
typedef vector<pii> vii;
typedef tuple<int, int, int> tiii;

const int INF = INT_MAX;


int main()
{
    FAST_IO;
    string s;
    cin >> s;
    if (s.back() == '2' || s.back() == '4' || s.back() == '5' ||  s.back() == '7' || s.back() == '9') ats("hon");
    else if (s.back() == '0' || s.back() == '1' || s.back() == '6' ||  s.back() == '8') ats("pon");
    else {
        ats("bon");
    }
    return 0;
}



Measured memory_bytes: 3640
from collections import deque

drc = ((0, 1), (0, -1), (1, 0), (-1, 0))

H, W = map(int, input().split())
a = tuple(input() for _ in range(H))
visited = [[False] * W for _ in range(H)]
# 重複探索を避けるため、訪問済みフラグを用意

q = deque()
for r in range(H):
    for c in range(W):
        if a[r][c] == '#':
            q.append((r, c, 0))
            visited[r][c] = True
            # BFS の起点となる座標と黒からの距離を deque に入れる
            # deque に入れたら訪問済みフラグを True にする
            # もし、座標(r, c) が pop された時点で visited とすると、
            # それまでに (r, c) が複数 deque に入れられてしまう恐れがある

while q:
    r, c, d = q.popleft()
    for dr, dc in drc:
        nr = r + dr
        if not (0 <= nr < H): continue
        nc = c + dc
        if not (0 <= nc < W): continue
        # 座標がセルからはみ出ていないか？
        if visited[nr][nc]: continue
        # 訪問済みか
        # 座標チェック前に訪問済みチェックをすると、IndexError
        q.append((nr, nc, d + 1))
        visited[nr][nc] = True
        # deque に入れたら訪問済みフラグを True にする

print(d)
# 最後に pop した距離 d が一番黒色から遠いセルになる


Measured memory_bytes: 135388
#include <bits/stdc++.h>
using namespace std;
 
int gcd(int x,int y){
  if(x%y == 0) return y;
  else return gcd(y,x%y);
}
int gcd2(int x,int y,int z){
  return gcd(x,gcd(y,z));
}

int main(){
  int n; cin >> n;
  long long ans=0;
  for(int i=1; i<=n; i++)
  	for(int j=1; j<=n; j++)
  		for(int k=1; k<=n; k++)
          ans += gcd2(i,j,k);
  cout << ans << endl;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define debug(x) cerr<<#x<<" = "<<x<<endl
#define fgx cerr<<"-----------"<<endl
using namespace std;
typedef long long ll;

int Read() {
    int x = 0, f = 1; char ch = getchar();
    while(ch < '0' || ch > '9'){if(ch == '-')f = -1; ch = getchar();}
    while(ch >='0' && ch <='9'){x = x*10 + ch - '0'; ch = getchar();}
    return x*f;
}

int main() {
	int a = Read(), b = Read(), c = Read();
	ll ans = b;
	ans += min(c, a + b + 1);
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF=0x3f3f3f3f;
const int MAXN=55,MAXM=150100;
vector<int> arr[MAXN];
int num[MAXN],val[MAXN],w[MAXN],p[MAXN],id[MAXN];
int f[2][MAXM],g[MAXM],q[MAXM];
int n,x,d,now,ans,siz;
inline bool cmp_(int a,int b) {return w[a]*val[b]<w[b]*val[a];}
inline void dfs(int now,int fa)
{
	val[now]=1,w[now]=num[now];
	for(int i=0;i<arr[now].size();i++)
		if(arr[now][i]!=fa) dfs(arr[now][i],now),val[now]+=val[arr[now][i]],w[now]=min(w[now]+w[arr[now][i]],INF);
	return;
}
signed main()
{
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>n>>x>>d;
	p[1]=INF;
	for(int i=2;i<=n;i++) p[i]=d;
	cin>>num[1];
	for(int i=2,X;i<=n;i++) cin>>num[i]>>X,arr[X].push_back(i);
	dfs(1,0);
	for(int i=1;i<=n;i++) id[i]=i;
	sort(id+1,id+n+1,cmp_);
	memset(f[now],0x3f,sizeof(f[now]));
	f[now][0]=0;
	for(int i=1;i<=n;i++)
	{
		int X=id[i],D=min(n,p[X]);
		p[X]-=D,now^=1;
		memset(f[now],0x3f,sizeof(f[now]));
		siz+=D*val[X];
		for(int j=0;j<val[X];j++)
		{
			int l=1,r=0;
			for(int k=0;k*val[X]+j<=siz;k++)
			{
				int u=k*val[X]+j;
				while(l<=r&&k-q[l]>D) l++;
				while(l<=r&&g[r]+(k-q[r])*w[X]>=f[now^1][u]) r--;
				q[++r]=k,g[r]=f[now^1][u];
				f[now][u]=min(f[now][u],g[l]+(k-q[l])*w[X]);
			}
		}
	}
	for(int i=0;i<=siz;i++)
		if(f[now][i]<=x)
		{
			int s1=0,s2=0;
			for(int j=1;j<=n;j++)
			{
				int tmp=id[j];
				ans=max(ans,s1+i+min(p[tmp],(x-f[now][i]-s2)/w[tmp])*val[tmp]);
				s1+=p[tmp]*val[tmp],s2+=p[tmp]*w[tmp];
//				cout<<s1<<" "<<s2<<endl;
				if(s2+f[now][i]>x) break;
			}
		}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2944
#include <stdio.h>

int main() {
  int n,k,a;
  int h[100000];
  scanf("%d %d", &n,&k);
  for(int i=0; i<n;i++) {
    scanf("%d", &h[i]);
  }
  for(int i=0; i<n;i++) {
    if(h[i] >= k)a++;
  }
  printf("%d",a);
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(void){
  int n;
  cin>>n;
  int a[n];
  for(int i(0);i<n;i++){
    cin>>a[i];
  }
  int max(0);
  for(int i(0);i<n;i++){
    for(int j(0);j<n;j++){
      int t;
      t= a[j]-a[i];
      if(t>max){
        max=t;
      }
    }
  }
  cout<<max<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<vector>

using namespace std;

int findMaxPoints(vector<vector<int> > &routine , int n , int points , int current)
{
if(n<0) return points;
if(current==0) return max(findMaxPoints(routine,n-1,points+routine[n][1],1),findMaxPoints(routine,n-1,points+routine[n][2],2));
if(current==1) return max(findMaxPoints(routine,n-1,points+routine[n][0],0),findMaxPoints(routine,n-1,points+routine[n][2],2));
if(current==2) return max(findMaxPoints(routine,n-1,points+routine[n][0],0),findMaxPoints(routine,n-1,points+routine[n][1],1));
return max(findMaxPoints(routine,n-1,points+routine[n][0],0),max(findMaxPoints(routine,n-1,points+routine[n][1],1),findMaxPoints(routine,n-1,points+routine[n][2],2)));	
}

int findMaxPointsDP(vector<vector<int> > &routine , int n)
{
int dp[3]={routine[0][0],routine[0][1],routine[0][2]};
int temp[3]={0,0,0}; 
for(int i=1;i<n;i++)
{
temp[0]=routine[i][0]+max(dp[1],dp[2]);
temp[1]=routine[i][1]+max(dp[0],dp[2]);
temp[2]=routine[i][2]+max(dp[0],dp[1]);
dp[0]=temp[0];
dp[1]=temp[1];
dp[2]=temp[2];
}
return max(dp[0],max(dp[1],dp[2]));
}

int main()
{
int n;
cin>>n;
vector<vector<int > > routine(n,vector<int>(3,0));
for(int i=0;i<n;i++)
{
for(int j=0;j<3;j++)
{
cin>>routine[i][j];
}
}
cout<<findMaxPointsDP(routine,n)<<endl;
return 0;
}

Measured memory_bytes: 5760
#include<iostream>

#include<cmath>
#include<string>
#include <algorithm> 

using namespace std;

# define p(s) cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) cout << (j ? "Yes" : "No") << endl;

string lpad(string l,int s,int n){
    string temp = to_string(n);
    string res = "";
    int loop = s - temp.size();
    while(loop--) res+=l;

    return res+temp;
}

int main()
{
    string str;
    cin >> str ;

    int m = stoi(str.substr(5,2));

    printIf(m <= 4,"Heisei","TBD")
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cassert>
using namespace std;
typedef long long ll;

#define REP(i,n) for (int i=0; i<(int)(n); ++i)
#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define FOREQ(i,k,n) for (int i=(k); i<=(int)(n); ++i)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(v) (int)((v).size())
#define MEMSET(v,h) memset((v),(h),sizeof(v))

int n;
char str[10000];
char temp[10000];
int prev[100010];
int next[100010];

int main() {
  while (scanf("%d ", &n), n) {
    MEMSET(prev, 0);
    MEMSET(next, 0);

    map<pair<string, int>, int> position;
    FOREQ(i, 1, n) {
      fgets(str, 9999, stdin);
      int len = strlen(str);
      str[len - 1] = 0;
      len--;
      if (str[0] == '-') { continue; }
      if (len == 1 && str[0] == 'v') {
        prev[i] = i + 1;
        next[i + 1] = i;
        continue;
      }
      int index = 0;
      REP(j, len) {
        if (!isdigit(str[j])) {
          temp[j] = str[j];
          temp[j + 1] = 0;
          continue;
        }
        index = j;
        break;
      }
      int num;
      char c = 0;
      sscanf(str + index, "%d%c", &num, &c);
      position[make_pair(temp, num)] = i;
      if (num == 1) {
        set<pair<string, int> > visit;
        visit.insert(make_pair(temp, 1));
        pair<string, int> here(temp, 2);
        while (position.count(here)) {
          visit.insert(here);
          int x = position[here];
          int y = position[make_pair(temp, here.second - 1)];
          prev[x] = y;
          next[y] = x;
          here.second++;
        }
        FORIT(it, visit) {
          position.erase(*it);
        }
      }
      if (c == 'v') {
        prev[i] = i + 1;
        next[i + 1] = i;
        continue;
      }
    }

    //FOREQ(i, 1, n) {
    //    cout << prev[i] << " " << next[i] << endl;
    //}
    FOREQ(i, 1, n) {
      if (prev[i] == 0) {
        int index = i;
        while (true) {
          printf("%d\n", index);
          if (next[index] == 0) { break; }
          index = next[index];
        }
      }
    }
  }
}

Measured memory_bytes: 2792
//package com.company;
import java.util.*;
import java.lang.*;
import java.io.*;
//****Use Integer Wrapper Class for Arrays.sort()****
public class Main {
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] Args)throws Exception{
        FastReader scan=new FastReader(System.in);
        int t=1;
//        t=scan.nextInt();
        while(t-->0){
            int n=scan.nextInt();
            int k=scan.nextInt();
            int[] arr=new int[n];
            for(int i=0;i<n;i++){
                arr[i]=scan.nextInt();
            }
            for(int i=k;i<n;i++){
                int prev=arr[i-k];
                int cur=arr[i];
                if(cur>prev){
                    out.println("Yes");
                }else{
                    out.println("No");
                }
            }
        }
        out.flush();
        out.close();
    }
    static class FastReader {

        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;

        FastReader(InputStream is) {
            in = is;
        }

        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }

        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan()) ;
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }

        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan()) ;
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan()) ;
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }
}


Measured memory_bytes: 51852
#include<iostream>

using namespace std;
int main(){
  int age,dFee,lFee;
  cin>>age;
  cin>>dFee;
  lFee=dFee;
  if(age >= 6 && age <= 12){
    lFee/=2;
  }else if(age<=5){
  	lFee=0;
  }
  cout<<lFee<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N) {
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    reverse(a. begin(),a.end());
    int s = 0, c = 0;
    rep (i, (N + 1) / 2) {
        s += a[2 * i];
    }
    rep (i, N / 2) {
        c += a[2 * i + 1];
    }
    cout << s - c << endl;
}




Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Integer[] set1 = {1, 2, 6, 5, 1};
        Integer[] set2 = {2, 3, 5, 4, 2};
        Integer[] set3 = {1, 3, 6, 4, 1};

        //Read stuff
        Scanner reader = new Scanner(System.in);

        //Given faces and result
        int face1, face2;
        List<String> face3 = new ArrayList<>();

        //Get die faces
        String[] die = reader.nextLine().split(" ");
        List<String> diee = new ArrayList<>();

        for (int i = 0; i < 6; i++) {
            diee.add(die[i]);
        }

        //Get questions
        List<String> questions = new ArrayList<>();
        int n = Integer.parseInt(reader.nextLine());

        for (int i = 0; i < n; i++) {
            questions.add(reader.nextLine());
        }

        //Parse questions, search for 3rd face
        for (int i = 0; i < n; i++) {
            String[] faces = questions.get(i).split(" ");
            face1 = diee.indexOf(faces[0]) + 1;
            face2 = diee.indexOf(faces[1]) + 1;

            //1,2,6,5,1 and R
            if (search(face1, face2, set1)) {
                face3.add(diee.get(3 - 1));
            } else if (search(face2, face1, set1)) {
                face3.add(diee.get(4 - 1));
            } //2,3,5,4,2 and R
            else if (search(face1, face2, set2)) {
                face3.add(diee.get(1 - 1));
            } else if (search(face2, face1, set2)) {
                face3.add(diee.get(6 - 1));
            } //1,3,6,4,1 and R
            else if (search(face1, face2, set3)) {
                face3.add(diee.get(5 - 1));
            } else if (search(face2, face1, set3)) {
                face3.add(diee.get(2 - 1));
            }
        }

        //Print result
        for (String x : face3) {
            System.out.println(x);
        }

    }

    public static boolean search(int x, int y, Integer[] set) {
        for (int i = 0; i < 4; i++) {
            if (set[i] == x && set[i + 1] == y) {
                return true;
            }
        }
        return false;
    }
}

Measured memory_bytes: 25996
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

//vector<int> G[300];

int main(){
  
  string s;
  cin>>s;
  int n = s.size();
  REP(i,n-1){
    if(s[i]=='A' && s[i+1]=='C'){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}


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

int main() {
  long long N, M;
  cin >> N >> M;
  for (int i = 0; i < M; ++i) {
    long long tmp;
    cin >> tmp;
    N -= tmp;
  }
  long long asu = -1;
  cout << max(N, asu) << '\n';
  return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long a, b;
  cin >> a >> b;
  long foo = a + b;
  if (foo >= 10) puts("error");
  else cout << foo << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a_list = list(map(int,input().split()))
p = 1
for i in range(n):
    if a_list[i] == 0:
        print(0)
        exit()
for i in range(n):
    p *= a_list[i]
    if p > 10**18:
        print(-1)
        exit()
print(p)

Measured memory_bytes: 21632
from bisect import bisect_left
def rt(i):
    while i!=G[i][0]:
        i = G[i][0]
    return i
N,M = map(int,input().split())
P = list(map(int,input().split()))
P.insert(0,0)
G = {i:[i,1] for i in range(1,N+1)}
for _ in range(M):
    x,y = map(int,input().split())
    rx = rt(x)
    ry = rt(y)
    if rx!=ry:
        if G[rx][1]>=G[ry][1]:
            G[ry][0] = rx
            G[rx][1] += G[ry][1]
        else:
            G[rx][0] = ry
            G[ry][1] += G[rx][1]
hist = [0 for _ in range(N+1)]
A = {}
for i in range(1,N+1):
    ri = rt(i)
    if hist[ri]==0:
        A[ri] = []
        hist[ri] = 1
    A[ri].append(i)
cnt = 0
for a in A:
    B = []
    for i in range(len(A[a])):
        B.append(P[A[a][i]])
    B = sorted(B)
    B.append(10**8)
    cur = 0
    for i in range(len(A[a])):
        if A[a][i]==B[cur]:
            cnt += 1
        elif A[a][i]<B[cur]:
            continue
        else:
            cur = bisect_left(B,A[a][i])
            if B[cur]==A[a][i]:
                cnt += 1
                cur += 1
print(cnt)

Measured memory_bytes: 49392
import sys
Sa=input()
Sb=input()
Sc=input()


def check(x,Sa,Sb,Sc):
    if(x=='a'):
        if(Sa==''):
            print('A')
            sys.exit()
        x=Sa[:1]
        Sa=Sa[1:]
        check(x,Sa,Sb,Sc)
    elif(x=='b'):
        if(Sb==''):
            print('B')
            sys.exit()
        x=Sb[:1]
        Sb=Sb[1:]
        check(x,Sa,Sb,Sc)
    else:
        if(x==''):
            print('C')
            sys.exit()
        x=Sc[:1]
        Sc=Sc[1:]
        check(x,Sa,Sb,Sc)

        
first=Sa[:1]
Sa=Sa[1:]
check(first,Sa,Sb,Sc)




Measured memory_bytes: 3192
#include <stdio.h>
#include <algorithm>
#include <array>


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

using lli = long long int;

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;
}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


constexpr int N = 1000;
constexpr int mod = 1e9 + 7;
std::array<std::array<lli, N + 1>, 2> A;

struct faster{
    lli Power[N+1], invP[N+1];
    constexpr faster(): Power(), invP(){
        Power[0] = 1;
        for(int i = 1; i <= N; ++i) Power[i] = (Power[i-1] * i) % mod;
        invP[N] = inverse(Power[N]);
        for(int i = N; i > 0; --i) invP[i-1] = (invP[i] * i) % mod;
    }
    constexpr void swap(lli &a, lli &b) const {
        a ^= b; b ^= a; a ^= b;
    }
    constexpr lli inverse(lli a) const noexcept{
        lli b = mod, u = 1, v = 0;
        while (b != 0) { 
            lli t = a / b; a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        u %= mod; if (u < 0) u += mod;
        return u;
    }
};

// 累乗の余りを求める関数
inline lli power(lli a, int n, lli mod_number___ = mod){
    lli res = 1, waiting = a;
    while(n){ if(n & 1){ 
        (res *= waiting) %= mod_number___;}
        (waiting *= waiting) %= mod_number___; 
        n >>= 1;
    }
    return res;
}

constexpr faster Init;

int main(void){
    int n, a, b, c, d; scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);

    A[0][0] = 1;
    for(int p = a; p <= b; ++p){
        for(int j = 0; j <= n; ++j) A[1][j] = A[0][j];
        for(int j = 0; j <= n; ++j){
            lli C = power(Init.invP[p], c) * Init.invP[j] % mod;
            int ptr = j + c * p; 
            int e = (n - j) / p; if(e > d) e = d;
            for(int k = c; k <= e; ++k, ptr += p){
                lli c = (Init.Power[ptr] * Init.invP[k] % mod) * C % mod;
                (A[1][ptr] += c * A[0][j]) %= mod;
                (C *= Init.invP[p]) %= mod;
            }
        }
        std::swap(A[0], A[1]);
    }
    printf("%lld\n", A[0][n]);
    return 0;
}

Measured memory_bytes: 888
allCards :: [String]
allCards = map unwords $ sequence [["S" , "H" , "C" , "D"] , [show x | x <- [1..13] :: [Int]]]

solve :: [Int] -> String
solve [m,f,r]
    | m == -1 || f == -1 = "F"
    | m + f >= 80 = "A"
    | m + f >= 65 = "B"
    | m + f >= 50 = "C"
    | m + f >= 30 && r >= 50 = "C"
    | m + f >= 30 = "D"
    | otherwise = "F"

main :: IO ()
main  = getContents
    >>= return . takeWhile (/= [-1,-1,-1]) . map (map read) . map words . lines
    >>= return . map solve
    >>= mapM_ putStrLn

Measured memory_bytes: 3928
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD 1000000007
#define PI 3.14159265359
#define eps (1e-8)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");

signed main(){
    FASTER;
    double a,b,x;cin>>a>>b>>x;
    double tant = 2.0*((a*a*b)-x)/(a*a*a);
    if(b-a*tant<0){
        tant = (a*b*b)/(2.0*x);
    }
    cout<<fixed<<setprecision(10)<<atan(tant)*(180.0000000000/PI);
}

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

int main() {
  int n, m;
  cin >> n >> m;
  unordered_set<int> islands;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    int x = 0;
    if (a == 1) x = b;
    if (b == n) x = a;
    if (x != 0) {
      if (islands.find(x) != islands.end()) {
        cout << "POSSIBLE" << endl;
        return 0;
      }
      islands.insert(x);
    }
  }
  cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 8520
#include <bits/stdc++.h>
#include <algorithm>
#include <unordered_map>
#define ull unsigned long long
#define int long long
#define ll long long
#define fr(i, n) for (int i = 0; i < n; i++)
#define frf(i, j, n) for (int i = j; i <= n; i++)
#define frd(i, n) for (int i = n; i >= 0; i--)
#define mp(i, j) make_pair(i, j)
#define pb(x) push_back(x)
using namespace std;
// typedef vector<vector<ll>> matrix;
// const ll PRIME = 1e9 + 7;
// typedef pair<int,pair<int,int> >  ppi;

void solve()
{
    int h,w,m;
    cin>>h>>w>>m;
    int x,y;
    vector<int>row(h,0);
    vector<int>col(w,0);
   map< pair<int,int>, int> mp;
    fr(i,m)
    {
        cin>>x>>y;
        x--,y--;
        row[x]++;
        col[y]++;
        mp[mp(x,y)]=1;

    }
   
    vector<pair<int,int> >mr;
    vector<pair<int,int> >mc;
    fr(i,h)
    {
        mr.pb(mp(row[i],i));
    }
    fr(i,w)
    {
        mc.pb(mp(col[i],i));
    }
   
    sort(mr.begin(),mr.end());
    sort(mc.begin(),mc.end());
    int rmax=mr[mr.size()-1].first;
    int cmax=mc[mc.size()-1].first;
   
    vector<pair<int,int> >rr;
    vector<pair<int,int> >cc;
    int k=mr.size()-1;
    while (k>=0 && mr[k].first==rmax)
    {
        rr.pb(mr[k]);
        k--;
        /* code */
    }
    k=(int)mc.size()-1;
    while (k>=0 && mc[k].first==cmax)
    {
        cc.pb(mc[k]);
        k--;
        /* code */
    }
    int flag=1,ans=rmax+cmax;
    fr(i,(int)rr.size())
    {
        fr(j,(int)cc.size())
        {
            if(mp[mp(rr[i].second,cc[j].second)]==0)
            {
                flag=0;
                break;
            }
        }
        if(flag==0)break;
    }
    cout<<ans-flag;
}
int32_t main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t;
    // int  k = 1;
    // cin >> t;
    t = 1;

    while (t--)
    {
        // cout << "Case #" << k++ << ": ";
        solve();
    }
}


Measured memory_bytes: 53012
#include <math.h>
#include <iomanip>
#include <iostream>
#include <cstdlib>

using namespace std;

const double MIN = 0.0;
const double MAX = 10000;

bool isRange(double v)
{
    if ((MIN < v) && (v < MAX))
    {
        return true;
    }
    return false;
}

int main()
{
    double r;
    double s, l;
    while (cin >> r)
    {
        if (isRange(r))
        {
            s = r * r * M_PI;
            l = r * 2 * M_PI;
            cout << fixed << setprecision(5) << s << " " << l << endl;
        }
    }
}

Measured memory_bytes: 3212
N, A = map(int,input().split())
x = list(map(int,input().split()))

dp = [[[0 for k in range(N*A+1)] for j in range(N+1)] for l in range(N+1)]
dp[0][0][0] = 1

for p in range(N):
    for q in range(N):
        for r in range(N*A):
            dp[p+1][q][r] += dp[p][q][r]
            if r+x[p] <= N*A:
                dp[p+1][q+1][r+x[p]] += dp[p][q][r]
                
ans = 0
for k in range(1,N+1):
    ans += dp[N][k][k*A]
print(ans)

Measured memory_bytes: 95836
#include <stdio.h>
/*長方形の中に円が含まれるかを判定*/
int main(void)
{
    int w, h, x, y, r;
    scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);
    if (((x - r) < 0) || ((x + r) > w) || ((y - r) < 0) || ((y + r) > h))

    {
        printf("No\n");
    }

    if (((x - r) >= 0) && ((x + r) <= w))
    {
        if (((y - r) >= 0) && ((y + r) <= h))
        {
            printf("Yes\n");
        }
    }
}


Measured memory_bytes: 2088
<?php


fscanf(STDIN, "%d%d", $n, $q);

$tree = array_fill(1,$n,[]);
$point = array_fill(1,$n,0);

for($i=0;$i<$n-1;$i++){
    fscanf(STDIN, "%d%d", $start, $end);
    $tree[$start][] = $end;
}

for($i=0;$i<$q;$i++){
    fscanf(STDIN, "%d%d", $target, $plus);
    $point[$target]+= $plus;
}

$start = $point[1];
$point[1] =0;
plus_point(1,$start);

echo implode(" ", $point);


function plus_point($target, $plus){
    global $tree, $point;
    $point[$target] += $plus;
    if(!empty($tree[$target])){
        foreach($tree[$target] as $value ){
            plus_point($value, $point[$target]);
        }
    }

}

Measured memory_bytes: 158200
#include <bits/stdc++.h>
using namespace std;
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; }

using Edge = pair<int,int>; // (隣接頂点, 辺番号)
using Graph = vector<Edge>;
int N;


int main() {
    cin >> N;
    Graph G[N];
    for (int i = 0; i < N-1; ++i) {
        int a, b; cin >> a >> b; --a, --b;
        G[a].push_back(Edge(b, i)); 
        G[b].push_back(Edge(a, i));
    }
    int max_color = 0;
    for (int i = 0; i < N; ++i) chmax(max_color, (int)G[i].size());
    vector<int> res(N-1, -1);

    vector<int> dist(N, -1);
    queue<pair<int,int>> que; // (頂点, 前回の色)
    que.push({0, -1});
    dist[0] = 0;
    while (!que.empty()) {
        auto p = que.front(); que.pop();
        int v = p.first, c = p.second;
        int color = 1;
        if (color == c) ++color;
        for (auto e : G[v]) {
            if (dist[e.first] == -1) {
                dist[e.first] = dist[v] + 1;
                que.push({e.first, color});
                res[e.second] = color;
                ++color;
                if (color == c) ++color;
            }
        }
    }
    cout << max_color << endl;
    for (auto v : res) cout << v << endl;
}


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

typedef long long ll;
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define fork(i, n) for (ll i = 0; i < (n); i++)
#define forn for (ll i = 0; i < (n); i++)
#define fori(i, k, n) for (ll i = k; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define en '\n'
#define FILL(x, v) memset(x, v, sizeof(x))
#define pb push_back
#define fast                     \
	ios::sync_with_stdio(false); \
	cin.tie(NULL);               \
	cout.tie(NULL);

template <typename A, typename B>
inline void chmin(A &a, B b)
{
	if (a > b)
		a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b)
{
	if (a < b)
		a = b;
}
template <typename T>
void print(vector<T> &a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
template <typename T>
void print(deque<T> &a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
template <typename T>
void print(vector<vector<T>> &a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}

int main()
{
	fast;
	int n, s = 0;
	cin >> n;
	vi a(n);
	forn
	{
		cin >> a[i];
		s ^= a[i];
	}
	forn
	{
		a[i] ^= s;
	}
	print(a);
}

Measured memory_bytes: 3988
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b, c, d, e;
  cin >>a;
  b=a%10;
  c=(a-b)/10 %10;
  d=(a-10*c-b)/100 %10;
  e=(a-100*d-10*c-b)/1000 %10;
  if((b == c && b==d)||(c==d && d==e)){
    cout <<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
   }


Measured memory_bytes: 256
from math import sqrt
from itertools import combinations_with_replacement
n = int(input())
m = int(sqrt(n)) + 1
cnt = 0
list_N = [0]*n
list_A = []
for i in range(1, m+1):
    list_A.append(i)

list_P = list(combinations_with_replacement(list_A, 3))

for x, y, z in list_P:
    l = [x, y, z]
    cnt = len(set(l))
    d = pow(x, 2) + pow(y, 2) + pow(z, 2) + x*y + y*z + z*x
    if d <= n:
        if cnt == 1:
            list_N[d-1] += 1
        elif cnt == 2:
            list_N[d-1] += 3
        elif cnt == 3:
            list_N[d-1] += 6


for ans in list_N:
    print(ans)


Measured memory_bytes: 22016
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;


int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int a[]={64,32,16,8,4,2,1};
	int n,i;
	cin>>n;
	for(i=0;i<7;i++){
		if(a[i]<=n){
			cout<<a[i]<<endl;
			return 0;
		}
	}
	
	
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);

void main()
{
    auto N = lread();
    auto D = new long[](N);
    foreach (i; 0 .. N)
    {
        auto d = lread();
        D[i] = d;
    }
    // writeln(D);
    auto D_so = D.sort();
    // writeln(D_so);
    long cnt;
    foreach (i; 0 .. N - 1)
    {
        if (D[i] == D[i + 1])
        {
            continue;
        }
        cnt += 1;
    }
    writeln(cnt + 1);
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}


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

using namespace std;

int main(void){
  int a, b;
  cin >> a >> b;
  cin.ignore();

  if(a >= 13){
    cout << b << endl;
  } else if(a >= 6){
    cout << b/2 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int n; cin >> n;
	vector<vector<pair<int, int>>> p(n);

	for (int i = 0; i <= n - 1; i++) {
		int a; cin >> a;
		for (int j = 0; j <= a - 1; j++) {
			int x, y; cin >> x >> y;
			p[i].push_back({x - 1, y});
		}
	}
	int ans = 0;
	for (int mask = 0; mask <= ((1 << n) - 1); mask++) {
		bool flg = true;

		for (int i = 0; i <= n - 1; i++) {
			if ((mask & (1 << i)) == 0) continue;

			for (auto t : p[i]) {
				if (t.ss == 1) {
					if ((mask & (1 << t.ff)) == 0) {flg = false; break;}
				}
				else {
					if ((mask & (1 << t.ff)) != 0) {flg = false; break;}
				}

				if (!flg) break;
			}
		}

		if (flg) ans = max(ans, __builtin_popcount(mask));
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 3648
x,n =map(int,input().split())
p = list(map(int,input().split()))
if n ==0:
    print(x)

else :
    for i in range(0,200):
        s=x+i
        if s in p:
            pass
        else:
            ans = s
            break

    for n in range(0,200):
        m =x-n
        if m in p:
            pass
        else:
            anss = m
            ansss = x + n
            break
    if ansss <= ans:
        print(anss)
    else :
        print(ans)


Measured memory_bytes: 9200
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vb vector<bool>
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
using namespace std;
using namespace __gnu_pbds; 
ll mi(ll n,ll m){ll pw=n%m;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans%mod;}
ll pw(ll a,ll n){ll pw=a;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw;pw = pw*pw;ex>>=1;}return ans;}
ll pwm(ll a,ll n){ll pw=a%mod;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw%mod;pw = pw*pw%mod;ex>>=1;}return ans%mod;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
template<typename T> using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//st.order_of_key(num)->number of elements < num
//st.find_by_order(i)->iterator of ith element in sorted order starting from zero
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define mkp make_pair
//#define int long long int
//Binary_Search->dp->greedy
//auto check = [&](ll x){};
void solve(){
	ll n,k;
	cin>>n>>k;
	vl dp(k+1);
	dp[k]=1;
	ll cnt=0,ans=k;
	for(ll i=k-1;i>=2;i--){
		ll you=(k/i);
		dp[i]=pwm(you,n);
		for(ll j=2*i;j<=k;j+=i) dp[i]=(dp[i]-dp[j]+mod)%mod;
		cnt=(cnt+dp[i])%mod;
		ans=(ans+(i*dp[i]%mod))%mod;
	}
	ll ult=(pwm(k,n)-cnt+mod)%mod;
	ans=(ans+ult-1)%mod;
	cout<<ans<<endl;
	
	
	
}
int main(){
int t=1;
//scanf("%d",&t);
while(t--){
	solve();
}
return 0;
}    
 

Measured memory_bytes: 4048
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N; cin >> N;
  for(int i = 1; i <=9; i++){
    for(int j = i; j <= 9; j++){
      if(i * j == N){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;

}

Measured memory_bytes: 3600
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef complex<double> P;
static const double EPS = 1e-8;
static const int INF = (int)1e8;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) for (int i=0; i<(int)(n); ++i)
#define FOREQ(i,k,n) for (int i=(k); i<=(int)(n); ++i)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FIND(m,w) ((m).find(w)!=(m).end())

int main(void){
  int height,column,width,space;
  while(cin>>height>>column>>width>>space){
    cin.ignore();
    string line;
    vector<string> words;
    while(getline(cin,line)){
      if(line=="?") break;
      for(int i=0; i==0||i<line.size(); i+=width){
        string word = line.substr(i,width);
        while(word.size()!=width)word+=".";
        words.push_back(word);
      }
    }
    string brank;  while(brank.size()<width)brank+=".";
    string spacestr; while(spacestr.size()<space)spacestr+=".";
    int page = 0;
    while(true){
      if(page>=words.size()) break;
      REP(y,height){
        string output;
        REP(x,column){
          if(x) output+=spacestr;
          if(page+height*x+y<words.size()) output += words[page+x*height+y];
          else {
            output+=brank;
          }
        }
        cout<<output<<endl;
      }
      cout<<"#"<<endl;
      page+=height*column;
    }
    cout<<"?"<<endl;
  }
  return 0;
}

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

#include <boost/algorithm/string/classification.hpp>  // is_any_of
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/math/tools/minima.hpp>
#include <boost/multi_array.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>

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

namespace adaptor = boost::adaptors;
using namespace std;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::replace_all;
using boost::algorithm::split;
using boost::math::tools::brent_find_minima;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP
void Main()
{
	double r;
	cin >> r;
	cout << 2 * r * M_PI << endl;
}
// END

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,o=0;
	cin>>n;
	ll arr[n];
	for(ll i=0;i<n;i++)
	{
		cin>>arr[i];
		o+=(arr[i]==1);
	}
	if(o==0)
	{
		cout<<"-1\n";
		return 0;
	}
	ll k=1;
	for(ll i=0;i<n;i++)
		if(arr[i]==k)k++;
	cout<<n-k+1<<"\n";
	return 0;
}

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

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;

typedef long long ll;
typedef long double ld;

ll check(ll b) {
    ll lb = -4500, rb = 4500;
    while (rb - lb > 1) {
        ll mid = (lb + rb) / 2;
        ll val = mid * mid * mid * mid * mid;
        if (val >= b) rb = mid;
        else lb = mid;
    }
    return rb;
}

void solve() {
   ll x;
   cin >> x;
   vector<ll> cands;
   for (ll div = 0; div <= 4500; ++div) {
        ll shit = div * div * div * div * div;
        //if (shit > (ll) 1e17) break;
        ll val = shit - x;
        ll b = check(val);
        if (b * b * b * b * b == val) {
            cout << div << ' ' << b << "\n";
            return;
        }
   }
   assert(false);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>

int main(void){
    int n,a;
    scanf("%d %d",&n,&a);
    int c[n];
    int t[a];
    int mincost = 1001;
    int mintime = 1001;
    for(int i = 0;i<n;i++){
        scanf("%d %d",&c[i],&t[i]);
        if(c[i] <= mincost && t[i] <= a){
            mincost = c[i];
            mintime = c[i];
        }
    }
    if(mincost == 1001){
        printf("TLE\n");
    }else{
        printf("%d\n",mincost);
    }
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int a, b;
    cin >> a >> b;
    int h = 100, w = 100;
    vector<vector<char>> ans(h, vector<char>(w));
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            if(i < 50)  ans[i][j] = '.';
            else    ans[i][j] = '#';
        }
    }
    --a, --b;
    for(int i = 0; i < 49; ++i){
        for(int j = (i % 2 == 0) ? 0 : 2; j < w; j += 4){
            if(!b)  break;
            ans[i][j] = '#';
            --b;
        }
        if(!b)  break;
    }
    for(int i = 51; i < h; ++i){
        for(int j = (i % 2 != 0) ? 0 : 2; j < w; j += 4){
            if(!a)  break;
            ans[i][j] = '.';
            --a;
        }
        if(!a)  break;
    }
    cout << h << " " << w << "\n";
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            cout << ans[i][j];
        }
        cout << "\n";
    }
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  string s,t; cin >>s>>t;
  sort(all(s));
  sort(all(t), greater());
  if(s<t){
    cout <<"Yes"<<endl;
  }else{
    cout <<"No"<<endl;
  }
}




Measured memory_bytes: 3580
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef pair<double,double> PD;
typedef priority_queue<P,vector<P>,greater<P> > P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd> > Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-6;


#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod
#define MUL(a,b) a=(a*b)%mod

ll dp[200010][3][2];

int main(){
    ll N; cin>>N;
    vec d(N); 
    rep(i,N) cin>>d[i];
    rep(i,200010) rep(j,3) rep(k,2) dp[i][j][k]=-INF;
    dp[0][0][0]=0;
    rep(i,N) rep(j,3){
        dp[i+1][j][1]=dp[i][j][0]+d[i];
        dp[i+1][j][0]=dp[i][j][1];
        if(j>0) dp[i+1][j][0]=max(dp[i+1][j][0],dp[i][j-1][0]);
    }
    ll ans=-INF;
    if(N%2) ans=max(dp[N][1][0],dp[N][2][1]);
    else ans=max(dp[N][0][0],dp[N][1][1]);
    cout<<ans<<endl;

}

Measured memory_bytes: 14328