akhauriyash/Code-Regression huggingface dataset:
// start fold
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<cstring>
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
using namespace std;
#define ri register int
#define il inline
#define LL long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define fi first
#define se second
#define enter putchar('\n')
#define size(x) ((int)x.size())
#define mem0(x) memset(x,0,sizeof(x))
template<class T>il void in(T &x)
{
	x=0; short f=1; char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9') x=x*10+(c^'0'),c=getchar();
	x*=f;
}
template <typename T,typename ...Args>il void in(T &x, Args &...args)
{
	in(x); in(args...);
}
template<class T>il void out(T x,const char c='\n')
{
	static short st[30];
	short m=0;
	if(x<0) putchar('-'),x=-x;
	do st[++m]=x%10,x/=10; while(x);
	while(m) putchar(st[m--]|'0');
	putchar(c);
}
template <typename T,typename ...Args>il void out(const T &x,const Args &...args)
{
	out(x,' '); out(args...);
}
template<class T>il void print(T a[],int n)
{
	if(n<=0) return;
	for(ri i=0; i<n; ++i) out(a[i],' ');
	enter;
}
namespace i207M
{
// end fold
#define N 16
#define M N*N
const int md=1e9+7;
int n,m;
int v[M],nx[M],head[N],cnte=1;
il void adde(const int uu,const int vv)
{
	v[++cnte]=vv,nx[cnte]=head[uu],head[uu]=cnte;
}
int ined[1<<N];
int f[2][1<<N];
int pw2[M];
int bit,ys[1<<N];
signed main()
{
#ifdef M207
	freopen("in.in","r",stdin);
	// freopen("out.out","w",stdout);
#endif
	in(n,m); pw2[0]=1; bit=(1<<n)-1;
	for(ri i=0; i<n; ++i) ys[1<<i]=i;
	for(ri i=1,a,b; i<=m; ++i)
	{
		in(a,b); --a,--b;
		adde(a,b), adde(b,a);
		pw2[i]=(pw2[i-1]<<1)%md;
	}
	for(ri s=1; s<=bit; ++s)
	{
		int x=s&-s;
		ined[s]=ined[s^x],x=ys[x];
		for(ri i=head[x]; i; i=nx[i])
			if((s>>v[i])&1) ++ined[s];
	}
	for(ri c=0; c<=1; ++c)
		for(ri s=1; s<=bit; ++s)
			if((s>>c)&1)
			{
				int val=pw2[ined[s]];
				for(ri t=s&(s-1); t; t=s&(t-1))
					if((t>>c)&1)
					{
						val=(val-(LL)f[c][t]*pw2[ined[s^t]]%md+md)%md;
					}
				f[c][s]=val;
			}
	int ans=0;
	for(ri s=1; s<=bit; ++s)
		if(s&1)
		{
			int bu=bit^s;
			for(ri t=bu; t; t=bu&(t-1))
				if((t&2)&&ined[s]+ined[t]==ined[s|t])
					ans=(ans+(LL)f[0][s]*f[1][t]%md*pw2[ined[(s|t)^bit]])%md;
		}
	ans=(pw2[m]-ans+md)%md;
	out(ans);
	return 0;
}
// start fold
}
signed main()
{
	i207M::main();
	return 0;
}
// end fold


Measured memory_bytes: 640
#include <cstdio>

int main() {
	int n, m, d;
	scanf("%d%d%d", &n, &m, &d);
	double t;
	if (d == 0) t = n;
	else t = (n - d) << 1;
	t *= m - 1;
	t /= n;
	t /= n;
	printf("%.10lf\n", t);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    string s;
    cin >> n >> s;
    int ok = 0, ng = n / 2 + 1;
    while (ng - ok > 1){
        int len = (ok + ng) / 2;
        set<string> st;
        bool found = false;
        FOR(i,len,n-len){
            st.insert(s.substr(i - len, len));
            if (st.count(s.substr(i, len))){
                found = true;
                break;
            }
        }
        if (found) ok = len;
        else ng = len;
    }
    cout << ok << endl;
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  string S;
  cin>>S;
  int Wcount = 0;
  int Rcount = 0;
  rep(i,N){
    if(S.at(i)=='W'){
      Wcount += 1;
    }
    else{
      Rcount += 1;
    }
  }
  int key = 0;
  rep(i,Rcount){
    if(S.at(i)=='W'){
      key = 1;
      break;
    }
  }
  if(key==0){
    cout<<0<<endl;
  }
  else{
    int count = 0;
    rep(i,Rcount){
      if(S.at(i)=='W'){
        count += 1;
      }
    }
    int ans = min(Rcount,min(Wcount,count));
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 3696
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#define ll long long
#define rg register
#define go(i,x,a) for(rg int i=a;i<x;i++)
#define inf 0x3f3f3f3f
#define INF 0x7ffffffv
using namespace std;

const int maxn=2005;
int n,hd[maxn],k,dep[maxn],siz[maxn];
int ans=0,low[maxn],high[maxn],d[maxn];
char s[maxn];
struct edd{
	int nt,v;
}e[maxn*2];
struct pt{
	int l,r;
	pt(int _l=0,int _r=0):l(_l),r(_r){};
	friend bool operator <(pt a,pt b){
		return a.l > b.l;
	}
}p[maxn];

inline int rd(){
	int ret=0,af=1; char gc=getchar();
	while(gc < '0' || gc > '9'){ if(gc == '-') af=-af; gc=getchar(); }
	while(gc >= '0' && gc <= '9') ret=ret*10+gc-'0',gc=getchar();
	return ret*af;
}

inline void add(int a,int b){
	e[k].v=b; e[k].nt=hd[a]; hd[a]=k++;
	e[k].v=a; e[k].nt=hd[b]; hd[b]=k++;
}

inline void gmin(int &a,int b){ if(a > b) a=b; return ; }

void dfs(int x,int fa){
	siz[x]=s[x] == '1'; low[x]=high[x]=d[x]=0;
	for(rg int i=hd[x];i!=-1;i=e[i].nt){
		int v=e[i].v; if(v == fa) continue;
		dfs(v,x);
		siz[x]+=siz[v];
		high[x]+=high[v]+siz[v];
	//	d[x]+=d[v];
	}
	int tt=0,sl=0,sr=0;
	for(rg int i=hd[x];i!=-1;i=e[i].nt){
		int v=e[i].v; if(v == fa) continue;
		p[++tt]=pt(low[v]+siz[v],high[v]+siz[v]);
		sr=sr+high[v]+siz[v]; sl=sl+low[v]+siz[v];
	}
	if(!tt) return ;
	sort(p+1,p+tt+1);
	if(p[1].l*2 <= sl){
		if(sl%2 == 0) low[x]=0,d[x]+=sl/2;
		else{
			go(i,tt+1,1)
				if(p[i].r > p[i].l){
					sl++; break;
				}
			low[x]=sl%2; d[x]+=sl/2;
		}
	}else{
		if(sr-p[1].r >= p[1].l) low[x]=0,d[x]+=p[1].l;
		else low[x]=p[1].l-(sr-p[1].r),d[x]+=sr-p[1].r;
	}
}

int main(){
//	freopen("1.in","r",stdin);
	memset(hd,-1,sizeof(hd)); k=0;
	n=rd(); scanf("%s",s+1);
	int a,b;
	go(i,n,1){
		a=rd(); b=rd(); add(a,b);
	}
	ans=inf;
	go(i,n+1,1){
		dfs(i,0);
		if(low[i] == 0 && high[i]%2 == 0) gmin(ans,high[i]/2);//,printf("%d %d\n",i,d[i]);
	}
	printf("%d",ans == inf ? -1 : ans);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n;
    cin >> n;
    int N[101010] = {0};
    for(int i = 1; i <= 100; i++) {
        for(int j = 1; j <= 100; j++) {
            for(int k = 1; k <= 100; k++) {
                N[i*i + j*j + k*k + i*j + j*k + k*i]++;
            }
        }
    }
    for(int i = 1; i <= n; i++) {
        cout << N[i] << endl;
    }
}

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

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
int n;
double a[1000100];
int main(){
	double s;
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	double ans=0;
	for(int i=1;i<=n;i++){
		ans+=1/a[i];
	}
	printf("%.6lf",1/ans);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		String s=scan.next().toLowerCase();
		int k=s.length();
		if(n>=k)System.out.println(s);
		else {
			String ss=s.substring(0, n);
			System.out.println(ss+"...");
		}
		
	}

}


Measured memory_bytes: 38584
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	int n;cin>>n;
	vector<int>a(n),b(n),c(n);
	for(auto&& w:a)cin>>w;
	for(auto&& w:b)cin>>w;
	int sum=0,sumA=0,sumB=0;
	for(int i=0;i<n;i++){
		c[i]=b[i]-a[i];
		sum+=c[i];
		if(c[i]>0)sumA+=(c[i]+1)/2;
		else sumB-=c[i];
	}
	if(sum>=0 && sum>=sumB && sum>=sumA)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
//	cout<< sum<< " "<<sumA<<" "<<sumB<<endl;
	
}



Measured memory_bytes: 512
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str = scan.next();
		String asw = "ABC";
 
		if (str.equals(asw)) {
			System.out.println("ARC");
		} else {
			System.out.println("ABC");
		}
        scan.close();
    }
}

Measured memory_bytes: 35624
#include<stdio.h>

void kcut(int a[],int k,int n){
  int i,j,b[200];
  for(i=0,j=2*n-k;i<k;i++,j++){
    b[j] = a[i];
  }
  for(i=k,j=0;j<2*n-k;i++,j++){
    b[j] = a[i];
  }
  for(i=0;i<2*n;i++){
    a[i] = b[i];
  }
  return;
}

void riffle(int a[],int n){
  int i,j=0,b[200];
  for(i=0;i<n;i++){
    b[j] = a[i];
    j++;
    b[j] = a[i+n];
    j++;
  }
  for(i=0;i<2*n;i++){
    a[i] = b[i];
  }
  return;
}

int main(void){
  int n,m,a[200],b[1000],i;
  scanf("%d %d",&n,&m);
  for(i=0;i<m;i++){
    scanf("%d",&b[i]);
  }
  for(i=0;i<2*n;i++){
    a[i] = i + 1;
  }
  for(i=0;i<m;i++){
    if(b[i]==0)riffle(a,n);
    else kcut(a,b[i],n);
  }
  for(i=0;i<2*n;i++){
    printf("%d\n",a[i]);
  }
  return(0);
}

Measured memory_bytes: 1824
#include  <bits/stdc++.h>
using namespace std;
static int fast_io = []() { std::ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }();
int main(){
  int n;
  cin>>n;
  vector<int> tasks(n);
  int sum=0;
  for(int i = 0;i<n;i++){
    cin>>tasks[i];
    sum+=tasks[i];
  } 
  int drinks,pi,xi;
  cin>>drinks;
  for(int i = 0;i<drinks;i++){
    cin>>pi>>xi;
    pi--;
    int diff=tasks[pi]-xi;
    cout<<sum-diff<<"\n";  
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(){

  int n,i,j,tmp,cnt=0,min;
  int *a;
  
  scanf("%d",&n);

  a = malloc(sizeof(int)*n);

  for(i=0;i<n;i++)scanf("%d",&a[i]);

  for(i=0;i<n;i++){
    min = i;
    for(j=i;j<n;j++)if(a[j] < a[min])min = j;

    if(a[i]!=a[min]){
      tmp = a[i];
      a[i] = a[min];
      a[min] = tmp;
      cnt++;
    }
  }

  for(i=0;i<n-1;i++)printf("%d ",a[i]);
  printf("%d\n",a[i]);
  printf("%d\n",cnt);
 
  free(a);
  return 0;
}



Measured memory_bytes: 2104
#include<stdio.h>
#include<math.h>

#define MAX_LENGTH 32

int main(void)
{
        char line[MAX_LENGTH];
        double r;

        fgets(line, sizeof(line), stdin);
        sscanf(line, "%lf", &r);

        printf("%lf ", M_PI * r * r);
        printf("%lf\n", 2 * M_PI * r);


        return 0;
}

Measured memory_bytes: 656
def Partition(NUM_LIST, left, right):
    NUM_LIST = NUM_LIST[left:right]
    v = NUM_LIST[-1]
    border = 0
    for i in range(len(NUM_LIST)-1):
        if v >= NUM_LIST[i]:
            NUM_LIST[border], NUM_LIST[i] = NUM_LIST[i], NUM_LIST[border]
            border+=1
    NUM_LIST[border], NUM_LIST[-1] = NUM_LIST[-1], NUM_LIST[border]
    return border, NUM_LIST

n = int(input())
NUM_LIST = list(map(int, input().split()))
border, NUM_LIST = Partition(NUM_LIST, 0, len(NUM_LIST))

print(" ".join(list(map(str, NUM_LIST[:border]))) + " ["+str(NUM_LIST[border])+"] "
+" ".join(list(map(str, NUM_LIST[border+1:]))))
            
    


Measured memory_bytes: 16384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s,t;
    cin >> s;
    cin >> t;
    string s2 = s+s;
    if(s2.find(t)!=string::npos){
        cout << "Yes" <<endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, int> psi;

#define ff first
#define ss second
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define input freopen("input.txt","r",stdin)
#define output freopen("output.txt","w",stdout)
#define d(a,b,c) cout<<a<<" "<<b<<" "<<c<<'\n'
#define IO ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define mem(a, b) memset(a,b,sizeof(a))

int main()
{
    string s, t, g; cin >> s >> t;
    for(int i = 0; i < t.size()-1; i++)
        g += t[i];
    if(s == g)
        cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

using namespace std;
int main() {
  int n;
  int a[10*10*10*10*10];
  int tmp;

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

  int on = 1;
  for (int i = 0; i < n; i++) {
    on = a[on-1];
    if (on == 2) {
      cout << i+1 << endl;
      return 0;
    }
  }

  cout << "-1" << endl;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
int main()
{
	int n, k;
	cin >> n >> k;
	int a[k], b[k];
	int lon=0, nho=1000000;
	for(int i=0; i<k; i++)
	{
		cin >> a[i] >> b[i];
		lon=max(lon, a[i]);
		nho=min(nho, b[i]);
	}
	if(lon>nho) cout << 0;
	else cout << nho-lon+1;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;
#define MAX 1000000
typedef long long ll;

int  main(){
  ll count=0,ans=0;
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='B'){
      count++;
    }else if(s[i]=='W'){
      ans+=count;
    }
  }
  cout<<ans<<endl;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void AGC011B()
{
	int N;
	cin >> N;
	priority_queue<int, vector<int>, greater<int> > qu;
	for (int i = 1; i <= N; ++i)
	{
		int x;
		cin >> x;
		qu.push(x);
	}

	ll ct = 0;
	ll n = 0;
	int prevx = 0;
	while (!qu.empty())
	{
		int x = qu.top(); qu.pop();
		if (x > 2 * n)
		{
			ct = 1;
		}
		else
		{
			++ct;
		}
		n += x;
	}
	cout << ct << endl;

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

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

class Main{
    public static void main(String[] args){
	BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));
	try {
	    while(true){
		String st = sc.readLine();
		if(st.equals("END OF INPUT"))
		    break;
		String[] sp = st.split(" ");
		for(int i=0; i<sp.length; i++)
		    System.out.print(sp[i].length());
		System.out.println();
	    }
	}catch(Exception e){
	    System.out.println("Error");
	}
    }
}

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

signed main()
{
    int n , i;
    long long a[200001] , s[200001] , ans = 0 , rCr , x , pin;

    cin >> n;
    for(i=1 ;i<=n ;i++ ){
        cin >> a[i];
    }

    s[0] = 0;
    
    for(i=1 ;i<=n ;i++ ){
        s[i] = s[i-1] + a[i];
    } 

    sort(s , s + (n + 1));

    i = 0 ;
    while(i < n){
        if(s[i] == s[i+1]){
            pin = i;
            i = i + 1;
            x = 1;
            while(s[i] == s[pin] && i <= n){
                i++;
                x++;
            }
            ans += (x * (x - 1)) / 2;
        } else {
            i++;
        }
    }

    cout << ans << endl;

    return (0);
}

Measured memory_bytes: 6672
#include <iostream>

int main() {
  int h, w;
  char c[100][100];
  std::cin >> h >> w;

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      std::cin >> c[i][j];
    }
  }

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      std::cout << c[i][j];
    }
    std::cout << "\n";
    for (int j = 0; j < w; j++) {
      std::cout << c[i][j];
    }
    std::cout << "\n";
  }

  return 0;
}

Measured memory_bytes: 256
# AtCoder Beginner Contest 091
# B - Two Colors Card Game

import collections

N=int(input())
S=[]
for i in range (N):
    s=input()
    S.append(s)

M=int(input())
T=[]
for j in range(M):
    t=input()
    T.append(t)

C_S=collections.Counter(S)
C_T=collections.Counter(T)

score=0

for word in C_S:
    temp_score=C_S[word] - C_T[word]
    if temp_score>score :
        score=temp_score
    else:
        pass

print(score)

Measured memory_bytes: 9476
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define DL double
#define MLL map<LL,LL>::iterator
#define MSL map<string,L>::iterator
#define MLS map<LL,string>::iterator
#define MSS map<string,string>::iterator
#define MCL map<char,LL>::iterator
#define SL set<LL>::iterator
#define SS set<string>::iterator
#define VL V<LL>::iterator
#define G getline
#define SZ size()
#define IN insert
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define MAX 1e18
#define MIN -1e18
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
V<LL>v;
map<LL,LL>u;
void Y()
{
    cout<<"Yes"<<endl;
}
void N()
{
    cout<<"No"<<endl;
}
int main()
{
    FAST;
    LL n,m,i,j,k,p,q,o,l,s,t,z=0,r;
    string a,b,c;
    DL x,y;
   cin>>n;
   x=(DL)n;
   cout<<fixed<<setprecision(2)<<2*PI*x<<endl;

    return 0;
}


Measured memory_bytes: 3840
from collections import deque
n, m = map(int, input().split())
path = [[] for _ in range(n+1)]
for _ in range(m):
    a, b = map(int, input().split())
    path[a].append(b)
    path[b].append(a)


queue = deque([1])

depth = [-1]*(n+1)

depth[0] = depth[1] = 0

ans = [-1]*(n+1)

while queue:
    v = queue.popleft()
    for i in path[v]:
        if depth[i] == -1:
            depth[i] = depth[v] + 1
            queue.append(i)
            ans[i] = v

if -1 in depth:
    print("No")
else:
    print("Yes")
    # for i in range(2, n+1):
    #     print("部屋番号：", i, "path", path[i])
    #     print("深さ", depth[i])
    print(*ans[2:], sep="\n")


Measured memory_bytes: 96680
/// Rustで競技プログラミングの入力をスッキリ記述するマクロ
///
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        t: u64,
        ct: [(u64, u64); n],
    }

    let v = ct.into_iter()
        .filter(|&(_, ti)| ti <= t)
        .collect::<Vec<_>>();
    if v.is_empty() {
        println!("TLE");
        return;
    }

    println!("{}",
             v
             .into_iter()
             .min_by_key(|&(ci, _)| ci)
             .unwrap()
             .0);

}


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

using namespace std;

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

template <typename T> void max_self(T& a, T b){
  a = max(a,b);
}

template <typename T> void min_self(T& a, T b){
  a = min(a,b);
}

void solve(){	
  int k;cin>>k;
  string str;cin>>str;
  bool t=false;
  if(str.size() > k){
    t=true;
    while(str.size() > k)
      str.erase(str.begin() + str.size()-1);
  }
  cout<<str;
  if(t)
    cout<<"...\n";
  else
    cout<<"\n";
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  //int t; cin >> t;
  //while(t--) solve();
  //
  solve();
  return 0;
}


Measured memory_bytes: 3652
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

bool isACGT(char c) {
    if (c == 'A') return true;
    if (c == 'C') return true;
    if (c == 'G') return true;
    if (c == 'T') return true;
    return false;
}

int main() {

    string s;
    cin >> s;
    int len = s.length();
    bool isACGTChar[10];
    for (int i = 0; i < len; i++) {
        isACGTChar[i] = isACGT(s[i]);
    }
    int max = 0;
    for (int i = 0; i < len; i++) {
        if (!isACGTChar[i]) continue;
        int maxLength = 1;
        for (int j = 1; j <= len - i; j++) {
            if (!isACGTChar[i+j]) break;
            maxLength += 1;
        }
        max = std::max(max, maxLength);
    }
    cout << max << endl;

}



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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}


signed main(void) {
	string s,t;
	cin >> s >> t;
	int n=s.size();
	int m = t.size();
	int ret=INF;
	rep(i,n-m+1){
		int count=0;
		rep(j,m){
			if(s[i+j]!=t[j])count++;
		}
		ret = min(ret,count);
	}
	print(ret);
}

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

using namespace std;

using ll=long long ;
int n;
ll M;
ll& add(ll& r, ll x){
    return (r+=x)%=M;
}
ll X(ll r, ll x){
    return r*x%M;
}
ll& mult(ll& r, ll x){
    return (r*=x)%=M;
}
ll& mult_1(ll& r, ll x){
    return (r*=x)%=M-1;
}
ll mpow(ll x, int64_t e) {
    ll res = 1;
    for (; e; e >>= 1) {
        if (e & 1) mult(res, x);
        mult(x,x);
    }
    return res;
}
ll mpow_1(ll x, int64_t e) {
    ll res = 1;
    for (; e; e >>= 1) {
        if (e & 1) mult_1(res, x);
        mult_1(x,x);
    }
    return res;
}

const int N = 3123; 
ll pw[N],pw_1[N];
ll dp[N][N];
ll f[N];
ll fac[N], ifac[N], inv[N];

ll C(int n, int k) {
    if (n < k || k < 0) return 0;
    return fac[n] * ifac[n-k]%M * ifac[k]%M;
}

void pre() {
    memset(dp, 0, sizeof dp);
    dp[0][0] = 1; 
    for (int i = 1; i <= n; i++) {
        dp[i][0] = 1;
        for (int j = 1; j <= i; j++) {
            ll tmp = dp[i-1][j];
            add(dp[i][j], mult(tmp, j+1));
            add(dp[i][j], dp[i-1][j-1]);
        }
    }
    pw[0] = pw_1[0] = 1;
    for (int i = 1; i <= n; i++) {
        pw[i] = pw[i-1];
        mult(pw[i], 2);
        pw_1[i] = pw_1[i-1];
        mult_1(pw_1[i], 2);
    }
    memset(f, 0, sizeof f);
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= i; j++) {
            ll tmp = pw[n-i];
            add(f[i], X(dp[i][j], mpow(tmp, j)));
        }
    }
    fac[0] = fac[1] = 1;
    ifac[0] = ifac[1] = 1;
    inv[1] = 1;
    for (int i = 2; i <= n; i++) {
        fac[i] = fac[i-1] * i % M;
        inv[i] = (M-M/i) * inv[M%i] % M;
        ifac[i] = ifac[i-1] * inv[i] % M;
    }
}

void solve() {
    cin >> n >> M;
    pre();
    ll Q = 0;
    for (int i = 1; i <= n; i++) {
        ll tmp = C(n,i) * f[i] %M * mpow(2, pw_1[n-i])%M;
        (i&1)? add(Q, tmp) : add(Q, M-tmp);
    }
    ll P = mpow(2, pw_1[n]);
    ll res = (P-Q+M) %M;
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 76672
n = int(input())
list_A1 = list(map(int, input().split()))
list_A2= list(map(int, input().split()))
ans = 0
for i in range(n):
    k = sum(list_A1[:i]) + sum(list_A2[i:]) + list_A1[i]
    ans = max(ans, k)



print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>

using namespace std;

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

  cout << 800 * A - 200 * (A / 15) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int n,T;
	cin >> n>>T;
	vi t(n);
	rep(i, n)cin >> t[i];
	int ans = 0;
	if (n == 1) {
		cout << T << endl;
		return 0;
	}
	rep(i, n-1) {
		if (t[i + 1] - t[i] < T) {
			ans += t[i + 1] - t[i];
		}
		else {
			ans += T;
		}
	}
	ans += T;
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 1024
package main

import (
	"fmt"
)

func main() {
	var N int
	var S string
	fmt.Scan(&N, &S)
	for i := 0; i < len(S); i++ {
		sub := []rune(S)
		changed := sub[i] + rune(N) - rune(0)
		if changed > 'Z' {
			changed = changed - 'Z' + 'A' - rune(1) + rune(0)
		}
		fmt.Printf("%c", changed)
	}
	fmt.Println()
}


Measured memory_bytes: 7552
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
// #define INF LLONG_MAX/2

using namespace std;

int MOD = 1000000007;
int n;


signed main(){

    cin >> n;
    map<int,int> m;
    rep(i,n){
        int a;
        cin >> a;
        m[a]++;
    }
    int cnt = 0;
    for(auto x:m){
        if(x.se % 2 == 0)cnt++;
    }
    if(cnt%2 == 0)cout << m.size() <<endl;
    else cout << m.size()-1 <<endl; 



    
    

    return 0;
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl 

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
using Pl=pair<ll,ll>;
using PPl=pair<ll,Pl>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n,m;
    cin>>n>>m;
    vs vec;
    REP(i,n){
        string st;
        cin>>st;
        if(st==string(m,'.')){
            continue;
        }else{
            vec.pb(st);
        }
    }
    REP(i,vec.size()){
        REP(j,m){
            bool f=true;
            REP(k,vec.size()){
                if(vec[k][j]=='#'){
                    f=false;
                }
            }
            if(!f){
                cout<<vec[i][j];
            }
        }cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
 
using namespace std;
using ll = long long;
 
long long ncr(int n, int r) {
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    long long ans = 1;
    int i;
 
    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }
 
    return ans;
}
ll mod(ll a,ll b,ll m){
    if(b==0)return 1;
    if(b%2==0){
        ll y =  mod(a,b/2,m);
        return (y*y)%m;
    }
    else{
        return ((a%m)*mod(a,b-1,m))%m;
    }
}
 
ll modinv(ll a,ll m){
return mod(a,m-2,m);
//works only for prime m.
//else calculate phi(m)-1.
}
 
 
 
int main()
{
    ll h,w,m;
    cin>>h>>w>>m;
    map<int,int>row,col;
    map<pair<int,int>,int>s;
    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        s[{x,y}]++;
        row[x]++;
        col[y]++;
    }
    ll res=0;
   int rmax=0;int colmax=0;
   int orz;int oc;
    vector<int>ypob,xpob;
   for(auto x:row){
        //cout<<x.second<<endl;
    rmax=max(rmax,x.second);
   }
   for(auto x:col){
       //cout<<x.second<<endl;
    colmax=max(colmax,x.second);
 
   }
  // cout<<rmax<<" "<<colmax<<endl;
   for(auto x:row){
    if(x.second==rmax)xpob.push_back(x.first);
   }
   for(auto x:col){
     if(x.second==colmax)ypob.push_back(x.first);
 
   }
   ll cur_res=rmax+colmax-1;
//  for(auto x:xpob)cout<<x<<endl;
  for(auto x:xpob){
       bool ok=true;
    for(auto y:ypob){
        if(!s.count({x,y})){
            cur_res++;
            ok=false;
            break;
        }
 
    }
    if(!ok)break;
  }
cout<<cur_res<<endl;
    return 0;
}

Measured memory_bytes: 54328
import math

def get_primes(num):
    
    lim = math.sqrt(num)
    prime = []
    data = [i+1 for i in range(1, num)]
    
    while True:
        
        if data[0] >= lim:
            return prime + data
        
        prime.append(data[0])
        data = [i for i in data if i % data[0] != 0]

def is_prime(num, prime_arr):
    for i in prime_arr:
        if num <= i:
            return True
        if num % i == 0:
            return False
    return True

prime_arr = get_primes(10000)

N = int(input())

prime_count = 0
for i in range(N):
    num = int(input())
    if is_prime(num, prime_arr):
        prime_count += 1

print(prime_count)


Measured memory_bytes: 6028
#include<cstdio>
#include<algorithm>
using namespace std;
int gi(){
	int x=0,w=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')w=0,ch=getchar();
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
const int N=1e6+5;
int n,m,q,mod,a[N],b[N],c[N],g,z,fa[N],chk[2][N];
int find(int x){return x==fa[x]?x:fa[x]=find(fa[x]);}
void link(int x,int y){fa[find(x)]=find(y);}
int id(int u,int x,int y){return u*6+x*2+y;}
int main(){
	n=gi();m=gi();q=gi();mod=gi();
	for(int i=1;i<=m;++i){
		a[i]=gi(),b[i]=gi(),c[i]=gi();
		g=__gcd(g,abs(c[i]-c[1]));
	}
	if(!g)g=mod;mod=__gcd(mod,3*g);z=c[1]%g;
	for(int i=0;i<n*6;++i)fa[i]=i;
	for(int i=1;i<=m;++i){
		int u=a[i]-1,v=b[i]-1,w=(c[i]-z)/g%3;
		for(int x=0;x<3;++x){
			link(id(u,x,0),id(v,(2*x+w)%3,1));
			link(id(u,x,1),id(v,(2*x+w)%3,0));
			link(id(v,x,0),id(u,(2*x+w)%3,1));
			link(id(v,x,1),id(u,(2*x+w)%3,0));
		}
	}
	for(int i=0,j=z;i<mod<<1;++i,j=(j<<1)%mod)chk[i&1][j]=1;
	while(q--){
		int s=gi()-1,t=gi()-1,r=gi(),res=0;
		for(int x=0;x<3;++x)
			for(int y=0;y<2;++y)
				if(find(id(t,0,0))==find(id(s,x,y)))
					res|=chk[y][(r+z+(3-x)*g)%mod];
		puts(res?"YES":"NO");
	}
	return 0;
}


Measured memory_bytes: 16768
#include "bits/stdc++.h"
using namespace std;
#define pb          push_back
#define mp          make_pair
#define ll          long long
#define pii         pair<ll, ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll, ll>
#define mii         map<pii, ll>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rev(i,a,b)  for(int i=a;i>=b;i--)

#define bg(i)       i.begin()
#define fset(it,s)   for(auto it = s.begin(); it != s.end(); it++)
 
#define track(x)                 cerr<<#x<<": "<<x<<endl
#define track2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define track3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define track4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
 
#define ed(i)       i.end()
#define mem(a)	    memset(a, 0, sizeof(a))

#define MOD         1000000007
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a + b + p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
void self_max(int &a, int &b) {a = max(a, b); }
void self_min(int &a, int &b) {a = min(a, b); }
void self_add(int &a, int b, int p = MOD) {
    a += b;
    if(a >= p)
        a -= p;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
const int INF = 1e9 + 5;
#define N	    	400001

void solve(){
    int n;
    cin>>n;
    vector<vector<int>> can(n, vector<int>(n));
    rep(i, 0, n)
        rep(j, 0, n)
            cin>>can[i][j];
    int dp[1<<n+1];
    mem(dp);
    dp[0] = 1;
    rep(child, 1, n+1) {
        rep(msk, 0, 1<<n) {
            if(__builtin_popcount(msk) == child-1) {
                rep(i, 0, n) {
                    if(can[child-1][i] && ((msk>>i) & 1) == 0) {
                        int newMks = msk | (1<<i);
                        self_add(dp[newMks], dp[msk]);
                    }
                }
            }
        }
    }
    cout<<dp[(1<<n)-1]<<endl;
}
int main() {
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin>>t;
	while(t--){
		solve();
	}
}




Measured memory_bytes: 16640
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
 
typedef struct Node* NodePointer;
 
typedef struct Node {
  int key;
  NodePointer next, pre;
} Node;
 
NodePointer h, l;
 
NodePointer make_node(int key) {
  NodePointer tmp = malloc(sizeof(Node));
  tmp->next = tmp->pre = NULL;
  tmp->key = key;
  return tmp;
}
 
void init() {
  h = malloc(sizeof(Node));
  l = malloc(sizeof(Node));
  h->next = l;
  l->pre = h;
}
 
void insert(NodePointer s, int key) {
  NodePointer node = make_node(key);
  NodePointer t = s->next;
  s->next = node;
  node->pre = s;
  node->next = t;
  t->pre = node;
}
 
void delete(NodePointer p) {
  NodePointer s = p->pre;
  NodePointer t = p->next;
  s->next = t;
  t->pre = s;
  free(p);
}
 
int main() {
  int N, num;
  char str[30];
  NodePointer p;
  init();
  scanf(" %d ", &N);
  while(N--) {
    scanf(" %s ", str);
    if(!strcmp(str,"insert")) {
      scanf(" %d ", &num);
      insert(h,num);
    } else if(!strcmp(str,"delete")) {
      scanf(" %d ", &num);
      for(p = h->next; p != l; p = p->next) {
        if(p->key == num) {
          delete(p);
          break;
        }
      }
    } else if(!strcmp(str,"deleteFirst")) {
      delete(h->next);
    } else if(!strcmp(str,"deleteLast")) {
      delete(l->pre);
    }
  }
 
  for(p = h->next; p != l; p = p->next) {
    printf(p == h->next? "%d":" %d", p->key);
  }
  printf("\n");
 
  return 0;
}

Measured memory_bytes: 31792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
typedef long long ll;
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pcont(x) for(auto i: x){cout << i << " ";} cout << "\n";

int main(){
    IOS;
    int n, x, t;
    cin >> n >> x >> t;
    if(n % x == 0){
        cout << (n/x)*t << "\n";
    } else{
        cout << ((n/x) + 1)*t << "\n";
    }
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define NIL -1
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using Field=vector<vector<int>>;

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}

const double PI=(acos(-1));

int main(){
    ll n,d;
    cin>>n>>d;
    int ans=0;
    rep(i,n){
        ll x,y;
        cin>>x>>y;
        long double dis=x*x+y*y;
        dis=pow(dis,0.5);
        if(dis<=(long double)d)++ans;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3700
#include <iostream>
#include <cmath>
#include <cstdio>
#define REP(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,a) REP(i,0,a)
using namespace std;

const int INF = 1 << 28;
int n;
double xyzr[101][4], cost[101][101];

double calc(int i,int j) {
    double d = 0.0;
    rep(k,3) d += (xyzr[i][k]-xyzr[j][k])*(xyzr[i][k]-xyzr[j][k]);
    d = sqrt(d);
    return max(0.0, d-xyzr[i][3]-xyzr[j][3]);
}

int main(void){
    while (cin >> n, n) {
        rep(i,n) rep(j,4) cin >> xyzr[i][j];
        
        rep(i,n) REP(j,i+1,n) cost[i][j] = cost[j][i] = calc(i,j);
        double mincost[n];
        bool used[n];
        rep(i,n) {
            mincost[i] = INF;
            used[i] = false;
        }
        mincost[0] = 0.0;
        double ans = 0.0;
        
        while (1) {
            int v = -1;
            rep(u,n) {
                if (!used[u] && (v == -1 || mincost[u] < mincost[v])) v = u;
            }
            if (v == -1) break;
            used[v] = true;
            ans += mincost[v];
            rep(u,n) mincost[u] = min(mincost[u], cost[u][v]);
        }
        printf("%.3f\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1324
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7


s=input().rstrip()
u=list(map(int,s))
k=sum(u)
if int(s)%k==0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3316
package main

import (
	"sort"
	"fmt"
	"bufio"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	n, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return n
}

func intSlice(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func init() {
	sc.Split(bufio.ScanWords)
}

func contain(s []int, t int) bool {
	l := 0
	r := len(s)

	for l < r {
		cur := (l+r) / 2
		if s[cur] == t {
			return true
		}

		if s[cur] > t {
			r = cur
		} else if s[cur] < t {
			l = cur + 1
		}
	}
	return false
}

func main() {
	n := nextInt()
	S := intSlice(n)
	m := nextInt()
	T := intSlice(m)

	sort.Sort(sort.IntSlice(S))

	containCount := 0
	for _, t := range T {
		if contain(S, t) {
			containCount++
		}
	}
	fmt.Println(containCount)
}



Measured memory_bytes: 3084
S = input()
T = input()

min_c = 10000000

for i in range(len(S)-len(T)+1):
    c = 0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            c+=1

    min_c = min(c,min_c)
print(min_c)

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

        int main() {
          int N;
          cin>> N; 
          
          
          
          
          vector<int> A(N);
          int S=0;
          int D=0; 
          
          for(int i=0; i<N; i++){
                cin>> A.at(i); 
                S =S +A.at(i);
                D =D+A.at(i)*A.at(i); 
          }

          cout<< (S*S-D)/2<<endl;
          
          
          

        }


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

ll f(ll x, vector<ll> a) {
	ll rsl = 0;
	rep(i, 0, a.size()) rsl += (x % a[i]);
	return rsl;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

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

	ll N;
	cin >> N;
	vector<ll> a(N);
	ll rsl = 0;
	rep(i, 0, N) {
		cin >> a[i];
		rsl += (a[i] - 1);
	}

	cout << rsl << endl;
}


Measured memory_bytes: 256
// sonntyou.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;
int n, p;
int main(void) {
	while (1) {
		cin >> n >> p;
		int scr[50] = {}, wan = p;
		int i = 0;
		if (n == 0 && p == 0) break;
		while (1) {
			if (wan >= 1) {
				scr[i]++;
				wan--;
				if (wan == 0 && scr[i] == p) {
					cout << i << endl;
					break;
				}
			}
			else {
				wan += scr[i];
				scr[i] = 0;
			}
			i = (i + 1) % n;
		}
	}
	return 0;
}


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

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

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>

using namespace std;

typedef unsigned long long ull;

const ull MOD = 1e9 + 7;

int main()
{
    int N;
    
    cin >> N;
    
    ull power = 1;
    for (int i = 1; i <= N; i++)
    {
        power *= i;
        power %= MOD;
    }
    
    printf("%lld\n", power);
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------

int main(){
  bool ans = false;
  int a,b,k;
  cin>>k>>a>>b;
  for(int i=a;i<=b;i++){
      if(i%k==0){
          ans=true;
          break;
  }
}
if(ans)cout<<"OK"<<endl;
else cout<<"NG"<<endl;
}
   



Measured memory_bytes: 3624