akhauriyash/Code-Regression huggingface dataset:
#include <cmath>
#include <cstdio>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#define vi vector<int>
#define vb vector<bool>
#define lli long long int
#define vvi vector<vector<int>>
#define loop(n) for (int i = 0; i < n; i++)
using namespace std;

auto SpeedUp = []() {
    std::ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return 0;
}();

void solve()
{
    int n;
    cin>>n;
    if(n>=30)
    { 
        cout<<"Yes"<<endl;
        return;
    }
    cout<<"No"<<endl;
    return;
}

int main()
{

    solve();
    return 0;
}

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

#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
#define CININIT cin.tie(0),ios::sync_with_stdio(false)
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main(){
    int n,a,b,c,x;
    while(cin>>n>>a>>b>>c>>x){
        if(n==0 and a==0 and b==0 and c==0 and x==0){
            break;
        }

        int frame = 0;
        vector<int> Y(n);
        rep(i,n) cin>>Y[i];
        rep(i,n){
            int y = Y[i];

            while(x!=y){
                ++frame;
                x = (a * x + b) % c;
                if(frame>10000){
                    cout << -1 << endl;
                    goto next;
                }
            }
            if(i!=n-1){
                frame++;
                x = (a * x + b) % c;
            }
        }
        cout << frame << endl;
next:;
    }
}

Measured memory_bytes: 3084
#[allow(dead_code)]
fn main() {
    let mut aa = i::str();
    let mut bb = i::str();

    if (aa.len()>bb.len()){
        println!("GREATER");
        return;
    }
    if (aa.len()<bb.len()){
        println!("LESS");
        return;
    }
    let mut len1=aa.len();
    let aavec:Vec<char> =aa.as_str().chars().collect();
    let bbvec:Vec<char> =bb.as_str().chars().collect();


    for xx1 in 0..len1 {
        if (aavec[xx1]>bbvec[xx1]){
            println!("GREATER");
            return;
        }
        if (aavec[xx1]<bbvec[xx1]){
            println!("LESS");
            return;
        }
    }

    println!("EQUAL");
}


#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }
    pub fn strv(n: usize) -> Vec<String> {
        (0..n).map(|_| str()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 2132
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<stdlib.h>
#include<iomanip>
#include<limits>
#include<queue>
#include<stack>
#include<math.h>
#include<array>

using namespace std;

#define rep(i, n) for( int i = 0; i < (n); i++)
#define loop(i, a, n) for(int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main(){
	string O ="", E;
	cin >> E >> O;
	string ans;
	rep(i, O.size()){
		ans = ans + E[i] + O[i];
	}
	if(O.size() == E.size()){
		cout << ans << endl;
	}else{
		cout << ans << E[O.size()] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	while(1){
		int h,w,i,j;
		scanf("%d %d",&h,&w);
		if(w==0&&h==0){
			break;
		}
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


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

int main(void)
{
    IOS
    int N; cin >> N;
    vector<ll> A(N);
    REP(i,N) cin >> A[i];
    sort(ALL(A));

    int cnt = 0;
    ll r = 0;
    REP(i,N-1) {
        r += A[i];
        if (r *2 < A[i+1]) cnt = 0;
        else cnt++;
    } 

    cout << cnt+1 << '\n';

    return 0;
}

Measured memory_bytes: 1024
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<cmath>
#include<cstdint>
#include<cstddef>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using usize = uint_fast64_t;
#define rep(i, n) for (usize i = 0; i < (usize)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i32 n,m;
cin >> n >> m;
i64 time = m * 1900 + (n - m) * 100;
i64 k = pow(2,m);
cout << time * k << endl;
}

Measured memory_bytes: 3876
#include <stdio.h>
#include <cmath>
#include <algorithm>
 
int main(){
    int n,tmp,count = 0,limit;
    scanf("%d",&n);
 
    for(int i = 0; i < n; i++)
    {
        scanf("%d",&tmp);
        limit = sqrt(tmp);
        for(int j = 2; j <= limit; j++){
            if(tmp%j==0){
                count++;
                break;
            }
        }
    }
    printf("%d\n",n-count);
}


Measured memory_bytes: 2708
#include<bits/stdc++.h>
using namespace std;
int N,M;
int main()
{
	while(true){
		scanf("%d%d",&N,&M);
		if(N<M)swap(N,M);
		if(N==0&&M==0)return 0;
		int cou=0;
		while(true){
			cou++;
			int M1=N%M;
			int N1=M;
			N=N1;M=M1;
			if(M==0)break;
		}
		printf("%d %d\n",N,cou);
	}
}

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

#define int long long
#define fi first
#define se second
#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 rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int k,x;

signed main() {
    cin >> x >> k;
    repo(i,max(-1000000LL, k-x+1), min(1000000LL,k+x)) cout << i << " ";cout << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		int count = 0;
		for (int i = 0; i < n; i++) {
			if (i + 1 != arr[i]) {
				continue;
			}
			if (i != n - 1) {
				int t = arr[i];
				arr[i] = arr[i + 1];
				arr[i + 1] = t;
			} else {
				int t = arr[i];
				arr[i] = arr[i - 1];
				arr[i - 1] = t;
			}
			count++;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 53024
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<map>

using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){

    string s;
    cin >> s;

    int ans;

    if(s == "SUN"){
        ans = 7;
    }
    else if(s == "MON"){
        ans = 6;
    }
    else if(s == "TUE"){
        ans = 5;
    }
    else if(s == "WED"){
        ans = 4;
    }
    else if(s == "THU"){
        ans = 3;
    }
    else if(s == "FRI"){
        ans = 2;
    }
    else if(s == "SAT"){
        ans = 1;
    }

    //SUN,MON,TUE,WED,THU,FRI,SAT 

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 888
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <queue>
#include <stack>
#include <string.h>
#include <list>
using namespace std;
typedef long long ll;
#define all(a)  (a).begin(), (a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i = 0; i < n; i++)
#define repR(i,n) for(int i = n-1; i >= 0; i--)
#define FOR(i,m,n) for(int i = m; i < n; i++)
#define PB push_back
#define MP make_pair
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))


int main() {
    int a, b, res;
    cin >> a >> b;
    res = a-1;
    if(b>=a) res++;
    cout << res << endl;
    return 0;
}

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

int main() {
  int N;
  cin>>N;
  bool f=false;
  while (N--) {
    char S;
    cin>>S;
    if (S=='Y') {
      f=true;
      break;
    }
  }
  if (f) {
    cout<<"Four"<<endl;
  } else {
    cout<<"Three"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;//×Ô¶¯È¡Ä£2^64 
const double pi=acos(-1.0);
const int mod = 1e9+7; // 998244353;
const int inf = 0x7fffffff;//2^31-1	
const ll INF = 0x7fffffffffffffff;
const int dx[]={-1,0,1,0},dy[]={0,1,0,-1};
//double begin_time=clock();    double end_time=clock();printf("time= %lf ms\n",end_time-begin_time);
//bool operator < (const mmp &a) const{return x<a.x||x==a.x&&y<a.y;}       //map<int,map<int,int> >z;
//map<int,int>::iterator it;for(it=z.begin();it!=z.end();it++)printf("%d %d\n",it->first,it->second);
//ll pow(ll a,ll b){ll s=1;while(b){if(b&1){s=(s*a)%mod;b--;}b/=2;a=a*a%mod;}return s;}  //¿ìËÙÃÝÈ¡Ä£ 
//lower_bound(begin,end,num); µÚÒ»¸ö>=numµÄÊý×Ö upper_bound(begin,end,num); µÚÒ»¸ö>numµÄÊý×Ö,·µ»ØµØÖ·
//freopen("input.in","r",stdin);     freopen("output.out","w",stdout);      //ÎÄ¼þ¶ÁÐ´Ìá½» 
//reverse(s.begin(),s.end());   //·­×ª×Ö·û´® ||        floor(); ÏòÏÂÈ¡Õû  ceil(); ÏòÉÏÈ¡Õû
//x&(x-1)==0 //ÊÇ2µÄN´Î·½||         x%9 //x¸÷¸öÎ»µÄºÍ||           log10(x)+1   //xµÄÎ»Êý|| 
//ÊýÖáÉÏµÄn¸öµãÒÆ¶¯µ½Í¬Ò»Î»ÖÃ£¬ÒÆ¶¯µ½¸Ã×éÊý×ÖµÄÖÐÎ»ÊýµÄ×Ü¾àÀë×î¶Ì



int main()
{
	int a,b,c,d,e,T;
//	scanf("%d",&T);
//	while(T--)
	{
		scanf("%d%d%d%d",&a,&b,&c,&d);
		e=0;
		if(d>0)
		{
			if(a>=d)
			{
				e+=d;
				d=0;
			}
			else
			{
				e+=a;
				d-=a;
			}
		}
		if(d>0)
		{
			d-=b;
		}
		if(d>0)
		{
			e-=d;
		}
		printf("%d\n",e);
		

		 
		
	}
}




 



Measured memory_bytes: 3824
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;

typedef long long int64;

class CEnergyDrinkCollector {
 public:
  void solve(std::istream &in, std::ostream &out) {
      int n;
      int64 m;
      in >> n >> m;
      vector<pair<int64, int64>> v(n);

      forn(i, n)in >> v[i].first >> v[i].second;

      sort(all(v));

      int64 ans = 0;
      for (auto p : v) {
          int64 take = min(m, p.second);
          ans += take * p.first;
          m -= take;
          if (m <= 0)break;
      }
      out << ans << '\n';
  }
};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    CEnergyDrinkCollector solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>

int fib[44];

int fibo(int n){
  if(n == 0)
    return 1;
  if(n == 1)
    return 1;

  if(fib[n-1] != 0){
    return fib[n-1];
  }else{
    fib[n-1] = fibo(n-1)+fibo(n-2);
  }
  return fib[n-1];
}

int main(){
  int i, n, ans;

  scanf("%d", &n);

  if(n >= 0 && n <= 44){
    for(i = 0; i < n ; i++)
      fib[i] = 0;
    ans = fibo(n);
    printf("%d\n", ans);
  }
  
  return 0;
}



Measured memory_bytes: 2052
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define eps 1e-12
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
inline ll read(){
    ll x=0,f=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,m,l,r,d;
int ans[10005];
int main(){
    int i,j,k,u,v,f1,f2;
    n=read();
    for(i=1;i<=100;i++){
    	for(j=1;j<=100;j++){
    		for(k=1;k<=100;k++){
    			int x=i*i+j*j+k*k+i*j+i*k+j*k;
    			if(x>n) break;
    			ans[x]++;
    		}
    	}
    }
    for(i=1;i<=n;i++) cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
typedef pair<double,double> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 1000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N;
ll a[100100],b[100100];
void no(){
	cout << "No" << endl;
	exit(0);
}
void yes(){
	cout << "Yes" << endl;
	exit(0);
}
int main(){
	scanf("%d",&N);
	ll sum = 0ll;
	for(int i=0;i<N;i++){
		scanf("%lld",&a[i]);
		sum-=a[i];
	}
	for(int i=0;i<N;i++){
		scanf("%lld",&b[i]);
		sum+=b[i];
	}
	if(sum<0ll)no();
	ll rem = sum;
	for(int i=0;i<N;i++){
		if(b[i]<a[i])rem-=(a[i]-b[i]);
		else{
			if(b[i]%2ll!=a[i]%2ll){
				rem--;
				b[i]++;
			}
		}
	}
	if(rem%2ll==1ll)no();
	rem = sum;
	for(int i=0;i<N;i++){
		if(b[i]>a[i])rem-=(b[i]-a[i])/2ll;
	}
	if(rem<0ll)no();
	yes();
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <queue>
#include <deque>

using namespace std;
struct Item{
	int start;
	int end;
};


bool operator< (const Item &a, const Item &b){
	return a.start > b.start;
};


int main(void){
	
	int N;
	cin >> N;
	int K;
	cin >> K;
	
	vector<int> data(N);
	for(auto i = 0; i < N; i ++){
		cin >> data[i];
	}
	for(auto x = 0; x < K; x ++){
		int ended = 0;
		priority_queue<Item> raise_queue;
		priority_queue<int> down_queue;
		for(int i = 0; i < N; i ++){
			raise_queue.push({ i - data[i], i + data[i] });
//			cout << i << "," << data[i] << endl;
		}
		int height = 0;
		vector<int> new_data(N);
		for(int i = 0; i < N; i ++){
			while(!raise_queue.empty() && raise_queue.top().start <= i){
//				cout << i << "-" << raise_queue.top().start << endl;
				height += 1;
				down_queue.push(-raise_queue.top().end);
				raise_queue.pop();
			}
			while(!down_queue.empty() && -down_queue.top() < i){
				height -= 1;
				down_queue.pop();
			}
			new_data[i] = height;
			if(height == N){
				ended += 1;
			}
		}
		data = move(new_data);
//		data = new_data;
		if(ended == N){
//			cout << x << endl;
			break;
		}else{
//			cout << ended << endl;
		}
	}
	
	for(int i = 0; i < N; i ++){
		if(i > 0){
			cout << ' ';
		}
		cout << data[i];
	}
	cout << endl;
	
	return 0;
}



Measured memory_bytes: 8248
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<limits>

using namespace std;

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

const long long INF = (long long)1e18;
const long long MOD = (long long)1e9 + 7; 

const long double eps = 1e-7;
string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}

#define MAX

#define x first
#define y second

vector<pair<int,int>> coordinate1, coordinate2;

long double _dis(pair<int,int> a, pair<int,int> b, pair<int,int> c){
	long double  X, Y, Z, t;
	X = c.x - b.x;
	Y = c.y - b.y;
	t = -(X*(b.x - a.x) + Y*(b.y - a.y));
	
	if(t < 0)return sqrt((b.x - a.x)*(b.x - a.x) + (b.y - a.y)*(b.y - a.y));
	else if(t > X*X + Y*Y)return sqrt((c.x - a.x)*(c.x - a.x) + (c.y - a.y)*(c.y - a.y));
	else return sqrt(((X*(b.y - a.y) - Y*(b.x - a.x))*(X*(b.y - a.y) - Y*(b.x - a.x)))/(X*X + Y*Y));
}

long double dis(int a, int b){
	return min(min(_dis(coordinate1[a],coordinate2[b],coordinate2[b+1]),_dis(coordinate1[a+1],coordinate2[b],coordinate2[b+1])),min(_dis(coordinate2[b],coordinate1[a],coordinate1[a+1]),_dis(coordinate2[b+1],coordinate1[a],coordinate1[a+1])));
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N1, N2, x, y;
	long double ans = numeric_limits<long double>::max()/16;
	
	cin>>N1;
	
	coordinate1.resize(N1+2);
	coordinate1[0] = make_pair(0,0);
	coordinate1[N1+1] = make_pair(1000,0);
	
	for(int i = 1; i <= N1; i++){
		cin>>x>>y;
		coordinate1[i] = make_pair(x,y);
	}
	
	cin>>N2;
	
	coordinate2.resize(N2+2);
	coordinate2[0] = make_pair(0,1000);
	coordinate2[N2+1] = make_pair(1000,1000);
	
	for(int i = 1; i <= N2; i++){
		cin>>x>>y;
		coordinate2[i] = make_pair(x,y);
	}
	
	for(int i = 0; i <= N1; i++){
		for(int j = 0; j <= N2; j++){
			ans = min(ans, dis(i,j));
		}
	}
	
	cout<<ans<<endl;
	
	return 0;
}


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

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

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

#define INF 0x7fffffff

int main() {
	long long		a,b,c,i,j,k,n,m,x,y,ans1 , ans = 0;
	string	str;

	cin >> n >> x >> y;

	vector< vector<int> > aa(n+1, vector<int>(n+1));
	for(i=1;i<=n-1;i++) {
		for(j=i+1;j<=n;j++) {
			aa[i][j] = j - i;
			if ((i<=x) && (y<=j)) {
				aa[i][j] = j - i - (y-x) + 1;
			} else if ((x<=i) && (y<=j)) {
				k = (i-x+1+(j-y));
				if ( aa[i][j] > k ) aa[i][j] = k;
			} else if ((x<=i) && (j<=y)) {
				k = (i-x+1+(y-j));
				if ( aa[i][j] > k ) aa[i][j] = k;
			} else if ((i<=x) && (j<=y)) {
				k = (x-i+1+(y-j));
				if ( aa[i][j] > k ) aa[i][j] = k;
			}
		}
	}
/*
	for(i=1;i<=n;i++) {
		for(j=1;j<=n;j++) {
			cout << aa[i][j] << " ";
		}
		cout << endl;
	}
*/
	vector<int> an(n+1);
	for(i=1;i<=n-1;i++) {
		for(j=i+1;j<=n;j++) {
			 an[aa[i][j]]++;
		}
	}
	for(i=1;i<n;i++) {
		cout << an[i] << endl;
	}

}


Measured memory_bytes: 16000
#include<bits/stdc++.h>
using namespace std;
int main() {

	string s;
	int minz = INT16_MAX;
	cin >> s;

	for (int i = 0; i < s.length(); i++)
	{
		int t = stoi(s.substr(i, 3));
		

		minz = min(abs(753 - t), minz);
	}
	cout << minz << endl;
}




Measured memory_bytes: 256
#include <stdio.h>
 
int main() {
 
  long long i,j,k,n,m,l,a,b,c;
  long long A[101][101] = {0};
  long long B[101][101] = {0};
  long long C[101][101] = {0};
 
  scanf("%lld %lld %lld",&n,&m,&l);
 
  for(j=0; j<n; j++) {
    for(i=0; i<m; i++) {
 
      scanf("%lld", &a);
      A[j][i] = a;
     
    }
  }
 
  for(j=0; j<m; j++){
    for(i=0;i<l;i++){
      scanf("%lld",&b);
      B[j][i] = b;
    }
  }
 
    for(i=0 ;i<n; i++) {
      for(j=0; j<l; j++){
    C[i][j] = 0;
    for(k=0;k<m; k++) {
       C[i][j] += A[i][k]*B[k][j];  
       /*    printf("%d ",C[i][j]); */
    }
    /* printf("\n"); */
      }
    }
 
 
     for(i=0; i<n; i++) {
      for(j=0; j<l; j++) {
    printf("%lld",C[i][j]);
    if(j !=l-1) {
      printf(" ");
    }
      }
      printf("\n");
      } 
 
    return 0;
 
  }



Measured memory_bytes: 2112
n,m,x = map(int, input().split())
costs = [list(map(int, input().split())) for _ in range(n)]

'''
n,m,x = [int(i) for i in input().split()]
costs =[]

for i in range(n):
    a = [int(i) for i in input().split()]
    costs.append(a)
'''


INF = 1000000000000000000000000000
ans = INF

for i in range(1<<n):  #n bits all searches
    # 1<<n == 2**n
    c = 0
    sums = [0]*m
    for j in range(n):
        if i>>j & 1: #i>>j %2 == 1  is also fine.
            #apply this candidate. 
            c += costs[j][0]
            for k in range(m):
                sums[k] += costs[j][k+1]    
    '''
    cost = 0
    c = 0
    sums = [0] * m
    use_index=[]
    for j in range(n):
        if i%2==1:
            use_index.append(j)
        i >>= 1
    
    for v in use_index:
        c += costs[v][0]        
        for j in range(m):
            sums[j] += costs[v][j+1]
    '''
    
    #if min(sums) >= x:
    if all(s>=x for s in sums):
        ans = min(ans, c)
'''            
    judge=True
    for j in range(m):
        if sums[j]<x:
            judge=False
            break
    
    if judge:
        ans = min(ans, c)
'''
if ans==INF:
    print(-1)
else:
    print(ans)
 


Measured memory_bytes: 9124
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int a [20] , n;

int dfs ( int u , int lim ){
	if ( u == n + 1 ) return lim ;
	int ans = 0;
	for ( int i = a [u] - 1 ; i <= a [u] + 1 ; ++ i )
		ans += dfs ( u + 1 , lim || ( !(i&1) ) ) ;
	return ans ;
}
int main (){
	scanf ( "%d" , & n ) ;
	for ( int i = 1; i <= n ; ++ i )
		scanf ( "%d" , & a[i] );
	printf ( "%d" , dfs ( 1 , 0 ) ) ;
	return 0 ;
}

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

const int MOD = (int)1e9+7;

int main(){
  int N,M;
  cin >> N >> M;
  vector<pair<pair<int,int>,int>> PYI(M);
  for(int i=0;i<M;i++){
    int p,y;
    cin >> p >> y;
    PYI.at(i)=make_pair(make_pair(p,y),i);
  }

  sort(PYI.begin(),PYI.end());
  vector<pair<int,int>> ans(M);
  int count=1;
  for(int i=0;i<M;i++){
    int P=PYI.at(i).first.first;
    int Y=PYI.at(i).first.second;
    int I=PYI.at(i).second;
    if(i>=1 && P==PYI.at(i-1).first.first)  count++;
    else  count=1;
    ans.at(I)=make_pair(P,count);
  }
  for(int i=0;i<M;i++){
    printf("%06d%06d\n",ans.at(i).first,ans.at(i).second);
  }

  return 0;
}


Measured memory_bytes: 3456
#include <iostream>

using namespace std;

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

  long long n, a, b;
  cin >> n >> a >> b;

  if (n == 1) {
    if (a == b) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  } else { // 2 <= n
    if (b < a) {
      cout << 0 << endl;
    } else {
      cout << (n - 2) * (b - a) + 1 << endl;
    }
  }

  return 0;
}


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

ll waru(ll x){
  if(x>=1000000007) return x%1000000007;
  else return x;}


int main() {
ll n; cin>>n;
  string s; cin>>s;
  ll kaburi[26]={0};
  
  for(int j=0;j<n;j++){
   if(s[j]=='a')kaburi[0]++;
       if(s[j]=='b')kaburi[1]++;
       if(s[j]=='c')kaburi[2]++;
       if(s[j]=='d')kaburi[3]++;
       if(s[j]=='e')kaburi[4]++;
       if(s[j]=='f')kaburi[5]++;
       if(s[j]=='g')kaburi[6]++;
       if(s[j]=='h')kaburi[7]++;
       if(s[j]=='i')kaburi[8]++;
       if(s[j]=='j')kaburi[9]++;
       if(s[j]=='k')kaburi[10]++;
       if(s[j]=='l')kaburi[11]++;
       if(s[j]=='m')kaburi[12]++;
       if(s[j]=='n')kaburi[13]++;
       if(s[j]=='o')kaburi[14]++;
       if(s[j]=='p')kaburi[15]++;
       if(s[j]=='q')kaburi[16]++;
       if(s[j]=='r')kaburi[17]++;
       if(s[j]=='s')kaburi[18]++;
       if(s[j]=='t')kaburi[19]++;
       if(s[j]=='u')kaburi[20]++;
       if(s[j]=='v')kaburi[21]++;
       if(s[j]=='w')kaburi[22]++;
       if(s[j]=='x')kaburi[23]++;
       if(s[j]=='y')kaburi[24]++;
       if(s[j]=='z')kaburi[25]++;
  }
 ll ans=1;
  for(int k=0;k<=25;k++){
    ans=waru((ans*(kaburi[k]+1)));
 }
    
    cout<<ans-1<<endl;
  
}

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

#define Bye return 0
#define ll long long

using namespace std;

void solve(){
    int n; cin>>n;
    vector<int> a(n+1);
    for (int i=0; i<n-1; i++){
        int e; cin>>e;
        a[e-1]++;
    }

    for (int i=0; i<n; i++)
        cout<<a[i]<<endl;
}

int main(){
    solve();
    Bye;
}

Measured memory_bytes: 4020
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<vs> vvs;

typedef vector<pair<int, int>> vpi;
typedef vector<pair<ll, ll>> vpl;
typedef vector<tuple<int, int, int>> vti;


int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;
    k--;
    if (s[k] == 'A') s[k] = 'a';
    else if (s[k] == 'B') s[k] = 'b';
    else if (s[k] == 'C') s[k] = 'c';
    cout << s << endl;
}


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

int main() {
  vector<int> n;
  vector<int> x;
  while (true) {
    int tmp_n;
    int tmp_x;
    cin >> tmp_n;
    cin >> tmp_x;
    if (tmp_n == 0 && tmp_x == 0) {
      break;
    }
    n.push_back(tmp_n);
    x.push_back(tmp_x);
  }
  // rep(i, n.size()) cout << n[i] << " " << x[i] << endl;
  for (int l = 0; l < n.size(); l++) {
    int count = 0;
    for (int i = 1; i <= n[l]; i++)
    {
      for (int j = i+1; j <= n[l]; j++)
      {
        if (i == j)
        {
          continue;
        }
        for (int k = j+1; k <= n[l]; k++)
        {
          if (k == j || k == i)
          {
            continue;
          }
          if ((i + j + k) == x[l]) {
            count++;
          }
        }
      }
    }
    cout << count << endl;
  }
  return 0;
}


Measured memory_bytes: 3172
s = list(input())
n = len(s)
ans = [0 for _ in range(n)]

for i in range(2):
    cnt = 0
    for i in range(n):
        if s[i] == "R":
            cnt += 1
        else:
            ans[i] += cnt//2
            ans[i-1] += (cnt+1)//2
            cnt = 0
    ans.reverse()
    s.reverse()
    for i in range(n):
        if s[i] == "L":
            s[i] = "R"
        else:
            s[i] = "L"

print(*ans)


Measured memory_bytes: 7088
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define INF 1000000000000000
#define fi first
#define se second
#define all(v) v.begin(),v.end()
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
struct edge{int to,cost;};
typedef pair<int,int> P;
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
int kaijo(int n){
	int ans=1;
	for(int i=2;i<=n;i++){
		ans*=i;
		ans%=MOD;
	}
	return ans;
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int comb(int a,int b){
	return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
}
int n;
string s;
bool b,c;
signed main(){
	cin>>n;
	int l=0,r=n;
	cout<<l<<endl<<flush;
	cin>>s;
	if(s=="Vacant")return 0;
	b=(s=="Female");
	while(r-l>1){
		int mid=(l+r)/2;
		cout<<mid<<endl<<flush;
		cin>>s;
		if(s=="Vacant")return 0;
		c=(s=="Female");
		if(mid%2){
			if(b==c)r=mid;
			else l=mid;
		}
		else{
			if(b==c)l=mid;
			else r=mid;
		}
	}
	return 0;
}


Measured memory_bytes: 852
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
template<typename T> inline void chkmin(T &a, const T &b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T &a, const T &b) { a = a > b ? a : b; }

const int MAXN = 250005;
struct Data { int x, p; } dat[MAXN];
int arr[MAXN], n;

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		int x; scanf("%d", &x);
		dat[i] = Data { x, i };
	}
	sort(dat + 1, dat + 1 + n, [&](const Data &a, const Data &b) { return a.x < b.x; });
	for (int i = 1; i <= n; i++) {
		int x = dat[i].x, c = dat[i].p - 1;
		for (int j = 1; c && j < x; j++) if (!arr[j])
			arr[j] = dat[i].p, --c;
		if (c > 0) return puts("No"), 0;
		arr[x] = dat[i].p;
	}
	for (int i = n; i > 0; i--) {
		int x = dat[i].x, c = n - dat[i].p;
		for (int j = n * n; c && j > x; j--) if (!arr[j])
			arr[j] = dat[i].p, --c;
		if (c > 0) return puts("No"), 0;
	}
	puts("Yes");
	for (int i = 1; i <= n * n; i++) printf("%d ", arr[i]);
	return 0;
}

Measured memory_bytes: 2176
import math

n,k=map(int,input().split())
a = [int(i) for i in input().split()]
dic={}
ans=0
for i in a:
    if i in dic:
        dic[i]+=1
    else:
        dic[i]=1

dic=sorted(dic.items() , key=lambda x:x[0], reverse=True)
check=0
for i in range(len(dic)-1):
    ans+=dic[i][1]*(((1+(k-1))*(k-1))//2)*(n-check-dic[i][1])
    check +=dic[i][1]

check=0
for i in range(n):
    for j in range(i+1,n):
        if a[i]>a[j]:
            check+=1
    
    
print((ans+check*k)%(10**9+7))

Measured memory_bytes: 3316
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n, m = map(int, input().split())
    S = set(int(input()) for _ in range(m))

    a, b = 0, 1 # a[-1], a[0]
    for i in range(1, n + 1):
        if i in S:
            a, b = b, 0
        else:
            a, b = b, (a + b) % MOD

    print(b)
resolve()

Measured memory_bytes: 81992
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


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

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    int n,a,b;
    cin>>n>>a>>b;
    int hlt[n+1];
    for(int i=1;i<=n;i++)
            cin>>hlt[i];
    int l=1,r=1e9;
    int z=(a-b);
    int ans=1e9;
    while(l<=r)
    {
        int mid=l+(r-l)/2;
        int tot=0;
        for(int i=1;i<=n;i++)
        {
            int temp=hlt[i];
            temp-=mid*b;
            if(temp>0)
            {
                tot+=(temp/z);
                if(temp%z)
                    tot++;
            }
        }
        if(tot<=mid)
        {
            ans=min(ans,mid);
            r=mid-1;
        }
        else
        {
            l=mid+1;
        }
    }
    cout<<ans;

} 



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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = int;
using i64 = long long;
using f64 = double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf64 = vector<f64>;
using vstr = vector<string>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  int a, b;
  cin >> a >> b;
  int ans = 0;
  amax(ans, a + b);
  amax(ans, a + a - 1);
  amax(ans, b + b - 1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    ll N,K; cin>>N>>K;
    ll ans;
    if(N%K==0){
        cout<<0<<endl;
        return 0;
    }
    else if(N>K){
        ll a=N/K;
         ans =min(N-K*(N/K),-(N-K*(N/K+1)));
        cout<<ans<<endl;
    }
    else {
        ans=min(N,-(N-K));
        cout<<ans<<endl;
    }
}


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

void file() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void fast()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
}

const int MAX = 2e5 + 5;

int n;

int a[MAX];

ll dp[MAX][3]; // dp[N][K] holds the maximum sum of choosing N / 2 element and skipping K elements

ll solve(int idx, int k)
{
    if (idx > n)
    {
        return k == 2 ? -1e17 : 0;
    }
    
    ll &ret = dp[idx][k];

    if (~ret)
    {
        return ret;
    }
    ret = -1e17;

    ret = max(ret, solve(idx + 2, k) + a[idx]);

    if (k) // you can skip k elements in the serius
    {
        ret = max(ret, solve(idx + 1, k - 1));
    }
    return ret;

}

int main(int argc, char const *argv[])
{
    file();
    
    cin>>n;

    memset(dp, -1, sizeof(dp));
    
    for (int i = 0; i < n; ++i)
    {
        cin>>a[i];
    }

    cout<<solve(0, (n & 1) + 1);
        

}

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

using namespace std;

int const N = 22222;

int p[N], a[N], b[N];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", p + i);
  for (int i = 0; i < n; i++) p[i]--;
  for (int i = 0; i < n; i++) {
    a[i] = (i + 1) * (n + 1);
    b[i] = (n - i) * (n + 1);
  }
  for (int i = 0; i < n; i++) {
    a[p[i]] += i;
  }
  for (int i = 0; i < n; i++) {
    if (i > 0) putchar(' ');
    printf("%d", a[i]);
  }
  puts("");
  for (int i = 0; i < n; i++) {
    if (i > 0) putchar(' ');
    printf("%d", b[i]);
  }
  puts("");
}


Measured memory_bytes: 896
//////////////////////////
/*      _        ____   */
/*  U  /"\  u U /"___|  */
/*   \/ _ \/  \| | u    */
/*   / ___ \   | |/__   */
/*  /_/   \_\   \____|  */
/*   \\    >>  _// \\   */
/*  (__)  (__)(__)(__)  */
/*  Compro by NULL_CT©  */
//////////////////////////
/*STL Libs*/
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

/*Boost*/
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#define int long long //Black Magic
#define REP(I, LIM) for (int I = 0; I < LIM; I++)
#define ALL(LIST) (LIST.begin()), (LIST.end())

using namespace std;
using bint = boost::multiprecision::cpp_int;

constexpr int MOD = 10000007;

vector<int> divisor(int n) {
  vector<int> head, tail;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      head.push_back(i);
      if (i * i != n)
        tail.push_back(n / i);
    }
  }
  head.insert(head.end(), tail.rbegin(), tail.rend());
  return (head);
}

//--------------------------------

void execute() {
  int ans=0;
  REP(i, 3) {
    int a;
    cin >> a;
    ans+=a;
  }
  cout<< (ans >= 22 ? "bust" : "win") <<endl;
}

//--------------------------------

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  // cout<<fixed<<setprecision(20);

  execute();

  return (0);
}


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

int main() {
  long long K;
  cin >> K;
  int a = 7%K;
  for (int i = 1; i < 1000002; i++) {
    if (a == 0) {
      cout << i << endl;
      break;
    }
    a = (a*10 + 7)%K;
    if (i == 1000001)
      cout << -1 << endl;
  }
      
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#include <math.h>  /* M_PI */
#include <stdio.h> /* printf */
int main(void)
{
 int a,b,h,m;
  cin >>a >>b >>h >>m;
  long double X,Y;
  X=2*M_PI/60*m;
  Y=2*M_PI/720*(60*h+m);
  long double C;
  long double Z;
  if(X-Y>=0){
    if(X-Y>=M_PI){
      Z=2*M_PI-X+Y;
    }
    else{
    Z=X-Y;
    }
  }
  else{
    if(Y-X>=M_PI){
      Z=2*M_PI-Y+X;
    }
    else{
    Z=Y-X;
    }
  }
  if(X-Y!=0){
    if(Z==M_PI){
      cout <<a+b;
    }
    else{
  C=a*a+b*b-2*a*b*cos(Z);
  long double D;
  D=sqrt(C);
 cout <<fixed <<setprecision(10)<<D<<endl;
    }
  }
  else{
    if(a>b){
    cout <<a-b;
  }
    else{
      cout<<b-a;
    }
  }
}

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

int main(){
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	for (int i = 0; i < tx-sx; ++i)
	{
		cout << "R";
	}
	for (int i = 0; i < ty-sy; ++i)
	{
		cout << "U";
	}
	for (int i = 0; i < tx-sx; ++i)
	{
		cout << "L";
	}
	for (int i = 0; i < ty-sy; ++i)
	{
		cout << "D";
	}
	cout << "D";
	for (int i = 0; i <= tx-sx; ++i)
	{
		cout << "R";
	}
	for (int i = 0; i <= ty-sy; ++i)
	{
		cout << "U";
	}
	cout << "L";
	cout << "U";
	for (int i = 0; i <= tx-sx; ++i)
	{
		cout << "L";
	}
	for (int i = 0; i <= ty-sy; ++i)
	{
		cout << "D";
	}
	cout << "R";
	cout << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	HashMap<Character,Integer> map;

	private int getSum(String str){
		int sum = 0;
		for(int i=0; i < str.length(); i++){
			int res = str.charAt(i) - '0';
			if (res  >= 0 && res <= 9) {
				 sum += map.get(str.charAt(++i)) * res;
			}
			else{
				res = 1;
				sum += map.get(str.charAt(i)) * res;
			}
		}
		return sum;
	}

	public void doIt(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		map = new HashMap<Character, Integer>();
		map.put('m', 1000);
		map.put('c', 100);
		map.put('x', 10);
		map.put('i', 1);
		char [] list = {'i','x','c','m'};
		while (n-- > 0){
			String str1 = sc.next();
			String str2 = sc.next();
			int sum1 = getSum(str1);
			int sum2 = getSum(str2);
			int sum = sum1 + sum2;

			//decode
			ArrayList<Character> al = new ArrayList<Character>();
			int len = ("" + sum).length();
			for(int i =0; i < len ; i++){
				if(sum %10 == 0){

				}
				else if(sum % 10 == 1){
					al.add(list[i]);
				}
				else{
					al.add(list[i]);
					al.add(("" + sum%10).charAt(0));
				}
				sum = sum / 10;
			}
			//print
			for(int i=al.size()-1; i >= 0;i--){
				System.out.print(al.get(i));
			}
			System.out.println("");
		}

	}
	public static void main(String[] args) {
		Main obj = new Main();
		obj.doIt();
	}
}

Measured memory_bytes: 13000
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <cstdio>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
bool c[10];
int main() {
    int N = readInt();
    int K = readInt();
    
    vector<int> D;
    for(int i=0; i<K; ++i){
        int a = readInt();
        c[a]=true;
    }
    
    int ans=100000;
    for(int i=1; i<10; ++i){
        int t = i;
        if(c[i]) continue;
        if(t >= N) ans = min(ans, t);
        for(int j=0; j<10; ++j){
            t = i;
            if(c[j]) continue;
            t = t*10 + j;
            if(t >= N) ans = min(ans, t);
            for(int k=0; k<10; ++k){
                t = i*10 + j;
                if(c[k]) continue;
                t = t*10 + k;
                if(t >= N) ans = min(ans, t);
                for(int l=0; l<10; ++l){
                    t = i*100 + j*10 + k;
                    if(c[l]) continue;
                    t = t*10 + k;
                    if(t >= N) ans = min(ans, t);
                    for(int m=0; m<10; ++m){
                        t = i*1000 + j*100 + k*10 + m;
                        if(c[m]) continue;
                        t = t*10 + k;
                        if(t >= N) ans = min(ans, t);
                    }
                }
            }
        }
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
    int num,adj[100][100]={{0}},u,k,v,i,j,l;
    scanf("%d",&num);
    for (i=0; i<num; i++) {
        scanf("%d %d",&u,&k);
        for (j=0; j<k; j++) {
            scanf("%d",&v);
            adj[u-1][v-1]=1;
        }
    }
    for (i=0; i<num; i++) {
        for (j=0; j<num; j++) {
            if (j) printf(" ");
            printf("%d",adj[i][j]);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin>>a;
  
  if(a==22){
    cout<<"Christmas Eve Eve Eve"<<endl;
  }
  if(a==25){
    cout<<"Christmas"<<endl;
  }
  if(a==23){
    cout<<"Christmas Eve Eve"<<endl;
  }
  if(a==24){
    cout<<"Christmas Eve"<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);

bool IsPrime(ll num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (ll i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main(){
 ll x; cin>>x;
  for(ll i=x;x<=100000;i++){
  if(IsPrime(i)){
  cout<<i<<endl;
    return 0;
  }
  }



}



Measured memory_bytes: 256
#木作って終わり、問題文難しい
#

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,m,k = map(int, input().split())
    
    def find(par, x):
        if par[x] < 0:
            return x
        else:
            par[x] = find(par, par[x])
            return par[x]
    
    def unite(par, x,y):
        x = find(par,x)
        y = find(par,y)
        if x == y:
            return False
        else:
            if par[x] > par[y]:
                x,y = y,x
            par[x] += par[y]
            par[y] = x
            return True
    
    def same(par, x,y):
        return find(par, x) == find(par, y)
    
    def size(par, x):
        return -par[find(par, x)]

    friend = [-1]*n
    adj = [0]*n
    for _ in range(m):
        a,b = map(int, input().split())
        adj[a-1] += 1
        adj[b-1] += 1
        unite(friend, a-1, b-1)

    res = []
    for i in range(n):
        p = size(friend, i) - 1 -adj[i]
        res.append(p)

    for _ in range(k):
        a,b = map(int, input().split())
        if same(friend, a-1, b-1):
            res[a-1] -= 1
            res[b-1] -= 1

    print(*res)

if __name__ == '__main__':
    main()

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

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

    ll ans = 0;
    ans += X/500 * 1000;
    ans += (X%500) /5 * 5;

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int ans = 0;
int n;
int m;
vector<vector<int> > ab(9,vector<int> (0,0));
bool c[8];

void solve(int i){
        int n_false=0;
        for(int k =0;k<n;k++){
             if(c[k] == false){
                n_false ++;
            }
        }   
        if(n_false == 0){
            ans ++;
            return;
            }
        
    for(int j=0;j<ab[i].size();j++){
        if(c[ab[i][j]-1] == false){
            c[ab[i][j]-1] = true;
            solve(ab[i][j]);
            c[ab[i][j]-1] =false; 
        }
        
    }
}

int main(){
    cin >> n >> m;
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        ab[a].push_back(b);
        ab[b].push_back(a);
    }
    for(int j=1;j<=n;j++){
        c[j] = false;
    }
    c[0] = true;
    solve(1);
    cout << ans << endl;
}

Measured memory_bytes: 256