akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define deb(x) cout<<#x<<" " <<x<<"\n";
#define pi 3.1415926535897932384626433832795
#define mod 1000000007
#define all(x) x.begin(), x.end()
#define cr7 ios_base::sync_with_stdio(false);cin.tie(NULL);
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (((a)*(b))/gcd((a),(b)))
/*
1
0
2
*/
int main()
{
    cr7
#ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
#endif
    string s;
    cin >> s;
    if (count(all(s), 'B') != 0) {
        cout << "ARC\n";
    } else {
        cout << "ABC\n";
    }
    return 0;
}

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC085A
{
    class Program
    {
        static void Main(string[] args)
        {
            string S;
            S = Console.ReadLine();
            char[] cs = S.ToCharArray();
            cs[3]= '8';
            Console.WriteLine(cs);
            Console.ReadKey();

        }
    }
}

Measured memory_bytes: 11092
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a,s[8],d[4],f,g,h,j,i;
	while(1){
		scanf("%d",&a);
		g=0;
		if(a==0) break;
		while(1){
			if(a==g) break;
			g++;
			for(j=0;j<8;j++) scanf("%d",&s[j]);
			d[0]=(s[0]*s[4])-(s[1]*s[5])-(s[2]*s[6])-(s[3]*s[7]);
			d[1]=(s[0]*s[5])+(s[1]*s[4])+(s[2]*s[7])-(s[3]*s[6]);
			d[2]=(s[0]*s[6])-(s[1]*s[7])+(s[2]*s[4])+(s[3]*s[5]);
			d[3]=(s[0]*s[7])+(s[1]*s[6])-(s[2]*s[5])+(s[3]*s[4]);
			for(i=0;i<4;i++){
				printf("%d",d[i]);
				if(i!=3) printf(" ");
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 2744
#include <iostream>
#include <string>
#include <vector>
#include <queue>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); ++i)
const int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};

int h, w;

inline bool inrect(int x, int y){
    return 0 <= x && x < h && 0 <= y && y < w;
}

int solve(vector<string>& a, char c){
    int res = 0;
    rep(i, h)rep(j, w)if(a[i][j] == c){
        rep(k, 4){
            int sx = i + dx[k], sy = j + dy[k];
            if(!inrect(sx, sy) || a[sx][sy] != '.')continue;
            a[sx][sy] = c;
            bool ok = true;
            int cnt = 0;
            queue<pair<int, int> > q;
            for(q.emplace(sx, sy); !q.empty();){
                int x = q.front().first, y = q.front().second; q.pop();
                cnt++;
                rep(l, 4){
                    int nx = x + dx[l], ny = y + dy[l];
                    if(!inrect(nx, ny))continue;
                    if(a[nx][ny] == '.'){
                        a[nx][ny] = c;
                        q.emplace(nx, ny);
                    }
                    else if(a[nx][ny] != c)ok = false;
                }
            }
            if(ok)res += cnt;
        }
    }
    return res;
}

int main(){
    while(cin >> w >> h, w|h){
        vector<string> a(h);
        rep(i, h)cin >> a[i];
        cout << solve(a, 'B') << " " << solve(a, 'W') << '\n';
    }
    return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <cmath>
using namespace std;
long long convert(long long x, long long n){
    long long y=0, i=0, z;
   int count=0;
    while(x > 0){
        z = x%n;
        y += z*pow(10, i);
        x = x/n;
        i++;
      	count++;
    }
  	cout<<count<<endl;
    return y;
}

int main(void){
   long long N,K;
   cin>>N>>K;
   long long k=convert(N,K);
  // string s=to_string(k);
   //cout<<s.size()<<" "<<k<<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#include <deque>
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl
#define isort(a) sort(a.begin(),a.end())

using namespace std;

#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

typedef pair<ll,ll> Pair;
typedef vector<ll> vecll;
const ll inf =1000000007;

void asolve(){
    string s,t;
    cin >> s >>t;
    bool can=true;

    for(ll i=0;i<s.size();i++){
        if(s[i]!=t[i]) can=false;
    }

    if(can) cout <<"Yes" << endl;
    else cout <<"No" << endl;


}

void bsolve(){

    ll a,b,c,k;
    cin >> a>> b>> c>>k;

    if(k<=a){
        kaku(k);
    }
    else if(k<=(a+b)){
        kaku(a);
    }
    else if (k<=a+b+c){
        kaku(a+a+b-k);
    }
    else {
        kaku(a-c);
    }

}

void csolve(){

    ll n,m,x;
    cin >> n >> m >>x;
    ll c[n];
    ll a[n][m];
    rep(i,n){
        cin >> c[i];
        rep(j,m){
            cin >> a[i][j];
        }
    }
    ll ri[m];
    ll ans=-1;
    for(ll bit=0;bit<(1LL<<n);bit++){
        rep(i,m) ri[i]=0;
        ll score=0;
        ll can=true;
        rep(i,n){
            if(bit & (1LL<<i)){
                score+=c[i];
                rep(j,m){
                    ri[j]+=a[i][j];
                }
            }
        }
        rep(i,m){
            if(x>ri[i]) can=false;
        }
        if(can){
            if(ans==-1) ans=score;
            else ans=min(ans,score);
        }
    }
    kaku(ans);
}

void dsolve(){

    ll n,k;
    cin >> n>> k;
    map<ll,ll> mp;
    rep(i,n){
        ll a;
        cin >>a;
        mp[i+1]=a;
    }
    ll now=1;

    vecll vec;//いった集合
    vec.pb(1);
    bool visit[n+1];
    rep(i,n+1) visit[i]=false;
    visit[1]=true;
    map<ll,ll> iku;//そこを訪れたのはなん回目か
    iku[1]=0;
    ll loop;
    bool d=false;

    for(ll i=1;i<=k;i++){
        now=mp[now];
        if(visit[now]){
            d=true;
            loop=i;
            break;
        }
        else{
            vec.pb(now);
            iku[now]=i;
            visit[now]=true;
        }
    }
    //loop~iku[now]でループ検出

    //ループ処理
    if(d){
        ll e=loop-iku[now];
        ll u=(k-iku[now])%e;

        now=vec[iku[now]+u];

        cout << now << endl;
    }
    else{
        cout << now << endl;
    }

}


int main(){
    csolve();
}

Measured memory_bytes: 3648
n = int(input())
line = input()
a = []
b = []
max = 0

for i in range(0, n):
  a.clear()
  b.clear()
  for j in range(0, i):
  	a.append(line[j])
  for k in range(i, n):
    b.append(line[k])
    
  if (len(set(a) & set(b)) > max):
    max = len(set(a) & set(b))

print(max)

Measured memory_bytes: 3064
a = input()
b = input()
length_a = len(a)
length_b = len(b)


def check():
    for i in range(length_a - length_b + 1):
        for j in range(length_b):
            if b[j] == "_" or a[i + j] == b[j]:continue
            else:break
        else:
            print("Yes")
            return
    print("No")
    return


check()



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

public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc=new Scanner(System.in);
        String s=sc.next(),t=sc.next();
        int a=sc.nextInt(),b=sc.nextInt();
        if(s.equals(sc.next())){
            a--;
        }else{
            b--;
        }
        System.out.println(a +" "+b);
    }
}

Measured memory_bytes: 21844
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int m = scanner.nextInt();

        final int[][] table = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                table[i][j] = scanner.nextInt();
            }
        }

        final Set<Integer> selectables = IntStream.rangeClosed(1, m)
                .boxed()
                .collect(Collectors.toSet());
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < m; i++) {
            final Map<Integer, Integer> map = new HashMap<>();
            for (int j = 0; j < n; j++) {
                for (int k = 0; k < m; k++) {
                    final int sport = table[j][k];
                    if (selectables.contains(sport)) {
                        map.compute(sport, (key, v) -> v == null ? 1 : v + 1);
                        break;
                    }
                }
            }

            int max = -1;
            int maxSport = -1;
            for (final Map.Entry<Integer, Integer> entry : map.entrySet()) {
                if (max < entry.getValue()) {
                    max = entry.getValue();
                    maxSport = entry.getKey();
                }
            }
            min = Math.min(max, min);
            selectables.remove(maxSport);
        }

        System.out.println(min);
    }
}


Measured memory_bytes: 90320
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

struct edge{
	int to,co,p;
};

vector<edge> vs[105];

int ds[105];
void bfs(int st){
	queue<mp> que;
	que.push(mp(0,st));
	memset(ds,-1,sizeof(ds));
	while(!que.empty()){
		mp pa=que.front();
		que.pop();
		int no=pa.sec,
			nd=pa.fir;
		if(ds[no]>=0)continue;
		ds[no]=nd;
		rep(i,vs[no].size()){
			int to=vs[no][i].to,
				ec=vs[no][i].co;
			if(ec<=0 || ds[to]>=0)continue;
			que.push(mp(nd+1,to));
		}
	}
}

int gone[105];
int dfs(int no,int gl,int f){
	gone[no]=1;
	if(no==gl)return f;
	rep(i,vs[no].size()){
		edge& e=vs[no][i];
		if(gone[e.to] || e.co<=0 || ds[e.to]<=ds[no])continue;
		int tf=dfs(e.to,gl,min(f,e.co));
		if(tf<=0)continue;
		e.co-=tf;
		vs[e.to][e.p].co+=tf;
		return tf;
	}
	return 0;
}

int dinic(int st,int gl){
	int res=0;
	for(;;){
		bfs(st);
		if(ds[gl]<0)break;
		for(;;){
			memset(gone,0,sizeof(gone));
			int f=dfs(st,gl,IINF);
			if(f<=0)break;
			res+=f;
		}
	}
	return res;
}
	
int n,m;
int main(void){
	scanf("%d%d",&n,&m);
	rep(i,m){
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		edge e;
		e.to=b; e.co=c; e.p=vs[b].size();
		vs[a].push_back(e);
		e.to=a; e.co=0; e.p=vs[a].size()-1;
		vs[b].push_back(e);
	}
	printf("%d\n",dinic(0,n-1));
	return 0;
}

Measured memory_bytes: 1260
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807/5;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
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;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
	int a,b;
	cin>>a>>b;
	if(a<=9&&b<=9)cout<<a*b<<endl;
	else cout<<-1<<endl;
	return 0;
}

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

ll dp[110][100100];

const ll MOD = 1e9+7;

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

  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  rep(i, N) cin >> a[i];

  rep(i, 110){
    rep(j, 100100){
      dp[i][j] = 0;
    }
  }

  dp[0][K] = 1;

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

    vector<ll> sum(K+2);
    rep(j, K+2){
      sum[j] = 0;
    }

    rep(j, K+1){
      sum[j+1] = (sum[j] + dp[i][j]) % MOD;
    }

    rep(k, K+1){
      dp[i+1][k] = (sum[min(k+a[i]+1, K+1)] + MOD - sum[k]) % MOD;
    }

  }

  cout << dp[N][0] << endl;

  return 0;
}


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

int main() {
	int n; cin >> n;
	vector<int>a(n); for (auto&& x : a)cin >> x;

	long long ans1 = 0, ans2 = 0, sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i];
		if (i % 2 == 0 && sum >= 0) {			
			ans1 += sum + 1;
			sum = -1;
		}
		else if (i % 2 == 1 && sum <= 0) {
			ans1 += -sum + 1;
			sum = 1;
		}
	}

	sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i];
		if (i % 2 == 1 && sum >= 0) {
			ans2 += sum + 1;
			sum = -1;
		}
		else if (i % 2 == 0 && sum <= 0) {
			ans2 += -sum + 1;
			sum = 1;
		}
	}
	cout << min(ans1, ans2) << endl;

	return 0;
}

Measured memory_bytes: 3796
#ifndef TEMPLATE_HPP
#define TEMPLATE_HPP
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())
using namespace std;
using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename U> vector<U> make_vector(T&& n, U&& val) { return vector<U>(forward<T>(n), forward<U>(val)); }
template <typename T, typename... Args> decltype(auto) make_vector(T&& n, Args&&... args) { return vector<decltype(make_vector(forward<Args>(args)...))>(forward<T>(n), make_vector(forward<Args>(args)...)); }
const int INF = 1001001001;
const i64 LINF = 1001001001001001001ll;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
#endif

void solve() {
  i64 x, k, d;
  cin >> x >> k >> d;
  if (x == 0) {
    if (k % 2 == 0) {
      cout << 0 << endl;
    } else {
      cout << d << endl;
    }
    return;
  }
  if (x < 0) x *= -1;
  i64 c = (x + d - 1) / d;
  if (c > k) {
    cout << x - d * k << endl;
    return;
  }
  k -= c;
  if (k % 2 == 0) {
    cout << abs(x - d * c) << endl;
  } else {
    cout << abs(x - d * (c - 1)) << endl;
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(16);
  cerr << fixed << setprecision(16);
  solve();
  return 0;
}

Measured memory_bytes: 3628
N = int(input())
T,A = (int(i) for i in input().split())
H = [int(i) for i in input().split()]

place = 1
closest = abs(A - (T - H[0]*0.006))

for i in range(1,N):
    temperature = abs(A - (T - H[i]*0.006))
    if temperature < closest:
        place = i + 1
        closest = temperature

print(place)

Measured memory_bytes: 3064
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;

void main() {
  auto n = readln.chomp.to!int;
  int[][][] f = new int[][][](n, 5, 2);
  int[][] p = new int[][](n, 11);

  for (int i = 0; i < n; ++i) {
    auto l = readln.chomp.split.map!(to!int).array;
    for (int j = 0; j < 10; j += 2) {
      f[i][j / 2][0] = l[j];
      f[i][j / 2][1] = l[j + 1];
    }
  }

  for (int i = 0; i < n; ++i) {
    auto l = readln.chomp.split.map!(to!int).array;
    for (int j = 0; j < 11; ++j) {
      p[i][j] = l[j];
    }
  }

  int maxBenefit = -1000000007;

  for (int i = 1; i < (2 << 9); ++i) {
    int sum;
    int[] c = new int[](n);
    for (int j = 0; j < 10; ++j) {
      //writeln(j, " = ", (i >> j) & 1);
      if (((i >> j) & 1) == 1) {
        for (int k = 0; k < n; ++k) {
          //writeln(k, " ", j / 2, " " , j % 2, " = ", f[k][j / 2][j % 2]);
          if (f[k][j / 2][j % 2] == 1) {
            c[k]++;
          }
        }
      }
    }

    for (int j = 0; j < n; ++j) {
      sum += p[j][c[j]];
    }

    if (maxBenefit < sum) {
      maxBenefit = sum;
    }
  }

  maxBenefit.writeln;
}

Measured memory_bytes: 892
// https://atcoder.jp/contests/abc054/tasks/abc054_a

#include <iostream>
using namespace std;

int main()
{
  /* Magic word */
  cin.tie(0);
  ios::sync_with_stdio(false);
  /* ---------- */

  int a, b;
  string r;

  cin >> a >> b;

  r = a == b ? "Draw" : (a + 11) % 13 < (b + 11) % 13 ? "Bob" : "Alice";

  cout << r << "\n";

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if(a>0&&b>0){
    cout << "Positive" << endl;
  }else if(a<=0&&b>=0){
    cout << "Zero" << endl;
  }else if(a<0&&b<0){
    if((b-a)%2==0){
      cout << "Negative" << endl;
    }else{
      cout << "Positive" << endl;
    }
  }
}


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

int main() {

    int N, K;
    cin >> N >> K;

    int ans = 0;

    while(N--)
    {
        int x;
        cin >> x;
        ans += (x >= K);
    }

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (long long i = 0; i < n; i++)
#define RREP(i, n) for (long long i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (long long i = start; i < end; i++)
#define RFOR(i, start, end) for (long long i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    int k, x;
    cin >> k >> x;

    vector<int> ans;
    FOR(i, x - k + 1, x + k) { ans.emplace_back(i); }
    print(ans);

    return 0;
}

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

int main(){

  double a,b;

  while(cin>>a>>b){

    if(a<35.5 && b<71)cout << "AAA" << endl;
    else if(a<37.5 && b<77)cout << "AA" << endl;
    else if(a<40 && b<83)cout << "A" << endl;
    else if(a<43 && b<89)cout << "B" << endl;
    else if(a<50 && b<105)cout << "C" << endl;
    else if(a<55 && b<116)cout << "D" << endl;
    else if(a<70 && b<148)cout << "E" << endl;
    else cout << "NA" << endl;

  }


  return 0;
}

Measured memory_bytes: 1220
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<memory.h>
using namespace std;
typedef long long ll;
const int Max = 1e2 + 5;
int lst[Max][Max];
int book[Max];
int res = 0, nn = 0;

void dfs(int n)
{
	book[n] = 1;
	int g = 0;
	for (int i = 1;i <= nn;i++) if (book[i]) g++;
	if (g == nn)
	{
		res++;
		return;
	}
	for (int i = 1;i <= nn;i++)
	{
		if (lst[n][i]&&book[i]==0)
		{
			dfs(i);
			book[i] = 0;
		}
	}
	return;
}

int main()
{
	int m;
	cin >> nn >> m;
	for (int i = 1;i <= m;i++)
	{
		int a, b;
		cin >> a >> b;
		lst[a][b] = 1;
		lst[b][a] = 1;
	}
	dfs(1);
	cout << res;

}

Measured memory_bytes: 3180
a = [list(map(int,input().split())) for i in range(3)]
n = int(input())
b = []
for i in range(n):
    b.append(int(input()))

yoko1 = [a[0][0],a[0][1],a[0][2]]
yoko2 = [a[1][0],a[1][1],a[1][2]]
yoko3 = [a[2][0],a[2][1],a[2][2]]
tate1 = [a[0][0],a[1][0],a[2][0]]
tate2 = [a[0][1],a[1][1],a[2][1]]
tate3 = [a[0][2],a[1][2],a[2][2]]
naname1 = [a[0][0],a[1][1],a[2][2]]
naname2 = [a[0][2],a[1][1],a[2][0]]
count = 0
d = [yoko1,yoko2,yoko3,tate1,tate2,tate3,naname1,naname2]
for i in range(8):
    if d[i][0] in b and d[i][1] in b and d[i][2] in b:
        count = 1
        break
if count == 1:
    print("Yes")
else:
    print("No")

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

int main() {
    int n, k, t, cnt = 0;
    cin >> n >> k;
    for (int i=0; i<n; i++) {
        cin >> t;
        if (t >= k) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 384
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int N; cin >> N;
    int A[N]; REP(i,N) cin >> A[i];
    int ans = 0;
    bool flag = true;
    while(flag){
        REP(i,N){
            if(A[i]%2){
                flag = false;
                break;
            }
            A[i] /= 2;
        }
        if(flag) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int a, b;
    cin >> a >> b;
    for (int i = 0; i < 3; ++i) {
        if (i+1 == a) continue;
        if (i+1 == b) continue;
        cout << i + 1 << endl;
    }
}

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

#define int long long

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

int N;
int A[100000];
int ch[100000] = {};
bool used[100000] = {};
vector<int> G[100000];

int dfs(int v) {
    used[v] = true;
    if (G[v].size() == 1) {
        ch[v] = A[v];
    }
    int max_ch = 0;
    for (int i = 0; i < G[v].size(); i++) {
        if (!used[G[v][i]]) {
            int cur_ch = dfs(G[v][i]);
            ch[v] += cur_ch;
            max_ch = max(max_ch, cur_ch);
        }
    }
    if (v != 0 && G[v].size() >= 3 && ch[v] - A[v] > ch[v] - max_ch) {
        return ch[v] = -1;
    }
    if ((v != 0 && G[v].size() == 2 && ch[v] != A[v]) || A[v] > ch[v]) {
        return ch[v] = -1;
    }
    return ch[v] = 2 * A[v] - ch[v];
}

signed main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        G[a - 1].push_back(b - 1);
        G[b - 1].push_back(a - 1);
    }
    if (dfs(0) != 0) {
        cout << "NO" << endl;
        return 0;
    }
    for (int i = 0; i < N; i++) {
        if (ch[i] < 0) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 11392
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int num;
		while ((num = in.nextInt()) != 0) {
			long ans = 0;
			for (int i = 0; i < 10; i++) {
				int v = Integer.rotateRight(num, i * 3) & 7;
				if (v >= 4) {
					v++;
				}
				if (v >= 6) {
					v++;
				}
				ans += (v * Math.pow(10, i));
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 47336
#include "bits/stdc++.h"

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,a) for(int i = 0; i < (a); ++i)

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int UI;

using namespace std;

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

    int n;
    cin >> n;
    string s = to_string(n);

    if (s[1] == s[0] && s[2] == s[0])
    {
        cout << "Yes" << endl;
    }
    else if (s[2] == s[1] && s[3] == s[1])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
// clang-format off
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define SORT_DESC(x) sort(all(x), greater<>())
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) cout<<ans<<endl;
#define INF 1e9;
#define LINF 1e18;
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;}
const string YES = "Yes";
const string NO = "No";
// clang-format on

void solve(long long N) {
  ANS((N / 100 == N % 10 ? YES : NO));
}

// clang-format off
int main() {
  long long N;
  scanf("%lld",&N);
  solve(N);
  return 0;
}


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

int main()
{
  long long int k,x,i,r2=1000000;
  cin>>k>>x;
  for(i=max(x-k+1,r2*(-1));i<=min(k+x-1,r2);i++)
  {
    cout<<i<<" ";
  }
}

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  string s;
  cin >> s;
  map<char, int> m;
  for (auto &i : s) m[i]++;
  for (auto &i : m) {
    if (i.sc % 2) {
      cout << "No" << '\n';
      return 0;
    }
  }
  cout << "Yes" << '\n';
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 100005

struct Info{
    Info(int arg_index,int arg_value){
        index = arg_index;
        value = arg_value;
    }

    int index,value;
};

int N,M;
int T,table[SIZE];
vector<Info> info[SIZE];

int main(){

    scanf("%d %d %d",&N,&M,&T);

    set<int> SET;

    int TIME;
    int index,command;

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

        scanf("%lld %d %d",&TIME,&index,&command);
        index--;

        if(command == 0){ //退室命令

            SET.erase(index);

            for(auto another: SET){

                info[index].push_back(Info(another,TIME));
                info[another].push_back(Info(index,TIME));
            }

        }else{ //入室命令

            for(auto another: SET){

                info[index].push_back(Info(another,-TIME));
                info[another].push_back(Info(index,-TIME));
            }

            SET.insert(index);
        }
    }

    for(auto a: SET){
        for(auto b: SET){
            if(a >= b)continue;

            info[a].push_back(Info(b,T));
            info[b].push_back(Info(a,T));
        }
    }

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

        table[i] = 0;
    }

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

        vector<int> V;

        for(int k = 0; k < info[i].size(); k++){

            V.push_back(info[i][k].index);

            table[info[i][k].index] += info[i][k].value;
        }
        sort(V.begin(),V.end());
        V.erase(unique(V.begin(),V.end()),V.end());

        int maximum = 0;
        int ans = 0;
        if(i == 0){
            ans = 1;
        }

        for(int k = 0; k < V.size(); k++){

            if(maximum < table[V[k]]){
                maximum = table[V[k]];
                ans = V[k];
            }
            table[V[k]] = 0;
        }

        printf("%d\n",ans+1);
    }

    return 0;
}



Measured memory_bytes: 172832
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    vector<bool> oks(n+1, true);
    vector<ll> dp(n+1);
    rep(i, m) { int a; cin >> a; oks[a] = false; }
    dp[0] = 1;
    rep(i, n) for (int j=i+1; j<=min(n,i+2); j++) {
        if (oks[j]) {dp[j] += dp[i]; dp[j] %= MOD;}
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
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;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    ll l, r; cin >> l >> r;
    ll mod = 2019;
    if (l/mod != r/mod) {
        cout << 0 << endl;
    } else {
        ll ans = mod-1;
        repf(i,l,r+1) repf(j,i+1,r+1) {
            chmin(ans, ((ll)i*(ll)j)%mod);
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

namespace{
	const int mod=1e9+7;
	int fac[999],rev[999];
	int mul(int x,int y){
		return (ll)x*y%mod;
	}
	int power(int x,int p){
		int res=1;
		for(;p;p>>=1,x=mul(x,x))
			if(p&1) res=mul(res,x);
		return res;
	}
	void add(int &x,int y){
		x=(x+y>=mod?x+y-mod:x+y);
	}
	void init(int n){
		fac[0]=1;
		rep(i,1,n) fac[i]=mul(fac[i-1],i);
		rev[n]=power(fac[n],mod-2);
		per(i,n,1) rev[i-1]=mul(rev[i],i);
	}
}

const int N=21,M=1<<20;
int cnt[M],sum[M],f[M],w[N],n,m,a,b;
vector<pii> e[N];

void dfs(int u,int fa){
	for(auto v:e[u]){
		if(v.fi==fa) continue;
		w[v.fi]=w[u]|(1<<v.se);
		dfs(v.fi,u);
	}
}

int main(){
	read(n),read(m),init(m+2),n--;
	rep(i,1,n){
		read(a),read(b);
		e[a].pb(mp(b,i-1));
		e[b].pb(mp(a,i-1));
		f[1<<(i-1)]++;
	}
	dfs(1,0);
	rep(i,n+1,m){
		read(a),read(b);
		f[w[a]^w[b]]++;
	}
	for(int k=0,d=1;k<n;k++,d<<=1)
		for(int i=0;i<(1<<n);i+=d<<1){
			int *l=f+i,*r=f+i+d;
			REP(j,d) (*r++)+=*l++;
		}
	cnt[(1<<n)-1]=1;
	for(int s=(1<<n)-1;s;s--) REP(i,n){
		if(!(s>>i&1)) continue;
		int t=s^(1<<i),C=cnt[s],S=sum[s];
		int num=m-f[s],nw=f[s]-f[t]-1;
		C=mul(C,mul(fac[num+nw],rev[num]));
		S=mul(S,mul(fac[num+nw+1],rev[num+1]));
		add(S,mul(C,n-__builtin_popcount(t)));
		add(cnt[t],C),add(sum[t],S);
	}
	cout<<sum[0]<<endl;
	return 0;
}


Measured memory_bytes: 9792
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>

#define INF (int)1e09

using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::fixed;
using std::pair;
using std::make_pair;
using std::min;
using std::max;
using std::string;
using std::vector;
using std::list;
using std::map;
using std::set; // insert erase find count
using std::queue;
using std::priority_queue;
using std::stack;

#define M 256

template <typename T> using Vec = vector<T>; // c++11
typedef pair<int, int> PII;
typedef pair<int, pair<int, int> > PIII;

int main(void) {
    while (1) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        Vec<int> ip(n + 1);
        for (int i = 1; i <= n; i++) {
            cin >> ip[i];
        }

        double hmin = 1e15;
        Vec<int> mp(3);

        for (int s = 0; s <= 15; s++) {
            //cout << endl;
            for (int a = 0; a <= 15; a++) {
                //cout << endl;
                for (int c = 0; c <= 15; c++) {
                    //cout << "S = " << s << ", A = " << a << ", C = " << c << endl;
                    Vec<int> r(n + 1);
                    r[0] = s;
                    for (int k = 1; k <= n; k++) {
                        r[k] = ((a * r[k - 1] + c) % M);
                    }
                    Vec<int> store(M, 0);
                    int op;
                    for (int k = 1; k <= n; k++) {
                        op = (ip[k] + r[k]) % M;
                        //cout << ip[k] << " " << r[k] << " " << op << endl;
                        store[op]++;
                    }
                    double hnow = 0;
                    for (int k = 0; k < M; k++) {
                        if (store[k] != 0) {
                            double value = (double)store[k] / (double)n;
                            hnow += -value * std::log(value) * pow(10, 10);
                        }
                    }
                    //cout << hnow << endl;
                    if (hmin > hnow) {
                        hmin = hnow;
                        mp[0] = s;
                        mp[1] = a;
                        mp[2] = c;
                    }
                }
            }
        }
        cout << mp[0] << " " << mp[1] << " " << mp[2] << endl;
    }
    return 0;
}

Measured memory_bytes: 3308
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        CF_Reader in = new CF_Reader();

        int n = in.intNext();
        out.println(n/2 + n%2);

        out.close();
    }

    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}


Measured memory_bytes: 21204
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
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;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n, w, a, b, dp[101][150100];

signed main() {
	cin >> n >> w;
	rep(i,n+1) rep(j,100100) dp[i][j] = 1ll<<60;
	dp[0][0] = 0;
	rep(i,n) {
		cin >> a >> b;
		rep(j,100100) {
			chmin(dp[i+1][j], dp[i][j]);
			chmin(dp[i+1][j+b], dp[i][j] + a);
		}
	}
	repr(i,100000) if (dp[n][i]<=w) return cout << i << endl, 0;
}

Measured memory_bytes: 117504
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int ans = mod;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }    
    for(int i = -100; i <= 100; i++){
        int can = 0;
        for(int j = 0; j < n; j++){
            can += (i-a[j])*(i-a[j]);
        }
        if(ans > can) ans = can;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <math.h>

using namespace std;

int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    
    if(a < b && b < c){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3084
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <string>
#include <map>
using namespace std;

int main()
{
    int N, X, ans, D;
    ans = 1;
    D = 0;
    cin >> N >> X;
    int L;
    for (int i = 1; i <= N && D <= X; i++)
    {
        cin >> L;
        D += L;
        if (D <= X)
            ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
#define all(v) v.begin(),v.end()


ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
int main(){
  ll n ,m;
  cin >> n >> m;
  vector<int>cnt(n);
  vector<int>ten[n];
  int h[n];
  rep(i,n) cin >> h[i];
  rep(i,m){
    ll a,b;
    cin >> a >> b;
    a--;b--;
    ten[a].push_back(b);
    ten[b].push_back(a);
    cnt[a]++;cnt[b]++;
  }
  int ans=0;
  for(int i=0;i<n;i++){
    bool flag=true;
    for(int j=0;j<cnt[i];j++){
      ll x=h[i];
      ll y=h[ten[i][j]];
      if(x<=y) flag=false;
    }
    if(flag) ans++;
  }
  cout << ans << endl;




  return 0;
}



Measured memory_bytes: 9120
import sys
from bisect import bisect
from itertools import accumulate


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    a = list(accumulate([0] + A))
    b = list(accumulate(B))
    # print(a)
    # print(b)
    answer = 0
    for i in range(N + 1):
        k_b = K - a[i]
        if k_b >= 0:
            b_read = bisect(b, k_b)
            # print(b_read)
            answer = max(i + b_read, answer)
        else:
            continue

    print(answer)


if __name__ == "__main__":
    main()


Measured memory_bytes: 47416
a,b,k = map(int,input().split())
#最大公約数を調べるためa,bのうつ値が最小値のものをsaiに代入
shou = min(a,b)
dai  = max(a,b)
min_list = []

for i in range(1,shou+1):
    if shou % i == 0:
        if dai % i == 0:
            min_list.append(i)

print(min_list[-k])

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
typedef long long ll;
using namespace std;

int main(){
    ll h,w;
    cin >> h >> w;
    ll ans = 1000000000;
    for(int i=1;i<w;i++){
        ll s_1 = i*h;
        ll s_2 = (w-i)*(h/2);
        ll s_3 = (w-i)*(h-h/2);
        ll diff = max(s_1,max(s_2,s_3))-min(s_1,min(s_2,s_3));
        if(diff<ans){
            ans = diff;
           
        }
        if((w-i)>=2){
        s_2 = ((w-i)/2)*h;
        s_3 = (w-(w-i)/2-i)*h;
        diff = max(s_1,max(s_2,s_3))-min(s_1,min(s_2,s_3));
        if(diff<ans){
            ans = diff;
        }
        }
    }


        ll tmp = h;
        h  =w;
        w = tmp;
    for(int i=1;i<w;i++){
        ll s_1 = i*h;
        ll s_2 = (w-i)*(h/2);
        ll s_3 = (w-i)*(h-h/2);
        ll diff = max(s_1,max(s_2,s_3))-min(s_1,min(s_2,s_3));
        if(diff<ans){
            ans = diff;
        }
        if((w-i)>=2){
        s_2 = ((w-i)/2)*h;
        s_3 = (w-(w-i)/2-i)*h;
        diff = max(s_1,max(s_2,s_3))-min(s_1,min(s_2,s_3));
        if(diff<ans){
            ans = diff;
        }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    N,M = map(int,input().split())
    A = list(map(int,input().split()))
    m_count = sum(x >= sum(A)/(4*M) for x in A)
    if M <= m_count:
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
_, *data = readlines.map(&:chomp)
nodes = data.map {|l| l.split.map(&:to_i)}.sort
x = nodes.reduce({}) do |r, n|
  n[2..-1].each do |c|
    r[c] = n.first
  end
  r
end

def depth(x, n, d=0)
  return d unless x[n]
  depth(x, x[n], d+1)
end

result = nodes.map do |n|
  if x[n.first].nil?
    kind = 'root'
  elsif n[1] == 0
    kind = 'leaf'
  else
    kind = 'internal node'
  end
  parent = x[n.first] || -1
  depth = depth(x, n.first)
  children = n[2..-1].join(', ')
  "node #{n.first}: parent = #{parent}, depth = #{depth}, #{kind}, [#{children}]"
end
puts result


Measured memory_bytes: 42944
import heapq
n, m = map(int, input().split())
lst = list(map(int, input().split()))
lst = list(map(lambda x: x*(-1), lst))
heapq.heapify(lst)

for i in range(m):
    tmp_min = heapq.heappop(lst)
    heapq.heappush(lst, (-1)*(-tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print(-sum(lst))

Measured memory_bytes: 73196