akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.StringTokenizer;

public class Main  implements Runnable {
	int[][] ta = new int[16][4096];
	int ptr = 0;
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 64 * 1024 * 1024).start();
    }

    public void run() {
    	FastScanner sc = new FastScanner(System.in);
    	//int[] ar = new int[3];
    	//ar[0]=Integer.parseInt(sc.next());
    	//Arrays.parallelSort(ar);
		int n = Integer.parseInt(sc.next());
		//long a = Long.parseLong(sc.next());
		//String s = sc.next();
		//String str = sc.next();
		//char c[] = str.toCharArray();
		//char a[][] = new char[n];
		//ArrayList<Str_4> lists = new ArrayList<Str_4>();
		//lists = new ArrayList;
		PrintWriter out = new PrintWriter(System.out);
		//int[] ra = new int[r];
		//ArrayList<ArrayList<Integer>> lists = new ArrayList<>();
		int ans = 0;
		if(n >= 10)
		{
			ans += 9;
			if(n >= 1000)
			{
				ans += 900;
				if(n >= 100000)
				{
					ans += 90000;
				}
				else
				{
					if(n >= 10000)
					{
						ans += n - 9999;
					}
				}
			}
			else
			{
				if(n >= 100)
				{
					ans += n - 99;
				}
			}
		}
		else
		{
			ans += n;
		}
		

		out.println(ans);
		//out.println(a[5]);
		out.flush();
    }

    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;
        public FastScanner(String in) {
        	StringReader sr = new StringReader(in);
            reader = new BufferedReader(new BufferedReader(sr));
            tokenizer = null;
        }
        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public long nextInt() {
            return Integer.parseInt(next());
        }

    }
}

Measured memory_bytes: 25300
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

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

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int x=stoi(s),num=0;
    rep(i,s.size()) num+=s[i]-'0';
    if(x%num==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            s=[a[i],a[j],a[k]]
            if a[i]!=a[j] and a[i]!=a[k] and a[j]!=a[k]:
                if max(s)<sum(s)-max(s):
                    count+=1
print(count)


Measured memory_bytes: 74300
#include<bits/stdc++.h>
/*#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>*/

typedef long long ll ;
typedef double db;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define sf(a)		 scanf("%d",&a)
#define sfl(a)		scanf("%lld",&a)
#define sff(a,b)	 scanf("%d %d",&a,&b)
#define sffl(a,b)	scanf("%lld %lld",&a,&b)
#define pb(a)         push_back(a)
#define loop0(i,n)          for(int i=0;i<n;i++)
#define loop1(i,n)          for(int i=1;i<=n;i++)
#define loopab(a,b)       for(int i=a;i<=b;i++)
#define gcd(a, b)     __gcd(a, b)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)     cout<<"Case "<<z<<": "<<x<<"\n"
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)

using namespace std;
ll m = 1000000007;
ll power(ll a, ll b, ll m) {
    a%=m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a %m;
        a = a * a %m;
        b >>= 1;
    }
    return res;
}
int main()
{
    ll i,j,n;
    cin>>n;
    ll a[n];
    loop0(i,n)cin>>a[i];
    ll o[64]={};
    ll z[64]={};
    loop0(i,n)
    {
        ll b = a[i];
        ll k = 0;
        while(b!=0)
        {
            if(b&1)
            {
                o[k]++;
            }
            else
            {
                z[k]++;
            }
            b/=2;
            k++;
        }
        for(j=k ; j<64 ; j++)
        {
            z[j]++;
        }
    }
    ll ans = 0;
    loop0(i,64)
    {
        if(o[i]!=0&&z[i]!=0)
        {
            ll s = (o[i]%m*z[i]%m)%m;
            s = (s%m*power(2,i,m)%m)%m;
            ans = (ans%m+s%m)%m;
        }
    }
    cout<<ans%m<<nw;
	return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
	int n, m;
	cin >> n;
	vector<string> s(n);
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	cin >> m;
	vector<string> t(m);
	for (int j = 0; j < m; j++) {
		cin >> t[j];
	}
	
	int ans = 0;
	for (int i = 0; i < n;i++) {
		int a = 1;
		for (int j = i + 1; j < n; j++) {
			if (s[i] == s[j])a++;
		}
		for (int k = 0; k < m; k++) {
			if (s[i] == t[k])a--;
		}
		ans = max(a, ans);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int[] AtoZ = new int[26];
		String s = "";
		while (sc.hasNext()) {
			s += sc.next();
		}
		for (int i=0; i<s.length(); i++) {
			char c = s.charAt(i);
			if (c>=65&&c<=90 || c>=97&&c<=122) {
				if (c>=65&&c<=90) {c += 32;}
				int n = (char)(c-97);
				AtoZ[n]++;
			}
		}
		for (int i=0; i<26; i++) {
			char c = (char)(i+97);
			System.out.println(c+" "+":"+" "+AtoZ[i]);
		}
	}
}


Measured memory_bytes: 26836
#include <bits/stdc++.h>
#define INF 1e9
#define endl '\n'
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define FORE(i, a, b) for (int i = (a), e = (b); i < e; ++i)
#define RFORE(i, a, b) for (int i = (b)-1, e = (a); i >= e; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, A, B;
    cin >> N >> A >> B;
    int ans = 0;
    FOR(i, 1, N + 1) {
        int n = i;
        int s = 0;
        while (n > 0) {
            s += n % 10;
            n /= 10;
        }
        if ((A <= s) & (s <= B)) { ans += i; }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def search(topx, topy, botx, boty, grid):
    ret = grid[boty][botx]
    if topx > 0: ret -= grid[boty][topx - 1]
    if topy > 0: ret -= grid[topy - 1][botx]
    if topx > 0 and topy > 0: ret += grid[topy - 1][topx - 1]
    return ret

def Main():
    H, W, K = read_ints()
    chocolate = [list(read_str()) for _ in range(H)]
    
    grid = [[0] * W for _ in range(H)]
    for h in range(H):
        for w in range(W):
            if chocolate[h][w] == '1': grid[h][w] += 1
            if w > 0: grid[h][w] += grid[h][w - 1]
            if h > 0: grid[h][w] += grid[h - 1][w]
            if h > 0 and w > 0: grid[h][w] -= grid[h - 1][w - 1]

    ans = INF
    for bit in range(1 << ~-H):
        cnt = 0
        cut = []
        for h in range(~-H):
            if bit >> h & 1:
                cnt += 1
                cut.append(h)
        cut.append(~-H)

        white = [0] * len(cut)
        topx = 0
        flag = False
        for w in range(~-W):
            topy = 0
            for i in range(len(cut)):
                if search(topx, topy, w, cut[i], grid) > K:
                    flag = True
                    break
                white[i] = search(topx, topy, w+1, cut[i], grid)
                topy = cut[i] + 1
            if flag: break
            for x in white:
                if x <= K:
                    continue
                topx = w + 1
                cnt += 1
                break
        if not flag:
            ans = min(ans, cnt)
    print(ans)
    

if __name__ == '__main__':
    Main()

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

char buf[1000000];
signed main() {
  int n, k;
  char s[11];
  scanf("%d %d %s", &n, &k, s);
  char *p = buf;
  size_t len = strlen(s);
  s[len++] = ' ';
  int i = 0;
  for (; i < k; i++) {
    strcpy(p, s);
    p += len;
    if (p - buf > 10000) {
      write(STDOUT_FILENO, buf, p - buf);
      p = buf;
    }
  }
  for (; i < n; i++) {
    strcpy(p, "7 ");
    p += 2;
  }
  write(STDOUT_FILENO, buf, p - buf);
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <string>
using namespace std;
typedef long long ll;
int main(){
    int n; string s;
    cin >> n; cin >> s;
    vector<int> a(n);
    for(int i=0; i<n; ++i){
        if(s[i]=='R'){a[i] = 0;}
        if(s[i]=='G'){a[i] = 1;}
        if(s[i]=='B'){a[i] = 2;}
    }
    vector<ll> cnt(3);
    for(int i=0; i<n; ++i){cnt[a[i]]++;}
    ll ans = 1;
    for(int i=0; i<3; ++i){ans *= cnt[i];}
    for(int j=1; j<n; ++j){
        for(int i=0; i<j; ++i){
            int k = j + j - i;
          
            if(k<n){
                if(a[i]==a[j]){continue;}
                if(a[i]==a[k]){continue;}
                if(a[j]==a[k]){continue;}
                ans--;
            }
            
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<cstdio>

int main(void){
  int h,w;
  char c[1000][1000];

  scanf("%d %d",&h,&w);

  for(int i=0;i<h;i++)
    scanf("%s",c[i]);

  for(int i=0;i<h;i++)
    printf("%s\n%s\n",c[i],c[i]);

  return 0;
}


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

int main() 
{
    long long A, B, C, K;
    cin >> A >> B >> C >> K;
    
    long long sum = 0;
    if (A <= K) {
        sum += A;
        K -= A;
    }else{
        cout << K << endl;
        return 0;
    }
    
    if (B <= K) {
        K -= B;
        cout << sum - K << endl;
    }else{
        cout << sum << endl;
    }
}

Measured memory_bytes: 3588
N,M = map(int,input().split(' '))
a = [list(map(int,input().split(' '))) for i in range(N)]
c = [list(map(int,input().split(' '))) for i in range(M)]
last_ans = []
for i in range(len(a)):
    middle_ans = []
    for i1 in range(len(c)):
        tmp_a = a[i]
        tmp_c = c[i1]
        # print(tmp_a,tmp_c,abs(tmp_a[0]-tmp_c[0]))
        tmp = abs(tmp_a[0]-tmp_c[0]) + abs(tmp_a[1]-tmp_c[1])
        middle_ans.append(tmp)
    # rint(middle_ans,"aaaa")p
    last_ans.append(middle_ans.index(min(middle_ans))+1)
[print(i) for i in last_ans]

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

typedef long long ll;
 
int main(){
  int c[26]={};
  string s;
  cin >> s;
  for(int i=0; i<s.length(); i++){
    if(c[s[i]-'a']){
      cout << "no" << endl;
      return 0;
    }
    c[s[i]-'a']++;
  }
  cout << "yes" << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
if n <= 2:
    print(1)
elif n < 4:
    print(2)
elif n < 8:
    print(4)
elif n < 16:
    print(8)
elif n < 32:
    print(16)
elif n < 64:
    print(32)
else:
    print(64)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define int ll
typedef long long ll ;
const int MAX=3e5+10;
const int INF=0x3f3f3f3f;
const int mod=1e9+7;

int hang[MAX];
int lie[MAX];
map<pair<int,int>,int>mp;
void solve(){
    int h,w,m;
    cin>>h>>w>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        hang[a]++;
        lie[b]++;
        mp[pair<int,int>(a,b)]++;
    }
    int mh=0,ml=0;
    int idx_h,idx_l;
    for(int i=1;i<=h;i++){
        if(hang[i]>mh){
            mh=hang[i];
            idx_h=i;
        }
    }
    ll ans=0;
    for(int i=1;i<=w;i++){
        ll he=lie[i]+mh;
        if(mp[pair<int,int>(idx_h,i)]){
            he--;
            ans=max(ans,he);
        }else{
            ans=max(ans,he);
        }
    }

    for(int i=1;i<=w;i++){
        if(lie[i]>ml){
            ml=lie[i];
            idx_l=i;
        }
    }
    for(int i=1;i<=h;i++){
        ll he=hang[i]+ml;
        if(mp[pair<int,int>(i,idx_l)]){
            he--;
            ans=max(ans,he);
        }else{
            ans=max(ans,he);
        }
    }

    cout<<ans;
}

signed main() {
    //ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    int _=1;
    //cin>>_;
    while(_--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 64572
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
int bp(int pow, int n){
    int d = 1;
    while(n)
    {
        if(n%2==1)d=(d*pow)%mod;
        pow=(pow*pow)%mod;
        n/=2;
    }
    return d;
}
void solve(){
    int n;
    cin>>n;
    cout<<fixed<<setprecision(3)<<2*n*pi;   
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 3800
import java.util.*;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int x = sc.nextInt();

		if (x >= a && x <= a+b) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

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

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

Measured memory_bytes: 1156
#include <stdio.h>


int main(void){

        int a,b,c;

        scanf("%d%d%d",&a,&b,&c);

        if((a<=c && c<=b) || (b<=c && c<=a)){
                printf("Yes\n");
        }else{
                printf("No\n");
        }   
return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int MOD = 1000000007;

ll dp[100010];

void solve() {
  int n, m;
  cin >> n >> m;
  vi a(n+1);
  rep(i,m) {
    int t;
    cin >> t;
    a[t] = 1;
  }
  rep(i,n+1) {
    if(i <= 1) {
      if (a[i]) dp[i] = 0;
      else dp[i] = 1;
    }
    else if (a[i]) dp[i] = 0;
    else dp[i] = (dp[i-1] + dp[i-2]) % MOD;
  }
  cout << dp[n] << endl;
}

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

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

int main(void) {
	int n, k, q;
	cin >> n >> k >> q;
	vector<int> a(n, k-q);
	for (int i = 0; i < q; i++) {
		int b;
		cin >> b;
		b--;
		a[b]++;
	}

	for (int i = 0; i < n; i++) {
		if (a[i] <= 0) puts("No");
		else puts("Yes");
	}

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int main() {
	ll x, y;
	cin >> x >> y;
	cout << 2 * y - x << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
typedef long long ll;

int n;
char s[110000];

int main() {
	cin >> n;
	rep(i, n) cin >> s[i];
	int ans = 1;
	char now;
	rep(i, n) {
		if (!i) now = s[0];
		else {
			if (s[i] != now) {
				now = s[i];
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

public class Main {
	public static void main(String[] args){
      	Scanner scan = new Scanner(System.in);
		int zentai = scan.nextInt();
 		int kounyu = scan.nextInt();
        int[] priceArray = new int[zentai];
      int ans = 0;

		for(int i=0; i<zentai; i++){
			priceArray[i] = scan.nextInt();
			}
        Arrays.sort(priceArray);
      	for(int i=0; i<kounyu; i++){
			ans += priceArray[i];
			}

		System.out.println(ans);   
 
	}
}

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

int main() {
  int a,b,c,d;
  cin >> a >> b ; 
  c = (a+b)%2;
  if(c==0){
    d = (a+b)/2 ;}
  else{
    d = (a+b)/2 +1;
      }
    
  cout <<d <<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int[] line = Stream.of(sc.nextLine().split(" ", 0)).mapToInt(Integer::parseInt).toArray();
		int[] line2 = Stream.of(sc.nextLine().split(" ", 0)).mapToInt(Integer::parseInt).toArray();
		long sum = 0;

		for (int i = 0; i < line2.length; i++) {
			sum +=line2[i];
		}

		double lim = sum /(double)(line[1] * 4);

		int ans = 0;
		for (int i : line2) {
			if (i >= lim) {
				ans++;
			}
		}

		if (ans >= line[1]) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
}

Measured memory_bytes: 36108
# https://atcoder.jp/contests/arc059/tasks/arc059_a

n = int(input())
nums = [int(i) for i in input().split()]

ans = float('inf')
for i in range(-100, 101):
    t = 0
    for num in nums:
        t += (num - i) ** 2
    ans = min(ans, t)
print(ans)

Measured memory_bytes: 64240
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <cassert>

using namespace std;
 
typedef long long ll;


int main(){
    const int zero = 0;
    const int ten = 10;
    int X,A;
    cin >> X >>A ;
    if (X < A) cout << zero ;
    else cout << ten;
    
}

Measured memory_bytes: 256
A = input()
B = input()
C = input()
S = [A, B, C]
current = 'a'
dic = {'a':0, 'b':1, 'c':2}
while True:
    if not S[dic[current]]:
        print(current.upper())
        exit()
    else:
        S[dic[current]], current = S[dic[current]][1::], S[dic[current]][0]

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

using namespace std;

typedef long long int ll;

const ll mod = 1e9 + 7;
const ll MAXN = 1e6 + 5;

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

ll inv(ll a){
  return pwr(a, mod - 2);
}

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

  vector < ll > lp(MAXN, 0), primes;
  for(int i = 2; i < MAXN; i++){
    if(lp[i] == 0){
      lp[i] = i;
      primes.push_back(i);
    }
    for(int j = 0; j < primes.size() && primes[j] * i < MAXN && primes[j] <= i; j++) lp[i * primes[j]] = primes[j];
  }

  ll n;
  cin >> n;
  vector < ll > a(n);
  map < ll, ll > cnt;
  for(int i = 0; i < n; i++){
    cin >> a[i];
    ll b = a[i];
    while(b > 1){
      ll ct = 0, c = lp[b];
      while(b % c == 0){
        b /= c;
        ct++;
      }
      cnt[c] = max(cnt[c], ct);
    }
  }

  ll lcm = 1;
  for(auto i : cnt){
    ll b = pwr(i.first, i.second);
    lcm = (lcm * b) % mod;
  }

  ll ans = 0;
  for(int i = 0; i < n; i++){
    ans = (ans + ((lcm * inv(a[i])) % mod)) % mod;
  }

  cout << ans << '\n';
}


Measured memory_bytes: 9460
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define ll long long

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

int tgcd(int a, int b, int c)
{
  return gcd(gcd(a, b), c);
}

int main(void)
{
  int n, i, j, k;
  ll max = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++)
  {
    for (j = 1; j <= n; j++)
    {
      for (k = 1; k <= n; k++)
      {
        max += tgcd(i, j, k);
      }
    }
  }
  printf("%lld\n", max);
  return 0;
}

Measured memory_bytes: 1736
#include <stdio.h>

#include <string.h>

#include <stdlib.h>

#include <math.h>

#include <time.h>

#include <iostream>

#include <algorithm>

#include <stack>

#include <queue>

#include <map>

#include <set>

#include <iomanip>

#include <assert.h>



using namespace std;

int n,m;

string s,t;

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



int main()

{
	cin >> n >> m >> s >> t;
	int g = gcd(n,m),N = n / g,M = m / g;
	for (int i = 1,j = 1;i <= s.size() && j <= t.size();i += N,j += M)
		if (s[i - 1] != t[j - 1])
		{
			cout << "-1" << endl;
			return 0;
		}
	cout << (long long)n * m / g << endl;

	return 0;

}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (b - a == c - b)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


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

typedef long long ll;
int X, Y, Z, N;
struct Info {
    int g, s, b;
};
vector<Info> info;
bool cmp(Info a, Info b) {
    return a.g - a.s < b.g - b.s;
}
priority_queue<int> pq;
int cnt = 0;
ll sum = 0;
vector<ll> dp1, dp2;

int main() {
    scanf("%d %d %d", &X, &Y, &Z);
    N = X + Y + Z;
    info.resize(N);
    for(int i = 0; i < N; i++) {
        scanf("%d %d %d", &info[i].g, &info[i].s, &info[i].b);
    }

    sort(info.begin(), info.end(), cmp);
    reverse(info.begin(), info.end());

    dp1.resize(N);
    dp2.resize(N);

    for(int i = 0; i < X; i++) {
        pq.push(info[i].b - info[i].g);
        cnt++;
        sum += info[i].g;
    }
    dp1[X - 1] = sum;
    for(int i = X; i < X + Z; i++) {
        pq.push(info[i].b - info[i].g);
        cnt++;
        sum += info[i].g;
        while(X < cnt) {
            int t = pq.top(); pq.pop();
            cnt--;
            sum += t;
        }
        dp1[i] = sum;
    }

    while(!pq.empty()) pq.pop();
    cnt = 0;
    sum = 0;

    for(int i = N - 1; i >= N - Y; i--) {
        pq.push(info[i].b - info[i].s);
        cnt++;
        sum += info[i].s;
    }
    dp2[N - Y] = sum;
    for(int i = N - Y - 1; i >= X; i--) {
        pq.push(info[i].b - info[i].s);
        cnt++;
        sum += info[i].s;
        while(Y < cnt) {
            int t = pq.top(); pq.pop();
            cnt--;
            sum += t;
        }
        dp2[i] = sum;
    }

    ll mx = -1;
    for(int i = X - 1; i < X + Z; i++) {
        mx = max(mx, dp1[i] + dp2[i + 1]);
    }
    printf("%lld", mx);
}


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

int f(int x, int y, int z) {
  return pow(x, 2) + pow(y, 2) + pow(z, 2) + (x * y) + (y * z) + (z * x);
}
int main() {
  int N;
  cin >> N;

  int mx = sqrt(N / 6.0) + 60;
  map<int, int> freq;

  rep(x, mx) {
    rep(y, mx) {
      rep(z, mx) {
        // printf("%d %d %d %d\n", x + 1, y + 1, z + 1, f(x + 1, y + 1, z + 1));
        freq[f(x + 1, y + 1, z + 1)]++;
      }
    }
  }

  for (int i = 1; i <= N; i++) {
    cout << freq[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 5384
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>
#include <set>
#include <iomanip>

using namespace std;

typedef long long ll;

#define MAX 10000
#define INF 1000000010

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int N, W; cin >> N >> W;
  int v[N+1], w[N+1];
  for(int i=1;i<=N;i++){
    cin >> v[i] >> w[i];
  }
  ll dp[N+1][MAX+1];

  for(int i=0;i<=N;i++) dp[i][0] = 0;
  for(int i=1;i<=MAX;i++) dp[0][i] = INF;

  for(int i=0;i<N;i++){
    for(int j=0;j<=MAX;j++){
      if(j-v[i+1] >= 0)
        dp[i+1][j] = min(dp[i][j], dp[i][j-v[i+1]]+w[i+1]);
      else dp[i+1][j] = dp[i][j];
    }
  }
  int res;
  for(int j=0;j<=MAX;j++){
    if(dp[N][j] <= W) res = j;
  }
  cout << res << endl;
}


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

int main(){
	int N;
	cin >> N;
	vector<int> H(N);
	for(int i=0;i<N;i++){
		cin>>H[i];
	}
	int count=0,ret=H[0];
	for(int i=0;i<N;i++){
		ret = max(ret,H[i]);
		if(H[i]==ret) count++;
	}
	cout<<count;
}

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

int main(){
	int h, w, n;
	cin >> h >> w >> n;
	vector<string> m(h);
	vector<vector<int>> ans(h, vector<int>(w));
	vector<int> sl(h);
	vector<int> st(h);
	int sum = 0;
	rep(i, h){
		cin >> m[i];
		int s = 0;
		rep(j, w){
			if(m[i].at(j) == '#'){
				sum++;
				s++;
				if(st[i] == 0) st[i] = sum;
				ans[i][j] = sum;}
		}
		sl[i] = s;
	}
	rep(i, h){
		int k = st[i];
		rep(j, w){
			if(sl[i] != 0){
				if(ans[i][j] == 0){
					ans[i][j] = k;
				}else{
					k = ans[i][j];
				}
			}
		}
	}
	for(int i=1; i<h; i++){
		if(sl[i] == 0) ans[i] = ans[i-1];
	}
	for(int i=h-2; i>=0; i--){
		if(sl[i] == 0) ans[i] = ans[i+1];
	}
	rep(i, h){
		rep(j, w){
			cout << ans[i][j] << ' ';
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1280
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string S;
    cin >> S;
    string ans = "";
    rep(i, S.size()) {
        ans += 'x';
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=2e5+10;
int Ans[maxn],n,Begin[maxn],to[maxn<<1],Next[maxn<<1],e,Max[maxn];
inline void add_edge(int x,int y){
	to[++e]=y;
	Next[e]=Begin[x];
	Begin[x]=e;
}
void dfs1(int x,int ff,int lst,int Sec){
	Max[x]=Max[ff];
	if(ff>Max[x]) Max[x]=ff,lst=x,Sec=x;
	else chkmax(Sec,x);
	int u;
	if(x>Max[x]) u=x;
	else if(Max[Max[x]]>Sec) u=Max[x];
	else u=lst;
	Ans[u]++;
	for(int i=Begin[x];i;i=Next[i]) if(to[i]!=ff) dfs1(to[i],x,lst,Sec);
}
void dfs2(int x,int ff){
	for(int i=Begin[x];i;i=Next[i]) if(to[i]!=ff) Ans[to[i]]+=Ans[x],dfs2(to[i],x);
}
int main(){
	n=read();
	REP(i,1,n-1){
		int x=read(),y=read();
		add_edge(x,y),add_edge(y,x);
	}
	dfs1(1,0,0,0),Ans[1]=0,dfs2(1,0);
	REP(i,2,n) printf("%d%c",Ans[i],i==iend?'\n':' ');
	return 0;
}


Measured memory_bytes: 16384
#include <stdio.h>

long int a, b, k;

int main(){

    scanf("%ld %ld %ld", &a,&b,&k);

    if(a-k >= 0){
        printf("%ld %ld", a-k, b);
    }else if(b - k + a > 0){
        printf("%ld %ld", 0, b - k + a);
    }else{
        printf("%d %d", 0, 0);
    }
        return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <sstream>
#include <complex>

using namespace std;

using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using iii = pair<int, ii>;
using viii = vector<iii>;

using ll = long long int;
using vc = vector<char>;
using vb = vector<bool>;
using ib = pair<int, bool>;
using vib = vector<ib>;

#define MOD 1000 * 1000 * 1000 + 7
#define INF 1000 * 1000 * 1000
#define EMPTY -10
#define mp(a, b) make_pair(a,b)

bool resuelveCaso() {
	ll n, a, b, c, d, e;
	cin >> n >> a >> b >> c >> d >> e;
	if (!cin) return false;

	ll minim = min({ a,b,c,d,e });

	ll minv;
	if (n % minim == 0) minv = n / minim;
	else minv = n / minim + 1;

	minv += 4;


	cout << minv << '\n';

	return true;
}

int main() {
	while (resuelveCaso()) {}
	return 0;
}

Measured memory_bytes: 384
# ABC168b


def main():
    import sys
    sys.setrecursionlimit(10**6)
    # 再帰関数を使わない限りPypyで出すこと

    def dump(*args):
        sys.stderr.write(str(args))

    k = int(input())
    s = input()
    if (len(s) <= k):
        print(s)
    else:
        print(s[:k]+'...')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9168
A = [list(map(int,input().split())) for l in range(3)]
N = int(input())
B = [int(input()) for i in range(N)]

Bingo = False


for i in range(3):
    for j in range(3):
        for k in B:
            if k == A[i][j]:
                A[i][j] = 9999


for i in range(3):
    for j in range(3):
        if A[i][0] == A[i][1] == A[i][2] == 9999:
            Bingo = True
        elif A[0][j] == A[1][j] == A[2][j] == 9999:
            Bingo = True
        elif A[0][0] == A[1][1] == A[2][2] == 9999:
            Bingo = True
        elif A[0][2] == A[1][1] == A[2][0] == 9999:
            Bingo = True
   
if Bingo:
    print('Yes')
else:
    print('No')

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

using namespace std;

const int N = 2e5 + 5;

int n;
long long sum[N];
map <long long, int> cnt;

int main()
{
    scanf("%d", &n);
    long long ans = 0;
    cnt[0] = 1;
    for (int i = 1; i <= n; ++i) {
        int x;
        scanf("%d", &x);
        sum[i] = sum[i - 1] + x;
        ans += cnt[sum[i]];
        ++cnt[sum[i]];
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
typedef long long ll;

int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  if((b-a)%2 == 0){
    cout << (b-a)/2 << endl;
    return 0;
  }
  ll edgeA = a + (b-a)/2;
  ll edgeB = n - b + (b-a)/2 + 1;
  cout << min(edgeA,edgeB) << endl;
}

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

int main() {
  
  int K;
  cin >> K;
  int A;
  cin >> A;
  int B;
  cin >> B;
  int n = A / K;
  
  if(A % K == 0)
  {
    cout << "OK" << endl;
  }
  else if ((n + 1) * K <= B)
  {
    cout << "OK" << endl;
  }
  else 
  {
    cout << "NG" << endl;
  }
    


  
  
  
  
}

Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    char c[n];
    scanf("%s",&c);
    if(n%2){
        puts("No"); return 0;
    }
    for(int i=0;i<n/2;i++){
        if(c[i]!=c[i+n/2]){
            puts("No");
            return 0;
    }
  }
   puts("Yes");
   return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		String str;
		Scanner sc = new Scanner(System.in);
		HashMap<String,ArrayList<Integer>>  words = new HashMap<String,ArrayList<Integer>>();//hashmap??¨list?????????????????????????¬????????????????????????±????????????
		/**
		 * ???????????????????????¶????????????????????????????????§?????????????????????(null)??§????????¨??????.
		 */
			while(sc.hasNext()){ // Ctrl+Z??§??????
				str = sc.next(); //????????¨?????????????????????????????????

				if(words.containsKey(str)){//??¢???????????????
					words.get(str).add(sc.nextInt()); //?????????(key)?????¢?´¢????????????????????°??????key???list?????°???(???????????????)??????
				}
				else{ //??°???????????????
					ArrayList<Integer> list = new ArrayList<Integer>(); //??°??????key?????????????????°??????????????????
					list.add(sc.nextInt());
					words.put(str,list);
				}
			}
			//??¨??????key?????????????????¨????????????
			Iterator<String> it = words.keySet().iterator();
			ArrayList<String> getKeyList = new ArrayList<String>();
			while(it.hasNext()){
				String key = it.next();
				getKeyList.add(key);
			}
			Collections.sort(getKeyList);
			//System.out.print(getKeyList+" ");

			for(String st : getKeyList){
				List<Integer> showNum = words.get(st); //key????????????????????????????????????????´????????´?
				Collections.sort(showNum); //????´??????????key??????????????????????????????????????????????????????
				System.out.println(st); //key?????¨???
				int listSize = showNum.size();
				for(int i = 0; i < listSize; ++i){
					if(i == 0)
				    System.out.print(showNum.get(i));
					else if(i != 0)
					System.out.print(" "+showNum.get(i));
				}System.out.println("");
			}
			sc.close();
		}
	}

Measured memory_bytes: 26416
/**
*   Bismillahir Rahmanir Rahim.
*   Imtiaz_rafi
*   PCIU, CHITTAGONG
**/
#include<bits/stdc++.h>
using namespace std;
#define speed ios::sync_with_stdio(0);cin.tie(0);
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
#define rep(i,a) for(ll i=0;i<a;i++)
#define rep1(i,begin,end) for(ll i=begin;i<=end;i++)
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(v)   v.begin(),v.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define pi acos(-1)
// bitshift (1LL<<(3)) *2^3
typedef long long int ll;
typedef vector<ll>vi;
typedef map<ll,ll>m;
typedef map<char,ll>mc;
typedef set<ll>st;
typedef set<char>sc;
ll dx[] ={-1,+1,0,0,+1,-1,+1,-1};
ll dy[] ={0,0,-1,+1,+1,+1,-1,-1};
const ll mx = 1e5+123;
bool vis[mx];
vi adj[mx];
ll a,b,v[mx],c[mx],dp[110][mx];
ll solve(ll i,ll j)
{
    if(i>a) return 0;
    if(dp[i][j]!=-1) return dp[i][j];
    ll x=0,y=0;
    if(j+v[i]<=b) x=c[i]+solve(i+1,v[i]+j);
    y=solve(i+1,j);
    return dp[i][j]=max(x,y);
}

int main()
{
    speed;
    cin>>a>>b;
    rep1(i,1,a)
        cin>>v[i]>>c[i];
    mem(dp,-1);
    cout<<solve(1,0)<<endl;

}

Measured memory_bytes: 91896
nl = list(input())


# 繰り上げと繰り下げ
dp = [[0, 10000] for i in range(len(nl) + 1)]

for i, n in enumerate(nl[::-1]):
    n = int(n)
    dp[i+1][0] = min(dp[i][0] + n, dp[i][1] + n + 1)
    dp[i+1][1] = min(10 - n + dp[i][0], 10 - n - 1 + dp[i][1])



print(min(dp[-1][0], dp[-1][1]+1))





Measured memory_bytes: 186812
#include<iostream>

using namespace std;

int main() {

	int N = 0;
	int A[100] = {};

	cin >> N;

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

		cin >> A[i];

	}

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

		cout << A[u];

		if (u != N - 1) cout << " ";

	}

	cout << endl;

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

		int v = A[i];

		int u;

		for (u = i - 1; u >= 0; u--) {

			if (v > A[u]) break;

			A[u + 1] = A[u];

		}

		A[u + 1] = v;

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

			cout << A[u];

			if (u != N - 1) cout << " ";

		}

		cout << endl;

	}
	
	return 0;

}


Measured memory_bytes: 3064
"use strict";
new Promise(resolve => {
  resolve(require("fs").readFileSync("/dev/stdin", "utf8").split(/\s/));
}).then(input => {
  const s = input[0];
  const ans = s.split("").filter((item, index) => index % 2 === 0).join("");
  console.log(ans);
});


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

using namespace std;

int main() {
  int n,k;
  cin >> n >> k;
  set<int> s;
  for(int i=0; i<k;i++){
    int t;
    cin >> t;
    for(int j=0;j<t;j++){
      int y;
      cin >>y;
      s.insert(y);
    }
  }
  cout  << n-s.size() <<endl;
}



Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main(){
    int n,m,x;
    cin >> n >> m >> x;
    int rcost=0,lcost=0;
    for(int i=0;i<m;i++){
        int gate=0;
        cin >> gate;
        if (gate<x){
            lcost++;
        }else{
            rcost++;
        }
    }
    cout << min(lcost,rcost) << endl;
    return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
--import Data.Array
import Data.Array.IArray
--import Data.Array.Unboxed
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe
 
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
dictCompare :: [a -> a -> Ordering] -> a -> a -> Ordering
dictCompare [] _ _ = EQ
dictCompare (f:fs) x y = let c = f x y in if c==EQ then dictCompare fs x y else c
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
-- end of templete

main = map readInt . lines <$> getContents >>= mapM_ (putStrLn . ("3C"++) . tail . show . (+101) . (`mod`39) . (subtract 1))


Measured memory_bytes: 3652
#include <stdio.h>

int main() {
  int A,B,C,judge=0;
  scanf("%d %d %d",&A,&B,&C);
  if(A==B) {
    judge++;
  }
  if(A==C) {
    judge++;
  }
  if(B==C) {
    judge++;
  }
  if(judge==1) {
    printf("Yes");
  }else {
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 1720
#include<stdio.h>
int main(){
	double p[4][2];
	while(~scanf("%lf %lf %lf %lf %lf %lf %lf %lf"
		,&p[0][0],&p[0][1],&p[1][0],&p[1][1],&p[2][0],&p[2][1],&p[3][0],&p[3][1])){
		printf(!(p[0][0]> p[3][0] ||p[0][0] >p[3][1] || p[1][0]<p[2][0] ||p[1][1] <p[2][1])?"YES\n":"NO\n");
	}
	return 0;
}

Measured memory_bytes: 616
#include<iostream>
#include<algorithm>
using namespace std;
int main(){

  int n,m,a[1000],sum,dis,p;
  
  while(1){
    
    sum=0;
    dis=0;
      
    cin >>n>>m;
    
    if( n == 0 && m == 0 )break;
    
    for(int i=0 ; i < n ; i++){
      cin >>a[i];
      sum+=a[i];
    }
    
    sort(a,a+n);
    
    for(int i=n-m ; i >= 0  ; i-=m ){
      dis+=a[i];
    }
    
    p=sum-dis;
    
    cout <<p<<endl;
    
  }
  return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

struct UnionFind{
  vector<int> d;
  UnionFind(int n) : d(n, -1){}
  int find(int x){
    if(d.at(x) < 0) return x;
    return d.at(x) = find(d.at(x));
  }
  bool unite(int x, int y){
    x = find(x); y = find(y);
    if(x == y) return false;
    if(d.at(x) > d.at(y)) swap(x, y);
    d.at(x) += d.at(y);
    d.at(y)= x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -d.at(find(x)); }
};

int main(){
  int n;
  cin >> n;
  vector<tuple<int,int,int>> xy(n);
  rep(i, n){
    int a, b;
    cin >> a >> b;
    xy.at(i) = {a, b, i};
  }
  vector<pair<int, pair<int, int>>> r;
  sort(ALL(xy));
  rep(i,n-1){
    auto[x, y, z] = xy.at(i);
    auto[bx, by, bz] = xy.at(i+1);
    r.push_back({abs(bx-x), {z, bz}});
  }
  sort(ALL(xy), [](const auto &l, const auto &r){
    return get<1>(l) < get<1>(r);
  });
  rep(i,n-1){
    auto[x, y, z] = xy.at(i);
    auto[bx, by, bz] = xy.at(i+1);
    r.push_back({abs(by-y), {z, bz}});
  }

  ll ans = 0;
  UnionFind uf(n);
  sort(ALL(r));
  for(auto pp : r){
    auto [hv, p] = pp;
    auto [i, j] = p;
    if(uf.same(i, j) == true) continue;
    uf.unite(i,j);
    ans += hv;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7600
# coding: utf-8
# Your code here!

N = int(input())
word = [input() for i in range(N)]


#print(word[1:])
#print(word[2:])
for i in range(len(word)-1):
    if word[i][-1:len(word[i])]!=word[i+1][0:1] or word[i] in word[i+1:]:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3060
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def make_cumulative(A):
    C = [0] * (len(A) + 1)
    for i, a in enumerate(A):
        i += 1
        C[i] = C[i - 1] + a
    return C


def main():
    Q = NI()
    querys = [NLI() for _ in range(Q)]
    N = 100010
    hurui = [1] * N
    for i in range(N):
        if i <= 1:
            hurui[i] = 0
            continue
        if hurui[i] == 0:
            continue
        for j in range(i*2, N, i):
            hurui[j] = 0
    like_2017 = hurui[:]
    for i in range(N):
        if hurui[i] == 0 or i <= 2:
            continue
        if hurui[(i+1)//2] == 0:
            like_2017[i] = 0
    like_2017[2] = 0
    C = make_cumulative(like_2017)[1:]

    for q in querys:
        print(C[q[1]] - C[q[0]-1])

if __name__ == "__main__":
    main()

Measured memory_bytes: 32712
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    cin >> a>>b;
   int g,k,s,p;
   s=a*(a-1);
   p=b*(b-1);
   g=s/2;
   k=p/2;
   cout << g+k<<endl;
   
}


Measured memory_bytes: 256
# coding: utf-8

def f(num:int):
    if num % 2 == 0:
        return int(num / 2)
    else:
        return num * 3 + 1

first = int(input())

log = {first: 0}

prev = first
for i in range(1, 1000000 + 1):
    num = f(prev)
    if num in log:
        print(i + 1)
        break
    log[num] = i
    prev = num


Measured memory_bytes: 3060