akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define FOR(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define FORN(i,b,a)for(int i=(b);_a=(a);i>=_a;i--)
#define REP(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define re return
#define vi vector<int>
#define pb push_back
#define si set<int>
#define in insert
#define fl float
#define db double
#define ld long double
#define X first
#define Y first
#define st string
#define ull unsigned long long
#define size(s) s.size()
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
int main()
{
	int n,k,s;
	cin>>n>>k>>s;
	for(int i=0;i<k;i++)
		cout<<s<<" ";
	if(n==k)return 0;
	if(s!=1000000000)
	for(int i=k;i<n;i++)
		cout<<s+1<<" ";
	else	for(int i=k;i<n;i++)
		cout<<s-1<<" ";
	return 0;
}


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


int main(){
  int N;
  cin >> N;
  vector<int> B(N);
  for(int i=0;i<N-1;i++){
    cin >> B.at(i);
  }
  if(N == 2){
    cout << 2 * B.at(0) << endl;
  }else{
    int ans = B.at(0);
    for(int i=1;i<N-1;i++){
      ans += std::min(B.at(i-1),B.at(i));
    }
    ans += B.at(N-2);
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
use std::cmp::min;

#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (_, a, b) = scan!(i64, i64, i64);
    let vs = scan!(i64;;);

    let mut ans = 0;
    for (v0, v1) in vs.iter().zip(vs[1..].iter()) {
        ans += min(a * (v1 - v0), b)
    }
    println!("{}", ans)
}


Measured memory_bytes: 6396
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
 
ll pwr(ll base, ll p, ll mod=MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
 
 
ll gcd(ll a, ll b){
    if(b == 0)  return a;
    return gcd(b, a%b);
}


const int N = 200002;
int n;
vector<int> adj[N];


int dfs(int v, int par){
	int ans = 0;
	for(auto vv : adj[v])
		if(vv != par)
			ans ^= 1+dfs(vv, v);
// cout<<"dfs "<<v<<" returns "<<ans<<endl;
	return ans;
}

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

    cin>>n;
    int e = n-1;
    while(e--){
    	int a, b;
    	cin>>a>>b;
    	adj[a].pb(b);
    	adj[b].pb(a);
    }

    if(dfs(1, -1) == 0)	cout<<"Bob";
    else	cout<<"Alice";
    return 0;
}






Measured memory_bytes: 12800
import sys
import collections
INF = 10**18

def dfs(s,cnt):
    visited = [False]*n
    visited[s] = True
    q = collections.deque([s])
    while q:
        p = q.pop()
        visited[p] = True
        for v in edge[p]:
            if visited[v]:
                continue
            cnt[v] += cnt[p]
            q.append(v)
    return cnt

if __name__ == "__main__":
    n,q = map(int,input().split())
    edge = [[] for i in range(n)]
    for i in range(n-1):
        a,b = map(int,input().split())
        a-=1
        b-=1
        edge[a].append(b)
        edge[b].append(a)
    cnt = [0]*n
    for i in range(q):
        v,x = map(int,input().split())
        v -= 1
        cnt[v] += x
    ans = dfs(0,cnt)
    print(*ans)

Measured memory_bytes: 55200
#include <stdio.h>

int main(void){

	int i,j,h,w;

	while(1){

		scanf("%d %d",&h,&w);
		if(h==0&&w==0)break;

		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				if((i%2==0&&j%2==0)||(i%2==1&&j%2==1))printf("#");
				else printf(".");
			}
			printf("\n");
		}

		printf("\n");

	}

	return 0;

}

Measured memory_bytes: 572
#include <stdio.h>

int main(){
    int angka;
    scanf("%d", &angka);
    while(angka > 0){
        angka = angka - 1000;
    }
    if(angka < 0){
        printf("%d\n", angka * -1);
    }
    else if(angka == 0){
        printf("0\n");
    }
    return 0;
}

Measured memory_bytes: 1728
# 未完成
def solve():
    n = int(input())
    a = 0
    s = {}
    for i in range(n):
        t = ''.join(sorted(input()))
        b = s.get(t, 0)
        a += b  # k個の同じものから2個選ぶからkC2だが0~(k-1)の総和と同地
        s[t] = b+1
    print(a)


solve()


Measured memory_bytes: 61656
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        Scanner sc = new Scanner(System.in);
        
        int A = sc.nextInt();
        int B = sc.nextInt();
        int res = 0;
        
        if( (A >= 10) || (B  >= 10) ){
            res = -1;
        }else {
            res  = A * B;
        }
        
        System.out.println(res);
        
    }
}


Measured memory_bytes: 22732
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
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 2000000000
#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;
int W[105];
int main(){
    cin >> N;
    int sum = 0;
    for(int i=0;i<N;i++){
        cin >> W[i];
        sum += W[i];
    }
    int a = 0;
    int ans = sum;
    for(int i=0;i<N;i++){
        a += W[i];
        ans = min(ans,abs((sum-a)-a));
    }
    cout << ans << endl;
    return 0;
}

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

#include <queue>

using namespace std;



int main() {
  int N;cin>>N;
  vector<int> seq(N + 1);
  seq.assign(N + 1, 0);
  vector<int> p(N);
  for(int i=0;i<N;i++) cin>>p[i];

  for(int i=0;i<N;i++) {
    int cur = p[i];
    seq[cur] = seq[cur - 1] + 1;
  }

  int out = 0;
  for(int i=0;i<=N;i++) out = max(out, seq[i]);

  cout << N-out << endl;

  return 0;
}


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

using namespace std;

int main(){
    int L,R,M=2018;

    cin >> L >> R;

    int l=L%2019;
    int r=R%2019;

    if((r)<=(l)||2019<(R-L)){
        cout << "0" << endl;
    }else{
        for(int i=l;i<r;i++){
            for(int j=i+1;j<=r;j++){
            M = min(M,(i*j)%2019);
            }
            }
        cout << M << endl;
    }
}

Measured memory_bytes: 256
/*
I believe on myself and I will achieve
this->author = Fuad Ashraful Mehmet, CSE-UAP
Todo:
https://codeforces.com/contest/1398/problem/E
https://codeforces.com/problemset/problem/374/C
*/
#include<bits/stdc++.h>
#define forn(i,n) for(int i=0;i<(int)n;++i)
#define all(o) (o).begin(),(o).end()
#define dbg(o)  cerr<<"at "<<__LINE__<<" response = "<<o<<endl;
#define pb push_back
using namespace std;

const int N=1005;
int n,k,m;
string s,t;

int fun(int idx)
{
      int len=(int)t.size();
      int ret=0;
      
      for(int i=0;i<len;++i)
      {
            ret+=(s[idx++]!=t[i]);
      }
      return ret;
}
void HalfDead()
{
      
      cin>>s;
      cin>>t;
      int len_s=(int)s.size();
      int len_t=(int)t.size();
      
      int ans=1e9;
      for(int i=0;i+len_t<=len_s;++i)
      {
            ans=min(ans,fun(i));
      }

      cout<<ans<<endl;
}
int main()
{
      ios_base::sync_with_stdio(0); cin.tie(nullptr);  cout.tie(0);
      int tc=1;
     // cin>>tc;
      while(tc--)
      {
            HalfDead();
      }
      return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int ctoi(char c) {return c-'0';}// char to int
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}//MAX
int lcm(ll a,ll b){return a*b/gcd(a,b);}//MIN
 
int  main(){
string s;
cin >> s;
int n;
cin >> n;
for(int i=0;i<s.size();i+=n){
    cout<<s.at(i);
}
cout<<endl;
}
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int64_t i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define COUTDOUBLE(d,i) cout << setprecision((i)) << (d) << endl;
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}
#define MREP(i,m) for(auto i=(m).begin(); i != (m).end(); ++i) // auto key = i->first;auto value = i->second;

using namespace std;
typedef int64_t I;
typedef pair<I,I> P;
typedef vector<I> V;

I MOD = pow(10,9)+7;
I MAX = LONG_MAX;
I MIN = LONG_MIN;

// 最大公約数
I gcd(I a, I b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
I lcm(I a, I b) {
  return a * b / gcd(a, b);
}

int ctoi(char c){
  return c - '0';
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  I n;
  string s;
  cin >> n >> s;
  I t=0;
  char c;
  REP(i,s.size()){
    if (s.at(i) == c){
      c = s.at(i);
    }else{
      t++;
      c = s.at(i);
    }
  }
  cout << t << endl;
  return 0;
}



Measured memory_bytes: 512
#?????????????????????????????°??????

#swap???????????????????????????
def Swap(a, b)
    return b, a
end

#???????????????????????????????????????????????????
def BubbleSort(a, length)
    count = 0
    for i in 0..length-1
        for j in i+1..length-1
            k = (i + 1) + (length - 1) - j
            if a[k] < a[k-1] then
                count = count + 1
                a[k], a[k-1] = Swap(a[k], a[k-1])
            end
        end
    end
    #?????????????????????????????¨???????????°???main?????????
    return a, count
end

#????????????????????????????????¨?????????
def PrintBubbleSort(a, length, count)
    i = -1
    for i in 0..length-2
        print a[i], " "
    end
    print a[i+1], "\n"
    print count, "\n"
end

#?????????????????°?????\?????????
length = readline.to_i

#?????????????????????????????????????????§??\????????????
A = gets.chomp.split(" ").map(&:to_i)

B, count = BubbleSort(A, length)

PrintBubbleSort(B, length, count)

Measured memory_bytes: 8664
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;

int main() {
	//cout << "" << endl; // prints
	int N, K;
	const long long int mod = 998244353;
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> N >> K;
	long long int dp[N+1];
		dp[0] = 0;
		dp[1] = 1;
		dp[2] = -1;
	for(int a = 3; a <= N; a++){
		dp[a] = 0;
	}
	long long int LR[K+1][3];
	bool TF[N+1];
	for(int i = 0; i <= N; i++){
		TF[i] = false;
	}
	for(int i = 1; i <= K; i++){
		cin >> LR[i][1] >> LR[i][2];
		for(int j = LR[i][1]; j <= LR[i][2]; j++){
			TF[j] = true;
		}
	}

	for(int i = 1; i <= N; i++){
		if(i > 1)dp[i] += dp[i - 1];
		dp[i] = dp[i] % mod;
		for(int j = 1; j <= K; j++){
			if(i + LR[j][1] + 0 <= N){
				dp[i + LR[j][1] + 0] += dp[i];
				dp[i + LR[j][1] + 0] = dp[i + LR[j][1] + 0] % mod;
			}
			if(i + LR[j][2] + 1 <= N){
				dp[i + LR[j][2] + 1] -= dp[i];
				dp[i + LR[j][2] + 1] = dp[i + LR[j][2] + 1] % mod;
			}
		}
	}
	dp[N] = dp[N] % mod;
	if(dp[N] < 0){
		dp[N] += mod;
	}
	cout << dp[N] << endl;
	return 0;
}


Measured memory_bytes: 5396
#include <iostream>
using namespace std;
int main()
{
	int n,i, x;
		cin >> n;
		
		for( i = 1; i < n+1; i++){
			x = i;
			if(x % 3 == 0){
					cout << " " << i;
				}else {
					while( x > 0){
						if(x % 10 == 3){
						cout << " " << i;
						break;
				}else{
					x /= 10;
				}
			}
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[410][410],sum[410][410];
ll p,c1,c2;

ll solve(ll i,ll j,ll a[])
{
    if(i>=j){
        dp[i][j]=0;
        return a[i];}
    if(i+1==j)
        return dp[i][j]=a[i]+a[j];
    if(sum[i][j]!=-1)
        return sum[i][j];
    ll ans=9999999999999999999999,s1=0,s2=0,a1=0;
    for(ll k=i;k<j;k++){
            a1=0;
        s1=solve(i,k,a);
        s2=solve(k+1,j,a);
        a1=s1+s2+dp[i][k]+dp[k+1][j];
        ans=min(ans,a1);
        a1=s1+s2;
    }
    dp[i][j]=ans;
    sum[i][j]=a1;
    return a1;
}

int main()
{
    ll n,i,j,k;
    cin>>n;
    ll a[n+1];
    for(i=0;i<=n;i++){
        for(j=0;j<=n;j++){
            dp[i][j]=-1;
            sum[i][j]=-1;
        }
    }
    for(i=1;i<=n;i++)
        cin>>a[i];
    ll s=solve(1,n,a);
    /*for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            cout<<dp[i][j]<< " ";
        }cout<<endl;
    }*/
    cout<<dp[1][n]<<endl;
}



Measured memory_bytes: 2816
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>

int main()
{
    int a[3], b[3], one = 0, two = 0, three = 0, four = 0;

    for (int i = 0;i < 3;i++){
        std::cin >> a[i] >> b[i];
        if(a[i] == 1){
            one++;
        }
        else if(a[i] == 2){
            two++;
        }
        else if(a[i] == 3){
            three++;
        }
        else{
            four++;
        }
        if(b[i] == 1){
            one++;
        }
        else if(b[i] == 2){
            two++;
        }
        else if(b[i] == 3){
            three++;
        }
        else{
            four++;
        }
    }

    if(one == 0||two == 0|| three == 0||four == 0){
        std::cout << "NO\n";
    }
    else if(one == 2 && two == 2||one == 2&&three == 2||one == 2&&four == 2||two == 2&&three == 2||two == 2&& four == 2||three == 2&& four == 2){
        std::cout << "YES\n";
    }
    else{
        std::cout << "NO\n";
    }



    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		loop: while (true) {
			w = scanner.nextInt();
			h = scanner.nextInt();
			if ((w | h) == 0)
				break;
			count = 0;
			sy = -1;
			map = new boolean[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					int now = scanner.nextInt();
					if (now == 0) {
						count++;
						if (sy == -1) {
							sy = i;
							sx = j;
						}
					} else {
						map[i][j] = true;
					}
				}
			}
			if (count % 2 == 1 || count == 0) {
				System.out.println("No");
				continue;
			}
			for (int i = 0; i < h; i++) {
				lo: for (int j = 0; j < w; j++) {
					if (map[i][j])
						continue;
					int c = 0;
					for (int[] m : move) {
						int ny = i + m[0];
						int nx = j + m[1];
						if (!isOK(ny, nx))
							continue;
						c++;
						if (c == 2)
							continue lo;
					}
					System.out.println("No");
					continue loop;
				}
			}
			System.out.println(dfs(sy, sx, 0, -100) ? "Yes" : "No");
		}
	}

	private boolean dfs(int y, int x, int deep, int prev) {
		if (count - deep < Math.abs(y - sy) + Math.abs(x - sx))
			return false;
		for (int r = 0; r < 4; r++) {
			int ny = y + move[r][0];
			int nx = x + move[r][1];
			if (!isOK(ny, nx))
				continue;
			if (Math.max(r, prev) - Math.min(r, prev) == 2)
				continue;
			if (ny == sy && nx == sx && count - 1 == deep)
				return true;
			if (map[ny][nx])
				continue;
			if (!check(ny, nx))
				continue;
			map[ny][nx] = true;
			if (dfs(ny, nx, deep + 1, r))
				return true;
			map[ny][nx] = false;
		}
		return false;
	}

	private boolean check(int y, int x) {
		lo: for (int[] m : move2) {
			int ny = y + m[0];
			int nx = x + m[1];
			if (!isOK(ny, nx))
				continue;
			if(nx==sx&&ny==sy)
				continue;
			if (map[ny][nx])
				continue;
			int c = 0;
			for (int[] mm : move) {
				int nny = ny + mm[0];
				int nnx = nx + mm[1];
				if (!isOK(nny, nnx))
					continue;
				if (map[nny][nnx])
					continue;
				c++;
				if (c == 2)
					continue lo;
			}
			return false;
		}
		return true;
	}

	private boolean isOK(int y, int x) {
		if (0 <= y && y < h && 0 <= x && x < w)
			return true;
		return false;
	}

	int count;
	boolean[][] map;
	int[][] move = { { -1, 0 }, { 0, 1 }, { 1, 0 }, { 0, -1 } };
	int[][] move2 = { { -1, -1 }, { -1, 1 }, { 1, -1 }, { 1, 1 } };
	int h, w, sx, sy;
}

Measured memory_bytes: 50688
/** ------------------------------------------------------------------------ **/
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

template<typename T> using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> using ordered_map =
tree<T1, T2, less<T1>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using hash_set = gp_hash_table<T, null_type>;
template<typename T1, typename T2> using hash_map = gp_hash_table<T1, T2>;

mt19937 rng(time(nullptr));
mt19937_64 rng64(time(nullptr));

#define rep(i, s, t) for (int i = s; i < int(t); ++i)
#define for_iter(i, c) for (auto i = c.begin(); i != c.end(); ++i)
#define for_const_iter(i, c) for (auto i = c.cbegin(); i != c.cend(); ++i)

#define sc	scanf
#define pr	printf
#define ff	first
#define ss	second
#define mp	make_pair
#define pb	push_back
#define eb	emplace_back
#define range(c)	c.begin(), c.end()
#define const_range(c)	c.cbegin(), c.cend()
#define lowbit(x)	((x) & -(x))
#define pop_count	__builin_popcount
#define pop_count64	__builtin_popcountll
#define tail_count	__builtin_ctz
#define tail_count64	__builtin_ctzll
#define lead_count	__builtin_clz
#define lead_count64	__builtin_clzll

template<typename T1, typename T2>
ostream& operator<< (ostream& os, const pair<T1, T2>& p) {
	return os << "<" << p.ff << "," << p.ss << ">";
}
#define container_ostream(container)				\
template<typename... T>						\
ostream& operator<< (ostream& os, const container<T...>& c) {	\
	if (c.empty()) return os << "{ }";			\
	auto iter = c.cbegin();					\
	os << "{ " << *iter;					\
	while (++iter != c.cend()) os << ", " << *iter;		\
	return os << " }";					\
}
container_ostream(vector)
container_ostream(set)
container_ostream(map)

void dbg() { cerr << endl;}
template<typename Head, typename... Tail> void dbg(Head h, Tail... t) {
	cerr << " " << h;
	dbg(t...);
}

#ifdef LOCAL
#define debug(...) cerr << "[ "#__VA_ARGS__" ] :", dbg(__VA_ARGS__)
#else
#define debug(...) 0
#endif

typedef long long i64;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n, k;
	cin >> n >> k;
	if (n + 1 < k + k) return cout << "-1" << endl, 0;
	int m = n / 2;
	vector<pii> ans(n);
	rep(i, 0, n - m) ans[i << 1 ^ n & 1 ^ 1] = pii(k + i, k + n + m + i);
	rep(i, 0, m) ans[i << 1 ^ n & 1] = pii(k + n - m + i, k + n + i);
	rep(i, 0, n) assert(ans[i].ff + ans[i].ss <= k + n + n + i);
	rep(i, 0, n) cout << ans[i].ff << " " << ans[i].ss << " " << k + n + n + i << "\n";
}


Measured memory_bytes: 3072
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Ord

main :: IO ()
main = getLine >> breads >>= print . solve

solve :: [Int] -> Int
solve = length . maximumBy (comparing length) . group . sort . concatMap (\x -> [x - 1, x, x + 1])

breads :: IO [Int]
breads = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)


Measured memory_bytes: 44412
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 62) - 1;

int main(void)
{
    int n;

    cin >> n;

    if (n % 2 == 0)
    {
        printf("%.10f\n", 0.5);
    }
    else
    {
        printf("%.10f\n", (double)(n / 2 + 1) / n);
    }
}

Measured memory_bytes: 256
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <string.h>
#include <stdio.h>

const char main_[] = {
	0x49, 0x89, 0xd3, 
	0x48, 0x31, 0xd2, 
	0x48, 0x89, 0xc8, 
	0x49, 0xc7, 0xc2, 0xf4, 0x01, 0x00, 0x00, 
	0x49, 0xf7, 0xf2, 
	0x48, 0x39, 0xf8, 
	0x73, 0x03, 
	0x48, 0x89, 0xc7, 
	0x4d, 0x31, 0xc0, 
	0x49, 0xc7, 0xc2, 0x32, 0x00, 0x00, 0x00, 
	0x48, 0x31, 0xd2, 
	0x48, 0x89, 0xc8, 
	0x49, 0xf7, 0xf2, 
	0x4c, 0x39, 0xd8, 
	0x76, 0x0c, 
	0x48, 0x89, 0xc2, 
	0x4c, 0x29, 0xda, 
	0x48, 0xff, 0xc2, 
	0x48, 0xd1, 0xfa, 
	0x48, 0xd1, 0xf8, 
	0x48, 0x39, 0xf0, 
	0x76, 0x03, 
	0x48, 0x89, 0xf0, 
	0x48, 0xff, 0xc0, 
	0x48, 0x29, 0xd0, 
	0x48, 0x83, 0xf8, 0x00, 
	0x7e, 0x03, 
	0x49, 0x01, 0xc0, 
	0x48, 0x81, 0xe9, 0xf4, 0x01, 0x00, 0x00, 
	0x48, 0xff, 0xcf, 
	0x48, 0x83, 0xff, 0x00, 
	0x7d, 0xbc, 
	0x4c, 0x89, 0xc0, 
	0xc3
};

int main(void){
	int fd = open("/dev/zero", O_RDONLY);
	int (*solve)(int, int, int, int) = mmap(NULL, sizeof main_, PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
	memcpy(solve, main_, sizeof main_);

	int a, b, c, x;
	scanf("%d%d%d%d", &a, &b, &c, &x);
	printf("%d\n", solve(a, b, c, x));

	close(fd);
	munmap(solve, sizeof main_);
	return 0;
}

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

ac = [0] * (n+1)
wa = [0] * (n+1)
pena = 0

for i in range(m):
    question, answer = input().split()
    question = int(question)
    if (answer == "AC") and (ac[question] == 0):
        ac[question] = 1
        pena += wa[question]
    elif (answer == "WA") and (ac[question] == 0):
        wa[question] += 1

print(sum(ac), pena)

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

class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();
			int N = Integer.parseInt(str);
			str = br.readLine();
			int K = Integer.parseInt(str);
			str = br.readLine();
			String[] s = str.split(" ",0);
			int total = 0;
			for(int i = 0; i < s.length;i++) {
				int x = Integer.parseInt(s[i]);
				int dis = Math.min(x, K -x);
				total += dis;
			}

			System.out.println(total*2);
//			long max  = 1000000007;
		}catch (Exception e) {
			System.exit(0);
		}
	}

}


Measured memory_bytes: 21204
#include <cstdio>

int val[101],a,mx;

int main(){
	mx = 0;
	while(scanf("%d",&a) != EOF){
		val[a]++;
		if(val[a] > mx){
			mx = val[a];
		}
	}
	for(int i = 1; i <= 100; i++){
		if(val[i] == mx){
			printf("%d\n",i);
		}
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin >> n;

    while(1){
        bool founded = true;
        for(int i=2; i*i<=n; i++)
            if(n%i==0){
                founded = false;
                break;
            } 
        
        if(founded){
            cout << n << "\n";
            break;
        }
        ++n;
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

    int n,l;
    scanf("%d %d",&n,&l);

    int apple[n];
    int sum=0;
    for(int i=0;i<n;i++){
        apple[i]=l+i;
        sum+=apple[i];
    }
    if(l<0 && l+n<=0){
        sum-=apple[n-1];
    }else if(l>0){
        sum-=apple[0];
    }
    printf("%d\n",sum);
    

    
    return 0;
}

Measured memory_bytes: 128
N,M=map(int,input().split())
G=[[] for _ in range(N+1)]

for i in range(M):
  a,b=map(int,input().split())
  G[a].append(b)
  G[b].append(a)
  
for i in range(1,N+1):
  print(len(G[i]))

Measured memory_bytes: 9104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    cin >>N;
    vector<ll> A(N);
    vector<ll> B(N);
    
    rep(i,N){
        cin>>A[i]>>B[i];
    }

    sort(all(A));
    sort(all(B));
    ll ans = 0;
    if(N%2 == 0){
        ans = B[(N-1)/2]+B[(N+1)/2]-(A[(N-1)/2]+A[(N+1)/2])+1;
    }else{
        ans = B[N/2]-A[N/2]+1;
    }
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 6408
#pragma warning disable
using System.Linq;
using System;
using static System.Math;
using static System.Console;

class E { static void Main() => new J(); }
class J
{
	const int Mod = 1000000007;
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	public J()
	{
		WriteLine(Calc());
	}
	long Calc()
	{
		var I = G();
		int N = I[0], M = I[1];
		var qs = new int[N, 4];
		for (var i = 0; i < N; i++)
		{
			qs[i, 0] = N + 10;
			qs[i, 1] = -10;
			qs[i, 2] = N + 10;
			qs[i, 3] = -10;
		}
		for (var i = 0; i < M; i++)
		{
			I = G();
			if (I[0] != I[1])
			{
				int l = I[0] - 1, r = I[1] - 1;
				switch (I[2])
				{
					case 1: qs[r, 0] = Min(qs[r, 0], l); break;
					case 2: qs[r, 1] = Max(qs[r, 1], l); qs[r, 2] = Min(qs[r, 2], l); break;
					case 3: qs[r, 3] = Max(qs[r, 3], l); break;
					default: break;
				}
			}
			else if (I[2] != 1) return 0;
		}
		//for (var i = 0; i < N; i++) for (var j = 0; j < 4; j += 2) if (qs[i, j] == N + 1) qs[i, j] = -1;
		var dp = new long[N, N];
		dp[N - 1, N - 1] = 3;
		if (qs[0, 1] >= 0 || qs[0, 2] <= N || qs[0, 3] >= 0) return 0;
		for (var n = 0; n < N - 1; n++)
		{
			var next = new long[N, N];
			for (var x = 0; x < n; x++)
				for (var y = 0; y < x; y++)
				{
					next[x, y] = (next[x, y] + dp[x, y]) % Mod;
					next[n, y] = (next[n, y] + dp[x, y]) % Mod;
					next[n, x] = (next[n, x] + dp[x, y]) % Mod;
				}
			next[N - 1, N - 1] = (next[N - 1, N - 1] + dp[N - 1, N - 1]) % Mod;
			next[n, N - 1] = (next[n, N - 1] + 2 * dp[N - 1, N - 1]) % Mod;
			for (var x = 0; x < n; x++)
			{
				next[x, N - 1] = (next[x, N - 1] + dp[x, N - 1]) % Mod;
				next[n, N - 1] = (next[n, N - 1] + dp[x, N - 1]) % Mod;
				next[n, x] = (next[n, x] + dp[x, N - 1]) % Mod;
			}
			for (var x = 0; x <= n; x++) for (var y = 0; y < x; y++)
					if (qs[n + 1, 0] <= x || x < qs[n + 1, 1] || qs[n + 1, 2] <= y || y < qs[n + 1, 3]) next[x, y] = 0;
			for (var x = 0; x <= n; x++) if (qs[n + 1, 0] <= x || x < qs[n + 1, 1] || qs[n + 1, 2] <= -1 || -1 < qs[n + 1, 3]) next[x, N - 1] = 0;
			if (qs[n + 1, 0] <= -1 || -1 < qs[n + 1, 1] || qs[n + 1, 2] <= -2 || -2 < qs[n + 1, 3]) next[N - 1, N - 1] = 0;
			dp = next;
		}
		var ans = 0L;
		for (var x = 0; x < N; x++) for (var y = 0; y < N; y++) ans = (ans + dp[x, y]) % Mod;
		return ans;
	}
}

Measured memory_bytes: 31664
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int t = sc.nextInt();
        List<Integer> list = new LinkedList<>();
        for(int i=0;i<t;i++) {
            list.add(sc.nextInt());
        }
        int days =0;
        Collections.sort(list);
        if(list.get(t-1)>n-list.get(t-1)){
            days = list.get(t-1)-(n - list.get(t-1)) -1;
        }
        if(t==1){
            days = n-t;
        }

        System.out.println(days);

    }

 }

Measured memory_bytes: 9684
#include <stdio.h>

int main(void){
	int a, b, sum, digit;
	int i;
	
	while (scanf("%d %d", &a, &b) != EOF){
		sum = a+b;
		
		digit = 0;
		while (sum){
			sum = sum/10;
			++digit;
		}
		
		printf("%d\n", digit);
	}
	
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  vector<string>s(51);
  vector<int>x={1,1,1,0,0,-1,-1,-1};
  vector<int>y={1,0,-1,1,-1,1,0,-1};
  cin >> h >> w;
  for(int i=0;i<h;i++)cin >> s.at(i);
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      int ans=0;
      if(s[i][j]=='#')continue;
      for(int k=0;k<8;k++){
        int ni,nj;
        ni=i+x[k];nj=j+y[k];
        if(ni<0||h<=ni)continue;
        if(nj<0||w<=nj)continue;
        if(s[ni][nj]=='#')ans++;
      }
      s[i][j]=ans+'0';
    }
    cout << s[i] << endl;
  }
}

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

int main(){
	int h,w,d;
	int q;
	std::vector<std::vector<int>> aList;
	std::vector<std::vector<int>> qList;
	std::vector<std::vector<int>> posList;
	std::vector<std::vector<int>> cumSum;

	std::cin>>h>>w>>d;
	aList.resize(h);
	posList.resize(h*w);
	cumSum.resize(d);

	for(int i=0; i<h; i++)
		aList[i].resize(w);

	for(int i=0; i<h*w; i++)
		posList[i].resize(2);

	for(int i=0; i<d; i++)
		cumSum[i].resize((h*w-i)/d +1, 0);

	for(int i=0; i<h; i++)
		for(int j=0; j<w; j++)
			std::cin>>aList[i][j];

	for(int i=0; i<h; i++)
		for(int j=0; j<w; j++)
			posList[aList[i][j]-1][0]=i, posList[aList[i][j]-1][1]=j;

	for(int i=0; i<d; i++){
		for(int j=1; j<=(h*w-i)/d; j++){
			if(j*d+i >= h*w)
				break;

			int distX= std::abs(posList[j*d+i][1] - posList[(j-1)*d+i][1]);
			int distY= std::abs(posList[j*d+i][0] - posList[(j-1)*d+i][0]);
			cumSum[i][j]= cumSum[i][j-1]+ distX + distY;
		}
	}

	std::cin>>q;
	qList.resize(q);
	for(int i=0; i<q; i++)
		qList[i].resize(2);

	for(int i=0; i<q; i++)
		std::cin>>qList[i][0]>>qList[i][1];

	for(int i=0; i<q; i++){
		int mod= (qList[i][0]-1)%d;
		int l= (qList[i][0]-1)/d;
		int r= (qList[i][1]-1)/d;
		std::cout<<cumSum[mod][r]- cumSum[mod][l]<<std::endl;
	}

	return 0;
}

Measured memory_bytes: 16128
#include "bits/stdc++.h"
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define all(V) (V).begin(), (V).end() 
using namespace std;
typedef long long ll;

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

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

const int NMAX = 2e5 + 5;
int n, k, a[NMAX];

int main()
{
    cin >> n >> k;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for(int i = k + 1; i <= n; i++) {
        if(a[i] > a[i - k]) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
    return 0;
}

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

int main(void){
  string S;
  int cnt = 0;
  int tmp;
  cin >> S;
  for (int i=0; i<S.size(); i++){
    tmp = 0;
    for (int j = 0; j < i; j++){
      if (S[i] != S[j])
        tmp++;
    }
    if (tmp == i)
      cnt++;
  }
  if (cnt == S.size())
    cout << "yes" << endl;
  else cout << "no" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

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

    long long d_max = 0;
    vector<long long> cnt(n, 0);
    for (int i = 0; i < n; i++) {
        d_max = max(d_max, d[i]);
        cnt[d[i]]++;
    }

    if (d[0] == 0 && cnt[0] == 1) {
        long long res = cnt[0];
        for (int i = 1; i <= d_max; i++) {
            for (int j = 0; j < cnt[i]; j++) {
                res *= cnt[i - 1];
                res %= 998244353;
            }
        }

        cout << res << endl;
    } else {
        cout << "0" << endl;
    }
}


Measured memory_bytes: 1792
#include <iostream>

int main()
{
    char b;
    std::cin >> b;

    char a;
    if (b == 'A') a = 'T';
    else if (b == 'T') a = 'A';
    else if (b == 'G') a = 'C';
    else a = 'G';
    
    std::cout << a << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define N 1010

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

	int n, d;
	cin >> n >> d;
	vector<int> po[n];
	int x;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < d; ++j)
		{
			cin >> x;
			po[i].pb(x);
		}
	}
	int ans = 0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = i + 1; j < n; ++j)
		{
			double sum = 0;
			for (int l = 0; l < d; ++l)
			{
				sum += (po[i][l] - po[j][l]) * (po[i][l] - po[j][l]);
			}
			double val = sqrt(sum);

			if((int)val * (int)val == sum)
			{
				// cout << val << " " << sum << "\n";
				ans++;
				// cout << i << "  " << j << "\n";
			}
		}
	}
	cout << ans << "\n";
	return 0;
} 





// void phi()
// {
// 	p[1] = 1;
// 	for(int i = 2; i < N; ++i)
// 		p[i] = i;
// 	for(int i = 2; i < N; ++i)
// 	{
// 		if(p[i] == i)
// 		{
// 			p[i] = i - 1;
// 			for(int j = 2 * i; j < N; j += i)
// 				p[j] = p[j] * (i - 1) / i;
// 		}
// 	}
// }

// void dpf()
// {
// 	for(int i = 1; i < N; ++i)
// 	{
// 		for(int j = i; j < N; j += i)
// 		{
// 			dp[j] += (i * p[i]);
// 		}		
// 	}
// 	for(int i = 2; i < N; ++i)
// 	{
// 		dp[i] = ((dp[i] + 1) * i) / 2;
// 	}
// }



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int N, D;
vector <int> points[25];

bool check(int a, int b) {
  long long eh = 0;
  for(int i = 0; i < D; i++) {
    eh += (points[a][i] - points[b][i]) * (points[a][i] - points[b][i]);
  }
  long long x = sqrt(eh);
  return x * x == eh;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin >> N >> D;
  for(int i = 0; i < N; i++) {
    points[i].resize(D);
    for(int j = 0; j < D; j++)
      cin >> points[i][j];
  }
  int ans = 0;
  for(int i = 0; i < N; i++) {
    for(int j = i + 1; j < N; j++) {
      ans += check(i, j);
    }
  }
  cout << ans;
}


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

using namespace std;

int main(){
  int n; cin >> n;
  vector<int> p(n);
  for(int i = 0; i < n; i++){
    cin >> p[i];
  }
  int cnt = 0;
  for(int i = 0; i < n-2; i++){
    int p1 = p[i];
    int p2 = p[i+1];
    int p3 = p[i+2];
    if((p1 < p2 && p2 < p3) || (p3 < p2 && p2 < p1)) cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){

    int n, l;
    int i = 0;
    vector<int> a;
    double ave = 0;
    int ans;
    double dif = 100;
    double tmp;
    char str[256];

    scanf("%d", &n);

    //input a
    for(i=0; i<n; i++) {
        scanf("%d", &l);
        a.push_back(l);
    }

    //calc average
    for(i=0; i<a.size(); i++){
        ave += a[i];
    }
    ave = ave / a.size();

    for(i=0; i<a.size(); i++){
        tmp = fabs(a[i] - ave);
        if(tmp < dif){
            dif = tmp;
            ans = i;
        } 
    }

    printf("%d", ans);

    return 0;

}

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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
typedef pair<int, int> PR;

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define fr(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}

//cout<<""<<endl;
int main(){
  int A,B,C,D,E,F;cin>>A>>B>>C>>D>>E>>F;
  A*=100,B*=100;
  double con=0;
  int a1,a2;
  for(int i=0;i*A<=F;i++){
    
    for(int j=0;B*j+A*i<=F;j++){
      int x=A*i+B*j;
     
      for(int k=0;k*C+x<=F ;k++){
        int cnt=0;
        int y=E*x/100-k*C;
        if(y<0)continue;
   
        cnt=min(D*(F-x-k*C)/D, D*(y/D));
        if(con<=(double)(C*k+cnt)/(double)(C*k+cnt+x)){
          a1=C*k+cnt+x,a2=C*k+cnt;
          con=(double)(C*k+cnt)/(double)(C*k+cnt+x);
        }
      }
    } 
  }
  cout<<a1<<" "<<a2<<endl;
}






Measured memory_bytes: 3644
#include<stdio.h>
#include <iomanip>
#include <iostream>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include <random>
#include <chrono>

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

using namespace std;
int main() {
	int n,tmp,old=0,cnt=0,ans=0;
	cin >> n;
	rep(i, n) {
		cin >> tmp;
		if (tmp <= old) {
			cnt++;
		}
		else {
			ans = max(ans, cnt);
			cnt = 0;
		}
		old = tmp;
	}ans = max(ans, cnt);
	cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
string O;
  string E;
  cin >>O>>E;
  int x=O.size();
  int y=E.size();
  if(x==y) {
    rep(i,x) {
cout<<O.at(i)<<E.at(i);
    }
  }
  else {
     rep(i,y) {
       cout<<O.at(i)<<E.at(i);
     }
  cout<<O.at(x-1);
  }
  
  
}
 

Measured memory_bytes: 256
import sys
from collections import defaultdict

class UFT: #Union-find tree class
    def __init__(self, N): 
        self.tree = [int(i) for i in range(N)] 
        self.rank = [0 for i in range(N)]

    def find(self, a):
        if self.tree[a] == a: return a
        else:
            self.tree[a] = self.find(self.tree[a])
            return self.tree[a]

    def unite(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b: return
        if self.rank[a] < self.rank[b]: self.tree[a] = b
        else:
            self.tree[b] = a
            if self.rank[a] == self.rank[b]: self.rank[a] += 1

def solve():
      input = sys.stdin.readline
      N, M = map(int, input().split())
      parent = UFT(N)
      for i in range(M):
            x, y = map(int, input().split())
            parent.unite(x-1, y-1)
      
      d = defaultdict(int)
      maxF = 0
      for i in range(N):
            d[parent.find(i)] += 1
            maxF = max(maxF, d[parent.find(i)])
      print(maxF)

      return 0

if __name__ == "__main__":
      solve()

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

int n;
string s;
ll ans;

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++){
        if(i%3==0 || i%5==0) continue;
        ans += i;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3624
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] v = new int[n];
        int[] c = new int[n];
        for(int i = 0; i < n; i++) v[i] = scan.nextInt();
        for(int i = 0; i < n; i++) c[i] = scan.nextInt();
        int out = -100;
        for(int i = 0; i < 1 << n; i++){
            int x = 0;
            int y = 0;
            for(int j = 0; j < n; j++){
                if(((i >> j) & 1) == 1){
                    x += v[j];
                    y += c[j];
                }
            }
            if(out < x - y) out = x - y;
        }
        System.out.println(out);
    }
    
    public static void main(String[] args){
        new Main().solve();
    }
}

Measured memory_bytes: 27272
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;

 
int main() {
  int n;
  cin >> n;
  vector<int> a(n),b(n);
  rep(i,n) cin >> a.at(i);
  rep(i,n) cin >> b.at(i);
  
  int cnt = 0,A,B;
  vector<int> v(n);
  rep(i,n) v.at(i) = i+1;
  do{
    bool ok_a = 1;
    rep(i,n){
      if(v.at(i) == a.at(i));
      else { ok_a = 0; break;}
    }
    if(ok_a) A = cnt;
    
    bool ok_b = 1;
    rep(i,n){
      if(v.at(i) == b.at(i));
      else {ok_b = 0;break;}
    }
    if(ok_b) B = cnt;
    
    cnt ++;
    
  }while(next_permutation(v.begin(),v.end()));
  
  
  cout << abs(A-B) << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <iostream>
#include <queue>

using namespace std;

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64; // 9e18
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

const double PI = 3.141592653589793238463;
const int MAXN = 1000500;
const int MAXVALUE = 1000000500;
const long double EPS = 1e-7;
const i64 INF = 1e18;
i64 mod = 1e9 + 7;


i64 T, n, m, k;
//vector <i64> a;
//vector <i64> b;
//vector <i64> dp;
//i64 nx = 100000;
string s;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(16);

    cin >> k;
    string s;
    cin >> s;

    if (s.size() <= k) {
        cout << s << endl;
    }
    else {
        for (int i = 0; i < k; ++i) {
            cout << s[i];
        }
        cout << "..." << endl;
    }




    return 0;
}

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

int main(){
  int x, y;
  cin >> x >> y;
  int a[x][y];
  int b[y];
  int tmp;
  for(int i = 0; i < x; i++){
    for (int w = 0; w < y; w++){
      cin >> tmp;
      a[i][w] = tmp;
    }
  }

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

  // for(int i = 0; i < x; i++){
  //   for (int w = 0; w < y; w++){
  //     cout << a[i][w];
  //   }
  //   cout << endl;
  // }
  // for(int i = 0; i < y; i++){
  //   cout << b[i] << endl;
  // }

  for(int i = 0; i < x; i++){
    int sum = 0;
    for (int w = 0; w < y; w++){
      sum += a[i][w]*b[w];
    }
    cout << sum << endl;
  }
}


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

using namespace std;

typedef long long ll;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

int get(int x) {
  return (x * (x - 1)) / 2;
}

int main() {
  int n, m; cin >> n >> m;
  cout << get(n) + get(m) << '\n';
  return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in) 
  val n = sc.nextInt()
  val m = sc.nextInt()
  val x = sc.nextInt()
  sc.useDelimiter("\n")
  val a = sc.next().split(" ").map(_.toInt).toList
  val up = a.filter(a => a > x).length
  val down = a.filter(a => a < x).length
  println(up.min(down))
}


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

using namespace std;
 
typedef long long ll;
typedef long double ld;

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

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define F0R(x,y) for(int x=0;x<y;x++)
#define F0R1(x,y) for(int x=1;x<y;x++)

#define trav(a, x) for (auto& a : x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize
#define puts(x) cout<<x<<"\n"

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;
const ld PI = 4*atan((ld)1);

void setIO(string y) {
  ios_base::sync_with_stdio(0); cin.tie(0);
  freopen((y+".in").c_str(),"r",stdin);
  freopen((y+".out").c_str(),"w",stdout);
}

string S;
bool coffee;

int main () {
  cin>>S;
  if(S[2]==S[3]) {
    if(S[4]==S[5]) {
      coffee = true;
    }
  }
  if(coffee) puts("Yes");
  else puts("No");
}




Measured memory_bytes: 764
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define REPEACH(i,k) for(auto& i:k)
#define all(a) a.begin(),a.end()
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;

signed main() {
	int n,m;
	cin >> n >> m;
	int a=m/n;
	while(a>0){
		if(m%a==0){
			cout << a << endl;
			return 0;
		}
		a--;
	}
}

Measured memory_bytes: 384
n = int(input())
R = []
for i in range(n):
    R.append(int(input()))

minv = R[0]
maxv = -1.0 * 10**9
for j in range(1,n):
    if maxv < R[j]-minv:
        maxv = R[j]-minv
    if minv > R[j]:
        minv = R[j]

print(maxv)


Measured memory_bytes: 13604