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

using namespace std;

int main() {
  int n, m, a[50], b[50], c[50], d[50];
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &a[i], &b[i]);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &c[i], &d[i]);
  }
  for (int i = 0; i < n; i++) {
    int point = 0, cnt = 400000000;
    for (int j = 0; j < m; j++) {
      long kyori = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if (cnt > kyori) {
        point = j + 1;
        cnt = kyori;
      }
    }
    printf("%d\n", point);
  }
  return 0;
}

Measured memory_bytes: 384
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			String w = sc.nextLine();
			int len = w.length();

			Map<String, Integer> map = new HashMap<String, Integer>();
			for (int i = 0; i < len; i++) {
				String s = w.substring(i, i + 1);
				if (map.containsKey(s)) {
					map.put(s, map.get(s) + 1);
				} else {
					map.put(s, 1);
				}
			}

			for (Iterator<String> iter = map.keySet().iterator(); iter.hasNext();) {
				if (map.get(iter.next()).intValue() % 2 != 0) {
					System.out.println("No");
					return;
				}
			}
			System.out.println("Yes");

		} finally {
			sc.close();
		}
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
struct Node{
	int money;
	int a[15];
}book[15];
int b[15];
int main(){
	int n,m,x;
	cin>>n>>m>>x;
	for(int i=0;i<n;i++){
		cin>>book[i].money;
		for(int j=0;j<m;j++)cin>>book[i].a[j];
	}
	int arr=2e9;
	for(int i=0;i<(1<<n);i++){
		memset(b,0,sizeof b);
		int sum=0;
		for(int j=0;j<n;j++){
			if(i>>j&1){
				sum+=book[j].money;
				for(int k=0;k<m;k++) b[k]+=book[j].a[k];
			}
		}
		bool flag=1;
		for(int k=0;k<m;k++) {
			if(b[k]<x){
				flag=0;
				break;
			}
		}
		if(flag) arr=min(sum,arr);
	}
	if(arr==2e9)cout<<"-1";
	else cout<<arr;
}

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
void emp(map<T,ll>&m, T x){m.emplace(x,0).first->second++;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>a(n),b(n),c(n-1);
  rep(i,0,n)cin>>a[i];
  rep(i,0,n)cin>>b[i];
  rep(i,0,n-1)cin>>c[i];
  rep(i,0,n)res+=b[i];
  rep(i,0,n-1){
    if(a[i]+1==a[i+1])res+=c[a[i]-1];
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _boost ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define fi first
#define se second
#define clz __builtin_clz
#define clzll __builtin_clzll
#define bp __builtin_popcount
#define _unique(x) sort((x).begin(),(x).end()),(x).erase(unique((x).begin(), (x).end()),(x.end()))
#define all(x) (x).begin(),(x).end()
#define _rand(i,j) uniform_int_distribution<int>(i, j)(rng___)
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair < int, int > PII;
typedef pair < LL, LL > PLL;
typedef pair < LD, LD > PDD;
template < typename _T, typename _T2> string to_string(pair<_T,_T2> x) {return "<"+to_string(x.fi)+", "+to_string(x.se)+">";}
template < typename _T> string to_string(vector<_T> vec) {string s="[ "; for(auto el:vec)s+=to_string(el)+", "; s[s.size()-1]=']';s[s.size()-2]=' '; return s;}
template < typename _T> string to_string(set<_T> vec) {string s="{ "; for(auto el:vec)s+=to_string(el)+", "; s[s.size()-1]='}';s[s.size()-2]=' '; return s;}
template < typename _T, typename _T2> string to_string(map<_T,_T2> vec) {string s="{ "; for(auto el:vec)s+="mp["+to_string(el.fi)+"]= "+to_string(el.se)+", "; s[s.size()-1]='}';s[s.size()-2]=' '; return s;}
template < typename _T > inline void _DBG(const char *s, _T x){cerr << s << " = " << to_string(x) << "\n";}
template < typename _T, typename... args > void _DBG(const char *s, _T x, args... a){while(*s != ',') cerr << *s++;cerr << " = " << to_string(x) << "\n";_DBG(s + 1, a...);}
#ifdef LOCAL
#define _print(...) _DBG(#__VA_ARGS__, __VA_ARGS__)
#else
#define _print(...) ;//cout<<2;//(__VA_ARGS__)
#endif
mt19937 rng___(chrono::steady_clock::now().time_since_epoch().count());


const LL MOD = 998244353;//1e9+7;
const LL LLINF = 1e18+7;
const int N=2e5+8;


int main()
{
    _boost;
    int n,k;
    cin>>n>>k;
    vector<int> h(n);
    vector<LL> dp(n,LLINF);
    dp[0]=0;
    for(int i=0;i<n;i++)cin>>h[i];
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<min(i+k+1,n);j++)
        {
            dp[j]=min(dp[j],dp[i]+abs(h[j]-h[i]));
        }
    }
    cout<<dp[n-1];
}




Measured memory_bytes: 1408
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        if((a+b)%2==0) {
            int k = (a+b)/2;
            System.out.println(k);
        } else {
            System.out.println("IMPOSSIBLE");
        }
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N; cin >> N; string s;
  while(N != 0)
  {
    if(N%2 != 0) { --N; s = "1"+s; }
    else s = "0"+s;
    N /= -2;
  }
  if(s=="") s="0";
  cout << s << endl;
}

Measured memory_bytes: 256
package main
import (
   "fmt"
   "os"
   "bufio"
   "strconv"
)
var sc = bufio.NewScanner(os.Stdin)

func main() {
  sc.Split(bufio.ScanWords)
  n := nextInt()
  m := nextInt()
  vector := make([][]int, n)
  for i := 0; i < n; i++ {
    vector[i] = make([]int, m)
    for j := 0; j < m; j++ {
      vector[i][j] = nextInt()
    }
  }
  
  result := make([]int, n)
  for i := 0; i < m; i++ {
    val := nextInt()
    for j := 0; j < n; j++ {
        result[j] = result[j] + val * vector[j][i]
    }
  }
  for j := 0; j < n; j++ {
    fmt.Println(result[j])
  }
}
func getStdin() (string) {
    sc.Scan()
    v := sc.Text()
    return v
}

func nextInt() (int) {
    sc.Scan()
    v, e := strconv.Atoi(sc.Text())
    if e != nil { panic(e) }
    return v
}

func nextFloat() (float64) {
    sc.Scan()
    v, e := strconv.ParseFloat(sc.Text(), 64)
    if e != nil { panic(e) }
    return v
}




Measured memory_bytes: 1224
/*******************************
Author:galaxy yr
LANG:C++
Created Time:2019/08/10 20:41:31
*******************************/
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
const int maxn=1e5+10;
long long ans,num=1;
int n;
string s[maxn];
int main()
{
        //freopen("c.in","r",stdin);
        //freopen("c.out","w",stdout);
        cin>>n;
        for(int i=1;i<=n;i++) cin>>s[i],sort(s[i].begin(),s[i].end());
        sort(s+1,s+n+1);
        for(int i=2;i<=n;i++)
            if(s[i]==s[i-1])
                num++;
            else
            {
                ans+=1LL*num*(num-1)/2;
                num=1;
            }
        ans+=1LL*num*(num-1)/2;
        cout<<ans<<endl;
        return 0;
}


Measured memory_bytes: 7296
#define _'			'
struct T{int a,b;}A[_];long P[_],M=1e9+7,F[_],I[_]={1},X;i,j,k,t;c(a,b)struct T*a,*b;{t=a->a-b->a?:a->b-b->b;}p(a,b){return b?p(a%M*a%M,b/2)*(b%2?a:1L)%M:1;}f(a,b){return F[a+b]*I[a]%M*I[b]%M;}main(s){for(;++X<_;)I[X]=p(s=F[X]=X*s%M,M-2);for(k=A;~scanf("%d",k);k+=4)i++-1||gets(P);for(qsort(A,i/=2,8,c);j<i;P[j++]=X)for(X=f(s=A[k=j].a-=1,t=A[j].b-=1);k--;)X=t<A[k].b?X:(X-f(s-A[k].a,t-A[k].b)*P[k]%M+M)%M;printf("%d",X);}

Measured memory_bytes: 12540
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			int n = Integer.parseInt(br.readLine());
			int i, j, taro = 0, hanako = 0;
			for (i = 0; i < n; i++) {
				String input[] = br.readLine().split(" ");
				int min = (input[0].length() < input[1].length()) ? input[0].length() : input[1].length();
				for (j = 0; j < min; j++) {
					if (input[0].charAt(j) > input[1].charAt(j)) {
						taro = taro + 3;
						break;
					} else if (input[0].charAt(j) < input[1].charAt(j)) {
						hanako = hanako + 3;
						break;
					} else if (j == min - 1) {
						if (input[0].length() > input[1].length()) {
							taro = taro + 3;
						} else if (input[0].length() < input[1].length()) {
							hanako = hanako + 3;
						} else {
							taro = taro + 1;
							hanako = hanako + 1;
						}
					}
				}
			}
			System.out.println(taro + " " + hanako);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

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

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
typedef long long ll;

void main(void)
{
  ll x,m=100;
  scanf("%lld",&x);
  int i=0;
  while(m<x){
    i++;
    m=(ll)((double)m*1.01);
  }
  printf("%lld",i);

  
}

Measured memory_bytes: 1732
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
  double r;
  int i,j;
  while(cin>>r,r){
    for(i=1;i<1000000;i++){
      j=(int)(M_PI*i);
      if( fabs( (double)j/i-M_PI ) <= r )break;
      j++;
      if( fabs( (double)j/i-M_PI ) <= r )break;
    }
    printf("%d/%d\n",j,i);
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a, b;
    cin>>a>>b;
    ll ans = -1;
    for(int i=1; i<=20000; ++i) {
        if((ll)(0.08 * i) == a && (ll)(0.1 * i) == b) {
            ans = i;
            break;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <map>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define ITR(c,it)  for(it = c.begin(); it != c.end(); it++)

const int N_MAX = 100000;

typedef long long ll;

int H, W, N;
int a[N_MAX];
int b[N_MAX];

map<pair<int, int>, int> sqs;
int cnts[10];

void solve() {
  REP(k, N) {
    FOR(i, -2, 0) FOR(j, -2, 0) {
      int i2 = a[k] - 1 + i;
      int j2 = b[k] - 1 + j;
      if (i2 < 0 || i2 + 2 >= H || j2 < 0 || j2 + 2 >= W) continue;
      sqs[make_pair(i2, j2)]++;
    }
  }
  map<pair<int, int>, int>::iterator it;
  ITR(sqs, it) cnts[it->second]++;
  ll total = (ll) (H - 2) * (W - 2);
  FOR(k, 1, 9) total -= cnts[k];

  printf("%lld\n", total);
  FOR(k, 1, 9) printf("%d\n", cnts[k]);
}

void input() {
  scanf("%d%d%d", &H, &W, &N);
  REP(i, N) scanf("%d%d", a + i, b + i);
}

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


Measured memory_bytes: 57216
// オーバーフローしていませんかー？？

#include <iostream>
using ll = long long;

int main(){
  int A, B, C, D;
  std::cin >> A>>B>>C>>D;
  while(true){
    C -= B;
    if(C<=0){
      std::cout << "Yes" << std::endl;
      return 0;
    }
    A -= D;
    if(A<=0){
      std::cout << "No" << std::endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
const ll MOD=1e9+7;

bool conti(ll i){
	bool p = false;
	while(i){
		if( (i&1) and p ){
			return true;
		}else{
			p = i&1;
			i /= 2;
		}
	}
	return false;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll H , W , K;
	cin >> H >> W >> K;
	if(W==1){
		cout << 1 << endl;
		return 0; 
	}
	ll dp[H+1][W+1]={};
	dp[0][1] = 1;
	FOR(h,1,H+1){
		FOR(i,0, (1 << (W-1)) ){
			if(conti(i))continue;
			FOR(j,0,W-1){
				if(i&(1<<j)){
					(dp[h][j+1] += dp[h-1][j+2]) %= MOD;
					(dp[h][j+2] += dp[h-1][j+1]) %= MOD;
					j++;
 				}else{
 					(dp[h][j+1] += dp[h-1][j+1]) %= MOD;
 				}
			}
			if((i&(1<<(W-2)))==0)(dp[h][W]+=dp[h-1][W])%=MOD;
		}
	}
	cout << dp[H][K] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  int n,m;
  cin >> n >> m;
  if(abs(n-m)>=2){
    cout << 0 << endl;
    return 0;
  }
  if(n < m) swap(n,m);
  ll ans=1;
  ll mod=1e9+7;
  if(n==m){
    rep1(i,n) ans = ((ans*i)%mod)*i%mod;
    ans = (ans*2)%mod;
  }else{
    rep1(i,n) ans = (ans*i)%mod;
    rep1(i,m) ans = (ans*i)%mod;
  }
  cout << ans << endl;
    
  return 0;

}


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

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

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

  sort(S,S+N);

  int cnt = 1;
  for(int i = 0; i < N-1; i++){
    if(S[i] != S[i+1]) cnt++;
  }

  cout << cnt << endl;
}

Measured memory_bytes: 9856
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main(){
    int n, a, b;
    scanf("%d", &n);
    int total = 0;

    for(int i = 0; i < n; ++i){
        scanf("%d %d", &a, &b);
        total += b-a+1;
    }

    printf("%d\n", total);

    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int compare_int(const void *a, const void *b)
{
//    return *(int*)a - *(int*)b;
    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

long long  factorial(long long n) {
    if (n > 0) {
        return n * factorial(n - 1);
    } else {
        return 1;
    }
}

int main()
{
  int a ,b, c, d, e, X, Y;
//  long long  b, c, d, e, X, Y;
  //  double  c;
  long long  A[200003]={};
  int  B[100003]={};
  int  C[100003][11]={};

  int  flag[1003]={};

//  long long  a, b, c, d, X, Y;
  char s[101][101]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
//  int flag=0;
//  int tmp=0;
  char tmp[101]={};
  int min=1000000;
//  long long min=100000001;
  int len=0;
  int l=0;
  int r=1000001;
  int cnt=0;
  long long num=0;
  int num1=0;
  int num2=0;
  long long ans=1;
  int max=0;
  int addr=0;
  int ptn=0;
//  bool on_off[100]={};
  
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

  //  a=0;
//  scanf("%lld %lld", &a, &b);
//  scanf("%d%d", &a,&c);
//  cnt = strlen(t);
// printf("%d\n",a);
  scanf("%d%d", &a,&b);
//  scanf("%d", &B[0]);
  if(b==1){
    printf("0\n");
    return 0;
  }
    printf("%d\n", a-b);

    
//    printf("%s %d %d\n", s[i],C[i][0],C[i][1]);
   // printf("%d\n", C[i][1]);
/*  for(i=0;i<addr;i++){
//  scanf("%lld%lld", &B[0][i],&B[1][i]);
//    ans=ans+A[i];
    printf("%lld ", A[i]);
  }
*/
//    printf("%d ", cnt);
   
//  ans=a*3;
//  ans=(ans+b)/2;
//  printf("%d\n", ans);

  
//  printf("%lf\n",ans);
  //  //  if(flag==0)   printf("TLE\n");
//    if(max < cnt - max)  printf("Yes\n");
//    else  printf("No\n");
  
return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

const int MX = 315;
const int MM = 1000000007;

ll D[MX][MX][MX];
vector<pii> Q[MX];

bool check(int x, int y, int z){
	for(pii c : Q[x]){
		int t = 1 + (y >= c.first) + (z >= c.first);
		if( t != c.second ) return 0;
	}
	return 1;
}

int main()
{
	int N, M;
	scanf("%d%d", &N, &M);
	for(int i = 1; i <= M; i++){
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		Q[b+3].emplace_back(a+3, c);
	}
	ll ans = 0;
	D[3][2][1] = 1;
	for(int i = 4; i <= N+3; i++){
		for(int j = 2; j < i; j++){
			for(int k = 1; k < j; k++){
				ll &r = D[i][j][k];
				
				if(!check(i, j, k)) continue;
				if(j+1 != i) r = D[i-1][j][k];
				else{
					for(int t = k+1; t <= j-1; t++) r += D[j][t][k];
					for(int t = 1; t <= k-1; t++) r += D[j][k][t];
					r %= MM;
				}
			}
		}
	}
	ll tot = 0;
	for(int i = 1; i <= N+3; i++){
		for(int j = 1; j <= N+3; j++) tot = (tot + D[N+3][i][j]) % MM;
	}
	printf("%lld\n", tot);
}


Measured memory_bytes: 235776
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll max(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
double max(double a, double b) {

	if (a > b)return a;
	else return b;

}
//a??¨b?????§?????????

ll min(ll a, ll b) {

	if (a < b)return a;
	else return b;

}
//a??¨b????°??????????

ll avd_i(ll a, ll b) {

	if (a > b)return a - b;
	else return b - a;

}
double avd_d(double a, double b) {

	double re;
	if (a > b)re = a - b;
	else re = b - a;
	return re;

}
//a??¨b???????????¶??????

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//p????´???°,a???b??????p??§?????£?????????

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//p????´???°,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

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

}
//?????§??¬?´???°

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//????°???¬?????°

int main() {
	
	int n, b, f, r, v, num[4][3][10];

	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++) {

				num[i][j][k] = 0;

			}
		}
	}

	cin >> n;
	for (int i = 0; i < n; i++) {

		cin >> b >> f >> r >> v;

		num[b - 1][f - 1][r - 1] += v;

	}

	for (int i = 0; i < 4; i++) {

		if (i != 0)cout << "####################" << endl;
		for (int j = 0; j < 3; j++) {

			for (int k = 0; k < 10; k++) {

				cout << " " << num[i][j][k];

			}
			cout << endl;

		}

	}

	return 0;
}

Measured memory_bytes: 3148
#include<iostream>
#include<cstdio>
#include<cctype>
using namespace std;
int main(){
    char str;
    int counter[26] ={};
    while(cin >> str){
        if(isalpha(str)){
            str = tolower(str);
            counter[str - 'a']++;
        }
    }
        for(int i = 0; i < 26; i++){
            printf("%c : %d\n", i+'a', counter[i]);
        }
    return 0;
}


Measured memory_bytes: 3140
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		
		int length = in.nextInt();
		int array[] = new int[length];
		
		for (int i = 0; i < length; i++) {
			array[i] = in.nextInt();
		}
		print(array);
		
		for (int i = 1; i < length; i++) {
			int key = array[i]; // this is the reference value
			int j = i - 1;
			
			while (j >=0 && array[j] > key) // go backwards
			{
				array[j+1] = array[j];
				j = j-1; // decrement j
			}
			array[j+1] = key;
			print(array);
		}
		
		in.close();
		
	}
	public static void print(int array[]) {
		System.out.print(array[0]);
		for (int i = 1; i < array.length; i++) {
			System.out.print(" " + array[i]);
		}
		System.out.print("\n");
	}
}



Measured memory_bytes: 34200
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<limits>
#include<iomanip>
#include<cmath>
#include<climits>
using namespace std;

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define llrp(i,n) for(long long i=0;i<n;i++)
#define llrep(i,m,n) for(long long i=m;i<=n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define elif else if
#define vcin(a); rp(i,a.size()){cin>>a[i];}
#define vcout(a); rp(i,a.size()){cout<<a[i]<<endl;}
#define allchar(c) for(char c='a';c<='z';c++)

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef long long ll;
typedef string S;
typedef pair<int,int> P;
typedef queue<int> qi;

const int mod=1e9+7;

ll modpow(ll a,ll b,ll p){
    if(b==0){
        return 1;
    }elif(b%2==0){
        return modpow((a*a)%p,b/2,p);
    }else{
        return (a*modpow(a,b-1,p))%p;
    }
}

int main(){
    ll n,p,ans=1;
    cin >> n >> p;
    if(n==1||p==1){
        cout << p << endl;
        return 0;
    }
    ll q=p;
    ll i=2;
    while(p/i>=i){
        ll cnt=0;
        while(p%i==0){
            cnt++;
            p/=i;
        }
        if(cnt>=n)  ans*=pow(i,(cnt/n));
        i++;
    }
    cout << ans << endl;
    return 0;
}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
using ld = long double;
ll mod = 998244353;

ll rep_square(ll a, ll b) {
    // return a^b
    ll ans = 1;
    ll base = a;
    while (b != 0) {
        if (b & 1) {
            ans *= base;
            ans %= mod;
        }
        base *= base;
        base %= mod;
        b >>= 1;
    }
    return ans;
}

int main() {
    ll n, s;
    cin >> n >> s;
    ll a[n];
    rep(i, n) { cin >> a[i]; }

    ll dp[n][s + 1] = {};
    dp[0][0] = 2;
    if (a[0] <= s)
        dp[0][a[0]] = 1;

    repd(i, 1, n) {
        rep(j, s + 1) {
            dp[i][j] = dp[i - 1][j] * 2;
            if (j - a[i] >= 0) {
                dp[i][j] += dp[i - 1][j - a[i]];
            }
            dp[i][j] %= mod;
        }
    }

    cout << dp[n - 1][s] << endl;

    return 0;
}



Measured memory_bytes: 73952
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>
#include <utility>
 
#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;
constexpr auto mod = 1000000007;
 
using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }
template <typename T> inline T max_value(vector<T>& x) { return *max_element(x.begin(), x.end()); }
template <typename T> inline T min_value(vector<T>& x) { return *min_element(x.begin(), x.end()); }

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

  vector<ull> h;
  each(i, n) {
    ull tmp;
    cin >> tmp;
    h.push(tmp);
  }

  ull result = 0;
  ull height = 1;
  ull max_height = max_value(h);
  while (height <= max_height) {

    // section count
    each(i, n) {
      if (h[i] < height) {
        continue;
      } else {
        result++;
        while (i < n && h[i] >= height) {
          i++;
        }
      }
    }
    
    height++;
  }

  cout << result << endl;

 
  return 0;
}


Measured memory_bytes: 256
N = int(input())
prime_number = [2, 3, 5, 7]
prim = [2, 3, 5, 7]

#素数作成
for i in range(2, 101):
	prime_flag = True
	for j in prim:
		if i % j == 0:
			prime_flag = False
			break
			
	if prime_flag:
		prime_number.append(i)
	
prime_factor = [0] * len(prime_number)

for i in range(2, N + 1):
	tmp = i
	for j in range(len(prime_number)):
		while tmp % prime_number[j] == 0:
			prime_factor[j] += 1
			tmp //= prime_number[j]
			
count2 = 0
count4 = 0
count14 = 0
count24 = 0
count74 = 0

for i in prime_factor:
	if i >= 2:
		count2 += 1
	if i >= 4:
		count4 += 1
	if i >= 14:
		count14 += 1
	if i >= 24:
		count24 += 1
	if i >= 74:
		count74 += 1

if count4 >= 2:		
	combination4 = count4 * (count4 - 1) // 2
else:
	combination4 = 0
	
ans = combination4 * (count2 - 2) + count14 * (count4 - 1) + count24 * (count2 - 1) + count74
print(ans)


Measured memory_bytes: 38512
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            int[] a = in.nextIntArray(n);

            int[] dp = new int[n];
            Arrays.fill(dp, Integer.MAX_VALUE);
            dp[0] = 0;
            for (int i = 1; i < n; i++) {
                for (int j = 1; j <= k; j++) {
                    if (i - j >= 0) {
                        dp[i] = Math.min(dp[i], dp[i - j] + Math.abs(a[i] - a[i - j]));
                    }
                }
            }

            out.println(dp[n - 1]);
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

    }
}



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

int main() {
	long n,m,r=0,rs=0;
	cin >> n >> m;
	long a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		r += a[i];
	}

	for (int i = 0; i < n; i++) {
		if (a[i] >= r / (4.0 * m)) {
			rs++;
		}
	}
	if (rs>=m) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
x = list(map(int, input().split()))

if n >= m:
    ans = 0
else:
    x.sort()
    kyori = [x[i]-x[i-1] for i in range(1,m)]
    kyori.sort()
    ans = sum(kyori[0:m-n])
print(ans)


Measured memory_bytes: 83436
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define all(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int inf = (int)1e9;
const ll INF = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

int main() {
	int n, m;
	cin >> n >> m;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	map<ll, ll> nums;
	ll sum = 0LL;
	nums[sum]++;
	rep(i, n) {
		sum += a[i];
		nums[sum % m]++;
	}
	ll res = 0LL;
	for (auto it = nums.begin(); it != nums.end(); it++) {
		res += it->second * (it->second - 1) / 2;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 4992
package main

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

const mod = 1000000007

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func main() {
	sc.Split(bufio.ScanWords)
	n,m := scanInt(),scanInt()

	a := make([]int,m)
	for i := 0; i < m; i++ {
		a[i] = scanInt()
	}

	stairs := make([]int, n+1)
	stairs[0] = 1

	p := 0
	for i := 1; i < n+1; i++ {
		if p < m {
			if i == a[p] {
				p++
				continue
			}
		}
		
		stairs[i] = stairs[i-1]
		if i != 1 {
			stairs[i] = (stairs[i]+stairs[i-2])%mod
		}
	}

	fmt.Println(stairs[n])
	
}


Measured memory_bytes: 2304
#include<iostream>
#include<cstdio>

using namespace std;
#define Lens 500000
#define Max 2000000000

int A[Lens], L[Lens ], R[Lens ];
int N;
int sum = 0;

void merge(int A[], int N, int left, int right)
{
	//	cout <<left<<':'<< A[left] <<' '<<right<<':'<< A[right]<<' ';
	int mid = (left + right) / 2;
	int N1 = mid - left;
	int N2 = right - mid;
	for (int i = 0; i < N1; i++)
	{
		L[i] = A[left + i];
	}
	for (int i = 0; i < N2; i++)
	{
		R[i] = A[mid + i];
	}
	L[N1] = Max;
	R[N2] = Max;
	int tmp1 = 0, tmp2 = 0;
	for (int st = left; st < right; st++)
	{
	//	cout << left << ' ' << right << endl;
		if (L[tmp1] <= R[tmp2])
		{
			sum++;
	//		cout << A[st] << ' ' << L[tmp1] << endl;
			A[st] = L[tmp1++];
		}
		else
		{
			sum++;
	//		cout << A[st] << ' ' << R[tmp2] << endl;
			A[st] = R[tmp2++];
		}

	}
//	cout << endl;
}

void mergesort(int A[], int N, int left, int right)
{
	int mid = (left + right) / 2;

	if (right - left > 1)
	{
		mergesort(A, N, left, mid);
		mergesort(A, N, mid, right);
		merge(A, N, left, right);
	}

}


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

	mergesort(A, N, 0, N);
	for (int i = 0; i < N-1; i++)
	{
		cout << A[i] << ' ';
	}
	cout << A[N - 1] << endl;
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 6984
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N=get_nsp.map(&:to_i)
L=N.size
K=gets.to_i
D=(L<K ? K : L)

dp=Array.new(L+1){Array.new(2){Array.new(D+1){0}}}
dp[0][0][0]=1
L.times do|i|
    2.times do|j|
        D.times do|k|
            lim=(j==1 ? 10 : N[i]+1)
            lim.times do|d|
                dp[i+1][j==1||d<N[i] ? 1 : 0][k+(d.zero? ? 0 : 1)]+=dp[i][j][k]
            end
        end
    end
end
puts dp[L][0][K]+dp[L][1][K]

Measured memory_bytes: 2684
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX_N=10e5;
int A[MAX_N],B[MAX_N];
long long ans[MAX_N];
struct UnionFind{//MAX_N定義 && swap用のalgorithm必要
	
	int Par[MAX_N];//親は"-子供(自分含め)"を所持
	int N;
	UnionFind(int n){
		N=n;
		for(int i=0;i<N;i++)
			Par[i]=-1;
	}
	void unite(int a,int b){
		int par_a=find(a);
		int par_b=find(b);
		if(par_a==par_b)
			return ;
		if(Par[par_a]>Par[par_b])
			swap(par_a,par_b);
		Par[par_a]+=Par[par_b];
		Par[par_b] =par_a;
		return ;
	}
	int find(int a){
		if(Par[a]<0)
			return a;
		else
			return find(Par[a]);
	}
	int sizek(int a){
		if(Par[a]<0)
			return Par[a]*(-1);
		else
			return sizek(Par[a]);
	}
};
/*
UnionFind XX(頂点の数)
unite(a,b);a,b接続
find(a):aの親の番号返却
sizek(a):aの群れの頂点の数返却
*/

int main(void){
	int N,M;
		cin >> N >> M;
	UnionFind uni(N);
	for(int i=0;i<M;i++)
		cin >> A[i] >> B[i];
	
	ans[M-1]=(long long)N*(N-1)/2;
	for(int i=M-2;i>=0;i--){
		int q=uni.sizek(A[i+1]-1);
		int w=uni.sizek(B[i+1]-1);
		
		ans[i]=ans[i+1]-(long long)(uni.find(A[i+1]-1)==uni.find(B[i+1]-1)?0:q*w);
		uni.unite(A[i+1]-1,B[i+1]-1);
	}
	
	for(int i=0;i<M;i++)
		cout << ans[i] << endl;
	return 0;
}


Measured memory_bytes: 10624
n, a, b = map(int, input().split())
# 偶奇一致
if a % 2 == b % 2:
    print((b - a) // 2)
else:
    # left = a - 1
    # right = n - b

    # if left > right:
    #     cnt = right + 1
    #     left = min(a + cnt, n)
    #     print((n - left) // 2 + cnt)
    # else:
    #     cnt = left + 1
    #     right = max(b - cnt, 1)
    #     print((right - 1) // 2 + cnt)

    print(min(a - 1, n - b) + 1 + (b - a - 1) // 2)


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Description: ????????????
// Verifyed: various problem 
const R INF = 1E40L;
const R PI = acos(-1.0L);
using P=complex<R>;
const P O=0.0L;
using L=struct{P s,t;};
using VP=vector<P>;
using C=struct{P c;R r;};

auto& operator >> (istream& is,P& p){ R x,y;is >> x >> y; p=P(x,y); return is;}
auto& operator << (ostream& os,P& p){ os << real(p) << " " << imag(p); return os;}

inline R dot(P o,P a,P b){return real(conj(a-o)*(b-o));}
inline R det(P o,P a,P b){return imag(conj(a-o)*(b-o));}
inline int sdot(P o,P a,P b){return sgn(dot(o,a,b));}
inline int sdet(P o,P a,P b){return sgn(det(o,a,b));}

//projection verify AOJ CGL_1_A
P proj(L l,P p){ R u=real((p-l.s)/(l.t-l.s)); return (1-u)*l.s+u*l.t;} 
 
namespace std{
    bool operator <  (const P& a,const P& b){ return sgn(real(a-b))?real(a-b)<0:sgn(imag(a-b))<0;}
    bool operator == (const P& a,const P& b){ return sgn(real(a-b))==0 && sgn(imag(a-b))==0;}
}

bool operator <  (const C& a,const C& b){ return a.c==b.c?sgn(a.r-b.r)<0:a.c<b.c;}
bool operator == (const C& a,const C& b){ return a.c==b.c&&sgn(a.r-b.r)==0;}

L tan(C c,P p){P d=1il*(p-c.c);return L{p-d,p+d};}
VP contact(C c,P p){
    VP ret;
    P d=p-c.c;
    for(P s:{-1il,1il}) ret.emplace_back(c.c+c.r*(c.r+sq(norm(d)-norm(c.r))*s)*d/norm(d));
    uniq(ret);
    return ret;
}


int main(void){
    P p;
    C c;
    cin >> p >> c.c >> c.r;
    auto res=contact(c,p);
    cout.precision(20);
    for(auto &it:res) cout << fixed << real(it) << " " << imag(it) << endl;
    return 0;
}

Measured memory_bytes: 3276
import Control.Applicative ((<$>))
import Data.List (iterate)

breakNum :: Int -> Int
breakNum n = last twoList'
  where
    twoList  = take 7 $ iterate (*2) 1
    twoList' = filter (<=n) twoList

main :: IO ()
main = do
  n <- read <$> getLine :: IO Int
  
  putStrLn $ show $ breakNum n


Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N+1), B(N);
    for (auto& a:A) {
        cin >> a;
    }
    for (auto& b:B) {
        cin >> b;
    }
    long long ans = 0;
    int smlr;
    for (int i = 0; i<N; i++) {
        smlr = min(A[i], B[i]);
        A[i] -= smlr;
        B[i] -= smlr;
        ans += smlr;
        smlr = min(A[i+1], B[i]);
        A[i+1] -= smlr;
        ans += smlr;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main (String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder builder = new StringBuilder();
        int i = 1; 
        while(true) {
            String data = reader.readLine();
            String[] number = data.split(" ", 0);
            if(Integer.parseInt(number[0])== 0 && Integer.parseInt(number[1])== 0 )
                break;
            int[] numbers = sort (number);
            builder
                    .append(Integer.toString(numbers[0]))
                    .append(" ")
                    .append(Integer.toString(numbers[1]))
                    .append("\n");
        }        
        System.out.print(builder);
    }
    public static int[] sort ( String[] number) {
        int[] numbers = new int[2];
        Arrays.fill(numbers,0);
        numbers[0] = Integer.parseInt(number[0]);
        numbers[1] = Integer.parseInt(number[1]);
        if (numbers[0] > numbers[1]) {
            int w  = numbers[0];
            numbers[0] = numbers[1];
            numbers[1] = w;
        }
        return numbers;
    }
}

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

int main() {
	int A[3];
	for (int i = 0; i < 3; i++) cin >> A[i];

	sort(A, A + 3);

	int sum = 0;
	for (int i = 0; i < 2; i++) {
		sum += A[i + 1] - A[i];
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N,M=map(int, input().split())
B=[tuple(map(int, input().split())) for _ in range(M)]

P=list(range(N+1))
C=[1 for _ in range(N+1)]
C[0] = 0

def root(x):
    t = x
    stack = []
    while P[t] != t:
        stack.append(t)
        t = P[t]
    for c in stack: P[c] = t
    return t

def unite(a,b):
    ra = root(a)
    rb = root(b)
    if count(ra) < count(rb): ra,rb = rb,ra
    C[ra] += C[rb]
    C[rb] = 0
    P[rb] = ra

def same(a,b):
    return root(a) == root(b)

def count(x):
    return C[root(x)]

ans=[0]*(M+1)
ans[M] = N * (N-1) // 2

for i in range(M-1,-1,-1):
    a,b = B[i]
    if same(a,b):
        ans[i] = ans[i+1]
        continue
    ans[i] = ans[i+1] - count(a) * count(b)
    unite(a,b)

for i in range(1,M+1):
    print(ans[i])

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

using namespace std;

struct Dice {
    int s[6];

    int &top() { return s[0]; }

    int &south() { return s[1]; }

    int &east() { return s[2]; }

    int &west() { return s[3]; }

    int &north() { return s[4]; }

    int &bottom() { return s[5]; }

    void roll(char c) {
        string b("EWNSRL");
        int v[6][4] = {{0, 3, 5, 2},
                       {0, 2, 5, 3},
                       {0, 1, 5, 4},
                       {0, 4, 5, 1},
                       {1, 2, 4, 3},
                       {1, 3, 4, 2}};
        for (int k = 0; k < 6; ++k) {
            if (b[k] != c) continue;
            int t = s[v[k][0]];
            s[v[k][0]] = s[v[k][1]];
            s[v[k][1]] = s[v[k][2]];
            s[v[k][2]] = s[v[k][3]];
            s[v[k][3]] = t;
        }
    }

    bool totally_eq(const Dice &d) const{
        for (int i = 0; i < 6; ++i) if (s[i] != d.s[i]) return 0;
        return 1;
    }

    bool operator==(const Dice &d) const{
        vector<Dice> dices;
        bool ans = false;
        for (int i = 0; i < 6; ++i) {
            Dice t(d);
            if (i == 1) t.roll('N');
            if (i == 2) t.roll('S');
            if (i == 3) t.roll('S'), t.roll('S');
            if (i == 4) t.roll('R');
            if (i == 5) t.roll('L');
            for (int k = 0; k < 4; ++k) {
                dices.push_back(t);
                t.roll('E');
            }
        }
        for (auto e : dices) ans|=totally_eq(e);
        return ans;
    }
};

int main() {
    int n;
    Dice ds[101];

    cin >> n;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 6; ++j) cin >> ds[i].s[j];
    }

    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            if (ds[i] == ds[j]) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3216
import sys

def main():
    line = sys.stdin.readline()
    a, b = line.split()

    if a == 'H':
        if b == 'H':
            print('H')
        elif b == 'D':
            print('D')
    elif a == 'D':
        if b == 'H':
            print('D')
        elif b == 'D':
            print('H')

    return 0

if __name__ == '__main__':
    sys.exit(main())


Measured memory_bytes: 2940
import java.util.*;
public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    String A = sc.next();
        StringBuffer b = new StringBuffer(sc.next());
        String B = b.reverse().toString();
	   
        String ans = (A.equals(B))? "YES": "NO";
      	System.out.println(ans);
	}
}

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

using namespace std;
typedef long long ll ;
#define forl(i,n) for(int i=0 ; i<n ; i++)

int main()
{
	int T=1;
	// cin >> T ;

	while(T--)
	{
		ll n,l ;
		cin>>n>>l ;
		ll w[n+1],v[n+1] ;
		w[0]=0 ;
		v[0]=0 ;
		for(int i=1 ; i<=n ; i++)
			cin>>w[i]>>v[i] ;

		ll dp[n+1][l+1] ;
		for(int i=0 ; i<=l ; i++) 
			dp[0][i]=0 ;
		for(int i=0 ; i<=n ; i++)
			dp[i][0]=0 ;

		for(int i=1 ; i<=n ; i++)
		{
			for(int j=1 ; j<=l ; j++)
			{
				dp[i][j]=dp[i-1][j] ;
				if(j>=w[i])
					dp[i][j] = max(dp[i][j],v[i]+dp[i-1][j-w[i]]) ;
			}
		}
		ll ans=0 ;
		for(int i=1 ;i<=n ; i++)
			ans=max(ans,dp[i][l]) ;
		cout<<ans<<endl ;
	}
	return 0;
}

Measured memory_bytes: 82388
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scanf("%d\n", &N)

	sum := 0
	for i := 1; i <= N; i++ {
		if i%3 == 0 || i%5 == 0 {
			continue
		}
		sum += i
	}
	fmt.Println(sum)

}


Measured memory_bytes: 1816
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

template <class T1, class T2>
ostream& operator << (ostream& out, pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}

template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}

template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}

template <class T>
ostream& operator << (ostream& out, vector<vector<T>> &v)
{
	for (vector<T> &x : v)
		out << x << '\n';
	return out;
}

template <class T>
ostream& operator << (ostream& out, vector<T> &v)
{
	for (T &x : v)
		out << x << ' ';
	return out;
}

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

using ll   = long long;
using pii  = pair<int, int>;
using pll  = pair<long long, long long>;
using tiii = pair<pair<int, int>, int>;
using vi   = vector<int>;
using vl   = vector<long long>;
using vvi  = vector<vector<int>>;
using vvl  = vector<vector<long long>>;

#define F          first
#define S          second
#define First      first.first
#define Second     first.second
#define Third      second
#define mp         make_pair
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define per(i,b,a) for (int i = (b); i > (a); i--)
#define all(x)     x.begin(), x.end()
#define ret(x)     return cout << x, 0;
#define throwex    throw runtime_error ("Found the error.");

const int h = 1000000007;

signed main()
{
	ios::sync_with_stdio(false);
	#ifdef ONLINE_JUDGE
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.setstate(ios::failbit);
	#endif

	int n;
	cin >> n;
	vl v(n);
	cin >> v;
	vl dp(n);
	vl prefix(n);
	rep(i,0,n)
		prefix[i] = v[i] + (i - 2 > -1 ? prefix[i - 2] : 0);
	rep(i,1,n)
	{
		if(i & 1)
			dp[i] = prefix[i - 1];
		else
			dp[i] = dp[i - 1];
		dp[i] = max(dp[i], v[i] + (i - 2 > -1 ? dp[i - 2] : 0));
	}
	// cerr << prefix << '\n' << dp << '\n';
	cout << dp.back();
}


Measured memory_bytes: 7920
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    string s;
    cin >> s;
    for (int i = 0; i < sz(s); i += 2) {
        cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 592