akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <regex>
#include <sstream>
#include <string>
#include <thread>
#include <tuple>
#include <type_traits>
#include <vector>

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

int main() {
    ios::sync_with_stdio(false);
    int x;
    int ans = 0;
    for (int i = 0; i < 5; i++) {
        cin >> x;
        if (x == 0) {
            ans = i + 1;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3160
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

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

string s;

void solve() {
    ll ans = 0;
    int i_s = 0, i_e = s.length() - 1;
    while (i_s < i_e) {
        if (s[i_s] == s[i_e]) i_s++, i_e--;
        else if (s[i_s] == 'x') {
            i_s++;
            ans++;
        } else if (s[i_e] == 'x') {
            i_e--;
            ans++;
        } else {
            cout << -1 << endl;
            return;
        }
    }
    cout << ans << endl;
}

int main() {
    cin >> s;
    solve();
    return 0;
}

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

#define ll long long
#define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cps CLOCKS_PER_SEC
#define mod (ll)1000000007
#define f first
#define s second
#define debug1(x) cerr<<x<<"\n"
#define debug2(x,y) cerr<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cerr<<x<<" "<<y<<" "<<z<<"\n"
#define nl cerr<<"\n";
#define pq priority_queue
#define inf 0x3f3f3f3f
#define test cerr<<"abcd\n";
#define pi pair<int,int>
#define pii pair<int,pi>
#define pb push_back
#define mxn 1000005

int col(int i){
if(i&1)return i+i+i+1;
return i/2;
}
int a[mxn];
int main(){
sp;
int s;
cin>>s;
a[0]=s;
for(int i=1; i<mxn; ++i){
    a[i]=col(a[i-1]);
for(int j=0; j<i; ++j)
if(a[i]==a[j]){
cout<<i+1;
return 0;
}
}


return 0;}


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

double av(double a){
	if(a<0)return -a;
	return a;
}
int main(){
	int n, t, a, h, ind;
	double cd=1000000000;
	cin>>n>>t>>a;
	cin>>h;ind=0;
	cd=av(t-h*0.006-a);
	for(int i = 1;i < n;i ++){
		cin>>h;
		if(av(t-h*0.006-a)<cd){
			cd=av(t-h*0.006-a);
			ind=i;
		}
	}
	ind++;
	cout<<ind<<"\n";
}

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

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define all(c) (c).begin(), (c).end()
const int INF = 1e9 + 1;
const ll LINF = 1e18 + 1;
const ll MOD = 1e9 + 7;

bool check(vector<ll>& a, ll val, ll m) {
  int n = a.size();
  ll sum = 0;
  for (int i = 0; i < n; ++i) {
    sum += distance(lower_bound(all(a), val - a[i]), a.end());
  }
  // cout << val << " " << sum << endl;
  return sum <= m;
}

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

  ll n, m;
  cin >> n >> m;
  vector<ll> a(n);

  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(all(a));

  ll ok = 1e11, ng = -1;
  while (abs(ok - ng) > 1) {
    ll mid = (ok + ng) / 2;
    if (check(a, mid, m)) {
      ok = mid;
    } else {
      ng = mid;
    }
  }

  vector<ll> csum(n + 1, 0);
  for (int i = n - 1; i >= 0; --i) {
    csum[i] = csum[i + 1] + a[i];
  }

  ll ans = 0, cnt = 0;
  for (int i = 0; i < n; ++i) {
    ll t = distance(lower_bound(all(a), ok - a[i]), a.end());
    ans += csum[n - t];
    ans += t * a[i];
    cnt += t;
  }

  if (cnt < m) ans += (ok - 1) * (m - cnt);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        Map<Integer, Integer> mp = new HashMap<>();
        long sumA = 0;
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            sumA += a;
            if (mp.containsKey(a)) {
                mp.put(a, mp.get(a) + 1);
            } else {
                mp.put(a, 1);
            }
        }

        int q = sc.nextInt();
        for (int i = 0; i < q; i++) {
            int b = sc.nextInt();
            int c = sc.nextInt();
            int diff = c - b;
            if (mp.containsKey(b)) {
                int t = mp.get(b);
                mp.replace(b, 0);
                if (mp.containsKey(c)) {
                    mp.replace(c, mp.get(c) + t);
                } else {
                    mp.put(c, t);
                }
                sumA += diff*t;
            }

            System.out.println(sumA);
        }
    }
    
}


Measured memory_bytes: 67636
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
#define REP(i, n)           for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)       for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF                 (ll)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef long long           ll;
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
// メイン
int main()
{
	ll X, Y, A, B, C;
	cin >> X >> Y >> A >> B >> C;
	vector<ll> p(A), q(B), r(C);
	ll ansOne = 0;
	{
		REP(i, A) cin >> p[i];
		REP(i, B) cin >> q[i];
		REP(i, C) cin >> r[i];
		sort(p.rbegin(), p.rend());
		sort(q.rbegin(), q.rend());
		sort(r.rbegin(), r.rend());
	
		REP(i, X) ansOne += p[i];
		REP(i, Y) ansOne += q[i];
	}

	vector<ll> ans(C + 1, 0);
	ans[0] = ansOne;

	int idxC = 1;
	int idxA = X - 1;
	int idxB = Y - 1;
	for (auto rOne : r) {
		if (0 <= idxA && 0 <= idxB) {
			if (p[idxA] < rOne || q[idxB] < rOne) {
				if (p[idxA] < q[idxB]) {
					ansOne -= p[idxA];
					idxA--;
				} else {
					ansOne -= q[idxB];
					idxB--;
				}
				ansOne += rOne;
				ans[idxC] = ansOne;
				idxC++;
			}
		} else if (0 <= idxA) {
			if (p[idxA] < rOne) {
				ansOne -= p[idxA];
				idxA--;
				ansOne += rOne;
				ans[idxC] = ansOne;
				idxC++;
			}
		} else if (0 <= idxB) {
			if (q[idxB] < rOne) {
				ansOne -= q[idxB];
				idxB--;
				ansOne += rOne;
				ans[idxC] = ansOne;
				idxC++;
			}
		}
	}

	sort(ans.rbegin(), ans.rend());
	cout << ans[0] << endl;
	return 0;
}


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

struct Trn {
  int k;
  string *mat;
};

map<string, int> p;
map<string, Trn> q;

int min(string item) {
  int buy = p[item];
  if (q.find(item) != q.end()) {
    int trn = 0;
    for (int j=0; j<q[item].k; j++) {
      trn += min(q[item].mat[j]);
    }
    if (trn < buy) {
      return trn;
    }
  }
  return buy;
}

int main(void) {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) {
      break;
    }
    for (int j=0; j<n; j++) {
      string i;
      cin >> i;
      cin >> p[i];
    }
    int m;
    cin >> m;
    for (int j=0; j<m; j++) {
      string o;
      cin >> o;
      cin >> q[o].k;
      q[o].mat = new string[q[o].k];
      for (int l=0; l<q[o].k; l++) {
	cin >> q[o].mat[l];
      }
    }
    string item;
    cin >> item;
    cout << min(item) << endl;
    p.clear();
    if (!q.empty()) {
      for (map<string, Trn>::iterator j=q.begin(); j!=q.end(); j++) {
	delete[] j->second.mat;
      }
      q.clear();
    }
  }
  return 0;
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int gcd(int a, int b) {
	if (!b)return a;
	return gcd(b, a % b);
}

int main() {
    ll k, ans = 0;
    cin >> k;
    REP(a, k){
        REP(b, k){
            REP(c, k){
                ans += gcd(a, gcd(b, c));
            }
        }
    
    }
    cout << ans << endl;
}   

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

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();
        string s = sc.NextString();
        
        int[] c = new int[2];
        for (int i = 0; i < s.Length; i++)
            c[s[i] == '0' ? 0 : 1]++;
        
        Console.WriteLine(2 * c.Min());
    }
}

class Scanner
{
    int index = -1;
    string[] buf;

    public Scanner()
    {
    }

    public int NextInt()
    {
        CheckNext();
        return int.Parse(buf[index++]);
    }
        
    public long NextLong()
    {
    	CheckNext();
    	return long.Parse(buf[index++]);
    }

    public string NextString()
    {
        CheckNext();
        return buf[index++];
    }

    private void CheckNext()
    {
        if (index >= 0 && index < buf.Length) return;

        buf = Console.ReadLine().Split(' ');
        index = 0;
    }
}

Measured memory_bytes: 13792
#include <bits/stdc++.h>
using namespace std;
int main(void){
    double l;
    double w=0.0;
    
    cin >> l;
    
    w = l/3;
    
    cout << std::fixed << std::setprecision(12) << w*w*w << endl;
    
    return 0;    
}

Measured memory_bytes: 256
IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM_ID.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 ln         PIC X(400).
01 maxlen     PIC 9(10) VALUE 100 COMP.
01 cur        PIC 9(10) VALUE 1 COMP.
01 i          PIC 9(10) VALUE 1 COMP.
01 j          PIC 9(10) COMP.
01 len        PIC 9(10) COMP.
01 accum      PIC 9(10) VALUE ZERO COMP.
01 N          PIC 9(10).
01 A1.
  03 A11 OCCURS 100 DEPENDING ON N.
      05 A PIC 9(10) COMP.

PROCEDURE DIVISION.
  MOVE 3 TO N.
  ACCEPT ln.
  MOVE N TO maxlen.
  PERFORM maxlen TIMES
    PERFORM VARYING j FROM cur BY 1 UNTIL ln(j:1) = SPACE
    END-PERFORM
    COMPUTE len = j - cur
    MOVE ln(cur:len) TO A(i)
    ADD A(i) TO accum
    COMPUTE cur = j + 1
    ADD 1 TO i
  END-PERFORM.
  IF 22 <= accum THEN
    DISPLAY "bust"
  ELSE
    DISPLAY "win"
  END-IF.
  STOP RUN.


Measured memory_bytes: 3760
a, b, c = list(map(int, input().split()))

cnt = 0
if (a == b) and (b == c) and (a%2==0):
    print(-1)
elif (a%2!=0) or b%2!=0 or c%2!=0:
    print(0)
else:
    while(True):
        a_ = a/2
        b_ = b/2
        c_ = c/2
        a = b_ + c_
        b = a_ + c_
        c = a_ + b_
        cnt+=1
        if a%2!=0 or b%2!=0 or c%2!=0:
            print(cnt)
            exit()

Measured memory_bytes: 3064
from collections import deque

n = int(input())
a = [0 for i in range(n)]
for i in range(n):
    a[i] = int(input())

a.sort()

d = deque()

lft = False
smll = False

d.append(a[0])
fst = 1
end = n-1

for i in range(n-1):
    if not(smll):
        if not(lft):
            d.appendleft(a[end])
            end -= 1
            lft = True
        else:
            d.append(a[end])
            end -= 1
            lft = False
            smll = True
    else:
        if not(lft):
            d.appendleft(a[fst])
            fst += 1
            lft = True
        else:
            d.append(a[fst])
            fst += 1
            lft = False
            smll = False

memo = d.pop()
ans = 0
for i in range(n-1):
    memo2 = d.pop()
    ans += abs(memo-memo2)
    memo = memo2
    


d.append(a[n-1])
fst = 0
end = n-2
lft = False
smll = True


for i in range(n-1):
    if not(smll):
        if not(lft):
            d.appendleft(a[end])
            end -= 1
            lft = True
        else:
            d.append(a[end])
            end -= 1
            lft = False
            smll = True
    else:
        if not(lft):
            d.appendleft(a[fst])
            fst += 1
            lft = True
        else:
            d.append(a[fst])
            fst += 1
            lft = False
            smll = False

memo3 = d.pop()
ans2 = 0
for i in range(n-1):
    memo4 = d.pop()
    ans2 += abs(memo3-memo4)
    memo3 = memo4
    
ans = max(ans,ans2)
    
print(ans)


Measured memory_bytes: 8072
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define FILE "file"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 4 * 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

typedef long long ll;
#define pb push_back
#define mp make_pair

vector<int> v;

double compute(int ind)
{
    if(ind == 0)
    {
        return v[0];
    }
    
    return (v[ind] + compute(ind - 1)) / 2.0;
}

void solve()
{
    int n;
    cin >> n;
    
    v.resize(n);
    for(int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    
    sort(begin(v), end(v));
    
    cout << fixed << setprecision(9) << compute(n - 1);
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.in", "r", stdin);freopen("/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.out", "w", stdout);
    
    int t = 1;
    //cin >> t;
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


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

int main(){
  string S,T;
  cin >> S >> T;
  
  int count = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) == T.at(i)) {
      count++;
    } 
  }
  
  if (count == S.size()) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
typedef long long int lli;

const lli MOD = 1e9 + 7;

int main() {
	int n, m;
	cin >> n >> m;
	lli x[100010], y[100010];
	for (int i = 1;i <= n;i++) { cin >> x[i]; }
	for (int i = 1;i <= m;i++) { cin >> y[i]; }

	lli sumx = 0, sumy = 0;
	//x軸y軸で累積長さをとる
	for (int i = 1;i <= n - 1;i++) {
		sumx = (sumx + i*(((n - i)*(x[i + 1] - x[i]))%MOD)) % MOD;
	}
	for (int i = 1;i <= m - 1;i++) {
		sumy = (sumy + i*(((m - i)*(y[i + 1] - y[i]))%MOD)) % MOD;
	}
	lli ans=0;
	ans = (sumx*sumy) % MOD;
	cout << ans;
}

Measured memory_bytes: 1792
package main

import (
	"fmt"
	"io"
	"os"
)

func Solve(stdin io.Reader, stdout io.Writer) {
	var n, a, b int
	_, _ = fmt.Fscanf(stdin, "%d %d %v", &n, &a, &b)
	train := n * a
	if train > b {
		_, _ = fmt.Fprintf(stdout, "%d\n", b)
		return
	}
	_, _ = fmt.Fprintf(stdout, "%d\n", train)
}

func main() {
	Solve(os.Stdin, os.Stdout)
	return
}


Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
long long int dp[1001][1001];
int main()
{
	int n, m, d[1001], c[1001],x=0;
	scanf("%d %d", &n, &m);
/*	for (int i = 0; i <= n; i++)
	{
		for (int j = 0; j <=m; j++)
		{
			dp[i][j] = 100000000000000000;
		}
	}*/
	memset(dp, 0x7f, sizeof(dp));
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &d[i]);
	}
	for (int i = 1; i <= m; i++)
	{
		scanf("%d", &c[i]);
	}
	for (int i = 0; i <=n; i++)
	{
		for (int j = x; j <= m; j++)
		{
			if (i == 0)
				dp[i][j] = 0;
			else
				dp[i][j] = min(dp[i][j - 1], dp[i - 1][j - 1] + d[i] * c[j]);
		}
		x++;
	}
	printf("%lld\n", dp[n][m]);
	return 0;
}

Measured memory_bytes: 11060
int main(){
	double g[100][100],G0[100],G1[100],a;
	int n,m,i,j;
	for(;scanf("%d%d",&n,&m),n;){
		for(i=0;i<n;i++){
			for(j=0;j<n;j++)
				scanf("%lf",&g[i][j]);
			G0[i]=1;
		}
		for(;--m;){
			for(i=0;i<n;i++){
				G1[i]=0;
				for(j=0;j<n;j++){
					a=G0[j]*g[j][i];
					if(a>G1[i])
						G1[i]=a;
				}
			}
			memcpy(G0,G1,sizeof(G0));
		}
		a=0;
		for(i=0;i<n;i++)
			if(G0[i]>a)
				a=G0[i];
		printf("%.2f\n",a);
	}
	exit(0);
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Math;
using System.Text;
using System.Threading;
using System.Globalization;
using System.Runtime.CompilerServices;
using Library;

namespace Program
{
    public static class AGC009A
    {
        static public int numberOfRandomCases = 0;
        static public void MakeTestCase(List<string> _input, List<string> _output, ref Func<string[], bool> _outputChecker)
        {
        }
        static public void Solve()
        {
            var N = NN;
            var AB = Repeat(0, N).Select(_ => new { A = NN, B = NN }).ToArray();
            var cnt = 0L;
            for (var i = N - 1; i >= 0; i--)
            {
                cnt += (AB[i].B - ((cnt + AB[i].A) % AB[i].B)) % AB[i].B;
            }
            Console.WriteLine(cnt);
        }
        static class Console_
        {
            static Queue<string> param = new Queue<string>();
            public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }
        }
        class Printer : StreamWriter
        {
            public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
            public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }
            public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }
        }
        static public void Main(string[] args) { if (args.Length == 0) { Console.SetOut(new Printer(Console.OpenStandardOutput())); } var t = new Thread(Solve, 134217728); t.Start(); t.Join(); Console.Out.Flush(); }
        static long NN => long.Parse(Console_.NextString());
        static double ND => double.Parse(Console_.NextString());
        static string NS => Console_.NextString();
        static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();
        static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();
        static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();
        static IEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => x.OrderBy(_ => xorshift);
        static long Count<T>(this IEnumerable<T> x, Func<T, bool> pred) => Enumerable.Count(x, pred);
        static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n);
        static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c);
        static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }
        static IEnumerator<uint> _xsi = _xsc();
        static IEnumerator<uint> _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }
    }
}
namespace Library {
}


Measured memory_bytes: 27324
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iomanip>


#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;


// <<fixed<<setprecision(6)<<


int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}


int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}


int main(){
  double pi=3.14159265;
  double n;
  cin>>n;
  cout<<n*2.0*pi<<endl;

}

Measured memory_bytes: 3792
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
public class Main {
	
	
	 
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		s[3]='8';
		System.out.println(String.valueOf(s));
	}
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);


int main() {
  int n;
  cin >> n;
  vector<vector<int>> a(2,vector<int>(n));
  rep(i,2)rep(j,n) cin >> a[i][j];
  int sum = 0;
  int ans = -1;
  rep(i,n){
    for(int j = 0; j <= i; ++j){
      sum+=a[0][j];
    }
    for(int j = i; j < n; ++j){
      sum+=a[1][j];
    }
    ans=max(ans,sum);
    sum=0;
  } 
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
#define ll long long
#define ld long double
#define ALL(x) begin(x),end(x)
     
int main() {
  ll n;
  cin >> n;
  
  map<string,ll> m;
  ll num = 0;
  rep(i,n){
    string s;
    cin >> s;
    m[s]++;
    num = max(num,m[s]);
  }
 
  for(auto i = m.begin(); i != m.end(); i++){
    if(i->second == num) cout << i->first << endl;
  }
  //rep(i,m.size()) cout << m[i] << endl;
}

Measured memory_bytes: 19228
#include <bits/stdc++.h> 
using namespace std;
typedef vector<bool> bool_vector;
typedef vector<int> int_vector;
typedef vector<long long> long_vector;
typedef vector<double> double_vector;

typedef vector< vector<bool> > bool_matrix;
typedef vector< vector<int> > int_matrix;
typedef vector<string> string_vector;
typedef vector< vector<string> > string_matrix;

void dfs(int n, bool_vector vec, bool_matrix &mat, int n_true){
    if (n==0) mat.push_back(vec);
    else if (n_true == 0) {
        int i = n;
        while (i>0){
            vec[n-i] = false;
            i--;
        }
        mat.push_back(vec);
    }
    else if (n_true == n) {
        int i = n;
        while (i>0){
            vec[n-i] = true;
            i--;
        }
        mat.push_back(vec);
    }
    else {
        vec[n-1] = true;
        dfs(n-1, vec, mat, n_true-1);
        vec[n-1] = false;
        dfs(n-1, vec, mat, n_true);
    }
    return;
}

bool judge(int n, const bool_vector &vec, const vector< vector< pair<int, int> > > &qs, const int_vector &q_size)
{   
    for(size_t i=0; i<n; i++){
        if (vec[i]){
            for(size_t j=0; j<q_size[i]; j++){
                if ((int) vec[qs[i][j].first-1] != qs[i][j].second) return false;
            }
        }
    }
    return true;
}

int main(){
    int n;
    cin >> n;
    bool_vector vec(n, false);
    int_vector q_size;
    vector< vector< pair<int, int> > > qs;
    for (size_t i =0; i<n ; i++)
    {
        int n_q;
        vector< pair<int, int> > q;
        cin >> n_q;
        q_size.push_back(n_q);
        for (size_t j=0; j<n_q; j++){
            pair<int, int> xy;
            cin >> xy.first >> xy.second;
            q.push_back(xy);
        }
        qs.push_back(q);
    }

    for (size_t i = n; i > 0; i--)
    {
        bool_matrix mat;
        dfs(n, vec, mat, i);
        for (size_t j=0; j < mat.size(); j++){
            if(judge(n, mat[j], qs, q_size)) {
                cout << i << endl;
                return 0;
            } 
        }
    }
    cout << 0 << endl ;
}

Measured memory_bytes: 880
import heapq
n = int(input())
a = list(map(int,input().split()))

first = []
second = []
for i in range(n):
    first.append(a[i])
for i in range(2*n,3*n):
    second.append(-a[i])
heapq.heapify(first)
heapq.heapify(second)


sumfirst = [0]*(n+1)
sumsecond = [0]*(n+1)
sumfirst[0] = sum(first)
sumsecond[n] = -sum(second)

for i in range(1,n+1):
    k = 0
    k += a[n-1+i]
    heapq.heappush(first,a[n-1+i])
    k -= heapq.heappop(first)
    sumfirst[i] = sumfirst[i-1]+k

for i in range(n-1,-1,-1):
    k = 0
    k += a[n+i]
    heapq.heappush(second,-a[n+i])
    k -= -heapq.heappop(second)
    sumsecond[i] = sumsecond[i+1]+k

res = sumfirst[0]-sumsecond[0]
for i in range(n+1):
    res = max(res,sumfirst[i]-sumsecond[i])
print(res)

Measured memory_bytes: 38276
#include<stdio.h>


int main(){
     
    int N;
    int K;
    char Str[100];
    scanf("%d %d", &N, &K);
    scanf("%s", &Str);
    Str[K-1]= Str[K-1]+32;
    printf("%s", Str);
    
		
    
    
    
     
     
     
     
    
    return 0;
}

Measured memory_bytes: 1724
#include<stdio.h>
int main(void){
int a,b;
scanf("%d %d",&a,&b);
if(a<b){
printf("a < b\n");
}
else if(a>b){
printf("a > b\n");
}
else if(a==b){
printf("a == b\n");
}
return 0;
}

Measured memory_bytes: 580
import sys
sys.setrecursionlimit(10**6)
n,k=map(int,input().split())
l=[[] for i in range(n+1)]
for i in range(n-1):
  a,b=map(int,input().split())
  l[a].append(b)
  l[b].append(a)
ans=[k]
mod=10**9+7
def dfs(s,p):#sは今いる点colはその点の色
  if s==1:
    now=k-1
  else:
    now=k-2
  for i in l[s]:
    if i==p:
      pass
    else:
      ans[0]=(ans[0]*now)%mod
      now-=1
      dfs(i,s)
dfs(1,0)
print(ans[0])

Measured memory_bytes: 87344
N, x = map(int,input().split())
A = list(map(int,input().split()))
nums = 0
for i in range(N-1):
  if A[i]+A[i+1] > x:
    nums += (A[i]+A[i+1])-x
    A[i+1] -= (A[i]+A[i+1])-x
    if A[i+1]<0:
      A[i] -= abs(A[i+1])
      A[i+1] = 0
print(nums)

Measured memory_bytes: 14052
lists = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
i = int(input())

print(lists[i - 1])


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

using namespace std;

int main() {
    int N;
    cin >> N;
    if(N / 100 == 7) {
        cout << "Yes" << endl;
    } else if(N % 10 == 7) {
        cout << "Yes" << endl;
    } else if(N % 100 / 10 == 7) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3672
#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	int t=0;
	t = a;
	a = b;
	b = t;
	t = a;
	a = c;
	c = t;
	printf("%d %d %d",a,b,c);
	return 0;
} 

Measured memory_bytes: 128
#![allow(unused_mut, non_snake_case,unused_imports)]
use std::iter;
use std::cmp::{max, min, Ordering};
use std::mem::{swap};
use std::collections::{HashMap,BTreeMap,HashSet,BTreeSet,BinaryHeap,VecDeque};
use std::iter::FromIterator;

//　高速 EOF要
//macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();input_inner!{iter, $($r)*}};($($r:tt)*) => {let mut s = {use std::io::Read;let mut s = String::new();std::io::stdin().read_to_string(&mut s).unwrap();s};let mut iter = s.split_whitespace();input_inner!{iter, $($r)*}};}
//macro_rules! input_inner {($iter:expr) => {};($iter:expr, ) => {};($iter:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($iter, $t);input_inner!{$iter $($r)*}};}
//macro_rules! read_value {($iter:expr, ( $($t:tt),* )) => {( $(read_value!($iter, $t)),* )};($iter:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()};($iter:expr, chars) => {read_value!($iter, String).chars().collect::<Vec<char>>()};($iter:expr, usize1) => {read_value!($iter, usize) - 1};($iter:expr, $t:ty) => {$iter.next().unwrap().parse::<$t>().expect("Parse error")};}
// 低速 EOF不要
macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

// 非常時
fn read_line() -> String{ let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); s.trim().to_string() }

/*
 <url:https://beta.atcoder.jp/contests/abc113/tasks/abc113_a>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */
fn main(){
    input!(X:i32,Y:i32);
    println!("{}",X+Y/2);
}

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

int main() {
    ll n,a,b;
    cin >> n >> a >> b;
    ll times = n / (a+b);
    ll rest = n - times * (a + b);
    cout << times * a + min(rest, a) << endl;
}

Measured memory_bytes: 256
from collections import *
from heapq import *
import sys

sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]
dij = [(1, 0), (-1, 0), (0, 1), (0, -1)]


def main():
    s=SI()
    cnt0=s.count("0")
    cnt1=len(s)-cnt0
    print(min(cnt0,cnt1)*2)

main()


Measured memory_bytes: 3564
package main

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

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextInt64() int64 {
	i, err := strconv.ParseInt(io.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}


func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func intMin(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func (io *Io) PrintBool(b bool, trueS, falseS string) {
	if b {
		io.PrintLn(trueS)
	} else {
		io.PrintLn(falseS)
	}
}

func intMax(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func absi(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func b2i(b bool) int {
	if b {
		return 1
	}
	return 0
}

type Int64s []int64
func (f Int64s) Len() int {
	return len(f)
}
func (f Int64s) Less(i, j int) bool {
	return f[i] < f[j]
}

func (f Int64s) Swap(i, j int) {
	f[i], f[j] = f[j], f[i]
}


func solve(io *Io) {
	a := io.NextInt()
	b := io.NextInt()

	ans := "No"
	if a * b % 2 == 1 {
		ans = "Yes"
	}

	io.PrintLn(ans)
}

func main() {
	io := NewIo()
	defer io.Flush()

	solve(io)
}


Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int r,d,x;
int main()
{
	scanf("%d%d%d",&r,&d,&x);
	for(int i=1;i<=10;i++)
	{
		x=r*x-d;
		printf("%d\n",x);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int N;
vector<vector<int>> G;
vector<int> deg;
vector<bool> isw;
vector<bool> erased;
vector<int> d;
vector<bool> good;
void dfs(int v,int p=-1,int sum=0){
	sum += good[v];
	d[v] = sum;
	for(int u:G[v]) if(u!=p && !erased[u]) dfs(u,v,sum);
}

int main(){
	cin>>N;
	G.resize(N);
	deg.resize(N);
	isw.resize(N);
	erased.resize(N);
	d.resize(N);
	good.resize(N);

	rep(i,N-1){
		int x,y;
		cin>>x>>y;
		x--,y--;
		G[x].pb(y);
		G[y].pb(x);
	}
	string c;
	cin>>c;
	rep(i,N) isw[i] = (c[i]=='W');

	int Wnum = 0;
	int s = -1;
	rep(i,N) if(isw[i]){
		Wnum++;
		s = i;
	}
	if(Wnum <= 1){
		cout<<Wnum<<endl;
		return 0;
	}

	queue<int> que;

	rep(i,N){
		deg[i] = G[i].size();
		if(deg[i]<=1 && !isw[i]) que.push(i);
	}

	while(!que.empty()){
		int v = que.front();que.pop();
		if(erased[v]) continue;
		erased[v] = 1;
		deg[v] = 0;
		for(int u:G[v]){
			deg[u]--;
			if(deg[u]<=1 && !isw[u]) que.push(u);
		}
	}

	int ans = -2;
	rep(i,N) if(!erased[i]){
		ans += 2;
		bool penalty = isw[i]^(deg[i]%2==1);
		if(penalty) ans++;
		good[i] = penalty;
	}

	dfs(s);
	int ag = s;
	rep(i,N) if(!erased[i]){
		if(d[ag]<d[i]) ag = i;
	}


	dfs(ag);
	rep(i,N) if(!erased[i]){
		if(d[ag]<d[i]) ag = i;
	}
	ans -= d[ag]*2;
	cout<<ans<<endl;

}

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

using namespace std;

char s[25][25];

int bfs(int one,int two)
{
    int d[25][25];
    for(int o=0;o<25;o++) for(int i=0;i<25;i++) d[o][i]=-1;
    d[one][two]=0;
    queue<pair<int,int>> q;
    q.push({one,two});
    int z[4][2]={{1,0},{-1,0},{0,-1},{0,1}};
    int res=0;
    while(!q.empty())
    {
        int a,b;
        tie(a,b)=q.front();
        q.pop();
        for(int j=0;j<4;j++)
        {
            int e=a+z[j][0];
            int f=b+z[j][1];
            if(d[e][f]!=-1||s[e][f]!='.') continue;
            d[e][f]=d[a][b]+1;
            q.push({e,f});
            res=max(res,d[e][f]);
        }
    }
    return res;
}

int main()
{
    int h,w;
    scanf("%d%d",&h,&w);
    for(int o=0;o<=h+1;o++) for(int i=0;i<=w+1;i++) s[o][i]='#';
    for(int o=1;o<=h;o++) scanf("%s",s[o]+1);
    int res=0;
    for(int o=1;o<=h;o++) for(int i=1;i<=w;i++) if(s[o][i]=='.') res=max(res,bfs(o,i));
    printf("%d\n",res);
    return 0;
}


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

using namespace std;

int main(){
	int n; cin >> n;
	int k; cin >> k;
	int p[n];
	for(int i = 0; i < n; i++){
		cin >> p[i];
	}
	sort(p, p + n);
	int sum = 0;;
	for(int i = 0; i < k; i++){
		sum += p[i];
	}
	cout << sum << endl;
}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
//#include<tr1/unordered_map>
#pragma GCC optimize ("Ofast")
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for(int i=0; i<int(n); i++)
#define Forn(i, n) for(int i=1; i<=int(n); i++)

using namespace std;

/*#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;*/

int n, m;
int a[110];

int main()
{
    cin.tie(0);ios_base::sync_with_stdio(false);
    cin >> n >> m;
    int t = 0;
    forn(i, n)
    {
        cin >> a[i];
        t += a[i];
    }
    int c = 0;
    forn(i, n) if(a[i] * m * 4 >= t) c++;
    if(c>=m) cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 256
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

n,m=map(int, input().split(" "))

X=list(map(int, input().split(" ")))

arr=[abs(i-m) for i in X]

min=arr[0]
for i in range(len(arr)):
    min=gcd(min,arr[i])

print(min)


Measured memory_bytes: 14224
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define ms(x, v) memset(x, v, sizeof(x))
using namespace std;
ll ans[100];
int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
#endif
    ios::sync_with_stdio(0), cin.tie(0);
    ll k;
    while(cin >> k)
    {
        cout << 50 << endl;
        ll x = k / 50, y = k % 50;
        rep1(i, 50) ans[i] = 49 + x;
        rep1(i, 50) ans[i] -= y;
        for(int i = 50 - y + 1; i <= 50; i++) ans[i] += 51;

        rep1(i, 50) cout << ans[i] << ' ';
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, start, stop) for (ll i = start; i < stop; i++)
#define FORR(i, start, stop) for (ll i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<ll>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<ll>());
#define REMOVE(v,n) remove(vector<ll> v,v+v.size(),ll n)
#define ERASE(v,n) v.erase(v.begin()+n);
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;
void chmin(int &a, int b) { if (a > b) a = b; }
//string al="abcdefghijklmnopqrstuvwxyz";
//vector< vector<int> > v (size1, vector<int>(size2) );



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string al="abcdefghijklmnopqrstuvwxyz";
    ll N;
    cin>>N;
    vector< vector<ll> > cnt (N, vector<ll>(26,0) );
    string S;
    FOR(i,0,N){
        cin>>S;
        FOR(j,0,S.size()){
            cnt[i][S[j]-'a']++;
        }
    }

    
    FOR(i,0,26){
        ll a=10e9;
        FOR(j,0,N){
            a=min(cnt[j][i],a);
        }
        FOR(k,0,a){
            cout<<al[i];
        }
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong(), d = sc.nextLong(), count  = 0;
        while (n-->0){
            long a = sc.nextLong(), b = sc.nextLong();
            if(((a*a)+(b*b)) <= (d*d)){
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 59276
#include <iostream>
using namespace std;
bool isPrime(int n) 
{ 
    // Corner case 
    if (n <= 1)  return false; 
  
    // Check from 2 to n-1 
    for (int i=2; i<n; i++) 
        if (n%i == 0) 
            return false; 
  
    return true; 
} 
int main(void){
       int n;
       cin >> n;
       for(int i=n;  ; i++)
               if(isPrime(i)){
                    cout << i;
                    break;
               }
           
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int A[10];
int main(){
	for(int i=0;i<6;i++)cin>>A[i];
	bool flag=true;
	for(int i=0;i<5&&flag;i++){
		for(int j=i+1;j<5;j++){
			if(abs(A[i]-A[j])>A[5])flag=false;
		}
	}
	if(flag)cout<<"Yay!"<<endl;
	else cout<<":("<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
int main(){
	int n,q,m;
	while(cin>>n>>q&&(n||q)){
		set<int> data[n];
		for(int i=0;i<n;i++){
			cin>>m;
			for(int j=0;j<m;j++){
				int a;
				cin>>a;
				data[i].insert(a);
			}
		}
		int ans=-1,m=-1;
		for(int i=1;i<100;i++){
			int cnt=0;
			for(int j=0;j<n;j++){
				if(data[j].count(i))cnt++;
			}
			if(cnt>=q&&cnt>m){
				ans=i;
				m=cnt;
			}
		}
		if(ans!=-1)cout<<ans<<endl;
		else cout<<0<<endl;
	}
}

Measured memory_bytes: 1280
fun main(args: Array<String>) {
    
    var n = readLine()!!.toInt()
    var dict = mutableMapOf<String,Int>()
    (1..n).map{
        var a = readLine()!!
        if(dict[a] == null) dict[a] = 0
        dict[a] = dict[a]!! + 1
    }
    var m = readLine()!!.toInt()
    (1..m).map{
        var b = readLine()!!
        if(dict[b] == null) dict[b] = 0
        dict[b] = dict[b]!! - 1
    } 

    var sort_dict = dict.toList().sortedBy{it.second}
    if(sort_dict[sort_dict.size-1].second<=0) println(0)
    else println(sort_dict[sort_dict.size-1].second)
}

Measured memory_bytes: 38036
import bisect
import itertools
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N = int(input())
        L = list(map(int, input().split()))

        ans = 0
        L.sort()

        for i in range(1, N-1):
            for j in range(i):
                ab = L[i] + L[j]
                right = bisect.bisect_left(L, ab)
                left = i + 1
                ans += right - left

        print(ans)


# Run main
if __name__ == '__main__':
    AtCoder().main()


Measured memory_bytes: 43800
n = int(input())
X = list(map(int,input().split()))
medIndex = int((n-1)/2)
Z = sorted(X[:])
c1 = Z[int(n/2-1)]
c2 = Z[int(n/2)]
for i in range(n) :
  if (X[i] <= c1) :
    print(c2)
  else :
    print(c1)


Measured memory_bytes: 25556
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define boost ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define pii pair<ll,ll>
#define forn(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define mset(arr,x) memset(arr,x,sizeof(arr))
int main()
{
    boost;
            ll a,b,k;
            cin>>a>>b>>k;
            set<ll> s1;
            for(ll i=a;i<=min(b,a+k)-1;i++)
            {
                  s1.insert(i);
            }
            ll d=b-k;
            for(ll i=b-k+1;i<=b;i++)
            {
                  s1.insert(i);
            }
            for(auto it:s1)
            {
                  if(it>=a && it<=b)
                  {
                        cout<<it<<endl;     
                  }
            }
            
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0LL)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;}
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}


bool isOk(ll key,ll value){
  return key >= value;
}

ll binary_search(vector<ll> a,ll key){
  ll ok = a.size()-1;
  ll ng = 0;

  while(abs(ok - ng) > 1){
    ll mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}

bool isPrime(ll n) {
	for (int i = 2; n >= i * i; ++i) {
		if(!(n % i))return false;
	}
  return true;
}
vector<ll> primes(ll n){
  vector<ll> v(1,1);
  for (ll i = 2; n >= i * i; ++i) {
		if(!(n % i)){
      v.pb(i);
	  }
  }
  if(v.size()==1)v.pb(n);
  return v;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  int n,m;cin>>n;
  string s;cin>>s;
  int ans = 0;
  rep(i,n){
    if(s.substr(i,3) == "ABC")ans++;
  }
  print(ans);
  return 0;
} 

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

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		int n = fs.nextInt();
		int a[] = fs.nextIntArray(n);
		Arrays.sort(a);

		int memo[] = new int[n];
		for(int i=0;i<n;i++) {
			memo[a[i]]++;
		}
		
		if(n%2==0) {
			for(int i=1;i<n;i+=2) {
				if(memo[i]!=2) {
					System.out.println(0);
					return;
				}
			}
		}
		else {
			for(int i=0;i<n;i+=2) {
				if(i==0) {
					if(memo[i]!=1) {
						System.out.println(0);
						return;
					}
				}
				else {
					if(memo[i]!=2) {
						System.out.println(0);
						return;
					}
				}
			}
		}
		
		long ans = modpow(2,n/2);
		System.out.println(ans);
		
	}
	//MOD culculations
	static long plus(long x, long y) {
		x %= mod;
		y %= mod;
		long res = (x + y) % mod;
		return res;
	}

	static long sub(long x, long y) {
		x %= mod;
		y %= mod;
		long res = (x - y + mod) % mod;
		return res;
	}

	static long mul(long x, long y) {
		x %= mod;
		y %= mod;
		long res = x * y % mod;
		return res;
	}

	static long div(long x, long y) {
		x %= mod;
		y %= mod;
		long res = x * modpow(y, mod - 2) % mod;
		return res;
	}

	//modの元での高速pow()
	static long modpow(long a, long p) {
		if (p == 0)
			return 1;
		if (p % 2 == 0) {
			long halfP = p / 2;
			long root = modpow(a, halfP);
			return root * root % mod;
		} else
			return a * modpow(a, p - 1) % mod;
	}

}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer 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 int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

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

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

Measured memory_bytes: 34032