akhauriyash/Code-Regression huggingface dataset:
/*input
2
*/
/**
    Author: Kristopher Paul
    Date Created: 07-09-2019
    Contest Name:
                _/    _/   _/_/_/_/   _/   _/_/_/_/
               _/  _/     _/    _/   _/   _/
              _/_/       _/_/_/_/   _/   _/_/_/_/
             _/  _/     _/  _/     _/         _/
            _/    _/   _/    _/   _/   _/_/_/_/
**/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int ll
#define pb push_back
#define INF 1e18
#define MOD 1000000007
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define umap unordered_map
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define itr :: iterator it
#define all(v) v.begin(),v.end()
#define WL(t) while(t--)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define out(x) cout << #x << " is " << x << endl
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
//using namespace __gnu_pbds;

//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // set
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // multiset

int ModExp(int x,int y,int m){
    int res = 1;
    x = x % m;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % m;

        y = y>>1;
        x = (x*x) % m;
    }
    return res;
}

void solve(){
    int n;
    cin >> n;
    cout << ceil(pow(n,3)) << endl;
}

signed main(){
    FastIO;
    int t = 1;
//    cin >> t;
    WL(t){
        solve();
    }
}


Measured memory_bytes: 384
#include <iostream>
#include <set>
using namespace std;
int main()
{
    set<int> s;
    int n,m,k;
    cin >> n >> m >>k;
    for(int i=0;i<k&&n+i<=m;i++)
    {
        s.insert(n+i);
        s.insert(m-i);
    }
    set<int>::iterator it;
    for(it=s.begin();it!=s.end();it++)
    {
        cout << *it << endl;
    }
    return 0;
}

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

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

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

    sort(h, h + n);

    ll ans = -1;

    for(int i = k - 1; i < n; i++){
        if(ans == -1){
            ans = h[i] - h[i - k + 1];
        }else if(ans > h[i] - h[i - k + 1]){
            ans = h[i] - h[i - k + 1];
        }
    }

    cout << ans << endl;
    
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;

long long dfs(const vector<vector<int>> &G, const vector<long long> &A, int v, int prev){
  //cerr << v << endl;
  if(G[v].size() == 1 and G[v][0] == prev) return A[v];
  vector<long long> B;
  long long s = 0;
  for(auto v_ : G[v]){
    if(v_ == prev) continue;
    long long t = dfs(G,A,v_,v);
    if(t < 0) return -1;
    B.push_back(t);
    s += t;
  }
  sort(B.begin(), B.end());
  long long d = s - A[v];
  if(d >= 0 and s - 2*d >= 0 and s - B.back() >= d) return s - 2*d;
  return -1;
}

int main(){
  int N;
  cin >> N;
  vector<vector<int>> G(N);
  vector<long long> A(N);
  for(int i = 0; i < N; ++i) cin >> A[i];
  for(int i = 0; i < N-1; ++i){
    int a, b;
    cin >> a >> b;
    --a,--b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  //cerr << dfs(G,A,0,-1) << endl;
  int v = 0;
  for(int i = 0; i < N; ++i){
    if(G[i].size() > 1) continue;
    v = i;
    break;
  }
  //cerr << v << " " << dfs(G,A,v,-1) << endl;
  long long ans = dfs(G,A,v,-1);
  if(ans == A[v]) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 18944
package main

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

func parseInt(s string) int {
	return int(parseInt64(s))
}

func parseInt64(s string) int64 {
	x, _ := strconv.ParseInt(s, 10, 64)
	return x
}

var reader *bufio.Reader

func readLine() string {
	if reader == nil {
		reader = bufio.NewReader(os.Stdin)
	}
	s, _ := reader.ReadString('\n')
	return strings.TrimSuffix(s, "\n")
}

func readFields() []string {
	return strings.Fields(readLine())
}

type T int64

func max(a, b T) T {
	if a > b {
		return a
	} else {
		return b
	}
}

func min(a, b T) T {
	if a < b {
		return a
	} else {
		return b
	}
}

func sum(a []T) T {
	var result T
	for _, x := range a {
		result += x
	}
	return result
}

func squ(a T) T {
	return a * a
}

var CYCLE T = 1000000007

var LARGE T = 9223372036854775807
var h [200000]T
var c [200000]T

type Line struct {
	a T
	b T
}

var lines [200000]Line
var linesPtr int
var linesLength int

func query(x T) T {
	if linesLength == linesPtr {
		panic("deque is empty")
	}
	result := lines[linesPtr].a*x + lines[linesPtr].b
	for linesPtr < linesLength-1 {
		next := lines[linesPtr+1].a*x + lines[linesPtr+1].b
		if result < next {
			break
		}
		linesPtr++
		result = next
	}
	return result
}

func crossX(l1, l2 Line) float64 {
	return float64(l2.b-l1.b) / float64(l1.a-l2.a)
}

func add(a T, b T) {
	if linesLength > 0 && lines[linesLength-1].a <= a {
		panic("h order is not valid")
	}

	var line = Line{a, b}
	for linesLength >= linesPtr+2 && crossX(line, lines[linesLength-2]) <= crossX(lines[linesLength-1], lines[linesLength-2]) {
		linesLength--
	}

	lines[linesLength] = line
	linesLength++
}

func main() {
	var N int
	var C T
	fmt.Scan(&N, &C)
	var h0 T
	for i, f := range readFields() {
		h[i] = T(parseInt64(f))
		if i == 0 {
			h0 = h[i]
		}
		h[i] -= h0
	}

	add(0, 0)
	var c T
	for i := 1; i < N; i++ {
		c = query(h[i]) + C + squ(h[i])
		add(-2*h[i], c+squ(h[i]))
	}

	fmt.Printf("%d\n", c)
}


Measured memory_bytes: 12800
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
typedef long long ll;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;

string ans;

int sums(string s) {
  int sum = s[0] - '0';
  for (int i = 1; i <= 5; i += 2) {
    if (s[i] == '-') {
      sum -= s[i + 1] - '0';
    } else {
      sum += s[i + 1] - '0';
    }
  }
  return sum;
}

void sumup7(string s, int i) {
  if (i == 3) {
    if (sums(s) == 7) ans = s + "=7";

    s[5] = '-';
    if (sums(s) == 7) ans = s + "=7";
    s[5] = '+';
    return;
  }

  sumup7(s, i + 1);
  s[2 * i - 1] = '-';
  sumup7(s, i + 1);
  s[2 * i - 1] = '-';
  return;
}

int main() {
  string s(7, '+');
  for (int i = 0; i < 7; i += 2) {
    cin >> s[i];
  }
  sumup7(s, 1);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    for(int i = 0; i <= n; i += 7){
        if((n - i) % 4 == 0){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
	#define lb lower_bound 
	#define ub upper_bound
	#define pii pair<pair<int,int>,pair<int,int> >
	#define se second
	#define endl "\n"
	#define pi pair<int, int>
	#define mi          map<int,int>
	#define mii         map<pi,int>
	#define vi vector<int> 
	#define vvi vector<vi>
	#define bs   binary_search
	#define rep(i,a,b) for(int i=a;i<b;i++)
	#define rep1(i,a,b) for(int i=a;i<=b;i++)	
	#define all(c) (c).begin(),(c).end()
	#define sz(x)       (int)x.size() 
	#define PI 3.14159265358979323846
	
	 const int N =2e5+5;
	
	 int mod= 1e9+7;
	 int dx[4]={0,0,+1,-1};
	 int dy[4]={+1,-1,0,0};  
	 
	 
	int po(int a, int b) {
		a %= mod;
		int res = 1;
		while (b > 0) {
			if (b & 1)
				res = (res * a) % mod;
			a =(a*a) % mod;
			b >>= 1;
		}
		 return res;	
	   }

	  set<int> v[3];
	 void solve() {		 
	     int n,m;
	     cin>>n>>m;
	    
	     vi ans(n,0);
	     if(m==0) {
			 if(n==1) {
				     cout<<0<<endl;
				     return;
				 }
				 
			   cout<<1;
			   --n;
			   rep(i,1,n+1) 
			     cout<<0;
			     return;  
			 }
			 int f=0;
	     rep(i,0,m) {
			   int x,y;
			   cin>>x>>y;
			   --x;
			   if(n>1 && (x==0 && y==0)) f=1;
			   v[x].insert(y); 	    
			 }
			 
			 if(f==1) {
				    cout<<-1<<endl;
				    return;
				 }
				 
			 rep(i,0,n) {
				   if(sz(v[i])>1) {
					      cout<<-1<<endl;
					      return;
					   }
				 }
				 
			rep(i,0,n) {
				  ans[i]=*v[i].begin();				
				}
				
		    if(n>1 && ans[0]==0) ans[0]=1;
		    for(auto to:ans) cout<<to;
		    cout<<endl;		 
				 
		 
				    	 
	        
	 }
	
int32_t main() {
	cool;
	int t=1;
	//cin>>t;
	while(t--)
	   solve();
	   
	   
	   return 0;	   
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(a, b) for (int i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
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;}return false;}

int main()
{
    string s;
    cin >> s;
    if(s[2]==s[3]&&s[4]==s[5]){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	
	int d[n];
	for (int i = 0; i < n; i++) {
	    std::cin >> d[i];
	}
	
	sort(d, d + n);
	
	/*
	for (int i = 0; i < n; i++) {
	    std::cout << d[i] << std::endl;
	}
	*/
	int ans = n;
	
	for (int i = 0; i < n; i++) {
	    if(d[i] == d[i + 1]) ans--;
	}
	
	std::cout << ans << std::endl;
	
	return 0;
}

Measured memory_bytes: 256
#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 rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
typedef long long ll;
using namespace std;
int main(void){
    string s,t;cin>>s>>t;
    vector<vector<ll>> f(26);
    rep(i,s.size()){
        int x=s[i]-'a';
        f[x].push_back(i+1);
    }
    ll res1=0,res2=0;
    rep(i,t.size()){
        int x=t[i]-'a';
        auto& a=f[x];
        
        if(a.size()==0){
            cout<<-1<<endl;
            return 0;
        }
        
        if(a[a.size()-1]<=res2){
            res1++;
            res2=a[0];
            //cout<<res1<<" "<<res2<<endl;
            continue;
        }
        
        auto itr=upper_bound(a.begin(),a.end(),res2);
        int k=itr-a.begin();
        res2=a[k];
        //cout<<res1<<" "<<res2<<endl;
    }
    ll res=res1*s.size()+res2;
    cout<<res<<endl;
}

Measured memory_bytes: 1724
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define per(i,j,n) for(int i=(int)(j);(int)(n)<=i;i--)
#define int long long
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define endl "\n"
#define vi vector<ll>
#define pii pair<ll,ll>
#define vii vector<vi>
const int MOD=1e9+7;
//const int MOD=998244353;
const int INF=(1ll<<62)-1;
signed main(){
  ll N,A,B; cin>>N>>A>>B;
  string ans="Alice";
  if((B-A)%2==1) ans="Borys";
  cout<<ans<<endl;
}

Measured memory_bytes: 3572
/*
...........__________                                                                           ___  __
.............|       |                                                                           |   /
.............|       |                                                                           |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
...........__|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int                 long long
#define ull                 unsigned long long int
#define ld                  long double
#define vi                  vector<int>
#define vii                 vector<pair<int,int>>
#define vvi                 vector<vector<int>>
#define pii                 pair<int,int>
#define prec(x)             fixed<<setprecision(15)<<x
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define rev(x)              reverse(x.begin(),x.end())
#define mset(a,b)           memset(a,b,sizeof(a))
#define mcpy(a,b)           memcpy(a,b,sizeof(a))
#define fo0(i,n)            for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n)            for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b)           for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)            for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)            for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
const int inf=1e18;const int mod=1e9+7;const int N=2e5+9;
void read_And_write(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}

void raushan_kumar(){
    int d=0,e=0,f=0,g=0,p=0,w=0,flag=0,ans=0,res=0,cnt=0,sum=0;double f1=0.0,f2=0.0,f3=0.0;
    vi v(3);
    fo0(i,3) cin>>v[i];
    //case 1
    d=v[0]*v[1]*v[2];
    if(d%2){
    	cout<<min({v[0]*v[1],v[1]*v[2],v[0]*v[2]});
    }
    else{
    	cout<<0;
    }
}

int32_t main()
{
   fast;int t=1;
    // cin>>t;
    while(t--){raushan_kumar();}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int N=105;
int n,m;
char s[N][N];
int f[N][N];
int main(){
	scanf("%d%d",&n,&m);
	For(i,1,n) scanf("%s",s[i]+1);
	memset(f,10,sizeof(f));
	f[1][1]=(s[1][1]=='#');
	For(i,1,n) For(j,1,m){
		f[i][j+1]=min(f[i][j+1],f[i][j]+(s[i][j]!=s[i][j+1]));
		f[i+1][j]=min(f[i+1][j],f[i][j]+(s[i][j]!=s[i+1][j]));
	}
	int ans=f[n][m]+(s[n][m]=='#');
	printf("%d\n",ans/2);
} 


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = ni();
		int k = ni();

		int[] p = new int[n];

		for (int i = 0; i < n; i++) {
			p[i] = ni();
		}
		Arrays.sort(p);

		int count = 0;

		for (int i = 0; i < k; i++) {
			count += p[i];
		}

		out(count);
	}

	/*
	 * 以下メソッド集
	 */
	static int[] sort(int[] n) {
		Arrays.sort(n);
		return n;
	}

	static long[] sort(long[] n) {
		Arrays.sort(n);
		return n;
	}

	static int ketasuu(int n) {
		String str = "" + n;
		return str.length();
	}

	static int account(String str) {
		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

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

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static double max(double d, double e) {
		return Math.max(d, e);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static double min(double d, double e) {
		return Math.min(d, e);
	}

	static int min(int a, int b) {
		return (int) Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


Measured memory_bytes: 39072
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long j,a,b,i,sum=0;
	cin >> a;
	long long arr[a];
	for(i=0;i<a;i++)
	cin >> arr[i];
	for(i=0;i<a-1;i++)
	{
		for(j=i+1;j<a;j++)
		{
			sum=sum+arr[i]*arr[j];
		}
	}
	cout << sum;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define sz(s) (int)(s).size()
#define sqr(x) (x) * (x)
#define re(i, n) for (int i = 1; i <= n; i ++)
#define pb push_back
#define finish(x) return cout << x << endl, 0
#define MP make_mair
#define trav(x, a) for(auto& x: a)
#define all(x) (x).begin(),(x).end()
#define pi acis(-1)
#define Sor(x) sort(all(x))
#define Rev(x) reverse(all(x))
#define F first
#define S second
#define I insert
#define N 2222222
#define MOD 1000000007
#define nol(a) memset(a, 0, sizeof(a))
#define minus(a) memset(a, 0xff, sizeof(a))
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define deb(x) cerr << #x << " = " << x << '\n'
#define eb emplace_back
#define vll vector<long long>
#define file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)
#define INF 1000000021

using namespace std;
using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
//typedef vector<ll> vll;
typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//const ld pi = 2 * acos(0.0);
template <typename _T>inline void read(_T &f){f = 0; _T fu = 1; char c = getchar();while (c < '0' || c > '9') { if (c == '-') { fu = -1; } c = getchar();}    while (c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar();}f *= fu;}
template <typename T>void print(T x){if (x < 0) putchar('-'), x = -x;if (x < 10) putchar(x + 48);else print(x / 10), putchar(x % 10 + 48);}
template <typename T> void print(T x, char t){print(x); putchar(t);}
template <class T> bool umin(T& a, T b) {if(a>b){a = b; return 1;}return 0;}
template <class T> bool umax(T& a, T b) {if(a<b){a=b; return 1;}return 0;}
template <class T, class TT> bool pal(T a, TT n){int k = 0; for(int i =0; i <= n / 2; i ++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}
template<class T>void eras(vector<T>& a,T b){a.erase(find(a.begin(),a.end(),b));}
//int yil[13] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

ll powmod(ll a, ll b, ll m = MOD){ll r = 1;while(b>0){if(b&1)r=r*a%m;a=a*a%m;b>>=1;}return r;}
string to_upper(string a)
{
	for (int i = 0; i < (int)a.size(); ++ i) if (a[i] >= 'a' && a[i] <= 'z') a[i] -= 'a' - 'A';
	return a;
}
string to_lower(string a)
{
	for (int i = 0; i < (int)a.size(); ++ i) if (a[i] >= 'A' && a[i] <= 'Z') a[i] += 'a' - 'A';
	return a;
}
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	ll n;
	cin >> n;
	if (1000 > n)
	{
		return cout << 1000 - n, 0;
	}
	while (n > 1000)
		n -= 1000;
	cout << 1000 - n;






}

	

Measured memory_bytes: 3648
/*input
46 4 40 5
*/
/*

**************************
*						 *
* AUTHOR :: knight_coder *
*						 *
**************************

*/
#include<bits/stdc++.h>
#define lld          long long int
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<lld,lld>
#define msi         map<string,lld>
#define mis         map<lld, string>
#define mpi         map<pair<lld ,lld >,lld >
#define pii         pair<lld,lld>
#define vi          vector<lld>
#define vpi 		vector<pii>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (lld)x.size()
#define hell        1000000007
#define rrep(i,m,n)	for(lld i=m;i>=n;i--)
#define rep(i,m,n)	for(lld i=m;i<n;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define pr(x) 		cout<< x << " ";
#define pre(x)		cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; 
//change null_type to get ordered_map
#define N  100005
#define DEC(N)	cout << std::fixed; cout << setprecision(N);
void solve()
{
	lld a,b,c,d;
	cin >> a >> b >> c >> d;
	lld t=(a+d-1)/d;
	lld r=(c+b-1)/b;
	cout << ((t>=r)?"Yes":"No") << endl;
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	//cin>>tests;
	while(tests--)
	{
		solve();
	}
}

Measured memory_bytes: 3548
#include <iostream>

using namespace std;

typedef long long ll;

int main(int argc, char *argv[])
{
	int N, K;
	string S;

	cin >> N >> K;
	cin >> S;

	int score = 0;
	for (int i = 0; i < N - 1; i++) {
		if (S[i] == S[i + 1]) {
			score++;
		}
	}
	int ans = min(score + 2 * K, N - 1);
	cout << ans << endl;

	return 0;
}


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

int main() {
	string S;
	cin >> S;
	vector<int> check(26);
	int flag = 0;
	for (int i = 0; i < (int)S.size(); i++) {
		if (check.at(S.at(i) - 'a') == 1) {
			flag = 1;
			break;
		}
		check.at(S.at(i) - 'a')++;
	}
	if (flag == 0) {
		cout << "yes" << endl;
	} else {
		cout << "no" << endl;
	}
}

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

int main() {
  int N = 0;
  int M = 0;
  int C = 0;
  std::cin >> N >> M >> C;
  std::vector<int> B(M, 0);

  for (int i = 0; i < B.size(); i++) {
    int a = 0;
    std::cin >> a;
    B[i] = a;
  }

  std::vector<int> A_i_row(M, 0);
  std::vector<std::vector<int>> A(N, A_i_row);

  int counter = 0;
  for (int i = 0; i < A.size(); i++) {
    int judge = C;
    for (int j = 0; j < A[i].size(); j++) {
      int a = 0;
      std::cin >> a;
      A[i][j] = a;
      
      judge += a * B[j];
      
    }
    
    if (judge > 0) {
      counter += 1;
    }
  }
  std::cout << counter << std::endl;
  return 0;
}

Measured memory_bytes: 256
X=int(input())
answer=0
b=2
q=2
if X==1 or X==2 or X==3:
    print("1")
else :
    while b<X:
        while b**q<=X:
            if b**q>answer and b**q<=X:
                answer=b**q
            q+=1
        q=2
        b+=1
    print(answer)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define st first
#define nd second

using ll = long long ;
using namespace std;
using pii = pair<int,int>;
int a[150];
int main(){
	int n, m, sum = 0;;
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= n; i++){
		scanf("%d", &a[i]);
		sum += a[i];
	}
	int tot = (sum + 4 * m - 1) / (4 * m);
	int cnt = 0;
	for(int i = 1;  i <= n; i++){
		if(a[i] >= tot) cnt++;
	}
	printf(cnt >= m ? "Yes" : "No");

}

Measured memory_bytes: 256
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

########################################

N, M, K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a, b=[0], [0]
for i in range(N):
	a.append(a[i]+A[i])
for i in range(M):
	b.append(b[i]+B[i])
	
ans, j=0, M
for i in range(N+1):
	if a[i] > K :
		break
	while b[j] > K - a[i]:
		j-=1
	ans=max(ans, i+j)
print(ans)





Measured memory_bytes: 49508
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
int main(int argc, char *argv[]) {
  /*
  cin>>x;
  cout<<x<<endl;
  */
  int i,j,n,m,a,b;
  cin>>i>>j>>a>>b;
  int ans=(i-a)*(j-b);
  cout<<ans<<endl;
}


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

typedef pair<int, int> II;
typedef vector< II > VII;
typedef vector<int> VI;

#define endl "\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ll long long
#define fr(i,n) for(i=0;i<n;i++)

int a[100010],b[100010],c[100010];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int i,j,q,l,r;
    for(i=2;i<=100000;i++)
    {
        if(a[i]==0)
        {
            b[i]=1;
            for(j=i+i;j<=100000;j+=i)
                a[j]=1;
        }
    }
    for(i=1;i<=100000;i+=2)
    {
        if(b[i]==1 && b[(i+1)/2]==1)
            c[i]++;
    }
    for(i=2;i<=100000;i++)
        c[i]+=c[i-1];
    cin>>q;
    while(q--)
    {
        cin>>l>>r;
        cout<<c[r]-c[l-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 1792
import itertools
count =0
ans=0
n,m = map(int,input().split())
num=[0,1]
pattern = list(itertools.product(num, repeat=n))
lists =[]
switches = [1]*n
onoff = [0]*m
for i in range(m):
    lists.append(list(map(int,input().split())))
key_value = list(map(int,input().split()))
for l in pattern:
    switches = list(l)
    onoff = [0]*m
    for j in range(m):
        count=0
        for k in lists[j][1:]:
            if switches[k-1] == 1:
                count += 1
        if count %2 == key_value[j]:
            onoff[j] = 1
        else:
            break
    if not 0 in onoff:
        ans += 1

print(ans)


Measured memory_bytes: 9208
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>

using namespace std;

int ans = 0;

void look(vector <vector <int> > gr, vector <int> visited, int cur, int n) {
    bool flag = true;
    visited[cur] = 1;
    for (int k : gr[cur]) {
        if (!visited[k]) {
            look(gr, visited, k, n);
            flag = false;
        }
    }
    if (flag) {
        for (int i=1; i < n + 1; ++i) {
            if (visited[i] == 0) flag = false;
        }
        if (flag) ++ans;
    }
    visited[cur] = 0;
}

void solve() {
    int n, m;
    cin >> n >> m;
    vector <vector <int> > gr;
    gr = vector <vector <int>> (n+1);
    for (int i = 0; i < m; ++i) {
        int ai, bi;
        cin >> ai >> bi;
        gr[ai].push_back(bi);
        gr[bi].push_back(ai);
    }
    vector <int> visited(n+1, 0);
    look(gr, visited, 1, n);
    cout << ans;



}

int main() {

    solve();
    return 0;
}


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

int main()
{
  char input_str1[200], input_str2[200];
  char seq1[200], seq2[200];
  int wrong_counter, different_counter;
  int char_num_i, char_num_j;

  for( ; ; )
  {
    wrong_counter = 0;
    different_counter = 0;
    char_num_i = 0;
    char_num_j = 0;
    memset(seq1, '\0', 200);
    memset(seq2, '\0', 200);

    scanf("%s", input_str1);
    if(input_str1[0] == '.')
      break;

    scanf("%s", input_str2);

    if(strcmp(input_str1, input_str2) == 0)
    {
      printf("IDENTICAL\n");
      continue;
    }

    while(input_str1[char_num_i] != '\0' || input_str2[char_num_j] != '\0')
    {
      for( ; input_str1[char_num_i] != '\"' && input_str1[char_num_i] != '\0' ; char_num_i++)
      {
        sprintf(seq1, "%s%c", seq1, input_str1[char_num_i]);
      }

      for( ; input_str2[char_num_j] != '\"' && input_str2[char_num_j] != '\0' ; char_num_j++)
      {
        sprintf(seq2, "%s%c", seq2, input_str2[char_num_j]);
      }

      if(strcmp(seq1, seq2) != 0)
      {
        printf("DIFFERENT\n");
        different_counter = 1;
        memset(seq1, '\0', strlen(seq1));
        memset(seq2, '\0', strlen(seq2));
        break;
      }

      sprintf(seq1, "%c", input_str1[char_num_i]);
      if(seq1[0] == '\"')
        char_num_i++;

      sprintf(seq2, "%c", input_str2[char_num_j]);
      if(seq2[0] == '\"')
        char_num_j++;

      if(seq1[0] != seq2[0])
        break;

      for( ; input_str1[char_num_i] != '\"' && input_str1[char_num_i] != '\0' ; char_num_i++)
        sprintf(seq1, "%s%c", seq1, input_str1[char_num_i]);

      for( ; input_str2[char_num_j] != '\"' && input_str2[char_num_j] != '\0' ; char_num_j++)
        sprintf(seq2, "%s%c", seq2, input_str2[char_num_j]);

      if(input_str1[char_num_i] == '\"')
      {
        sprintf(seq1, "%s%c", seq1, input_str1[char_num_i]);
        char_num_i++;
      }

      if(input_str2[char_num_j] == '\"')
      {
        sprintf(seq2, "%s%c", seq2, input_str2[char_num_j]);
        char_num_j++;
      }

      if(strcmp(seq1, seq2) != 0)
      {
        wrong_counter += 1;
        if(wrong_counter == 2)
        {
          printf("DIFFERENT\n");
          different_counter = 1;
          break;
        }
      }
      memset(seq1, '\0', strlen(seq1));
      memset(seq2, '\0', strlen(seq2));

    }

    if(different_counter == 0)
    {
      if(seq1[0] != seq2[0])
      {
        printf("DIFFERENT\n");
        continue;
      }
      if(wrong_counter == 1)
        printf("CLOSE\n");
    }
  }

  return 0;
}



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

int a[222222], f[222222];
int main()
{
    long n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        scanf("%d", a + i);
    for (int i = 0; i < n; i++)
        scanf("%d", f + i);
    sort(a, a + n);
    sort(f, f + n, greater<>());
    long l = -1, r = 1e13;
    while (l + 1 < r)
    {
        long m = (l + r) / 2, x = 0;
        for (int i = 0; i < n; i++)
            x += max(a[i] - m / f[i], 0l);
        (x > k ? l : r) = m;
    }
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 1920
#include<iostream>
#include<iomanip>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
#include<memory>
using namespace std;
using ll=long long;

const int MAX_N = 300;

int dp[MAX_N+1][MAX_N+1][MAX_N+1];

const int MOD = 998244353;
int madd(int lhs,int rhs){
    int tmp = lhs+rhs;
    return tmp>=MOD ? tmp-MOD : tmp;
}
int main(){
    string s;
    cin>>s;
    int K;
    cin>>K;
    int n = s.size();
    vector<int> pack(n+1);
    int sum = 0;
    for(int i=0;i<n;i++){
        if(s[i]=='0') sum++;
        else pack[sum]++;
    }
    if(sum==n){
        cout<<1<<endl;
        return 0;
    }

    dp[0][0][min(K,n)]=1;
    for(int i=0;i<n;i++){
        for(int j=0;j<=n;j++){
            for(int k=0;k<=n;k++){
                if(dp[i][j][k]==0) continue;

                for(int x=0;x<pack[i];x++){
                    if(j-(pack[i]-x)>=0) dp[i+1][j-(pack[i]-x)][k] = madd(dp[i+1][j-(pack[i]-x)][k],dp[i][j][k]);
                }
                
                for(int x=pack[i];j+x-pack[i]<=n && k-(x-pack[i])>=0;x++){
                    dp[i+1][j+(x-pack[i])][k-(x-pack[i])] = madd(dp[i+1][j+(x-pack[i])][k-(x-pack[i])],dp[i][j][k]);
                }
            }
        }
    }

    
    int res = 0;
    int pos = n;
    for(int k=0;k<=n;k++){
        res = madd(res,dp[pos][0][k]);
    }
    cout<<res<<endl;

    


    
    
    return 0;
}


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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    int mmax = 0;
    int sum = 0;
    inc(i, 0, n){
        int l;cin >> l;
        mmax = max(mmax, l);
        sum += l;
    }
    cout << (mmax < sum-mmax ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    mod = 7 + 10 ** 9

    bit = dict()
    pow_list = dict()
    for j in range(60): 
        bit[j] = 0
        pow_list[j] = pow(2, j, mod)

    first = A[0]
    for j in range(60):
        bit[j] = first % 2
        first //= 2
    
    ans = 0
    for i in range(1, N):
        num = A[i]
        for j in range(60):
            if num % 2 == 1:
                ans += (i - bit[j]) * pow_list[j]
                ans %= mod
            else:
                ans += bit[j] * pow_list[j]
                ans %= mod
            bit[j] += (num % 2)
            num //=2
            
    print(ans)

    return 0

if __name__ == "__main__":
    solve()

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

int main() {
  int n, ans;
  cin >> n;
  if (n <= 9) {
    ans = n;
  } else if (n <= 99) {
    ans = 9;
  } else if (n <= 999) {
    ans = 9 + n - 99;
  } else if (n <= 9999) {
    ans = 9 + 900;
  } else if (n <= 99999) {
    ans = 9 + 900 + n - 9999;
  } else {
    ans = 9 + 900 + 90000;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
typedef long long ll;
using namespace std;
int main()
{
  string s;
  cin >> s;
  int n = s.size();
  ll ans = 0;
  for(int i = 0; i < (1<<n-1); i ++){
    int ind = 0;
    // cout << endl;
    for(int j = 0; j <= n - 1;j ++){
      if(i & (1<<j)){
	ans += stoll(s.substr(ind, j - ind + 1));
	// cout << stoi(s.substr(ind, j - ind + 1)) << endl; 
	ind = j + 1;
      }
      if(j == n - 1){
	ans += stoll(s.substr(ind, n - ind));
	// cout << stoi(s.substr(ind, j - ind + 1)) << endl; 
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int x,idx = 1;
    while (1)
    {
        cin >> x;
        if(x == 0)
            break;
        
        cout << "Case " << idx << ": " << x << endl;
        idx++;
    }
    
  
    return 0;
}


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

enum STATE {UP,DOWN};

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

  int A[100100];
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }

  int ans = 0;
  int pos = 0;
  STATE state;
  while (pos < N) {
    ++pos;
    while (pos < N && A[pos-1] == A[pos]) ++pos;

    if (pos == N) {
      ++ans;
      break;
    }

    if (A[pos-1] < A[pos]) state = UP;
    else state = DOWN;

    ++pos;
    while (pos < N &&
           (state == UP && A[pos-1] <= A[pos] ||
            state == DOWN && A[pos-1] >= A[pos])) {
      ++pos;
    }

    ++ans;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;

const int INF = 1e9;
const int mod = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main()
{
    string S;
    cin >> S;
    int n = 0,s = 0,w = 0,e = 0;
    for(int i = 0; i < S.size(); i++){
        if(S[i] == 'N') n = 1;
        if(S[i] == 'W') w = 1;
        if(S[i] == 'S') s = 1;
        if(S[i] == 'E') e = 1;
    }
    cout << (n != s || w != e ? "No" : "Yes") << endl;

    return 0;
}

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

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

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

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    bool num = true;
    for(int i = 0; i < a; i++){
        num &= (s[i] >= '0' && s[i] <= '9');
    }
    num &= s[a] == '-';
    for(int i = a + 1; i < a + b; i++){
        num &= (s[i] >= '0' && s[i] <= '9');
    }
    if(num){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}


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

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<" : "<<x<<endl
#define ALL(v) (v).begin(),(v).end()

int n,m;
int l[252521],r[252521];
pii e[125252];

int main(){
  scanf("%d%d",&n,&m);
  REP(i,n)l[i]=r[i]=i;
  REP(i,m){
    int o,p;
    scanf("%d%d",&o,&p);
    e[i] = pii(o,p-1);
  }
  sort(e,e+m);
  REP(i,m){
    int u = e[i].second;
    int v = u+1;
    l[v] = l[u];
    r[u] = r[v];
  }
  REP(i,n){
    printf("%d",r[i]-l[i]+1);
    if(i==n-1)putchar('\n');
    else putchar(' ');
  }
  return 0;
}

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

int main(){
  string a,b,c;
  bool flg=false;
  cin >> a >> b >> c;
  if(a.at(a.size()-1)==b.at(0)){
    if(b.at(b.size()-1)==c.at(0)){
      flg=true;
    }
  }
  if(flg){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

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

const int MOD = 998244353;
const ll INF = 1e18;
const int N = 2e5 + 12; //check the limits, dummy


int main() {

    ios_base::sync_with_stdio (0);
    cin.tie (0);

    ll r;
    cin >> r;
    cout << r*r;
    
    return 0;
}


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

int main(void)
{
  int N, i, ans = 0, str[101];
  scanf("%d", &N);
  for (i = 0; i < N; i++)
  {
    scanf("%d", &str[i]);
  }
  for (i = 0; i < N; i++)
  {
    if ((i + 1) % 2 == 1 && str[i] % 2 == 1)
    {
      ans++;
    }
  }
  printf("%d", ans);
  return 0;
}

Measured memory_bytes: 1724
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1000000000 + 7;

int main() {
    int h, w;
    cin >> h >> w;
    int cnt = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            char a;
            cin >> a;
            if (a == '#') cnt++;
        }
    }
    string ans = "Impossible";
    if (cnt == h + w - 1) ans = "Possible";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <math.h>
#include <complex>
using ll = long long;
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
int const MOD = 1e9 + 7;

using P = pair<int, int>;

int m;
ll ans;
int x[16], y[16];
vector<P> v;
bool used[16];
void dfs()
{
    if (v.size() == m / 2)
    {
        ll cnt = 0;
        for (int i = 0; i < v.size(); ++i)
        {
            for (int j = i + 1; j < v.size(); ++j)
            {
                int a = x[v[i].first] - x[v[i].second], b = y[v[i].first] - y[v[i].second],
                    c = x[v[j].first] - x[v[j].second], d = y[v[j].first] - y[v[j].second];
                if (a * d == b * c)
                {
                    cnt++;
                    continue;
                }
                if (a * d == b * c)
                {
                    cnt++;
                    continue;
                }
                a = -a;
                b = -b;
                if (a * d == b * c)
                {
                    cnt++;
                    continue;
                }
                a = -a;
                b = -b;
                c = -c;
                d = -d;
                if (a * d == b * c)
                {
                    cnt++;
                    continue;
                }
                a = -a;
                b = -b;
                if (a * d == b * c)
                {
                    cnt++;
                    continue;
                }
            }
        }
        ans = max(ans, cnt);
        return;
    }
    int i = 0;
    while (used[i])
        i++;
    for (int j = i + 1; j < m; ++j)
    {
        if (!used[j])
        {
            v.push_back(P(i, j));
            used[i] = used[j] = true;
            dfs();

            used[i] = used[j] = false;
            v.pop_back();
        }
    }
    return;
}
int main(void)
{
    cin >> m;
    for (int i = 0; i < m; ++i)
    {
        cin >> x[i] >> y[i];
    }
    dfs();
    cout << ans << endl;
    return 0;
}


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

int binary(int bina)
{
    int ans = 0;
    for (int i = 0; bina > 0; i++)
    {
        ans = ans + (bina % 2) * pow(10, i);
        bina = bina / 2;
    }
    return ans;
}

int main()
{
    int N;

    cin >> N;

    int F[N][10];
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            cin >> F[i][j];
        }
    }
    int P[N][11];
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < 11; j++)
        {
            cin >> P[i][j];
        }
    }

    int ans = 1;
    int score = INT_MIN;
    int max;
    string bit;
    int array[10];

    while (ans < 1024)
    {
        bit = to_string(binary(ans));
        bit = string(10 - bit.length(), '0') + bit;

        int i = 0;
        for (char c : bit)
        {
            array[i++] = c - '0';
        }

        int score_tmp = 0;
        for (int i = 0; i < N; i++)
        {
            int same = 0;
            for (int j = 0; j < 10; j++)
            {
                if (F[i][j] == 1 && array[j] == 1)
                {
                    same++;
                }
            }
            score_tmp += P[i][same];
        }

        if (score_tmp > score)
        {
            score = score_tmp;
        }

        ans++;
    }
    cout << score << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int n,i,j,tmp,sum=0;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      if(a[i]>a[j]){
        tmp=a[i];
        a[i]=a[j];
        a[j]=tmp;
      }
    }
  }
  for(i=0;i<n-1;i++){
    sum+=a[i];
  }
  if(a[i]<sum){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define CYES cout << "Yes" \
                  << "\n";
#define CNO cout << "No" \
                 << "\n";
#define CFS           \
    cin.tie(nullptr); \
    ios::sync_with_stdio(false);
#define CST(x) cout << fixed << setprecision(x);
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
const int IINF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = (int)1e9 + 7;
const string MM = " ";

int main()
{
    int n, m;
    cin >> n >> m;
    cout << n * (n - 1) / 2 + m * (m - 1) / 2 << "\n";
}

Measured memory_bytes: 256