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

int main(){
  int a;
  cin>>a;
  if(a==25)
    cout<<"Christmas"<<endl;
  if(a==24)
    cout<<"Christmas Eve"<<endl;
  if(a==23)
    cout<<"Christmas Eve Eve"<<endl;
  if(a==22)
    cout<<"Christmas Eve Eve Eve"<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
        int n,k;
    scanf("%d%d",&n,&k);

    double ans=0;
    double kakuritu;
    int j;
    for(int i=1;i<=n;i++)
    {
        j=i;
        kakuritu=1;
        while(j<k)
        {
            j*=2;
            kakuritu*=0.5;
        }
        ans+=kakuritu;
    }
    ans/=n;
    printf("%.12lf",ans);
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;

int my_pow(int a,int n){
    if(n==0) return 1;
    else return a*my_pow(a,n-1);
}

int main() {
    ll N;
    cin >> N;
    vector<int> l={3,5,7};
    int ans=0;
    for(int i=3;i<=9;i++){
        for(int j=0;j<my_pow(3,i);j++){
            int temp=0;
            int pre=j;
            int ct=0;
            int jg3=0,jg5=0,jg7=0;
            while(ct<i){
                temp+=my_pow(10,ct)*l[pre%3];
                if(pre%3==0) jg3=1;
                if(pre%3==1) jg5=1;
                if(pre%3==2) jg7=1;
                pre/=3;
                ct++;
            }
            if(jg3==1 && jg5==1 && jg7==1 && temp<=N) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// Tazoe

#include <iostream>
using namespace std;

void DFS(const int M[30][30], int D[30][30], int Y, int X, int C)
{
	D[Y][X] = C;

	if(M[Y][X]%2==0&&D[Y-1][X]>C+1){
		DFS(M, D, Y-1, X, C+1);
	}

	if(M[Y][X]/2%2==0&&D[Y+1][X]>C+1){
		DFS(M, D, Y+1, X, C+1);
	}

	if(M[Y][X]/4%2==0&&D[Y][X-1]>C+1){
		DFS(M, D, Y, X-1, C+1);
	}

	if(M[Y][X]/8%2==0&&D[Y][X+1]>C+1){
		DFS(M, D, Y, X+1, C+1);
	}
}

int main()
{
	while(true){
		int w, h;
		cin >> w >> h;

		if(w==0&&h==0)
			break;

		int M[30][30];
		for(int y=0; y<h; y++){
			for(int x=0; x<w; x++){
				M[y][x] = 0;

				if(y==0){
					M[y][x] += 1;
				}
				else if(y==h-1){
					M[y][x] += 2;
				}

				if(x==0){
					M[y][x] += 4;
				}
				else if(x==w-1){
					M[y][x] += 8;
				}
			}
		}

		for(int i=0; i<2*h-1; i++){
			if(i%2==0){
				for(int j=0; j<w-1; j++){
					int w;
					cin >> w;

					if(w==1){
						M[i/2][j]   += 8;
						M[i/2][j+1] += 4;
					}
				}
			}
			else{
				for(int j=0; j<w; j++){
					int w;
					cin >> w;

					if(w==1){
						M[i/2][j]   += 2;
						M[i/2+1][j] += 1;
					}
				}
			}
		}

		int D[30][30];
		for(int y=0; y<h; y++){
			for(int x=0; x<w; x++){
				D[y][x] = 1000;
			}
		}

		DFS(M, D, 0, 0, 1);

		if(D[h-1][w-1]!=1000){
			cout << D[h-1][w-1] << endl;
		}
		else{
			cout << 0 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n, m;
    cin >> n >> m;
    vector<pll> v;
    REP(i,n) {
        int a, b;
        cin >> a >> b;
        v.push_back({a,b});
    }

    sort(ALL(v));

    ll ans = 0;
    int i = 0;
    while(m > 0) {
        if (v[i].second > m) {
            ans += v[i].first * m;
            break;
        } else {
            ans += v[i].first * v[i].second;
            m -= v[i].second;
        }
        i++;
    }

    cout << ans << '\n';

    return 0;
}

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



int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,ans=1e9,amax=0,bmax=0,af,bf;
    cin>>n;
    map<int,int>a,b;
    rep(i,n/2){
        int x,y;
        cin>>x>>y;
        a[x]++;
        b[y]++;
    }
    for(auto i = a.begin(); i != a.end(); ++i){
        if(amax<(i->second)){
            amax=i->second;
            af=i->first;
        }
    }
    for(auto i = b.begin(); i != b.end(); ++i){
        if(bmax<=(i->second)){
            bmax=i->second;
            bf=i->first;
        }
    }
    if(bf!=af){
        cout<<n-amax-bmax<<endl;
        return 0;
    }

    for(auto i = a.begin(); i != a.end(); ++i) {
        for(auto j = b.begin(); j != b.end(); ++j){
            if((i->first)==(j->first))ans=min(ans,n-max(i->second,j->second));
            else ans=min(ans,n-(i->second)-(j->second));
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4992
// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;

#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0; i<n; i++)

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

    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int ans = 0;
    rep(i, n) {
        if (((i+1)*a[i])%2 == 1) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    for(int i=n-1; i>=0; i--){
        if (h[i] < h[i-1]){
            if (h[i] >= h[i-1] - 1)
                h[i-1]--;
            else{
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 640
def solve():
    cnt = 0
    for i in range(N):
        if B[i] > A[i]:
            if B[i] - (A[i]+A[i+1]) > 0:
                cnt += A[i] + A[i+1]
                A[i+1] = 0
            else:
                cnt += B[i]
                A[i+1] = A[i]+A[i+1] - B[i]
        else:
            cnt += B[i]
    print(cnt)
#    print(A)
#    print(B)

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    solve()


Measured memory_bytes: 24124
PROGRAM piyo
      IMPLICIT NONE
      INTEGER,PARAMETER :: p = 16
      integer(p) :: x
      read*,x
      
      if( x>=30 )then
        print*,'Yes'
      else
        print*,'No'
      end if
      
      
      
      
      stop
      !debugg
      
      
      
      END PROGRAM

Measured memory_bytes: 2904
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define f first
#define s second
using namespace std;
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
typedef long long ll;
const int INF = 1e9;
const ll INFl = 1e18;
typedef pair<int,int> pii;
typedef vector<int> vi;

void solve() {
	long double a, b; cin >> a >> b;
	ll ans = a * b;
	cout << ans << '\n';
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int q = 1;
	//cin >> q;
	while (q--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define fore(i,a,b) for(int i=a,thxicesi=b; i<thxicesi;i++)
#define FIN ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0)
#define sz(s) int(s.size())
using namespace std;
typedef long long ll;
int main()
{FIN;
    ll x; cin>>x;
    int steps = 0; ll ini = 100;
    while(ini< x){
        ini += ini/100;
        steps++;
    }
    cout<<steps<<"\n";
    return 0;
}


Measured memory_bytes: 3656
#include<stdio.h>
int main(void){
int i,j;
long long int n,a[10000],min,max,sum=0;
scanf("%lld",&n);
for(i=0;i < n;i++){
scanf("%lld",&a[i]);
sum += a[i];
min=a[0];
max=a[0];
}
for(j=0;j < n;j++){
if (min >= a[j]){
min=a[j];
}else if (max <= a[j]){
max=a[j];
}
}
printf("%lld %lld %lld\n",min,max,sum);
return 0;
}

Measured memory_bytes: 676
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();
        int n = s.length();
        int cnt0 = 0;
        int cnt1 = 0;
        for (int i = 0; i < n; i++) {
            char target = s.charAt(i);
            if (target == '0') {
                cnt0++;
            } else {
                cnt1++;
            }
        }
        int ans = Math.min(cnt0, cnt1);
        System.out.println(ans * 2);
    }
}

Measured memory_bytes: 24608
import java.util.Scanner;
import java.util.InputMismatchException;

class Main {
   public static void main(String args[]) {
      int x=0 ,y=0;
      int[][] z;
      Scanner scanner = new Scanner(System.in);
      x = scanner.nextInt();
      y = scanner.nextInt();
      z = new int[y][2];
      for (int i=0; i<y; i++) {
         for (int j=0; j<2; j++) {
            z[i][j] = scanner.nextInt();
         }
      }
      scanner.close();
      int sum = 0;
      int i,j;
      int maxz = 0;
      int minz = 100001;
         for (j=0; j<y; j++) {
            if (maxz < z[j][0]) {
               maxz = z[j][0];
            }
            if (minz > z[j][1]) {
               minz = z[j][1];
            }
      }
      if (minz-maxz > -1) {
         System.out.println(minz-maxz+1);
      } else {
         System.out.println(0);
      }
   }
}


Measured memory_bytes: 88360
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    for(int i =A; i<=B;i++){
      if(i%K==0){
        System.out.println("OK");
        return;
      }
    }

    System.out.println("NG");  
  }
}





Measured memory_bytes: 35704
# -*- coding: utf-8 -*-
h,w,n = map(int, input().split())

cube = {}
for _ in range(n):
    a,b = map(int, input().split())
    for k in range(3):
        for l in range(3):
            if h-2>=a-k>0 and w-2>=b-l>0:
                box = "-".join([str(a-k), str(b-l)])
                if box not in cube:
                    cube[box] = 0
                cube[box] += 1
# print(cube)
ret = [0 for _ in range(10)]
cnt = 0
for v in cube.values():
    ret[v] += 1
    cnt += 1
ret[0] = (h-2)*(w-2) - cnt

for r in ret:
    print(r)


Measured memory_bytes: 126764
#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<string>
#include<set>
#include<numeric>
#include<functional>
#include<unordered_map>
#include<cmath>
#include<cstdlib>
#include<cassert>

int main() {
	int A, B, C, D;
	std::cin >> A >> B >> C >> D;
	std::cout << std::max(A * B, C * D) << std::endl;
}


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

constexpr ll mod = 1000000000 + 7;
#define NMAX 200010
ll fac[NMAX];
ll inv[NMAX];

ll mod_pow(ll a, ll n, ll mod){
    ll ret = 1;
    while(n > 0){
        if(n & 1) ret = (ret*(a % mod))%mod;
        a = ((a%mod)*(a%mod)) % mod;
        n = n >> 1;
    }
    return ret;
}

ll mod_inv(ll a, ll mod){
    return mod_pow(a, mod-2, mod);
}

void mae_nck(){
    fac[1] = 1;
    inv[1] = 1;
    for(ll i = 2; i < NMAX; i++){
        fac[i] = (fac[i-1] * i)%mod;
        inv[i] = (inv[i-1] * mod_inv(i, mod))%mod;
    }
}

ll mod_nck(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    if(k == 0 || k == n) return 1;
    ll ret = ((fac[n] * inv[k])%mod * inv[n-k])%mod;
    return ret;
}
int main(){

    // pre-processing
    mae_nck();

    // input
    ll n, m, k;
    cin >> n >> m >> k;

    ll coeff = mod_nck(n * m - 2, k - 2);
    ll ans = 0;
    rep(i, 0, m-1){
        ll cm = m - i;
        ll cur = (cm * (cm - 1) / 2) % mod * (n * n) % mod;
        ans += cur % mod;
        ans %= mod;
    }
    rep(i, 0, n-1){
        ll cm = n - i;
        ll cur = (cm * (cm - 1) / 2) % mod * (m * m) % mod;
        ans += cur % mod;
        ans %= mod;
    }
    ans *= coeff;
    ans %= mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6764
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>

#ifdef GONGKUNPENG
#include <cassert>

#define _GG 1
#else
#define _GG 0
#endif

#define uint unsigned
#define vector std::vector
#define max(a, b) std::max(a, b)
#define min(a, b) std::min(a, b)
#define swap(a, b) std::swap(a, b)
#define sort(...) std::sort(__VA_ARGS__)
#define ms(a, v) memset(a, v, sizeof(a))
#define ufor(i, n) for (int i = 1; i < n; ++i)
#define sfor(i, n) for (int i = 1; i <= n; ++i)
#define tfor(i, n) for (int i = 0; i < n; ++i)

#if __cplusplus >= 201103L
using ll = long long;
using ull = unsigned long long;
#else
typedef long long ll;
typedef unsigned long long ull;
#endif

int main() {
  ll in;
  scanf("%lld", &in);
  printf("%lld\n", in / 500 * 1000 + in % 500 / 5 * 5);
  return 0;
}

Measured memory_bytes: 128
class UNION_FIND(object):
    def __init__(self,n):
        self.parent=[-1 for i in range(n)]
        
    def root(self,x):
        if self.parent[x]<0:
            return x
        else:
            self.parent[x]=self.root(self.parent[x])
            return self.parent[x]
 
    def size(self,x):
        return -self.parent[self.root(x)]
    def union(self,x,y):
        x=self.root(x)
        y=self.root(y)
        if x==y:
            return False
        if self.size(x)<self.size(y):
            x,y=y,x
        self.parent[x]+=self.parent[y]  #Aのサイズを更新する
        self.parent[y]=x   #Bの親をAに変更する
        return True
n,m=map(int,input().split())
u=UNION_FIND(n)
for i in range(m):
    a,b,c=map(int,input().split())
    u.union(a-1,b-1)
ans=0
for i in u.parent:
    if i<0:
        ans+=1
    
print(ans)

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

int main()
{
    /*A
    int r;
    cin>>r;
    cout<<r*r<<endl;
    return 0;
    */
   int n;
   cin>>n;
   string s;
   cin>>s;
   bool flag = 1;
    if(n%2!=0)
    {
        cout<<"No"<<endl;
        return 0;
    }
    else{ 
        for(int i=0;i<n/2;i++)
        {
            if(s[i]!=s[i+n/2])
            {
                flag = 0;
                break;
            } 
        }
   }
    if(flag)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>

using namespace std;

typedef struct {
    int total;
    int a;
    int b;
}dish_t;

bool cmp(const dish_t& p, const dish_t& q) {
    return p.total > q.total;
}

int main() {
    long long N;
    cin >> N ;
    vector<dish_t> dish(N);
    for (int i = 0; i < N; i++) {
        cin >> dish[i].a >> dish[i].b;
        dish[i].total = dish[i].a + dish[i].b;
    }
    
    sort(dish.begin(),dish.end(), cmp);
    long long ans = 0;
    //cout << "after sort" << endl;
    //for (int i = 0; i < N; i++) 
        //cout << dish[i].a <<"  "<< dish[i].b << endl;;

    for (int i = 0; i < N; i++) {
        if (!(i % 2))
            ans += dish[i].a;
        else
            ans -= dish[i].b;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
const  long long     mx=1e5+100;

#define      mod     1e9+7
#define      pai     acos(-1)
#define      ff      first
#define      ss      second
#define      ll      long long
#define      pb      push_back
#define      mp      make_pair
#define      fi      freopen("input.txt","r",stdin);
#define      fo      freopen("output.txt","w",stdout);
#define      fast    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

//typedef pair<ll,ll> pi;
//typedef map<ll,ll> mi;


int main()
{
    fast;
    ll i,j,a,b,c,d,n,m,k,x,y,t;
    string s;
    cin>>s;
    n=s.size();
    map<char,ll>frq;
    set<char>st;
    for(i=0;i<n;i++)
    {
        char ch = s[i];
        st.insert(ch);
        frq[ch]++;
    }
    bool ok=false;
    for(auto p: st)
    {
        if(frq[p]&1)
        {
            ok=true;
            break;
        }
    }
    if(ok)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
    return 0;

}



Measured memory_bytes: 3636
import java.io.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    long n = Long.parseLong(br.readLine());
    long[] num = new long[5];
    long minCapacity = Long.MAX_VALUE;
    for (int i=0; i<5; i++){
      num[i] = Long.parseLong(br.readLine());
      if (num[i] < minCapacity) minCapacity = num[i];
    }
    long result = 0;
    result += 5;
    if (n%minCapacity == 0){
      result += n/minCapacity-1;
    } else {
      result += n/minCapacity;
    }
    System.out.println(result);
  }
}


Measured memory_bytes: 21332
#include <iostream>
#include <string>

using namespace std;

int main(){
  string S;
  cin>>S;
  bool step=true;
  for (int i=0;i<S.size();i++){
    if (i%2==0){
      if (S[i]=='L'){
        step=false;
        break;
      }
    }
    else {
      if (S[i]=='R'){
        step=false;
        break;
      }
    }
  }
  cout<<( step ? "Yes" : "No" )<<endl;
}
      
  


Measured memory_bytes: 256
#include<iostream>
#include<stack>
#include<queue>
using namespace std;
#define max 100
#define infty 1<<21

int n;
int aa[max][max];
int color[max];
int d[max];
int p[max];

int prim() {
	for (int i = 0; i < n; i++) {
		color[i] = 0;
		d[i] = infty;
		p[i] = -1;
	}
	d[0] = 0;
	int ans = 0;

	while (true) {
		int mincost = infty;
		int u = -1;
		for (int i = 0; i < n; i++) {
			if (color[i] != 1 && d[i] < mincost) {
				u = i;
				mincost = d[i];
			}
		}
		if (u == -1) break;
		color[u] = 1;
		for (int i = 0; i < n; i++) {
			if (color[i] != 1 && aa[u][i] != -1) {
				if (aa[u][i] < d[i]) {
					d[i] = aa[u][i];
					p[i] = u;
				}
			}
		}
	}
	for (int i = 0; i < n; i++) {
		if (p[i] != -1) ans += aa[i][p[i]];
	}

	return ans;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			int num1;
			cin >> num1;
			aa[i][j] = num1;
		}
	}

	int kotae = prim();

	cout << kotae << endl;

	return 0;
}


Measured memory_bytes: 3116
x1,y1,x2,y2 = map(int, input().split() )



dx, dy = x2-x1, y2-y1

x4, y4 = x1 - dy, y1 + dx
x3, y3 = x2 - dy, y2 + dx

print( "{} {} {} {}".format(x3,y3,x4,y4) )

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char s1[1005],s2[1005];
	scanf("%s%s",&s1,&s2);
	int l1=strlen(s1),l2=strlen(s2);
	int min=1005;
	for(int i=0;i<l1;i++)
	{
		int p=0;
		if(i+l2<=l1)
		{
			for(int j=0;j<l2;j++)
			{
				if(s1[i+j]!=s2[j]) p++;
			}
		    if(p<min) min=p;
		 }
		else break;  
	}
	printf("%d",min);
   return 0;
}

Measured memory_bytes: 3796
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

vector<int> S[1000];
int main()
{

	int n; cin >> n;
	int k = -1;
	for (int i = 1; i <= 1000; i++) {
		if (i*(i - 1)  == 2*n) {
			k = i;
		}
	}

	if (k == -1) {
		cout << "No" << endl;
		return 0;
	}
	
	

	int idx = 1;

	for (int i = 0; i < k; i++) {
		for (int j = i + 1; j < k; j++) {
			S[i].push_back(idx);
			S[j].push_back(idx++);

			
		}
	}

	cout << "Yes" << endl;
	cout << k << endl;

	for (int i = 0; i < k; i++) {
		cout << S[i].size();

		for (int j : S[i]) {
			cout << " " << j;
		}

		cout << endl;
	}
	

	return 0;
}



Measured memory_bytes: 2304
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRT(v) sort(v.begin(),v.end())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    //入力
    string a,b;
    cin >> a >> b;
    //処理
    //出力
    if(a>b) cout << '>' << ENT;
    else if(a==b) cout << '=' << ENT;
    else if(a<b) cout << '<' << ENT;
    return 0;
}

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


Measured memory_bytes: 256
N,HP=map(int,input().split())
As=[0]*N
Bs=[0]*N
for i in range(N):
 a,b=map(int,input().split())
 As[i]=a
 Bs[i]=b
As.sort(reverse=True)
Bs.sort(reverse=True)

cnt=0
for b in Bs:
 if As[0] < b:
  HP-=b
  cnt+=1
 else:break
 if HP<=0:break
print(cnt+((HP//As[0])+(HP%As[0]!=0)if HP>0 else 0))


Measured memory_bytes: 11312
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
//*********************************************DO IT NOW****************************************************************
#include<bits/stdc++.h> 
#include<random>
#define int long long   
#define pp pair<int,int> 
#define ss second 
#define ff first 
#define pb push_back
#define mod 1000000007
#define pi 3.14159265359
#define mk(arr,n,type)  type *arr=new type[n];
#define sl s1.length();
#define yes cout<< "YES"<<endl
#define no  cout<< "NO"<<endl
#define all(v) (v).begin(),(v).end()
#define s(v)   sort(v,v+n)
#define  mt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define read(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define print(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" "
#define for1(i,a,n)  for(int i=0;i<n;i++)
#define rep(i, c) for(int i = 0; i < (int)c; i++)
#define set(x) cout<<fixed<<setprecision(x);
using namespace std;
//**********************************************DO IT NO****************************************************************
void fastio()
{  
  #ifndef ONLINE_JUDGE
  freopen("INPUT.txt","r",stdin);
  freopen("OUTPUT.txt","w",stdout); 
  #endif
  ios_base :: sync_with_stdio(false); 
  cin.tie(NULL) ; 
  cout.tie(NULL);
}
int dp[101][1001],ans1=1e9,dp1[1000001];
int num[10];
int a[1000000];
signed main()
{   
    fastio();
    int t=1;
   // cin>>t;
    while(t--)
    {  
      int n;
      cin>>n;
      int c=0;
      for(int i=1;i<=9;i++)
      {
          for(int j=1;j<=9;j++)
          {
            if(i*j==n)
            {
                c++;
                break;
            }
          }
          if(c)
          break;
      }
      if(c)
      cout<<"Yes";
      else
      cout<<"No";
       
    }
}
// 🍪 🍪 🍪


Measured memory_bytes: 3592
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <cctype>
#include <cstdio>
#include <vector>
using namespace std;

int main()
{
    char num[3];
    cin >> num;
    if(num[0]=='9' || num[1]=='9'){
        cout << "Yes";
    }else{
        cout << "No";
    }
    
    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#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;

int main()
{
    int n;
    while (cin >> n)
    {
        printf("%d\n", 2 + int(0.5 * (n - 1) * (n + 2)));
    }
    return 0;
}


Measured memory_bytes: 3132
// inputに入力データ全体が入る
function Main(input) {
    var map = {};
    var ans = 0;
    input.filter((v,i)=>i>0).forEach(v=>{
        if(!map[v]) ans++
        map[v]=true;
    });
    console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n"));

Measured memory_bytes: 7372
from math import gcd
from numpy import sign
mod = 1000000007
N = int(input())

d = {}
counter = 0

f = 0
l = 0

for _ in range(N):
    a, b = list(map(int, input().split()))
    if a == b == 0:
        counter += 1
    elif a==0:
        f += 1
    elif b==0:
        l += 1
    else:
        g = gcd(a, b)
        a, b =  a // g, b //g
        if b < 0:
            a, b = -a, -b
        if (a, b) not in d:
            d[(a, b)] =1
        else:
            d[(a, b)] +=1

answer = 1

group = set()
for (p, q), v in d.items():
    invp,invq=-q,p
    if invq<0:
        invp,invq=-invp,-invq
    if not (invp,invq) in group:
        group.add((p,q))

for (p, q) in group:
    invp,invq=-q,p
    if invq<0:
        invp,invq=-invp,-invq
    if (invp, invq) not in d:
        answer *= (2 ** d[(p, q)])
    else:
        answer *= ((2 ** d[(p, q)]) + (2 ** d[(invp, invq)]) - 1)
        
answer *= 2**f + 2**l - 1
    
print((answer + counter - 1) % mod)

Measured memory_bytes: 90168
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<map>
#include<ctime>
#include<vector>
#include<sstream>
#include<iostream>
using namespace std;
int main(void){

    int N;

    string s;
    while(getline(cin,s)){
    long long int D = 10000;
    vector<double> A,B;
        istringstream ss(s);
        int t;
        ss >> N;
        while(ss >> t)A.push_back(t);

        //for(int i = 0;i < A.size();i++)cout<<A[i]<<endl;
        double best = 1000000;
        double ans = 1000000;
        while(D--){
            vector<double> V1,V2;
            srand(time(NULL) + D);
            V1 = A;
            double sum = 0;
            int x = rand() % A.size();
            int y = rand() % A.size();
            swap(V1[x],V1[y]);

            for(int i = 0;i < V1.size()-1;i++){
                double R1 = V1[i] + V1[i+1];
                double R2 = V1[i] - V1[i+1];
                sum += sqrt((R1 * R1) - (R2 * R2));
            }

            sum += V1[0] + V1[V1.size()-1];
            double e = pow((sum/ans), 75);
            double z = (double)((int)(rand()%1000000))/1000000;
            if(z>=(1-(1/e)))ans = sum,A = V1;/*
            if(D%10000 == 0){
                for(int i = 0;i < A.size();i++){
                    cout<<A[i]<<" ";
                }
                cout<<" : ";
                for(int i = 0;i < B.size();i++){
                    cout<<B[i]<<" ";
                }
                cout<<endl;
            }*/
            if(sum<best)best = sum,B = V1;
        }
        int siz = 0;
        for(int i = 0;i < 1000;i++){
            if(best <= (double)i){
                siz = i;
                //cout<<siz<<endl;
                break;
            }
        }
        if(siz <= N)cout<<"OK"<<endl;
        else cout<<"NA"<<endl;
        }
    return 0;
}

Measured memory_bytes: 1240
N,T =  list(map(int,(input().split())))

keiro = []
cost = []
for i in range(N):
  c,t =  list(map(int,(input().split())))
  if t<=T:
    keiro.append(t)
    cost.append(c)
  

if len(cost) >0 :
  print((min(cost)))
else:
  print('TLE')



Measured memory_bytes: 3060
#![allow(non_snake_case,unused_imports,dead_code)]
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::{HashMap,HashSet,VecDeque,BinaryHeap};
use std::cmp::Ordering;

use proconio::input;
use proconio::marker::{Chars,Usize1,Isize1};

fn comp_f64(a: &f64, b: &f64) -> Ordering {
    if a < b {
        return Ordering::Less;
    } else if a > b {
        return Ordering::Greater;
    }
    Ordering::Equal
}

fn main() {
    input!{
        N:usize,
        AB:[(Usize1,Usize1);N-1],
    }

    let mut E = vec![Vec::new();N];
    for &(a,b) in &AB{
        E[a].push(b);
        E[b].push(a);
    }
    let D = bfs_dist(N,&E,0);
    let n = dfs_subtree_size(N, &E, 0);
    let d = D[N-1]/2+1;

    let mut i = N-1;
    while D[i] != d{
        for &j in &E[i]{
            if D[j]<D[i]{
                i = j;
                break
            }
        }
    }

    if n[i] as usize >= (N+1)/2{
        println!("Snuke");
    } else {
        println!("Fennec");
    }

}

fn dfs_subtree_size(N:usize,E:&Vec<Vec<usize>>,start:usize) -> Vec<isize>{
    let mut n = vec![-1;N];
    let mut q = vec![(start,start)];
    while let Some((i,p)) = q.pop(){
        let mut popped = true;
        let mut cnt = 1;
        for &j in &E[i]{
            if j == p{ continue;}
            if n[j] == -1{
                if popped {
                    q.push((i,p));
                    popped = false;
                }
                q.push((j,i));
            } else {
                cnt += n[j];
            }
        }
        if popped{
            n[i] = cnt;
        }
    }
    n
}


fn bfs_dist(N:usize,E:&Vec<Vec<usize>>,start:usize) -> Vec<isize>{
    let mut d = vec![-1;N];
    let mut q = Vec::new();
    q.push(start);
    d[start] = 0;
    while !q.is_empty(){
        let mut qq = Vec::new();
        for &i in &q{
            for &j in &E[i]{
                if d[j]!= -1{continue;}
                d[j] = d[i]+1;
                qq.push(j);
            }
        }
        q = qq;
    }
    d
}

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

using namespace std;

bool is_prime(int n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}

int main() {
  const int maxp = 55555;
  int N;
  cin >> N;
  vector<vector<int>> v(5, vector<int>());
  for (int i = 2; i <= maxp; i++) {
    if (is_prime(i)) {
      v[i % 5].push_back(i);
    }
  }
  for (int i = 1; i <= 4; i++) {
    if (v[i].size() >= N) {
      for (int j = 0; j < N; j++) {
        if (j > 0) cout << " ";
        cout << v[i][j];
      }
      cout << endl;
      break;
    }
  }

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 256
/*https://atcoder.jp/contests/dp/submissions/6442830 */

#include <stdio.h>
#include <string.h>

int max(int a, int b){
  if(a > b){
    return a;
  }
  return b;
}

int main(void) {
  char s[3010], t[3010];
  scanf("%s", s);
  scanf("%s", t);

  int N, M;
  N = strlen(s);
  M = strlen(t);

  int dp[N+1][M+1];
  for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= M; j++) {
      dp[i][j] = 0;
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if(s[i] == t[j]) dp[i+1][j+1] = dp[i][j]+1;
      else dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
    }
  }

  char ans[3010];
  int num = 0;
  while(N > 0 && M > 0){
    if(dp[N][M] == dp[N-1][M]) N--;
    else if(dp[N][M] == dp[N][M-1]) M--;
    else{
      N--, M--;
      ans[num++] = s[N];
    }
  }

  for (int i = num-1; i >= 0; i--) {
    printf("%c", ans[i]);
  }
  printf("\n");


  return 0;
}


Measured memory_bytes: 35328
#include<iostream>
#define MAX 50000
using namespace std;
int main(){
	int p[MAX+1];
	for(int i=0; i<MAX; i++) p[i] = 1;
	p[0] = p[1] = 0;
	for(int i=2; i*i <= MAX; i++){
		if(p[i] == 1){
			for(int j=i*2; j<=MAX; j+=i){
				p[j]=0;
			}
		}
	}
	
	int n;
	while(cin >> n){
		if(n==0) break;
		int count=0;
		for(int i=2; i<=n/2; i++){
			if(p[i]==1 && p[n-i]==1)
				count++;
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1060
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;
int n;
long long a[N];


long long gcd(long long a, long long b){
    return b ? gcd(b, a % b) : a;
}



int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>n;
    
    for (int i = 1; i <= n; i++)cin>>a[i];
    
    long long  lcm = 1;
    
    for (int i = 1; i <= n; i++){
        lcm = lcm/gcd(a[i], lcm)*a[i];
    }
    cout<<lcm<<endl;
    
    
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<chrono>
#include<random>
#include<cstdio>
#include<set>
#include<map>
#define MAX_N 100
#define MAX_M 100
#define INF 10000000
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;


int main(){
    int x,y;
    cin>>x;
    cin>>y;
    int ans=0;
    if(x==1){
        if(y==1){
            ans+=1000000;
            cout<<ans;
            return 0;
        }
        ans+=300000;
    }else if(x==2){
        ans+=200000;
    }else if(x==3){
        ans+=100000;
    }

    if(y==1){
        ans+=300000;
    }else if(y==2){
        ans+=200000;
    }else if(y==3){
        ans+=100000;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
 
int main(){
	int N;
  string a,b;
  cin>>N;
  cin>>a>>b;
  rep(i,N)cout<<a[i]<<b[i];
  cout<<endl;
  
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	int x, y, x1, y1;
	cin >> x >> y >> x1 >> y1;
	for (int i = 0; i < y1 - y; i++) {
		cout << "U";
	}
	for (int i = 0; i < x1 - x; i++) {
		cout << "R";
	}
	for (int i = 0; i < y1 - y; i++) {
		cout << "D";
	}
	for (int i = 0; i < x1 - x; i++) {
		cout << "L";
	}
	cout << "L";
	for (int i = 0; i < y1 - y + 1; i++) {
		cout << "U";
	}
	for (int i = 0; i < x1 - x + 1; i++) {
		cout << "R";
	}
	cout << "DR";
	for (int i = 0; i < y1 - y + 1; i++) {
		cout << "D";
	}
	for (int i = 0; i < x1 - x; i++) {
		cout << "L";
	}
	cout << "LU" << endl;
	return 0;
}

Measured memory_bytes: 256
def inpl(): return [int(i) for i in input().split()]
def ndir(noh, now):
    result = []
    if now != 0:
        result.append((noh, now-1))
    if now != W-1:
        result.append((noh, now+1))
    if noh != 0:
        result.append((noh-1, now))
    if noh != H-1:
        result.append((noh+1, now))
    return result

H, W = inpl()
S = [input() for _ in range(H)]
direc = [(1, 0), (-1, 0), (0, 1), (0, -1)]
Col = [[0]*W for _ in range(H)]
ans = 0
for i in range(H):
    for j in range(W):
        if Col[i][j] or S[i][j] == '#':
            continue
        gw, gb, kw, kb = 0, 0, 0, 0
        stack = [(i, j)]
        while stack:
            nh, nw = stack.pop()
            Col[nh][nw] = True
            if (nh+nw)%2:
                if S[nh][nw] == '#':
                    kb += 1
                else:
                    kw += 1
            else:
                if S[nh][nw] == '#':
                    gb += 1
                else:
                    gw += 1
            for ah, aw in ndir(nh, nw):
                if (S[nh][nw] == '.')^(S[ah][aw] == '.') and not Col[ah][aw]:
                    stack.append((ah, aw))
                    Col[ah][aw] = True
        ans += kb*gw + kw*gb
print(ans)


Measured memory_bytes: 12116
num, n = map(int,input().split())
givenlist = set(list(map(int,input().split())))
numlist = set([i for i in range(-1,102)]) - givenlist
min = 1000
for i in list(numlist):
    if abs(num-i) <= min:
        min = abs(num-i)

if num - min in numlist:
    print(num - min)
else:
    print(num + min)


Measured memory_bytes: 9132
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const ll INF=1e18;


int main() {
	int n,ans=0;
	cin >> n;
	vector<int> a(n);
	rep(i,n){
		cin >> a[i];
	}
	sort(a.begin(),a.end());
	rep(i,n){
		rep(j,i){
			rep(k,j){
				if (a[k] != a[j] && a[i] != a[j] && a[k] + a[j] > a[i]) ans++;
			}
		}
	}
	cout << ans<<endl;
}

Measured memory_bytes: 3616
# https://atcoder.jp/contests/agc027/tasks/agc027_a
n, x = [int(i) for i in input().split()]
A = sorted([int(i) for i in input().split()])

if sum(A) == x:
    ans = n
elif sum(A) < x:
    ans = n - 1
else:
    ans = 0
    for i in range(n):
        if A[i] <= x:
            if i == n - 1:
                if x == A[i]:
                    ans += 1
            else:
                x -= A[i]
                ans += 1
        else:
            continue

print(ans)


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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;
struct Edge{ll from, to, cost;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  map<string, ll> mp;
  cin >> N;
  rep(i, N){
    string s;
    cin >> s;
    sort(ALL(s));
    mp[s]++;
  }

  ll ans = 0;
  for(auto i = mp.begin();i!=mp.end();i++){
    ll v = i->second;
    ans += v * (v-1) /2;
  }
  cout << ans;
  return 0;
}


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

int main(){

    int a, b;

    cin>>a>>b;

    if(a>b){
cout<<"a"<<" > "<<"b"<<endl;
    }else if(a<b){
      cout<<"a"<<" < "<<"b"<<endl;  
    }else{
cout<<"a"<<" == "<<"b"<<endl;
    }
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
typedef long long ll;
typedef pair<char, char> c_c;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
const int INF = 1000000007;
const ll LLINF = 1000000000000000007LL;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    string s, t, u="";
    cin >> s >> t;
    rep(i,n){
        u += s.at(i);
        u += t.at(i);
    }
    cout << u << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a=1,b=1;
    while(true){
      a=sc.nextInt();
      b=sc.nextInt();
      if(a==0) break;
      for(int i=0;i<a;i++){
        for(int j=0;j<b;j++){
          System.out.print("#");
        }
        System.out.print("\n");
      }
      System.out.print("\n");
    }
    sc.close();
  }
}


Measured memory_bytes: 38096
import sys
from math import pi

def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0:
        a, b = b, a % b
    return b

def solve():
    input = sys.stdin.readline
    A, B, C, D = map(int, input().split())
    cDiv = (B // C) - ((A - 1) // C)
    dDiv = (B // D) - ((A - 1) // D)
    cd = C * D // gcd(C, D)
    cdDiv = (B // cd) - ((A - 1) // cd)
    print((B - A + 1) - (cDiv + dDiv - cdDiv))
    

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <bitset>
#include <functional>
#include <queue>
#include <utility>
#include <map>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<string, PII> PSI;
typedef pair<vector<int>, vector<int>> PVV;
const int INF = 1 << 29;	// 十分大きい値にする, INT_MAX にしないのはオーバーフロー対策

const int MAX_N = 1e+5, MAX_M = 1e+5;
const int MOD = 1000000007;

void solve()
{
	int N, L;
	int ans;

	cin >> N >> L;

	ans = 0;
	FOR(i, 0, N) {
		ans += L + i;
	}

	if (L + N - 1 > 0) {
		if (L > 0)
			ans -= L;
	}
	else {
		ans -= L + N - 1;
	}

	cout << ans << endl;
}

int main(void)
{
	solve();

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#define int int64_t
#define all(x) (x).begin(), (x).end()
#define OUT(x) ((cout << x), exit(0))
#define out(x) return void(cout << x << endl)
using namespace std;
typedef long double db;
const int64_t INF = (int64_t)(2e18);
const int inf = (int)(1e9 + 7);
//------------------------------------------//

int bigger(int s)
{
    if (s != int(1e9)) return s + 1;
    return 1;
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cin.tie(nullptr);

#ifdef _MY
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int n, k, s;
    cin >> n >> k >> s;
    
    vector<int> res(n, bigger(s));
    for (int i = 0; i < k; ++i) res[i] = s;

    for (auto& it : res) cout << it << " ";



    return 0;
}

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

int main() {
	int n,f=0,cnt=0;
	cin>>n;
	int a[n+4],vis[n+4]={0};
	for(int i=1;i<=n;i++)
	cin>>a[i];
	queue<int>q;
	q.push(1);
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
		if(x==2)
		{
		 f=1;
		 break;
		}
		vis[x]=1;
		if(!vis[a[x]])
		{
		 cnt++;
		 q.push(a[x]);
		}
	}
	if(f)
	cout<<cnt<<endl;
	else
	cout<<"-1"<<endl;
	return 0;
}

Measured memory_bytes: 1024
n = int(input())
l = [0 for _ in range(10**4)]
def fib(n):
    if n==0:
      l[0]=1
      return 1
    if n==1:
      l[1]=1
      return 1
    if l[n]!=0:
      return l[n]
    else:
      l[n]=fib(n-1)+fib(n-2)
      return fib(n-1)+fib(n-2)
    
print(fib(n))


Measured memory_bytes: 5668
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <vector>

using std::pair;
typedef std::vector<std::pair<int, int>> vec;
using std::make_pair;

int n, i;
vec es[100000];
int color[100000];
int max;

void co(int v, int p, int c){
	int l= es[v].size(), i;
	if(l>max) max=l;
	int j=0;
	for(i=0; i<l; i++){
		if(j==c) j++;
		int r = es[v][i].second;
		if(r!=p){
			color[es[v][i].first]=j;
			co(r, v, j);
			j++;
		}
	}
}

int main(void){
	scanf("%d", &n);
	int a, b;
	for(i=0; i<n-1; i++){
		scanf("%d%d", &a, &b);
		es[a-1].emplace_back(make_pair(i, b-1));
		es[b-1].emplace_back(make_pair(i, a-1));
	}
	max=0;
	co(0, -1, -1);
	printf("%d\n", max);
	for(i=0; i<n-1; i++){
		printf("%d\n", color[i]+1);
	}
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

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

    bool f = true;
    ll cnt = 0, ci = 0;
    if(S[0] != 'A') f = false;
    REP(i,2,SZ(S)-1) {
        if(S[i] == 'C') {
            ++cnt;
            ci = i;
        }
    }
    if(cnt != 1) f = false;
    else {
        REP(i,1,SZ(S)) {
            if(i == ci) continue;
            if(!('a' <= S[i] && S[i] <= 'z')) f = false;
        }
    }
    if(f) PR("AC");
    else PR("WA");

    return 0;
}

/*



*/

Measured memory_bytes: 3596
n,m = map(int,input().split())
a = [list(input())for i in range(n)]
b = [list(input())for i in range(m)]
for y in range(n-m+1):
    for z in range(n-m+1):
        count = 0
        for p in range(m):
            if b[p] == a[y+p][z:(z+m)]:
                count += 1
                if count == m:
                    print("Yes")
                    exit()
            else:
                count = 0
print("No")


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

using namespace std;

const int INF = 1e9;

int n,i,cnt[30],res[30],j;
char s[105];

int main(){
	scanf("%d", &n);
	
	for(i = 0; i < 26; i++)
	res[i] = INF;
	
	for(i = 0; i < n; i++){
		scanf("%s", s);
		
		int l = strlen(s);
		
		for(j = 0; j < l; j++)
		cnt[s[j] - 'a']++;
		
		for(j = 0; j < 26; j++)
		res[j] = min(res[j], cnt[j]);
		
		for(j = 0; j < 26; j++)
		cnt[j] = 0;
	}
	
	for(i = 0; i < 26; i++){
		for(j = 0; j < res[i]; j++)
		printf("%c", i + 'a');
	}
	
	printf("\n");
}


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

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

using ll = long long int;
using P = pair<int,int>;

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

const ll INF=(ll)1e19;
//const int INF=(1<<30);

vector<ll> b,p;

ll solve(int m, ll y){
  if(m==0)return 1;
  if(y==1)return 0;
  if(y<=1+b[m-1]+p[m-1])return solve(m-1,y-1);
  if(y==2+b[m-1]+p[m-1])return p[m-1]+1;
  if(y<=2+2*b[m-1]+2*p[m-1])return solve(m-1,y-2-p[m-1]-b[m-1]) + 1 + p[m-1];
  return 2*p[m-1]+1;
}

int main(){
  int n;
  ll x;
  cin >> n >> x;
  b.resize(n+1);
  p.resize(n+1);
  p[0]=1; b[0]=0;
  FOR(i,1,n+1){
    p[i] = p[i-1]*2+1;
    b[i] = b[i-1]*2+2;
  }

  cout << solve(n,x) << endl;
}



Measured memory_bytes: 256