akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Object o = run();
        if (o != null)
            System.out.println(o);
    }

    static Object run() {
        try (Scanner sc = new Scanner(System.in)) {
            long result = 0;
            int x = sc.nextInt();
            if (400 <= x && x < 600) result = 8;
            if (600 <= x && x < 800) result = 7;
            if (800 <= x && x < 1000) result = 6;
            if (1000 <= x && x < 1200) result = 5;
            if (1200 <= x && x < 1400) result = 4;
            if (1400 <= x && x < 1600) result = 3;
            if (1600 <= x && x < 1800) result = 2;
            if (1800 <= x && x < 2000) result = 1;
            return result;
        }
    }
}

class ChenNumberUtil {
    static Collection<Integer> getDivisors(int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                al.add(i);
                if (n / i != i)
                    al.add(n / i);
            }
        }
        Collections.sort(al);
        return al;
    }
}

class ChenBitUtil {
    static int popCount(int bit) {
        return Integer.bitCount(bit);
    }

    static boolean isFlag(int bit, int i) {
        return 0 != (bit & (1 << i));
    }

    static int setTrue(int bit, int i) {
        return bit |= (1 << i);
    }

    static int setFalse(int bit, int i) {
        return bit &= ~(1 << i);
    }

    static int setReverse(int bit, int i) {
        return isFlag(bit, i) ? setFalse(bit, i) : setTrue(bit, i);
    }

    static int reverseAll(int bit) {
        return ~bit;
    }
}


Measured memory_bytes: 27120
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class MainClass
{
	public static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');

		int N = int.Parse(input[0]);
		int Y = int.Parse(input[1]);

		int flag = 0;
		for (var i = 0; i<= N; i++)
		{
			for (var j = 0; j <= N - i; j++)
			{
				var k = N - i - j;

				var sum = i * 10000 + j * 5000 + k * 1000;

				if(sum==Y)
				{
					Console.WriteLine("{0} {1} {2}",i,j,k);
					flag = 1;
					goto label1;
				}
				else
				{
					continue;
				}
			}
		}
		if (flag == 0)
		{
			Console.WriteLine("-1 -1 -1");
		}
	label1:;


	}
}





Measured memory_bytes: 13140
#include<stdio.h>

int main(void)
{
	int x,y;
	
	while(3000)
	{
		scanf("%d %d",&x,&y);
		(((x>=0)&&(x<=10000))&&((y>=0)&&(y<10000)));
		if((x==0)&&(y==0))break;
		if(x<=y)
		{
			printf("%d %d\n",x,y);
		}
		else
		{
			printf("%d %d\n",y,x);
	
		}

	}
	
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define ls rt<<1
#define rs rt<<1|1
#define lson rt<<1,l,M
#define rson rt<<1|1,M+1,r
#define PI acos(-1)
#define MM int M=(l+r)>>1;
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define fh(i,be,e) for(int i=head[be];~i;i=e[i].next)
#define fa(i,V) for(auto i:V)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl '\n'
#define lcm(a,b) (a*b)/__gcd(a,b)
#define cp(i,ans) printf("%.if",ans);
#define cpp(i,ans) cout<<setprecision(i)<<fixed<<ans<<endl;
#define ppb pop_back
#define ppf pop_front
#define pb push_back
#define pf push_front
#define pq priority_queue
#define lowbit(x) (x)&(-x)
#define all(V) V.begin(),V.end()
#define ms multiset
#define mod(x) ((x+mo_num)%mo_num)
#define vc vector
#define vct vector<int>
#define out(i) cout<<(i)<<endl;
#define fi first
#define se second
#define fun(i) fu(i,1,n)
#define fut(i) fu(i,1,t)
#define fum(i) fu(i,1,m)
#define ld long double
#define umap unordered_map
#define P pair<int,int>
#define SET set<int>
#define mp map<int,int>
#define mk make_tuple
#define low lower_bound
#define upp upper_bound
#define yn(key) out(key?"YES":"NO")
#define in(i) i+1,i+1+n
#define im(i) i+1,i+1+m
#define bffs(i) __builtin_ffs(i)
#define bcount(i) __builtin_popcount(i)
#define bone(i) ((1<<i)-1)
using namespace std;
const int INF=LLONG_MAX-1e10;
const int dx[]={0,0,-1,1},dy[]={-1,1,0,0};//up down left right
const int maxn=1e6+1e5;
const int mo_num=1e9+7;
int n,m,t,a[maxn],b[maxn],ans;

main()
{
    IOS
    fu(i,1,4)cin>>a[i];
    ans=min(a[1],a[4]);
    a[4]-=ans;
    int x=min(a[2],a[4]);
    a[4]-=x;
    out(ans-a[4])
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <string>
#define ll long long int
#define ull unsigned long long int
#define db long double
#define rep(i,p,q) for(i=p;i<q;++i)
#define REP(i,p,q) for(i=p;i<=q;++i)
#define MOD 1000000007
#define stop return 0
#define pb push_back
#define nil -1
#define initial 0
#define waiting 1
#define visited 2
#define inf 10e+9
#define pb push_back
#define mp make_pair
#define pr pair<ll,ll>
#define MAX 300005
#define MAX2 2000005
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
using namespace std;

int main()
{
    ll n;
    cin>>n;
    ll a[n];
    ll count = 0;
    ll ans = 0;
     for(int i=0;i<n;i++)
      cin>>a[i];;

    for(int i=0;i<n-1;i++)
    {
    	//count = 0;
      if(a[i]>=a[i+1])
      {
        count++;
      }
      else
      {
        ans = max(ans,count);
        count = 0;
      }
    }
    ans = max(ans,count);
    cout<<ans<<"\n";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
constexpr ll mod = 1e9 + 7;
#define endl '\n'


template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char c) {
  return string(1,c);
}

string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (int i = int(N)-1; i >= 0; --i) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef COMPETITIVE_PROGRAMMING_LOCAL
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) if(0){}
#endif

 
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
 
  ll A,B,H,M;
  cin >> A >> B >> H >> M;
  double degree_M = double(M)/60*360;
  double degree_H = (double(H)/12 + (double(M)/60)/12)*360;
  double degree = degree_M - degree_H;
  if (fabs(degree) < 1e-9) {
    cout << fixed << setprecision(12) << fabs(A-B) << endl;
    return 0;
  }
  if (degree > 0) degree = degree_H - degree_M;
  dbg(degree);
  if (degree > 180) degree -= 180;
  if (degree < 0) degree += 180;
  double rad = degree*M_PI/180;

  cout << fixed << setprecision(12) << sqrt(A*A + B*B + 2*A*B*cos(rad)) << endl;
}


Measured memory_bytes: 4196
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    ArrayList <Integer> li = new ArrayList <Integer>();
    ArrayList <Integer> liu = new ArrayList <Integer>();
    ArrayList <Integer> lir = new ArrayList <Integer>();
    int x = sc.nextInt();
    int n = sc.nextInt();
    for(int i=0;i<n;i++){
      int a = sc.nextInt();
      li.add(a);
    }
    Collections.sort(li);
    int l=0;
    int k=0;
    int m=0;
    if(li.size() == 0){
      System.out.println(x);
      System.exit(0);
    }
    liu.add(li.get(0) - 2);
    for(int i=0;i<n;i++){
      if(li.get(i)<x){
        liu.add(li.get(i));
      }else if(li.get(i)>x){
        lir.add(li.get(i));
      }else{
        l++;
      }
    }
    lir.add(li.get(n-1) + 2);
    int under = 0;
    int upper = 0;
    for(int i=1;i<liu.size()+1;i++){
        if(x-i>liu.get(liu.size()-i)){
          k++;
          under=x-i;
          break;
        }
      }
    if(k==0){
        under=liu.get(0)-1;
      }
      for(int i=1;i<lir.size()+1;i++){
        if(x+i<lir.get(i-1)){
          m++;
          upper=x+i;
          break;
        }
      }
      if(m==0){
        upper=liu.get(liu.size()-1)+1;
      }
    if(l==0){
      System.out.println(x);
    }else if(x-under<upper-x){
        System.out.println(under);
      }else if(x-under>upper-x){
        System.out.println(upper);
      }else{
        System.out.println(under);
      }
           
  }
}
   


Measured memory_bytes: 27188
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#define LL long long
using namespace std;
LL n,a[25][25],g[1<<16],bin[1<<16],f[1<<16];
int main()
{
	scanf("%lld",&n);
	for(LL i=0;i<n;i++) bin[1<<i]=i;
	for(LL i=0;i<n;i++)
		for(LL j=0;j<n;j++) scanf("%lld",&a[i][j]);
	for(LL i=1;i<1<<n;i++)
	{
		LL u=i&(-i),x=bin[u],t=i^u;g[i]=g[t];
		for(LL j=0;j<n;j++)
			if((1<<j)&t) g[i]+=a[j][x];
	}
	for(LL i=1;i<1<<n;i++)
		for(LL j=i;j;j=(j-1)&i) f[i]=max(f[i],g[j]+f[i^j]);
	printf("%lld",f[(1<<n)-1]);
}

Measured memory_bytes: 1408
import java.util.LinkedList;
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int clock = scan.nextInt();
        int time = 0;
        LinkedList<String> names = new LinkedList<>();
        LinkedList<Integer> amounts = new LinkedList<>();
        for(int x =0; x < n; x++){
            names.add(scan.next());
            amounts.add(scan.nextInt());
        }
        while(!amounts.isEmpty()){
            String name = names.removeFirst();
            int amount = amounts.removeFirst();
            if(amount <= clock){
                time = time + amount;
                System.out.println(name + " " + time);
            }
            else{
                time = time + clock;
                amount = amount - clock;
                names.add(name);
                amounts.add(amount);
            }

        }

    }
}


Measured memory_bytes: 74652
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<stdlib.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<numeric>
#include<iomanip>
using namespace std;

int main()
{
	int x; cin >> x;
	int i = 1;
	int tmp = 0;
	while (1) {
		if (i*i > x) {
			tmp=(i - 1)*(i - 1);
			break;
		}
		else {
			i++;
		}
	}
	i = 1;
	while (1) {
		if (i*i*i > x) {
			int a= (i - 1)*(i - 1)*(i-1);
			if (tmp < a) {
				tmp = a;
			}
			break;
		}
		else {
			i++;
		}
	}
	i = 1;
	while (1) {
		if (i*i*i*i > x) {
			int a = (i - 1)*(i - 1)*(i - 1)*(i-1);
			if (tmp < a) {
				tmp = a;
			}
			break;
		}
		else {
			i++;
		}
	}	i = 1;
	while (1) {
		if (i*i*i*i*i > x) {
			int a = (i - 1)*(i - 1)*(i - 1)*(i - 1)*(i-1);
			if (tmp < a) {
				tmp = a;
			}
			break;
		}
		else {
			i++;
		}
	}
	cout << tmp << endl;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> AB(2);
    for (int i=0;i<2;++i) cin >> AB[i];
    int K; cin >> K;
    for (int i=0;i<K;++i){
        if (AB[i&1]&1) --AB[i&1];
        AB[(i&1)^1]+=AB[i&1]/2;
        AB[i&1]/=2;
    }
    cout << AB[0] << ' ' << AB[1] << '\n';
}

Measured memory_bytes: 256
num_island, num_service = gets.split(' ').map(&:to_i)

middle_s = []
middle_e = []
num_service.times do
  a, b = gets.split(' ').map(&:to_i)
  middle_s << b - 1 if a == 1
  middle_e << a - 1 if b == num_island
end

puts (middle_s & middle_e).count == 1 ? 'POSSIBLE' : 'IMPOSSIBLE'


Measured memory_bytes: 9816
N, K = map(int,input().split( ))
H = [int(i) for i in input().split( )]

H = sorted(H)
def binary_search(arr, s, e, x):
    end=e
    start=s
    if end >= start:
        mid = int(s + (end-start)/2)
        if x > arr[mid]:
            binary_search(arr, mid+1, end, x)
        elif x < arr[mid]:
            binary_search(arr, start, mid-1, x)
        else:
            for i in range(mid-start):
                if arr[mid-i-1] < x:
                    start = mid - i
                    break
            print(len(arr)-start)
    else:
        print(len(arr)-start)
binary_search(H,0,N-1,K)

Measured memory_bytes: 11896
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    while(true){
        int n;
        scanf("%d",&n);
        if(n==0) return 0;
        int a[n+1][n+1];
        fill(a[0],a[0]+(n+1)*(n+1),0);
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                scanf("%d",&a[i][j]);
                a[i][n]+=a[i][j];
                a[n][j]+=a[i][j];
                a[n][n]+=a[i][j];
                printf("%5d",a[i][j]);
            }
            printf("%5d\n",a[i][n]);
        }
        for(int i=0;i<=n;i++){
            printf("%5d",a[n][i]);
        }
        printf("\n");
    }
}

Measured memory_bytes: 1044
import java.io.*;
import java.util.*;
  
public class Main{
  public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s=br.readLine();
        String[] spl=s.split(" ");
        int a=Integer.parseInt(spl[0]);
        int b=Integer.parseInt(spl[1]);
        int c=Integer.parseInt(spl[2]);
  
        Arrays.sort(spl);
        System.out.println(spl[0]+" "+spl[1]+" "+spl[2]);
  
    }
}

Measured memory_bytes: 24240
#include <set>
#include <vector>
#include <iostream>

using namespace std;

int type(int num)
{
    
    if (num >= 3200) {
        
        return -1;
        
    }
    
    return num / 400;
    
}

int main(void)
{
    
    int n;
    vector<int> a;
    
    scanf("%d", &n);
    
    for (int i = 0; i < n; ++i) {
        
        int num; cin >> num;
        
        a.push_back(num);
        
    }
    
    set<int> normal;
    int special = 0;
    
    for (auto x: a) {
        
        int c = type(x);
        
        if (c == -1) {
            
            ++special;
            
        }
        else {
            
            normal.insert(c);
            
        }
        
    }
    
    int min = normal.size();
    
    if (min < 1 && special) {
        
        min = 1;
        
    }
    
    cout << min << ' ' << normal.size() + special << endl;
    
    return 0;
    
}
































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

using namespace std;

int main() {
  int64_t W, H, x, y;
  cin >> W >> H >> x >> y;
  double area = (double)(W * H) / 2;

  W *= 2;
  H *= 2;
  x *= 2;
  y *= 2;
  int64_t center_x = W / 2;
  int64_t center_y = H / 2;

  bool is_center = ((center_x == x) && (center_y == y));
  printf("%.12lf %d\n", area, is_center);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  
#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

const int N = 55;
int a[N], b[N];
bool ban[N];

bool dfs(int x, int y) {
    if (x < y) {
        return false;
    }
    if (x == y) {
        return true;
    }
    for (int i = 1; i <= x; i++) {
        if (!ban[i] && dfs(x % i, y))
            return true;
    }
    return false;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;

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

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

    for (int i = 0; i < n; i++) {
        if (!dfs(a[i], b[i])) {
            cout << "-1";
            return 0;
        }
    }

    for (int i = 50; i >= 0; i--) {
        ban[i] = true;
        for (int j = 0; j < n; j++) {
            if (!dfs(a[j], b[j])) {
                ban[i] = false;
                break;
            }
        }
    }

    ll ans = 0;

    for (int i = 50; i >= 0; i--) {
        if (!ban[i]) {
            ans += 1ll << i;
        }
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
// template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
// template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
bool is_palindrome(string s){return s == string(s.rbegin(),s.rend());}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
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;
}



int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
    }
    //solve(N, M, std::move(A));
    for (long long i = 0; i < M; i++) {
        N-=A[i];
    }
    if(N<0) N=-1;
    cout << N << endl;
    return 0;
}


Measured memory_bytes: 3756
from functools import cmp_to_key


def cmp(a, b):
    if a[1] == b[1]:
        return 0
    return -1 if a[1] < b[1] else 1

def main():
    N = int(input())
    T = []
    for _ in range(N):
        a, b = map(int, input().split())
        T.append([a, b])
    T2 = sorted(T, key=cmp_to_key(cmp))

    now = 0
    possible = 'Yes'
    for i in range(len(T2)):
        t = T2[i]
        deadline = t[1]
        now += t[0]
        if now > deadline:
            possible = 'No'
            break
    
    print(possible)
    

main()

Measured memory_bytes: 46504
#include<stdio.h>

int main(void)
{
  int a[10000];
  scanf("%d",&a[0]);

  int i=1,j;
  while(1){
    if(a[i-1]%2==0)
      a[i] = a[i-1]/2;
    else
      a[i] = 3*a[i-1]+1;

    for(j=0;j<i;j++)
      if(a[i]==a[j]){
        printf("%d\n",i+1);
        return 0;
      }

    i++;
  }

  return 0;
}

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

class Main{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int i;
        int j;
        while(true){
            //String s = br.readLine();
            String[] str = br.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int w = Integer.parseInt(str[1]);
            if(h == 0 || w == 0) break;
            for(i=0;i<h; i++){
                System.out.print("");
                for(j=0; j<w-1; j++){
                    if((i%2!=0 && j%2==0) ^ (i%2==0 && j%2!=0)){
                        System.out.print(".");
                    }else /*if((i%2==0 && j%2!=0) ^ ())*/{
                        System.out.print("#");
                    }
                   
                }
                if((i%2!=0 && j%2==0) ^ (i%2==0 && j%2!=0)){
                    System.out.println(".");
                }else{
                    System.out.println("#");
                }
                //int sum = i + j;
                //System.out.println(sum);
            }
            System.out.print("\n");
        }
    }
}

Measured memory_bytes: 26044
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
typedef long long ll;
#define mp make_pair
int x; 
int gcd(int a,int b){
	if(!b){
		return a;
	}
	else return gcd(b,a%b);
} 
int main(){
	cin>>x;

	cout<<360/(gcd(x,360));
	return 0;
}


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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(ull i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

#define clr(a,i) memset((a), (i) ,sizeof(a))

int main(){
  string s;
  std::cin >> s;
  rep(i,13){
    if(i<4) std::cout << s[i];
    else if(i==4) std::cout << " ";
    else std::cout << s[i-1] ;
  }
  std::cout << std::endl;
}


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

int main()
{
	auto start = steady_clock::now();

	random_device rnd;

	int D;
	vector<int> cs(26);
	cin >> D;
	for (auto &&c : cs)
	{
		cin >> c;
	}
	vector<vector<int>> sss(D, vector<int>(26));
	for (auto &&ss : sss)
	{
		for (auto &&s : ss)
		{
			cin >> s;
		}
	}

	vector<int> ts(D);
	for (auto &&t : ts)
	{
		t = rnd() % 26;
	}

	auto calc_score = [&] {
		vector<int> last(26, -1);

		int s = 0;

		for (int d = 0; d < D; d++)
		{
			s += sss[d][ts[d]];

			last[ts[d]] = d;

			for (int i = 0; i < 26; i++)
			{
				s -= cs[i] * (d - last[i]);
			}
		}

		// return max(0, 1000000 + s);
		return s;
	};

	auto calc_diff = [&](int d, int q) {
		int p = ts[d];

		ts[d] = q;

		int ret = calc_score();

		ts[d] = p;

		return ret;
	};

	int score = calc_score();

	while (duration_cast<milliseconds>(steady_clock::now() - start).count() < 1950)
	{
		for (int d = 0; d < D; d++)
		{
			for (int q = 0; q < 26; q++)
			{
				if (ts[d] == q)
				{
					continue;
				}

				int next_score = calc_diff(d, q);

				if (score < next_score)
				{
					ts[d] = q;
					score = next_score;
				}
			}
		}
	}

	for (auto &&t : ts)
	{
		cout << t + 1 << endl;
	}

	return 0;
}

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

struct Edge {
    int from;
    int to;
    int w;
};

int solve() {
    int L;
    cin >> L;
    vector<Edge> e;
    int m = 0;
    while ( L >> m ) m++;
    for ( int i = 0; i < m-1; i++ ) {
        e.push_back(Edge{i, i+1, 0});
    }
    for ( int i = 0; i < m-1; i++ ) {
        e.push_back(Edge{i, i+1, 1<<i});
    }
    for ( int i = m-1; i >= 1; i-- ) {
        if ( L & (1<<(i-1)) ) {
            int w = L & ~((1<<i)-1);
            e.push_back(Edge{i-1, m-1, w});
        }
    }
    cout << m << " " << e.size() << "\n";
    for ( auto ee : e ) {
        cout << ee.from + 1 << " " << ee.to + 1 << " " << ee.w << "\n";
    }
    return 0;
}

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

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

int main() {
  std::string str;
  std::cin >> str;
  if (str.size() % 2 == 1) {
   	std::cout << "No" << std::endl;
    return 0;
  }
  for (int i = 0; i < str.size(); i += 2)
    if (str[i] == 'h' && str[i+1] == 'i') {
      ;
    } else {
      std::cout << "No" << std::endl; 
      return 0;
    }
  std::cout << "Yes" << std::endl;
}
    

Measured memory_bytes: 256
import collections

n = int(input())
alp = [50] * 26

for i in range(n):
    S = collections.Counter(list(input()))
    for j in range(26):
        if chr(97 + j) in S.keys():
            alp[j] = min(alp[j], S[chr(97 + j)])
        else:
            alp[j] = 0
ans = []
for i in range(26):
    ans += [chr(97 + i)] * alp[i]
print(''.join(ans))

Measured memory_bytes: 3316
#include<cstdio>
int n,A[50];
int solve(int i,int M)
{
    if(M==0) return 1;
    if(i>=n) return 0;

   // else
   // {
        int res;
        res=solve(i+1,M)||solve(i+1,M-A[i]);
        return res;
   // }
}
int main()
{
    int q,M;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&A[i]);
    }
    scanf("%d",&q);
    for(int i=0;i<q;i++)
    {
        scanf("%d",&M);
        if(solve(0,M)) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}



Measured memory_bytes: 2616
// JavaProgram.cpp
// Author : Priydarshi Singh (@dryairship)
// One cat just leads to another. One bug leads to two others.

#include <bits/stdc++.h>
using namespace std;

// I like my types defined.
typedef long long           ll;
typedef pair<int, int>      pii;
typedef vector<int>         vi;
typedef vector<pii>         vii;
typedef set<int>            si;
typedef map<string, int>    msi;
typedef map<int, int>       mii;

// Traditional science is all about finding "hashtag define"s.
#define fr(i, n)            for(int i=0; i<(n); ++i)
#define frC(i, n, c)        for(int i=0; (i<(n)) && (c); ++i)
#define frA(i, a, n)        for(int i=a; i<=(n); ++i)
#define frD(i, a, n)        for(int i=a; i>=(n); --i)
#define fill(a)             memset(a, 0, sizeof(a))
#define fill1(a)            memset(a, -1, sizeof(a))
#define revsort(a, b)       sort(a, b, greater<int>())
#define ff                  first
#define ss                  second
#define pb                  push_back 
#define dout                if(DEBUGGING) cout
#define dbg                 if(DEBUGGING) 
#define endl                "\n"

// When you realize MOD > INF...
int DEBUGGING    =          0;
const int INF    =          1000000000;
const int MOD    =          1000000007;
const ll LINF    =          1e18;
const double PI  =          3.1415926535897932;
const double EPS =          1e-7;

// I'D SPAM. Hehe.
ll gcdEx                    (ll a, ll b, ll *x, ll *y){if(!a){*x=0;*y=1;return b;} 
ll x1,y1,gcd=gcdEx          (b%a,a,&x1,&y1); *x=y1-(b/a)*x1;*y=x1; return gcd;}
ll modI(ll b, ll m)         {ll x,y;gcdEx(b,m,&x,&y);return (x%m+m)%m;}
ll modD(ll a, ll b)         {return (modI(b,MOD)*(a%MOD))%MOD;}
ll modS(ll a, ll b)         {return ((a%MOD)-(b%MOD)+MOD)%MOD;}
ll modP(ll x, ll y)         {ll r=1; x%=MOD; while(y>0){if(y&1){r=(r*x)%MOD;} y=y>>1; x=(x*x)%MOD;} return r;}
ll modA(ll a, ll b)         {return ((a%MOD)+(b%MOD))%MOD;}
ll modM(ll a, ll b)         {return ((a%MOD)*(b%MOD))%MOD;}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int h[100005];
vi adj[100005];

void solve(int TEST_CASE){
    int n,m;
    cin >> n >> m;
    fr(i,n) cin >> h[i];
    int a,b;
    fr(i,m){
        cin >> a >> b;
        a--; b--;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    int f;
    int c=0;
    fr(i,n){
        f=1;
        fr(j,adj[i].size()){
            if(h[adj[i][j]]>=h[i]){
                f=0;
                break;
            }
        }
        if(f) c++;
    }
    cout << c;

}

int main(int argc, char* argv[]){
    if(argc==2 && argv[1][1]=='v') DEBUGGING = 1;
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin.exceptions(cin.failbit);
    int nTestCases=1;
    //cin >> nTestCases;
    frA(i,1,nTestCases) solve(i);
    return 0;
}

Measured memory_bytes: 9164
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <bitset>
#include <stack>
//#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
}
int main(void)
{
    lli N, K;
    cin >> N >> K;
    lli h[100010];
    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
    }
    lli dp[100010];
    for (int i = 0; i < N; i++)
    {
        dp[i] = 1000000000000000;
    }
    dp[0] = 0;
    for (int i = 1; i < N; ++i)
    {
        //chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        for (int j = 1; j <= K; j++)
        {
            if (i > j - 1)
            {
                chmin(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
            }
        }
    }
    cout << dp[N - 1] << endl;
    return 0;
}

Measured memory_bytes: 5136
S = input()
N = len(S)
words = ['dream', 'dreamer', 'erase', 'eraser']
while True:
    flag = False
    for i in words:
        n = len(i)
        if S[N-n:N] == i:
            flag = True
            N -= n
            break
    if not flag:
        ans = 'NO'
        break
    if N == 0:
        ans = 'YES'
        break

print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;
int main() {
  int A, B;
  cin >> A >> B;
  cout << ceil((double) (B - 1) / (A - 1)) << endl;
  return 0;
}


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

/*
double manhattan(int* x,int* y){
	double distance=0;
	for(int i=0;i<x.length();++i){
		distance+=abs(x[i]-y[i]);
	}
	return distance;
}

double euqlid(int* x,int* y){
	double distance=0;
	for(int i=0;i<x.length();++i){
		distance+=pow(x[i]-y[i],2);
	}
	return sqrt(distance);
}
*/

double mincofski(int* x,int* y,int p,int length){
	double distance=0;
	for(int i=0;i<length;++i){
		distance+=pow(abs(x[i]-y[i]),p);
	}
	return pow(distance,(double)1/p);
}

double chebichef(int* x,int* y,int length){
	double distance=0;
	for(int i=0;i<length;++i){
		if(distance<abs(x[i]-y[i]))distance=abs(x[i]-y[i]);
	}
	return distance;
}

int main(){
	int n;
	cin>>n;
	int x[n],y[n];
	for(int i=0;i<n;++i)cin>>x[i];
	for(int i=0;i<n;++i)cin>>y[i];
	cout<<fixed;
	cout<<setprecision(5)<<mincofski(x,y,1,n)<<endl;
	cout<<setprecision(5)<<mincofski(x,y,2,n)<<endl;
	cout<<setprecision(5)<<mincofski(x,y,3,n)<<endl;
	cout<<setprecision(5)<<chebichef(x,y,n)<<endl;
}


Measured memory_bytes: 3472
#include<iostream>
#include<string>
using namespace std;
string A,B,C;
int la,lb,lc;
int main()
{
	cin>>A>>B>>C;
	la=A.length()-1;	lb=B.length()-1;	  
	if (A[la]==B[0]&&B[lb]==C[0])	cout<<"YES";else cout<<"NO";
	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 L = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		int y = 0;
		int i = 0;
		for(i = 0;i<=L;i++){
				A = A - C;
				B = B - D;
				y++;
				if(A<=0&&B<=0){
					L = L - y;
					System.out.println(L);
					break;
				}
		}
	}
}

Measured memory_bytes: 26052
def main():
    n,m,c = tuple([int(t)for t in input().split()])
    b = tuple([int(t)for t in input().split()]) 
    ans = 0
    for _ in [0]*n:
      t = tuple([int(t)for t in input().split()])
      v = c
      for i in range(m):
        v+=b[i]*t[i]
      if v>0:
          ans+=1
    print(ans)
if __name__ == "__main__":
    main()


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

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

using namespace std;

int main(){
  string s;
  cin>>s;
  
  int result=0;
  rep(i, s.size()){
    if(s.at(i)=='+'){
      result++;
    }else{
      result--;
    }
  }
  cout<<result;
  
  return 0;
}

Measured memory_bytes: 256
def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    N, M = LI()
    A = LI()
    S = [0]*(M+2)
    for i in range(N-1):
        a0, a1 = A[i:i+2]
        S[a0+1] += 1
        S[a1] -= 1
        if a1<a0:
            S[0] += 1
    #print(S)
    for i in range(M):
        S[i+1] += S[i]
    for i in range(M+1):
        if S[i]<0:
            S[i] = 0
    D = defaultdict(int)
    for i in range(N-1):
        a0, a1 = A[i:i+2]
        cost = (a1 + M - a0) % M - 1
        D[a1] += cost
    start = 0
    for i in range(N-1):
        a0, a1 = A[i:i+2]
        cost = min(a1, (a1+M-a0)%M)
        start += cost
    #print(S)
    #print(D)
    #print(start)
    cost = start
    ans = start
    for i in range(1,M):
        cost += (D[i] - S[i])
        #print(cost)
        if ans>cost:
            ans = cost
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examE()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 100548
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
using namespace std;
typedef long long LL;
int main(){
    LL n, t, cnt = 0;
    vector <pair<int, int>> ary;
    cin >> n;
    for(LL i = 0; i < n; i++){
        cin >> t;
        ary.push_back(pair<int, int>(t, i % 2));
    }

    sort(ALL(ary));

    for(LL i = 0; i < n; i++){
        if(ary[i].second != i % 2) cnt++;
    }

    cout << cnt / 2;

    return 0;
}


Measured memory_bytes: 1400
/**
 *   author: malviyanshiv
 *   created: 18 August 2019  17:46:30
**/

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a-1; i >= b; i--)
#define FORE(a) for(auto ele : a )
#define ALL(a) begin(a), end(a)
#define RPB(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 0x7fffffff
#define LINF 2000000000000000007
#define F first
#define S second
#define TC int t; cin >> t; while(t--)
#define SET(a,b) memset(a,b,sizeof(a))

#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif

typedef long long ll;
typedef pair< int, int > PII;


void optimizeIO(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}

#define MAX 200005

vector<int> adj[MAX];
vector<int> value(MAX, 0);
vector<int> final(MAX, 0);
vector<bool> vis(MAX, false);

void dfs(int n, int val){
    final[n] = val;
    vis[n] = true;
    for(int nei : adj[n]){
        if(!vis[nei]){
            dfs(nei, val+value[nei]);
        }
    }
}

int main(){
    optimizeIO();

    int n, q, a, b;
    cin >> n >> q;
    REP(i, 0, n-1){
        cin >> a >> b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    while(q--){
        cin >> a >> b;
        value[a] += b;
    }
    dfs(1, value[1]);
    final[1] = value[1];
    for(int i = 1; i <= n; i++)
        cout << final[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 24320
#include<bits/stdc++.h>
using namespace std;
// URDL
long long mod = 1e9+7;
//

int main(){
  int n, x; cin >> n >> x;
  int p = 0;
  int l;
  int cnt = 1;
  for(int i=0; i<n; i++) {
    cin >> l;
    p += l;
    if(p <= x) cnt++;
  }
  cout << cnt << endl;

  return 0;
}


// EOF


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main()
{
	int n;
	string input;
	map<string,int> kuzi;
	cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> input;
		if (kuzi[input] == 0) {
			kuzi[input] = 1;
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 19220
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
using namespace std;
#define FAST   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll          long long
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define mii         map<int,int>
#define vi          vector<int>
#define vll         vector<long long>
#define all(a)      (a).begin(),(a).end()
#define clz(a)      __builtin_clz(a) // count leading zeroes
#define ctz(a)      __builtin_ctz(a) // count trailing zeroes
#define popc(a)     __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul         1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define SIZE        1000005
#define F           first
#define S           second
#define debug(x)    cerr << #x << " = " << x << endl;
#define mod         998244353

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " = " << arg1<<" |";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define endl        '\n'
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

void solve()
{
   int n; cin>>n;
   string s; cin>>s;
   int ans=0,black=0,white=0;
   rep(i,0,n)
   {
     black+=(s[i]=='#');
     if(black) white+=(s[i]=='.');
     if(black==white)
     {
       ans+=black;
       black=0,white=0;
     }
   }
   ans+=min(black,white);
   cout<<ans;
} 
int main()
{   
   FAST;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; t=1;
    while(t--){
       solve();
    }
    return 0;
}

Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
int jc[10002001];
inline int read(){
	int k=0; char ch; int  f=1;
	while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
	while(isdigit(ch)){k=(k<<1)+(k<<3)+(ch^48);ch=getchar();}
	return k*f;
}
inline void write(int x) {
	if (x < 0) {
		putchar('-');
		x = -x;
	}
	if (x < 10) {
		putchar(x | 48);
		return;
	}
	write(x / 10);
	putchar((x % 10) | 48);
}
int ksm(int x,int y){
	int ans=1;
	while(y){
		if(y&1) ans=ans*x%mod;
		x=x*x%mod; y>>=1;
	}
	return ans%mod;
}
int C(int x,int y){
	if(y==0) return 1;
	if(y>x||x<0||y<0) return 0;
	if(x<=y) return 1;
	return jc[x]%mod*ksm(jc[y]*jc[x-y]%mod,mod-2)%mod;
}
signed main(){
	int n,k; n=read(); k=read();
	jc[1]=1;
	for(int i=2;i<=n;i++) jc[i]=jc[i-1]*i%mod;
	for(int i=1;i<=k;i++){
	write(C(n-k+1,i)*C(k-1,i-1)%mod); puts(" ");
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ctime>
#include <sstream>
#define weewoo ios::sync_with_stdio(false);cin.tie(0)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ld long double
#define ll long long
#define se second
#define fi first
#define ctoi(x) (x-'0')
#define pi (acos(-1))
#define llputin(a,n) for(int i=0;i<n;i++){ll x;cin >> x;a.push_back(x);}
#define iputin(a,n) for(int i=0;i<n;i++){int x;cin >> x;a.push_back(x);}

#define MOD ((ll) 1e9 + (ll) 7)
using namespace std;

ll pw(ll x,ll a){
    if(a==0)
        return 1;
    ll t = pw(x,a/2);
    if(a%2==0)
        return (t*t);
    else
        return (t*t*x);
}

bool prime(int x)
{
    if(x < 2) return false;
        for(int i=2; i<= sqrt(x); i++) {
            if ((x%i) == 0) return false;
        }
    return true;
}




int main()
{
    weewoo;
    int n;
    string x,y;
    cin >> n >> x >> y;
    for(int i=0;i<n;i++){
        cout << x[i] << y[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
ll N, X;

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

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

  cin >> N >> X;
  ll ans = N; // X + N - X
  bool flag = true;
  ll a = max(X, N-X);
  ll b = min(X, N-X);
  while(flag){
    ll sy = a/b;
    ll am = a%b;
    ans+=(2*sy)*b;
    if (am==0){
      ans -= b;
      flag = false;
    }
    a = b;
    b = am;
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int X;
	
	cin>>X;
	
	if(X >= 30) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	
	return 0;
}

Measured memory_bytes: 3608
#include "bits/stdc++.h"
using namespace std;
#define fst first
#define scd second
constexpr long long mod = 1e9+7;
signed main()
{
	long long n, k, ans = 0;
	scanf("%lld%lld", &n, &k);
	for(int i = k; i <= n + 1; ++i)
	{
		ans = (ans + n * (n + 1ll) / 2ll - (n - i) * (n - i + 1ll) / 2ll - i * (i - 1ll) / 2ll + 1ll) % mod;
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 3812
/*
  AUTHOR:SOURABH
  CREATED:26:01:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<ll , null_type, less< ll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    //freopen("in.txt","r",stdin);
    //freopen(2 "out.txt","w",stdout);

    ll n,k,i,sum=0;
    cin>>n>>k;
    vll a(n);
    fn(i,n)
    cin>>a[i];
    sort(a.begin(),a.end());
    if(k>=n)
        cout<<0;
    else
    {
        fn(i,n-k)
        sum+=a[i];
        cout<<sum;
    }
    return 0;
}




Measured memory_bytes: 1792
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long lint;


int main(){
    
    int n,r;
    cin >> n >> r;
    if(n>=10){
        cout << r << endl;
    }else{
        cout << r + 100*(10-n) << endl;
    }
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int p[1000];
int root(int x){
	return p[x] < 0 ? x : p[x] = root(p[x]);
}

int main(){
	int n, m; cin >> n >> m;
	int c = 0, v = n;
	rep(i, n) p[i] = -1;
	rep(i, m){
		int a, b; cin >> a >> b; a--; b--;
		int ra = root(a), rb = root(b);
		if(ra == rb) continue;
		if(p[ra] == -1 && p[rb] == -1) c++, v -= 2;
		if(p[ra] != -1 && p[rb] != -1) c--;
		if(p[ra] != -1 && p[rb] == -1 || p[ra] == -1 && p[rb] != -1) v--;
		p[ra] += p[rb];
		p[rb] = ra;
	}
	cout << abs(c - v) << endl;
	
	return 0;
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) true
#define dump(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int K,X; cin >> K >> X;
	for(int i=X-(K-1);i<=X+(K-1);i++) cout << i << " ";
	cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
if (a==b && b==c){
	cout<<"1"<<endl;
	return 0;
}
if (a==b or a==c or b==c){
	cout<<"2"<<endl;
}
else{
	cout<<"3"<<endl;
}
return 0;
}


Measured memory_bytes: 256