akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

vector<int> g[200];
int main() {
  int n;
  while(cin>>n) {
    REP(i,n) g[i].clear();
    REP(i,n) {
      string s;
      cin >> s;
      REP(j,n) if (s[j]=='1') g[i].push_back(j);
    }
    int ans = -1;
    REP(s,n) {
      vector<int> dist(n,-1);
      queue<int> Q;
      dist[s] = 0;
      Q.push(s);
      int ng = 0;
      int tmp = 0;
      while(!Q.empty()) {
        int v = Q.front();Q.pop();
        int d = dist[v];
        tmp = d;
        FOR(it, g[v]) {
          if (dist[*it] == -1) {
            dist[*it] = d + 1;
            Q.push(*it);
          } else if (dist[*it] == d) {
            ng = 1;
            break;
          }
        }
        if (ng) break;
      }
      if (!ng) {
        chmax(ans,tmp+1);
      }
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<stdio.h>
#include<map>
#include<queue>
#include<vector>
using namespace std;
const int maxn=1e5+10;

typedef long long ll;

ll a[maxn];

int main(){
	ll n,m;
	cin>>n>>m;
	
	ll lcm=1;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(lcm>1e9) continue;
		lcm=lcm*a[i]/2 / __gcd(lcm,a[i]/2);
	}
	
	bool flag=0;
	for(int i=0;i<n;i++){
		ll t=lcm*2/a[i];
		if(t%2==0){
			flag=1;
			break;
		}
	}
	
	//个数=在此范围内的最小公倍数的奇数倍个数 
	ll ans=m/lcm;
	if(ans&1) ans=ans/2+1;
	else ans/=2;
	if(flag) cout<<"0";
	else cout<<ans;
	return 0;
}

Measured memory_bytes: 4356
def main():

    n = int(input())
    # activities = [[int(x) for x in input().split()] for _ in range(n)]
    dp = [0] * 3
    # dp[i] - the total happiness such that we did activity i on the last considered day
    for day in range(n):
        new_dp = [0] * 3
        activities = [int(x) for x in input().split()]
        for i in range(3):
            for j in range(3):
                if i != j:
                    new_dp[j] = max(new_dp[j], dp[i] + activities[j])
        dp = new_dp
    print(max(dp))


main()


Measured memory_bytes: 3188
<?php
$S = str_split(trim(fgets(STDIN)));
$long = count($S);
$ans = 1000;

for ($i = 0;$i < $long-2;$i++){
  $num = $S[$i].$S[$i+1].$S[$i+2];
  if ($ans>abs(753-$num)){
    $ans = abs(753-$num);
  }
}
echo $ans;

Measured memory_bytes: 3828
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
using namespace std;
int main(){
  string a,b,c;
  cin>>a>>b>>c;
  cout<<a[0]<<b[1]<<c[2];
  system ("pause");
  return 0;
  }

Measured memory_bytes: 504
#include <bits/stdc++.h>
#define MAXN 100000
long long v[MAXN+1];
int n;
long long a,b;
inline long long check(long long tot){
   long long ans=0;
   for(int i=1;i<=n;i++)
      if(v[i]>tot*b)
        ans+=(v[i]-tot*b)/(a-b)+((v[i]-tot*b)%(a-b)>0);
   return ans;
}
int main() {
    FILE * fi, * fout;
    int i;
   // fi = fopen("A.in" ,"r");
   // fout = fopen("A.out" ,"w");
    fi=stdin;
    fout=stdout;
    fscanf(fi,"%d%lld%lld" ,&n,&a,&b);
    for(i=1;i<=n;i++)
      fscanf(fi,"%d" ,&v[i]);
    int rez=0;
    for(int pas=1<<30;pas;pas>>=1)
      if(check(rez+pas)>rez+pas)
        rez+=pas;
    fprintf(fout,"%d\n" ,rez+1);
    //fclose(fi);
    //fclose(fout);
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
int main(void)
{
	int L;
	char S[100][1100], T[100][1100], tmp[][110] = {""};
	scanf("%s%s", S, T);
	L = strlen(S[0]);
	strncpy(tmp[0],S[0],L);
	strncat(S[0], tmp[0],L);
	if (strstr(S[0], T[0])) {
		printf("Yes");
	}
	else {
		printf("No");
	}

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int K=3e5+5;
int x[K],y[K];
vector<int>v[K];
vector<int>p[K];
map<pair<int,int>,bool>mp;
int numx[K],numy[K];
int maxx,maxy;
bool calx[K],caly[K];
int main(){
	int n,m,k;
	scanf("%d %d %d",&n,&m,&k);
	for(int i=1;i<=k;i++){
		scanf("%d %d",&x[i],&y[i]);
		mp[pair<int,int>{x[i],y[i]}]=1;
		v[x[i]].push_back(y[i]);
		p[y[i]].push_back(x[i]);
		numx[x[i]]++;
		numy[y[i]]++;
		maxx=max(maxx,numx[x[i]]);
		maxy=max(maxy,numy[y[i]]);
	}
	int ans=0;
	long long num=0;
//	printf("\n%d %d\n",maxx,maxy);
//	printf("%d %d\n",numx[maxx],numy[maxy]);
	int nx=0,ny=0;
	for(int i=1;i<=k;i++){
		if(numx[x[i]]==maxx&&numy[y[i]]==maxy) num++;
		if(numx[x[i]]==maxx&&!calx[x[i]]) nx++,calx[x[i]]=1;
		if(numy[y[i]]==maxy&&!caly[y[i]]) ny++,caly[y[i]]=1;
	}
	if(num==1ll*nx*ny){
		printf("%d",maxx+maxy-1);
	}
	else printf("%d",maxx+maxy);
	return 0;
}

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

int main(void){
	int n,i,dt,dx,dy,ans=1;

	scanf("%d",&n);

	int t[n+1],x[n+1],y[n+1];

	t[0]=0,x[0]=0,y[0]=0;

	for(i=1;i<=n;i++){
		scanf("%d %d %d",&t[i],&x[i],&y[i]);
	}

	for(i=1;i<=n;i++){
		dt=t[i]-t[i-1];
		dx=abs(x[i]-x[i-1]);
		dy=abs(y[i]-y[i-1]);

		if(dt<dx+dy || (dt-(dx+dy))%2!=0){
			ans=-1;
			break;
		}
	}

	if(ans==1){
		printf("Yes");
	}else if(ans==-1){
		printf("No");
	}

	return 0;

}

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

using namespace std;

#define fl(x,n) for(x=0;x<n;x++)
#define I(x) cin>>x
#define O(x) cout<<x<<endl
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define St(name) stack<string>name
#define lld long long int
#define INF 1000000 
int final_func(int k, int h[], int dp[]){
	dp[0] = 0;
	dp[1] = abs(h[1]-h[0]);
	for(int i = 2; i<k; i++){
		dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
	}
	return dp[k-1];
}



int main(){
    fast;
    int n;
    cin>>n;
    int h[n],dp[n];
    for(int i = 0; i<n; i++)
    	cin>>h[i];
    int result = final_func(n, h, dp);
    cout<<result;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<unistd.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define ST first
#define ND second
#define ll long long
#define ld long double
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using namespace std;
using namespace __gnu_pbds;
 
// replace ll  with pair if multiset needed
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ordered_set secik;
 
const ll  INF = 1e9 + 9;
const ll  MOD = 1e9 + 7;
const long long LINF = (ll)1e18 + 3;
 
// secik.insert({x, t++});
// secik.erase(secik.lower_bound({x,-1}));
// *secik.find_by_order(x)).first << "\n";
// secik.order_of_key(x)
 
//random_device device;
//mt19937 gener(device());
//uniform_int_distribution<ll > gen(0,n-1);
//gen(gener); // generate random number



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

	ll a,b,c,d; cin >> a >> b >> c >> d;
	ll ans = -LINF;
	if(b - a + 1 == 1){
		if(d - c + 1 == 1){
			ans = max(ans,a*c);
		} else {
			ans = max(ans,a*c);
			ans = max(ans,a*d);
		}
	} else {
		if(d - c + 1 == 1){
			ans = max(ans,a*c);
			ans = max(ans,b*c);
		} else {
			ans = max(ans,a*c);
			ans = max(ans,b*c);
			ans = max(ans,a*d);
			ans = max(ans,b*d);
		}
	}
	
	cout << ans;

















	
	return 0;
 
}

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

void solve(long long K, long long A, long long B)
{
    bool a = false;

    for (int i = A; i <= B; i++)
    {
        if (i % K == 0)
        {
            a = true;
            break;
        }
    }

    if (a)
    {
        cout << "OK" << endl;
    }
    else
    {
        cout << "NG" << endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long K;
    scanf("%lld", &K);
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    solve(K, A, B);
    return 0;
}


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

long long int comp(const void *a, const void *b)
{
    return *(long long *)a - *(long long *)b;
}

int main()
{
  int n;  
  scanf("%d", &n);
    
  long long int a[n];
  for(int i=0;i<n;i++){
    scanf("%lld", &a[i]);
  }

  qsort(a, n, sizeof(long long int), comp);
  
  for(int i=1;i<n;i++){
    if(a[i-1] == a[i]){
        printf("NO");
        return 0;
    }
  }
  printf("YES");
  return 0;
}

Measured memory_bytes: 3324
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007

int main() {
    int n; long long k; cin >> n >> k;
    vector<int> a(n);
    map<int, long long> m;
    for (int i = 0; i < n; i++) {
        cin >> a[i]; m[-a[i]]++;
    }
    long long s = 0;
    for (int i = 0; i < n-1; i++) {
        for (int j = i+1; j < n; j++) {
            if (a[i] > a[j]) s++;
        }
    }
    long long ans = s * k % mod;
    long long remain = n;
    for (auto x: m) {
        long long d = x.second;
        remain -= d;
        long long mul = d * (k * (k-1) / 2 % mod) % mod;
        ans += remain * mul % mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
      ios::sync_with_stdio(false);
      cin.tie(0);
    int n,m;
    cin>>n>>m;
    if(n==m){
        cout<<"Yes";
    }
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 3640
#include<cstdio>
int main(){
	char s[8001]={};
	scanf("%s",s);
	int x,y;
	int ans=0;
	scanf("%d%d",&x,&y);
	int a[5000]={};
	int k=0;
	int l=0;
	for(int i=0;1;i++){
		if(s[i]=='F'){
			k++;
		}else{
			a[l]+=k;
			k=0;
			l++;
		}
		if(s[i]==0){
			break;
		}
	}
	if(l==1){
		if(a[0]==x)ans=2;
	}else{
	int b[(l+1)/2]={};
	int c[l/2]={};
	for(int i=0;i<l;i++){
		if(i%2==0)b[i/2]=a[i];
		else c[i/2]=a[i];
	}
	int dpb[16001]={};
	int dpc[16001]={};
	dpb[8000+b[0]]=1;
	for(int i=1;i<(l+1)/2;i++){
		int dpbb[16001]={};
		for(int j=0;j<=16000;j++){
			if(dpb[j]==1){
				dpbb[j+b[i]]=1;
				dpbb[j-b[i]]=1;
			}
		}
		for(int j=0;j<=16000;j++){
			dpb[j]=dpbb[j];
		}
	}
	if(dpb[x+8000]==1)ans++;

	dpc[8000+c[0]]=1;
	dpc[8000-c[0]]=1;
	for(int i=1;i<l/2;i++){
		int dpcc[16001]={};
		for(int j=0;j<=16000;j++){
			if(dpc[j]==1){
				dpcc[j+c[i]]=1;
				dpcc[j-c[i]]=1;
			}
		}
		for(int j=0;j<=16000;j++){
			dpc[j]=dpcc[j];
		}
	}
	if(dpc[y+8000]==1)ans++;
	}
	if(ans==2)printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 384
N, M = map(int, input().split())
items = []
for i in range(M):
    items.append(tuple(map(int, input().split())))

red = [False] * N
box = [1] * N
red[0] = True

for i in range(M):
    x, y = items[i]
    x, y = x - 1, y - 1

    if box[x] and red[x]:
        red[y] = True

    if box[x] == 1 and red[x]:
        red[x] = False

    box[x] -= 1
    box[y] += 1

print(red.count(True))


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

#ifndef EPS
#define EPS (1e-10)
#endif
struct Point {
	double x, y;
	Point(double x = 0, double y = 0) :x(x), y(y) {}
	Point operator+(const Point&p)const { return Point(x + p.x, y + p.y); }
	Point operator-(const Point&p)const { return Point(x - p.x, y - p.y); }
	Point operator*(double a) { return Point(a*x, a*y); }
	Point operator/(double a) { return Point(x / a, y / a); }

	double norm() { return x*x + y*y; }
	double abs() { return sqrt(norm()); }

	double dot(const Point&p)const{
		return x*p.x+y*p.y;
	}
	double det(const Point&p)const{
		return x*p.y-y*p.x;
	}
	bool operator<(const Point&p)const {
		return x != p.x ? x < p.x : y < p.y;
	}
	bool operator==(const Point&p)const {
		return fabs(x - p.x) < EPS&&fabs(y - p.y) < EPS;
	}
};
typedef pair<Point,int>P;

P p[100],q[100];

vector<P>convex_hull(P*ps,int n){
	sort(ps,ps+n);
	int k=0;
	vector<P>qs(n*2);
	rep(i,n){
		while(k>1&&(qs[k-1].first-qs[k-2].first).det(ps[i].first-qs[k-1].first)<=0)k--;
		qs[k++]=ps[i];
	}
	for(int i=n-2,t=k;i>=0;i--){
		while(k>t&&(qs[k-1].first-qs[k-2].first).det(ps[i].first-qs[k-1].first)<=0)k--;
		qs[k++]=ps[i];
	}
	qs.resize(k-1);
	return qs;
}
int par[100];
int find(int x){
	if(x==par[x])return x;
	return par[x]=find(par[x]);
}
void unite(int x,int y){par[find(x)]=find(y);}
struct st{int a,b;double c;};
int main(){
	int v,r;scanf("%d%d",&v,&r);
	rep(i,v)scanf("%lf%lf",&p[i].first.x,&p[i].first.y),p[i].second=i,q[i]=p[i];
	rep(i,v)par[i]=i;
	vector<P>res=convex_hull(p,v);
	double ans=0;
	rep(i,res.size()){
		ans+=(res[(i+1)%res.size()].first-res[i].first).abs();
		unite(res[(i+1)%res.size()].second,res[i].second);
	}
	vector<st>u;
	rep(i,r){
		int a,b;scanf("%d%d",&a,&b);a--;b--;
		u.push_back({a,b,(q[a].first-q[b].first).abs()});
	}
	sort(u.begin(),u.end(),[](st&a,st&b){return a.c<b.c;});
	rep(i,u.size()){
		if(find(u[i].a)==find(u[i].b))continue;
		ans+=u[i].c;unite(u[i].a,u[i].b);
	}
	printf("%.7lf\n",ans);
}

Measured memory_bytes: 3276
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node
{
int key;
Node *next, *prev;
};

Node *nil;

Node* listSearch(int key)
{
Node *cur=nil->next;
while(cur !=nil && cur->key !=key)
{
cur =cur->next;
}
return cur;
}

void init()
{
nil =(Node *)malloc(sizeof(Node));
nil->next = nil;
nil->prev = nil;
}

void printList()
{
Node *cur=nil->next;
int isf=0;
while(1)
{
if(cur==nil)break;
if(isf++ > 0)printf(" ");
printf("%d",cur->key);
cur=cur->next;
}
printf("\n");
}

void deleteNode(Node *u)
{
if(u==nil)return;
u->prev->next = u->next;
u->next->prev = u->prev;
free(u);
}

void deleteFirst()
{
deleteNode(nil->next);
}

void deleteLast()
{
deleteNode(nil->prev);
}

void deleteKey(int key)
{
deleteNode(listSearch(key));
}

void insert(int key)
{
Node *y =(Node *)malloc(sizeof(Node));
y->key = key;
y->next = nil->next;
nil->next->prev=y;
nil->next=y;
y->prev = nil;
}

int main()
{
int key,n,i;
int size =0;
char com[20];
int np =0;
int nd=0;
scanf("%d",&n);
init();
for(i=0;i<n;i++)
{
scanf("%s%d", com, &key);
if(com[0]=='i')
{
insert(key);np++;size++;
}
else if(com[0]=='d')
{
if(strlen(com) >6)
{
if(com[6]=='F')deleteFirst();
else if (com[6]=='L')deleteLast();
}
else
{
deleteKey(key);nd++;
}
size--;
}
}

printList();

return 0;
}



Measured memory_bytes: 33792
#include <iostream>
#include <algorithm>
#include <vector>


#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define rREP(i, n) for(int (i) = (n) - 1; (i) >= 0; --(i))


using lli = long long int;
using pii = std::pair<int, int>;

class UnionFindTree{
    #define Repeat(i, k) for(int (i) = 0; (i) < (k); ++(i))
private:
    const int n;
    std::vector<int> Parent;
    std::vector<int> Size;
public:
    UnionFindTree(int nn): n(nn){
        Parent.resize(n); Size.resize(n, 1);
        Repeat(i, n) { Parent[i] = i; Size[i] = 1;}
    }
    int rootOf(int v){
        if(v == Parent[v]) return v;
        int pv = rootOf(Parent[v]);
        Parent[v] = pv;
        return pv;
    }
    int size(int v){
        return Size[rootOf(v)];
    }
    bool merge(int a, int b){
        int A = rootOf(a),
            B = rootOf(b);
        if(A == B) return false;
        if(Size[A] > Size[B]) std::swap(A, B);
        Parent[A] = B;
        Size[B] += Size[A];
        return true;
    }
    #undef Repeat
};

std::vector<pii> Q;
std::vector<lli> Ans;

int main(void){
    int n, m; scanf("%d%d", &n, &m);
    Ans.resize(m); Q.resize(m);
    UnionFindTree UFT(n);

    lli A = n; (A *= (n - 1)) >>= 1;

    REP(i, m){
        int a, b; scanf("%d%d", &a, &b);
        Q[i] = pii(a-1, b-1);
    }

    rREP(i, m){
        Ans[i] = A;
        int S1 = UFT.size(Q[i].first);
        int S2 = UFT.size(Q[i].second);
        if(UFT.merge(Q[i].first, Q[i].second)) A -= (lli)(S1) * S2;
    }
    REP(i, m) printf("%lld\n", Ans[i]);
    return 0;
}

Measured memory_bytes: 3712
w = input()
d = dict()

for i in range(len(w)):
    if w[i] in d:
        d[w[i]] += 1
    else:
        d[w[i]] = 1

ans = "Yes"
for k in d.keys():
    if d[k] % 2:
        ans = "No"
        break

print(ans)


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

int main() {
    int N, K; cin >> N >> K;
    int a[N]; REP(i, N) cin >> a[i];
    int dp[K+1]; REP(i, K+1) dp[i] = 0;
    bool can;
    REP(i, K+1){
        can = false;
        REP(j, N){
            if (i-a[j] < 0){
                continue;
            }
            if (dp[i-a[j]] == 0){
                can = true;
            }
        }
        if (can){
            dp[i] = 1;
        }
    }
    if (dp[K] == 1){
        cout << "First" << endl;
    }
    else{
        cout << "Second" << endl;
    }
}

Measured memory_bytes: 640
n = gets.to_i
h = gets.split.map &:to_i

def stairs(n,h)
  (n-1).downto(0) do |i|
    if i == 0
      puts "Yes"
      exit
    end
    if h[i-1] - h[i] > 1
      puts "No"
      exit
    elsif h[i-1] - h[i] == 1
      h[i-1] -= 1
    end
  end
end

puts stairs(n,h)


Measured memory_bytes: 8580
N, K = map(int, input().split())
H = list(map(int, input().split()))
 
INF = 10**9
 
dp = [INF]*N
dp[0] = 0
 
for i in range(N):
    for j in range(1, min(i+1, K+1)):
        dp[i] = min(dp[i], dp[i-j]+abs(H[i]-H[i-j]))
 
print(dp[N-1])

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

int main() {
  ll n, m; cin >>n >>m;
  ll t = 1900*m + 100 * (n-m);
  // x=t+(1/2)^m*t+1/4t+...=t/(1-(1/2)^m)
  //  = t*2^m/(2^m-1)
  ll buf = 1;
  for (int i=0; i<m; i++) buf *= 2;
  ll ans = t*buf;
  cout <<ans;
  cout <<endl;
}


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

int main(){
  while(1){
    
    int a,c=0;
    cin>>a;
    if(a==0) break;
    for(int n=1;n<=a;n++){
    
      if(n%2==1 && a%n==0){
        c++;
      }else if(n%2==0 && a%n==n/2){
        c++;
      }
    }   
     
    cout<<(c-1)/2<<endl;
  }
      
       
  return 0;
}




Measured memory_bytes: 2996
#include <stdio.h>
#include <string>
#include <cmath>
#include <list>
#include <algorithm>
#include <iostream>

using namespace std;

int main(void)
{
    int a, b, h, m;
    cin >> a >> b >> h >> m;

    static const double pi = 3.141592653589793;

    double xa = a * cos((180 - 60 * h - m) * pi / 360);
    double ya = a * sin((180 - 60 * h - m) * pi / 360);
    double xb = b * cos((15 - m) * pi / 30);
    double yb = b * sin((15 - m) * pi / 30);

    double d = sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
    printf("%.12f", d);
}


Measured memory_bytes: 4008
#!/usr/bin/env python3

def main():
    [N, K] = list(map(int, input().split()))
    s_list = []
    for i in range(N):
        s_list.append(list(map(int, input().split())))

    s_list.sort(key = lambda v: v[1], reverse = True)
    n_set = set()
    A, B = [0], [0]
    tot_a, tot_b = 0, 0
    for td in s_list:
        if not td[0] in n_set:
            n_set.add(td[0])
            tot_a += td[1]
            A.append(tot_a)
        else:
            tot_b += td[1]
            B.append(tot_b)

    min_n = max(1, K - (len(B) - 1))
    max_n = min(K + 1, len(A))
    max_x = 0
    for i in range(min_n, max_n):
        max_x = max(max_x, A[i] + i ** 2 + B[K - i])

    print(max_x)


if __name__ == '__main__':
    main()



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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if(ch=='A')return 1;
  else if(ch=='C')return 2;
  else if(ch=='G')return 3;
  else if(ch=='T')return 4;
  else return 0;
}

long long getkey(char str[]){
  long long s=0,p=1,i;  
  for(i=0;i<strlen(str);i++){
    s+=p * (getChar(str[i]));
    p*=5;
  }
  return s;
}

int h1(int key){
  return key%M;
}

int h2(int key){
  return 1+(key%(M-1));
}

int find(char str[]){
  long long key,i,h;

  key=getkey(str);
  for(i=0; ;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if(strlen(H[h])==0){
      return 0;
    }
  }
  return 0;
}

int insert(char str[]){
  long long key,i,h;
  key=getkey(str);
   for(i=0; ;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(){
  int i,n,h;
  char str[L],co[9];
  for(i=0;i<M;i++){
    H[i][0]='\0';
  }
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",co,str);
    if(co[0]=='i'){
      insert(str);
    }
    else{
      if(find(str)){
	printf("yes\n");
      }
      else{
	printf("no\n");
      }
    }
  }
  return 0;
}



Measured memory_bytes: 16036
#include <iostream>

using namespace std;

int main(){
    int n, a, b, max, min;
    cin >> n >> a >> b;
    if (a < b){
        max = a;
    }
    else{
        max = b;
    }
    if (a + b < n){
        min = 0;
    }
    else{
        min = a + b - n;
    }
    
    cout << max << " "<< min;
    return 0;
}

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

class Main{
    public static void main(String[] a){
         for (int i = 1; i < 10; i++) {
               for(int j = 1; j < 10; j++) {
                     System.out.println(i + "x" + j + "=" + (i * j));
               }
         }
    }
}

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

public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws NumberFormatException 
	 */
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Integer num = Integer.parseInt(br.readLine());
		Boolean[] card_single = new Boolean[13];
		Arrays.fill(card_single, false);
		//S,H,D,C
		Boolean[][] card_set = {card_single.clone(), card_single.clone(), card_single.clone(), card_single.clone()};
		for(int i = 1; i <= num; i++){
			String input = br.readLine();
			String[] card = input.split(" ");
			if(card[0].equals("S")){
				card_set[0] = add_card(card_set[0], card[1]);
			}
			else if(card[0].equals("H")){
				card_set[1] = add_card(card_set[1], card[1]);
			}
			else if(card[0].equals("C")){
				card_set[2] = add_card(card_set[2], card[1]);
			}
			else if(card[0].equals("D")){
				card_set[3] = add_card(card_set[3], card[1]);
			}
		}
		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 13; j++){
				if( !card_set[i][j]){
					print_card(i, j);
				}
			}
		}
	}
	
	private static void print_card(Integer name, Integer number){
		if(name == 0){
			System.out.print("S ");
		}
		else if(name == 1){
			System.out.print("H ");
		}
		else if(name == 2){
			System.out.print("C ");
		}
		else if(name == 3){
			System.out.print("D ");
		}
		System.out.print((number + 1) + "\n");
	}
	private static Boolean[] add_card(Boolean[] set, String position){
		set[Integer.parseInt(position) - 1] = true;
		return set;
	}

}

Measured memory_bytes: 16944
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.20f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

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

	map<string, int> mp;
	for (int i = 0; i < n; ++i) {
		string s;
		cin >> s;
		mp[s]++;
	}

	cout << "AC x " << mp["AC"] << endl;
	cout << "WA x " << mp["WA"] << endl;
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;

	return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int ans = 1e9;
    for (int x = -100; x <= 100; x++)
    {
        int sum = 0;
        rep(i, n)
            sum += (a[i] - x) * (a[i] - x);
        ans = min(ans, sum);
    }

    OP(ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
typedef long long ll;
const int N =1e5+6;
const int mod = 1e9+7;
ll cnt[N];
void solve(){
    int n;
    cin>>n;
    ll ans = 0;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        ans+=x;
        cnt[x]++;
    }
    int q;
    cin>>q;
    while(q--){
        ll a,b;
        cin>>a>>b;
        ans-=a*cnt[a];
        ans+=b*cnt[a];
        cnt[b]+=cnt[a];
        cnt[a] = 0;
        cout<<ans<<endl;
    }
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int t = 1;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 4392
nums = list(map(int, input().split()))
min = 0

for i in range(0, len(nums)):
    for j in range(0, len(nums)):
        if (nums[j] > nums[i]):
            min = nums[j]
            nums[j] = nums[i]
            nums[i] = min

text = " ".join(map(str, nums))
print(text)


Measured memory_bytes: 5592
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line = read_as_vec::<u64>();
    let (mut a, mut b, mut c) = (line[0], line[1], line[2]);

    let mut ans = cmp::min(b, c)*2;
    b -= ans/2;
    c -= ans/2;

    let ac_set = cmp::min(a, c);
    ans += ac_set;
    a -= ac_set;
    c -= ac_set;

    println!("{}", ans + b + cmp::min(1, c));
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
using ll = long long;
using graph = std::vector<std::vector<ll>>;

using namespace std;

int main() {
    ll N,K;
    cin >> N >> K;
    int dif = (N - 1)*(N - 2)/2 - K;
    if(dif < 0){
        cout << -1 << endl;
        return 0;
    }
    cout << N + dif - 1 << endl;
    for(int i = 2; i <= N; i++){
        cout << 1 << " " << i << endl;
    }
    int tmp = 0;
    if(dif == 0){
        return 0;
    }
    for(int i = 2; i <= N - 1; i++){
        for(int j = i + 1; j <= N; j++){
            tmp++;
            cout << i << " " << j << endl;
            if(tmp == dif){
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
#define C
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using static System.Console;
using static System.Math;

class Program
{
    static void Main()
    {
#if A
        var XY = ReadLine().Split().Select(int.Parse).ToArray();
        var X = XY[0];
        var Y = XY[1];
        var ans = Max(0, 4 - X) + Max(0, 4 - Y) + (X == 1 && Y == 1 ? 4 : 0);
        WriteLine(ans * 100000);
#endif
#if B
        var N = int.Parse(ReadLine());
        var A = ReadLine().Split().Select(long.Parse).ToArray();
        var a = new long[N + 1];
        for (int i = 0; i < N; i++)
        {
            a[i + 1] = 2 * A[i] + a[i];
        }
        var m = a[N] / 2;
        var ans = long.MaxValue;
        for (int i = 0; i <= N; i++)
        {
            ans = Min(ans, Abs(a[i] - m));
        }
        WriteLine(ans);
#endif
#if C
        var HWK = ReadLine().Split().Select(int.Parse).ToArray();
        var H = HWK[0];
        var W = HWK[1];
        var K = HWK[2];
        var s = new bool[H, W];
        for (int i = 0; i < H; i++)
        {
            var line = ReadLine();
            for (int j = 0; j < W; j++)
            {
                s[i, j] = line[j] == '#';
            }
        }
        var ha = new bool[H];
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                if (s[i, j]) ha[i] = true;
            }
        }
        var ans = new int[H, W];
        var k = 0;
        for (int i = 0; i < H; i++)
        {
            if (ha[i])
            {
                var b = false;
                k++;
                for (int j = 0; j < W; j++)
                {
                    if (s[i, j])
                    {
                        if (b) k++;
                        b = true;
                    }
                    ans[i, j] = k;
                }
            }
            else
            {
                for (int j = 0; j < W; j++)
                {
                    if (i != 0) ans[i, j] = ans[i - 1, j];
                }
            }
        }
        if (!ha[0])
        {
            for (int i = H-2; i >= 0; i--)
            {
                if(!ha[i])
                for (int j = 0; j < W; j++)
                {
                    ans[i, j] = ans[i+1, j];
                }
            }

        }

        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                Write(ans[i, j]);
                if (j != W - 1) Write(" ");
            }
            WriteLine();
        }
#endif
    }
}

Measured memory_bytes: 15968
#include<iostream>
using namespace std;
string s,t;
int main() {
  int n,f,l,m;cin>>n;f=0;l=n;
  cout<<0<<endl;
  cin>>s;
  if(s=="Vacant")return 0;
  while(t!="Vacant"){
    m=(f+l)/2;
    cout<<m<<endl;
    cin>>t;
    if(m%2^s==t)f=m;
    else l=m;
  }
  return 0;
}

Measured memory_bytes: 852
args = input().split()
N = int(args[0])
A = int(args[1])
B = int(args[2])
s = input()

a = 0
b = 0
for i in range(0, len(s)):
    if s[i] == 'a':
        if a + b < A + B:
            a = a + 1
            print('Yes')
        else:
            print('No')
    elif s[i] == 'b':
        if a + b < A + B and b < B:
            b = b + 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')


Measured memory_bytes: 4016
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 1000000;

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

typedef long long ll;

using namespace std;


/*
class ElectronicPetEasy
{
public:
	string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)
	{
		
	}
};
*/


int prime[50000];
bool is_prime[60000];


void sieve(void)
{
	int p = 0;
	
	REP(60000) is_prime[i] = true;
	is_prime[0] = is_prime[1] = false;
	for (int i=2; i<60000; i++)
	{
		if (is_prime[i])
		{
			prime[p++] = i;
			for (int j=2*i; j<60000; j+=i) is_prime[j] = false;
		}
	}
}


int main()
{
	int n, less, more;
	
	sieve();
	
	while (cin >> n)
	{
		for (int i=0; i<50000; i++)
		{
			if (prime[i] > n)
			{
				more = prime[i];
				break;
			}
		}
		
		for (int i=0; i<50000; i++)
		{
			if (prime[i] >= n)
			{
				less = prime[i - 1];
				break;
			}
		}
		
		cout << less << " " << more << endl;
	}
	
	return 0;
}

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n; cin >> n;
	vector<ll>v1;
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		ll a; cin >> a;
		v1.push_back(a);
		if (i != 0) {
			//cout << "tr2";
			if (v1[i] < v1[i - 1]) {
				//cout << "try";
				sum += (v1[i - 1] - v1[i]);
				v1[i] = v1[i - 1];
			}
		}
	}
	cout << sum;		
	return 0;
}



Measured memory_bytes: 5292
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 998244353;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    vector<P>cnt(N);
    for(int i = 0; i < N; i++) {
        int X,L;
        cin >> X >> L;
        cnt[i].first = X+L;
        cnt[i].second = X-L;
    }
    sort(cnt.begin(),cnt.end());
    int ans = 0;
    int sum = -1000000000;
    for(int i = 0; i < N; i++) {
        if(cnt[i].second >= sum) {
            sum = cnt[i].first;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4808
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl '\n'
#define int long long int
using namespace std;
#define pii pair <int, int>
#define mii map<int, int>
#define pb push_back
#define deb(x) cout << #x << " " << x << endl
#define deb2(x, y) cout << #x << " " << x << " " << #y << " " << y << endl
#define Loop(s, e, itr) for (int itr = s; itr < e; itr++)
#define loop(n) for(int i = 0; i < n; i++)
#define vin vector<int>
#define w(t) int tc; cin >> tc; for(int t = 1; t <= tc; t++)
#define vec vector
#define mod 1000000007
#define all(x) x.begin(), x.end()

int n, W;
int w[105], v[105];

int dp[101][1000005];

int get(int it, int wt){
    if(wt < 0) return INT_MIN;
    if(it == n) return 0;
    if(dp[it][wt] == -1){
        dp[it][wt] = max(get(it+1, wt), get(it+1, wt-w[it]) + v[it]);
    }
    return dp[it][wt];
}

int32_t main(){
    cin >> n >> W;
    loop(n) cin >> w[i] >> v[i];
    memset(dp, -1, sizeof(dp));
    cout << get(0, W);
}

Measured memory_bytes: 792676
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int r;
   cin >> r;
   cout << r*r << '\n';
   return 0;
} 

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

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

namespace nt{
  template<class NUM>
    NUM gcd(NUM a,NUM b){
      while((b=b%a)!=0) swap(a,b);
      return a;
    }
}

int main(){
  ll a,b,c,d; cin >> a >> b >> c >> d;
  ll lcm=c*d/nt::gcd(c,d);

  ll cnt[3];

  cnt[0] = b/lcm - (a-1)/lcm;
  cnt[1] = b/c   - (a-1)/c;
  cnt[2] = b/d   - (a-1)/d;

  cout << b-a+1+cnt[0]-cnt[1]-cnt[2] << endl;

  return 0;
}

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

int main(){
  int x[5];
  for(int i=0;i<5;i++){
    cin >> x[i];
  }
  for(int i=0;i<5;i++){
    if(x[i]==0){
      cout << i+1 <<endl;
    }
  }
}

Measured memory_bytes: 3616
#include "cstdio"
#define LL  unsigned long long

LL gcd(LL x,LL y)
{
    return y?gcd(y,x%y):x;
}

int main()
{
    LL num[104];
    int n;
    while (scanf ("%d",&n) != EOF)
    {
        for (int i=0;i<n;i++)
        {
            scanf ("%llu",&num[i]);
        }
        LL _gcd;
        LL ans = num[0];
        for (int i=1;i<n;i++)
        {
            _gcd = gcd(ans,num[i]);
            ans = num[i] /  _gcd * ans;
        }
        printf ("%llu\n",ans);
    }
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String input = scan.nextLine();
        int n = Integer.parseInt(input.split(" ")[0]);
        double d = Integer.parseInt(input.split(" ")[1]);
        int c = 0;
        int[][] x = new int[n][2];
        for(int i = 0; i < n ; i++){
            input = scan.nextLine();
            x[i][0] = Integer.parseInt(input.split(" ")[0]);
            x[i][1] = Integer.parseInt(input.split(" ")[1]);
            if(d >= Math.sqrt(Math.pow(x[i][0] , 2) + Math.pow(x[i][1] , 2))){
                c += 1;
            }
        }
        System.out.println(c);
    }
}


Measured memory_bytes: 67108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int N,K,S;
    cin>>N>>K>>S;
    int rem=S+1;
    if(rem>1000000000) rem=1;
    rep(i,K) cout<<S<<" ";
    for(int i=K;i<N;i++) cout<<rem<<" ";
    cout<<endl;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define llong long long int
#define ullong unsigned long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
const static long long int MOD = 1000000000 + 7;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a, b, k;
    cin >> a >> b >> k;
    if (a == b) {
        cout << a << endl;
        return 0;
    }
    if ((b - a) % 2) {
        if (k >= (b - a + 1) / 2) {
            for (int i = a; i <= b; ++i) {
                cout << i << endl;
            }
        } else {
            for (int i = a; i < a + k; ++i) {
                cout << i << endl;
            }

            for (int i = b - k + 1; i <= b ; ++i) {
                cout << i << endl;
            }
        }
    } else {
        if (k > ceil((b - a + 1) / 2)) {
            for (int i = a; i <= b; ++i) {
                cout << i << endl;
            }
        } else {
            for (int i = a; i < a + k; ++i) {
                cout << i << endl;
            }

            for (int i = b - k + 1; i <= b ; ++i) {
                cout << i << endl;
            }
        }
    }

    return 0;
}

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

int main(){
	int N,M;
	char A[50][50],B[50][50];
	scanf("%d %d",&N,&M);
	for(int i=0;i<N;i++) scanf(" %s",A[i]);
	for(int i=0;i<M;i++) scanf(" %s",B[i]);
	bool yes;
	for(int i=0;i<(N-M+1)*(N-M+1);i++){
		yes=true;
		for(int j=0;j<M*M;j++){
		    if(A[i/(N-M+1)+j/M][i%(N-M+1)+j%M]!=B[j/M][j%M]){
		    	yes=false;
		    	break;
		    }
		}
		if(yes) break;
	}
	
	if(yes) printf("Yes");
	else printf("No");
}

Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]



s = sorted(input())

if "".join(s) == "abc":
    print("Yes")
else:
    print("No")



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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  while(1) {
    int x, y;
    cin >> x >> y;
    if(x == 0 & y == 0) {
      break;
    }
    if(x > y) {
      swap(x, y);
    }
    cout << x << ' ' << y << endl;
  }
  return 0;
}


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

int main(void) {
    int r, c;
    int total = 0;
    cin >> r >> c;
    int a[r + 1][c + 1] = {};
    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            cin >> a[i][j];
            a[i][c] += a[i][j];
            a[r][j] += a[i][j];
            a[r][c] += a[i][j];
            cout << a[i][j] << " ";
        }
        cout << a[i][c] << endl;
    }
    
    for (int i = 0; i < c; i++) {
        cout << a[r][i] << " ";
    }
    cout << a[r][c] << endl;

    return 0;
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
ll H,W,K;
ll dy[4]={-1,0,0,1};
ll dx[4]={0,1,-1,0};
char A[805][805];
ll B[805][805];
int main(){
  cin>>H>>W>>K;
  for(ll i=0;i<H;i++){
  string s;cin>>s;
    for(ll j=0;j<W;j++){
    A[i][j]=s[j];
    }
  }ll I,J;
  for(ll i=0;i<H;i++)
    for(ll j=0;j<W;j++)
      if(A[i][j]!='S')
        B[i][j]=-1;
  else{I=i;J=j;
    B[i][j]=0;
  }queue<P>que;P p11(I,J);que.push(p11);
  while(!que.empty()){
  P p=que.front();
    que.pop();
    ll y=p.first;ll x=p.second;
    for(ll i=0;i<4;i++)
      if(0<=dy[i]+y && dy[i]+y<H &&0<=dx[i]+x && dx[i]+x<W){
      ll Y=dy[i]+y;ll X=dx[i]+x;
        if(A[Y][X]=='.'&& B[Y][X]==-1){
          B[Y][X]=B[y][x]+1;
        P q(Y,X);que.push(q);
        }
      }
   }ll ans=10000000000;
  for(ll i=0;i<H;i++)
    for(ll j=0;j<W;j++)
      if(B[i][j]!=-1&& B[i][j]<=K){
      ll a=1+(min(min(i,H-1-i),min(j,W-1-j))+K-1)/K;
      if(a<ans)ans=a;
       }cout<<ans<<endl;
  return 0;
}

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

int main() {
int N, Ans = 1;cin >> N;
vector<int> H(N);

for(int i = 0; i < N; i++){
cin >> H.at(i);
}


for(int m = 1; m < N; m++){
int count = 0;

for(int i = 0; i < m; i++){
if(H.at(i) <= H.at(m))count++;
}

if(count == m)Ans++;

}
cout << Ans << endl;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
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;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
//////////////////////////

#define MAX_N (ll)2E7///変更！！！！！！！
vector<ll>prime;
bool is_prime[MAX_N+1];
void precal(){
    rep(i,0,MAX_N)is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    rep(i,2,MAX_N){
        if(is_prime[i]){
            prime.pb(i);
            for(ll j=2*i;j<=MAX_N;j+=i)is_prime[j]=false;
        }
    }
}
vector<l_l> fact(ll n){
    vector<l_l>v;
    for(ll p:prime){
        if(p*p>n)break;
        ll c=0;
        while(n%p==0){
            n/=p;
            c++;
        }
        if(c)v.pb(l_l(p,c));//pという素因数がc個入っている
    }
    if(n!=1){
        ll vsize=v.size();
        if(vsize>=1&&v[vsize-1].first==n)v[vsize-1].second++;
        else v.pb(l_l(n,1));
    }
    if(v.size()==0){
        v.pb(l_l(1,1));
    }
    return v;
}
/////////////////////////////////////////////////////

int main(){fastio
    precal();
    ll n,p;cin>>n>>p;
    vector<l_l>f=fact(p);
    ll ans=1;
    for(auto x:f){
        ans*=powl(x.fi,x.se/n);
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 38376
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  cin >> N;
  vector<ll> memo(10005, 0);
  for (int x = 1; x <= 105; x++) {
    for (int y = 1; y <= 105; y++) {
      for (int z = 1; y <= 105; z++) {
        if (x + y + z > 1000) break;
        ll n = x * x + y * y + z * z + x * y + y * z + z * x;
        if (n < 10005) memo[n]++;
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    cout << memo[i] << endl;
  }
  return 0;
}

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

using namespace std;

int main() {
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            int val = 0;
            if (j >= a)
                val = 1 - val;
            if (i >= b)
                val = 1 - val;
            cout << val;
        }
        cout << "\n";
    }
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define N 200005
#define inf 0x3f3f3f3f
#define ls x<<1,l,mid
#define rs x<<1|1,mid+1,r
using namespace std;
int n;
int mn1[N*8],mn2[N*8],a[N],lazy[N*8];
void push_up(int x)
{
    mn1[x]=min(mn1[x<<1],mn1[x<<1|1]);
    mn2[x]=min(mn2[x<<1],mn2[x<<1|1]);
}
void push_down(int x)
{
    if(lazy[x])
    {
        int l=x*2,r=x*2+1;
        lazy[l]^=1;lazy[r]^=1;
        lazy[x]^=1;
        swap(mn1[l],mn2[l]);
        swap(mn1[r],mn2[r]);
    }
    return ;
}
void build(int x,int l,int r)
{
    if(l==r)
    {
        if(l%2==1)mn1[x]=a[l],mn2[x]=inf;
        else mn1[x]=inf,mn2[x]=a[l];
        return ;
    }
    int mid=(l+r)>>1;
    build(ls);build(rs);
    push_up(x);
}
int qur(int x,int l,int r,int ll,int rr,int op)
{
    if(ll<=l&&rr>=r)
    {
        if(op==1)return mn1[x];
        return mn2[x];
    }
    int mid=(l+r)>>1;
    push_down(x);
    if(ll>mid)return qur(rs,ll,rr,op);
    if(rr<=mid)return qur(ls,ll,rr,op);
    return min(qur(ls,ll,rr,op),qur(rs,ll,rr,op));
}
void del(int x,int l,int r,int pos)
{
    if(l==r){mn1[x]=mn2[x]=inf;return ;}
    int mid=(l+r)>>1;
    push_down(x);
    if(pos<=mid)del(ls,pos);
    else del(rs,pos);
    push_up(x);
}
void rev(int x,int l,int r,int ll,int rr)
{
    if(ll<=l&&rr>=r)
    {
        lazy[x]^=1;
        swap(mn1[x],mn2[x]);
        return ;
    }
    int mid=(l+r)>>1;
    push_down(x);
    if(ll<=mid)rev(ls,ll,rr);
    if(rr>mid)rev(rs,ll,rr);
    push_up(x);
}
set<int>t;
int fan[N];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]),fan[a[i]]=i;
    build(1,1,n);
    t.insert(n+1);
    for(int i=1;i<=n/2;i++)
    {
        int t1=qur(1,1,n,1,n,1);
        int nt=(*t.lower_bound(fan[t1]));
        int t2=qur(1,1,n,fan[t1],nt-1,2);
        printf("%d %d ",t1,t2);
        del(1,1,n,fan[t1]);del(1,1,n,fan[t2]);
        rev(1,1,n,fan[t1],fan[t2]);
        t.insert(fan[t1]);t.insert(fan[t2]);
    }puts("");
    return 0;
}

Measured memory_bytes: 23168