akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int X, Y, Z, K;
	cin >> X >> Y >> Z >> K;
	ll A[1000], C[1000];
	vector<ll> AB;
	rep(i, X) cin >> A[i];
	rep(i, Y) {
		ll B;
		cin >> B;
		rep(j, X) AB.pb(A[j] + B);
	}
	sort(AB.begin(), AB.end());
	rep(i, Z) cin >> C[i];
	sort(C, C + Z);
	reverse(C, C + Z);

	ll L = 3;
	ll R = 30000000000;
	while (L < R) {
		ll H = (L + R + 1) / 2;
		ll kazu = 0;
		ll goukei = 0;
		rep(i, X * Y) {
			while (kazu < Z && AB[i] + C[kazu] >= H) kazu++;
			goukei += kazu;
		}
		if (goukei >= K) L = H;
		else R = H - 1;
	}

	vector<ll> kotae;
	rep(i, X * Y) {
		ll kazu = 0;
		while (kazu < Z && AB[i] + C[kazu] >= L) kazu++;
		rep(q, kazu) {
			if (C[q] + AB[i] > L) kotae.pb(C[q] + AB[i]);
			else break;
		}
	}

	sort(kotae.begin(), kotae.end());
	reverse(kotae.begin(), kotae.end());
	int kaita = 0;
	for (ll k : kotae) {
		co(k);
		kaita++;
	}
	for (int i = kaita; i < K; i++) co(L);

	Would you please return 0;
}

Measured memory_bytes: 10604
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int n = sc.nextInt();

    Map<Integer, Set<Integer>> tree = new HashMap<>(n);
    List<Integer> values = new ArrayList<>(n);

    for (int i = 0; i < n - 1; i++) {
      int a = sc.nextInt();
      int b = sc.nextInt();
      Set<Integer> set;

      set = tree.getOrDefault(a, new HashSet<>());
      set.add(b);
      tree.put(a, set);

      set = tree.getOrDefault(b, new HashSet<>());
      set.add(a);
      tree.put(b, set);
    }

    for (int i = 0; i < n; i++) {
      values.add(sc.nextInt());
    }

    Collections.sort(values);

    LinkedList<Integer> assignable = new LinkedList<>();

    // find leaves
    for (int i = 1; i <= n; i++) {
      if (tree.get(i).size() == 1) {
        assignable.add(i);
      }
    }

    int[] assigned = new int[n + 1];
    int count = 0;
    int sum = 0;
    while (!assignable.isEmpty()) {

      int assign = assignable.remove();

      assigned[assign] = values.get(count++);

      // towards root
      Set<Integer> candidates = tree.get(assign);

      sum += assigned[assign];

      for (int candidate : candidates) {
        tree.get(candidate).remove(assign);
        if (tree.get(candidate).size() == 1) { // only towards root path
          assignable.add(candidate);
        }
      }
    }

    os.println(sum - values.get(values.size() - 1));
    List<String> result = new ArrayList<>(n);
    for (int i = 1; i <= n; i++) {
      result.add(String.valueOf(assigned[i]));
    }
    os.println(String.join(" ", result));
  }
}

Measured memory_bytes: 49688
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pie acos(-1)
#define loop(i,a,n) for(int i=a;i<n;i++)
#define trav(a,x) for(auto &a:x)
#define vi vector<int>
#define vl vector<ll>
#define pii pair<ll,ll>
#define endl "\n"
#define w 1e5
const int n=1e5+2;

void solve()
{
    int n;
    cin>>n;
    vector<vector<ll>>a(n+1,vector<ll>(3,0));
    vector<vector<ll>>ans(n+1,vector<ll>(3,0));
    loop(i,1,n+1)
    cin>>a[i][0]>>a[i][1]>>a[i][2];
    loop(i,0,3)
    ans[n][i]=a[n][i];
    for(int i=n-1;i>=0;i--)
    {
        loop(j,0,3)
        {
            ans[i][j]=a[i][j]+max(ans[i+1][(j+1)%3],ans[i+1][(j+2)%3]);
        }
    }
    cout<<max(max(ans[1][0],ans[1][2]),ans[1][1]);
}
int main() {
	// your code goes here
	io;
    solve();
	return 0;
}


Measured memory_bytes: 11264
#include <iostream>
#include <map>

using namespace std;

int main(void) {

	int over = 0;
	map<int, int> m;
	int N, n;
	cin >> N;
	decltype(m)::iterator it;
	for (int i = 0; i < N; i++) {
		cin >> n;
		it = m.find(n);
		if (it != m.end()) {
			if (n > m[n]) {
				++m[n];
			} else {
				++over;
			}

		} else {
			// nofound
			m.insert(make_pair(n, 1));
		}
	}

	for (it = m.begin(); it != m.end(); it++) {
		if (it->first > it->second) {
			over += it->second;
		}
	}

	cout << over << endl;
	return 0;
}



Measured memory_bytes: 4736
// (c) midandfeed aka asilentvoice
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define mt make_tuple

// Looping
#define lp(i, n) for(long long i = 0; i < n; i++)
#define rep(i, a, n) for(long long i = a; i < n; i++)
#define dlp(i, n) for(long long i = n; i >= 0; i--)
#define drep(i, n, a) for(long long i = n; i >= a; i--)
	
// Useful variable
#define bft bool found = true
#define bff bool found = false
#define llvmin ll vmin = 1e9
#define llvmax ll vmax = -1e9
#define llans ll ans = 0

// Data structure
#define pii pair<int, int> 			
#define pll pair<long long, long long> 	
#define vi vector<int> 		 		
#define vll vector<long long> 	
#define vpii vector<pii>
#define vpll vector<pll>

// Read Input
#define ssc(x) scanf("%s", &x)
#define isc(x) scanf("%d", &x)
#define llsc(x) scanf("%lld", &x)
#define fsc(x) scanf("%f", &x)

// Output
#define spr(x) printf("%s", x)
#define ipr(x) printf("%d", x)
#define llpr(x) printf("%lld", x)
#define fpr(x) printf("%f", x)
#define nl printf("\n")

// Trash macro
#define so using
#define many namespace
#define tubes std;
#define lelah int
#define nubes main()

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;

so many tubes
lelah nubes
{
	vector<ull> v;
	
	v.pb(2);
	v.pb(1);
	
	rep(i, 2, 88)
	{
		ull x = v[i-1] + v[i-2];
		v.pb(x);
	}
	
	int n;
	isc(n);
	
	llpr(v[n]);
	nl;
		
	
	return 0;
}

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


def main():
    n, m = map(int, input().split())
    data = [list(map(int, input().split())) for _ in range(m)]
    rule = [[] for _ in range(n)]
    for i in range(m):
        rule[data[i][0] - 1].append(data[i][1])
        rule[data[i][1] - 1].append(data[i][0])
    res = rule[0][:]
    ans = 0
    for j in range(n - 1):
        if j + 2 not in res:
            res.extend(rule[j + 1])
        else:
            ans += 1
            res = rule[j + 1][:]
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 73948
#include <iostream>
#include <cstring>

class Vec {
public:
	long* keys;
	int size, memory;
	Vec() {
		memory = 4;
		size = 0;
		keys = new long[memory];
	}
	~Vec() {
		delete[] keys;
	}
	void push_back(long key) {
		size++;
		if (size > memory) {
			memory *= 2;
			long* keys_new = new long[memory];
			memcpy(keys_new, keys, (size - 1) * sizeof(long));
			keys = keys_new;
		}
		keys[size - 1] = key;
	}
	void dump() {
		for (int i = 0; i < size; i++) {
			std::cout << keys[i] << (i == size - 1 ? "" : " ");
		} 
		std::cout << std::endl;
	}
	void clear() {
		if (size > 0) {
			size = 0;
			memory = 4;
			long* keys = new long[memory];
		}
	}
};

int main() {
	int n, q;
	std::cin >> n >> q;
	Vec* v = new Vec[n];
	while(q--) {
		int com, t;
		std::cin >> com >> t;
		if (com == 0) {
			long x;
			std::cin >> x;
			v[t].push_back(x);
		}
		if (com == 1) {
			v[t].dump();
		}
		if (com == 2) {
			v[t].clear();
		}
	}
}


Measured memory_bytes: 13500
#include<bits/stdc++.h>
#include<cctype>
#define For(i,a,b) for(i=(a);i<=(b);++i)
using namespace std;
template<typename T>void read(T &x)
{
    T s=0,f=1;char k=getchar();
    while(!isdigit(k)&&k!='-')k=getchar();
    if(!isdigit(k)){f=-1;k=getchar();}
    while(isdigit(k)){s=s*10+k-'0';k=getchar();}
    x=s*f;
}
const int MAXN=500010;
char a[MAXN];
int main(void)
{
	scanf("%s",a);
	int n=strlen(a)-1;
	int i;
	For(i,0,n-8)putchar(a[i]);
	putchar('\n');
    return 0;
}

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

using namespace std;

typedef long long ll;

int main(){
  int a, b; cin >> a >> b;
  string s; cin >> s;
  bool ans=true;
  for(int j=0;j<a;j++){
    if(s[j]-'0' < 0 || s[j]-'9' > 0) ans=false;
  }
  if(s[a] != '-') ans=false;
  for(int j=a+1;j<a+b+1;j++){
    if(s[j]-'0' < 0 || s[j]-'9' > 0) ans=false;
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
n,x,y = [int(x) for x in input().split()]
d = {x: 0 for x in range(1, n)}
for i in range(1,n):
    for j in range(i+1, n+1):
        d[min(abs(j-i), abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))] += 1
for v in d.values():
    print(v)

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


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

    int start=0;
    int leg=2;
    bool f=true;
    if(str[0]=='L') leg=1;
    if(str[0]=='R') leg=2;
    if(str[0]=='U' || str[0]=='D'){
      for(int i=1; i<str.size(); i++){
	if(str[i-1]==str[i]){
	  f=false;
	  break;
	}
	if(str[i]!='R' && str[i]!='L')continue;

	if(str[i]=='R'){
	  start=i;
	  leg=2;
	}
	if(str[i]=='L'){
	  start=i;
	  leg=1;
	}
      }
    }


    for(int i=start; i<str.size()-1; i++){
      if(str[i]==str[i+1]){
	f=false;
	break;
      }

      if(leg==1){
	if(str[i]=='U'){
	  if(str[i+1]=='L'){
	    f=false;
	    break;
	  }
	}
	
	if(str[i]=='D'){
	  if(str[i+1]=='L'){
	    f=false;
	    break;
	  }
	}
		
	if(str[i]=='R'){
	  f=false;
	  break;
	}
	leg=2;

      }else{
	if(str[i]=='U'){
	  if(str[i+1]=='R'){
	    f=false;
	    break;
	  }
	}
	
	if(str[i]=='D'){
	  if(str[i+1]=='R'){
	    f=false;
	    break;
	  }
	}
		
	if(str[i]=='L'){
	  f=false;
	  break;
	}
	leg=1;
      }

    }

    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k,c=0,i;
  cin>>n>>k;
  long A[n];
  for(i=1;i<=n;i++)
  {
    cin>>A[i];
    if(A[i]>=k) c++;
  }
  cout<<c<<endl;
}


Measured memory_bytes: 1024
H, W = map(int, input().split())
S = [input() for i in range(H)]
count = 0
for i in range(H):
    for j in range(W):

        # デフォルトが白色のキャンバスにおいて、square1001君は指定の場所を 黒色にしたい。
        # しかし、 "." の場合はキャンバスを白色 に染めるという操作のため、スキップして問題ない
        if S[i][j] == ".": continue

        # 黒色に染めたい場所がある（S[i][j] == "#"）時は、
        # 上下左右のマスを調べて、１つでも "#" があれば良い（上下左右に隣接する 2つのマスを選び黒く塗らなくてはならないから）

        # 左、上、右、下
        # ex. (1,1)
        # (0,1), (1,2), (2,1), (1,0)
        dx = [-1, 0, 1, 0]
        dy = [0, -1, 0, 1]
        is_exist = False

        # H = 1, W = 10
        # . . . . . . . # # #
        # => "Yes"
        # (x,y)
        # (0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (6, 0), (7, 0), (8, 0), (9, 0), (10, 0)
        # 上と下は定義されていないので範囲外
        # (0, 0)は左が範囲外、(10,0)は右が範囲外
        # [ ['...'], ['###'] ]
        # i = 0, j = 0 => '...' S[i][j][0], S[i][j][1]


        for dir in range(4):
            x = i + dx[dir] # x座標
            y = j + dy[dir] # y座標

            # (0, 1)や(1,0)だと (-1,1)や(1,-1) で範囲外を見てしまうので、そこはスキップさせる
            if x < 0 or y < 0 or H <= x or W <= y: continue
            if S[x][y] == "#": is_exist = True
        
        # ある場所 (x, y) の上下左右に黒色に染めたいマスがなかった場合、条件を満たさないため No を出す
        if is_exist == False:
            print("No")
            exit(0) # プログラムを強制終了
print("Yes")

        # if H == 1 or W == 1:
        #     if i == 0 and H == 1 and S[i][j] != S[i][j+1]:
        #         count += 1
        #     elif j == 0 and W == 1 and S[i][j] != S[i+1][j]:
        #         count += 1
        # elif H >= j-2 and W >= i-2:
        #     if S[i][j] != S[i][j+1] or S[i][j] != S[i+1][j]:
        #         count += 1

# if count == 0:
#     print("Yes")
# else:
#     print("No")

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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  std::string s;
  std::cin >> s;

  for (const auto i : s) {
    if (i == '7') {
      std::cout << "Yes" << std::endl;
      return 0;
    }
  }
  std::cout << "No" << std::endl;
  return 0;
}


Measured memory_bytes: 3628
import java.math.BigDecimal;
import java.util.*;
public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        final int n = sc.nextInt();
        final int k = sc.nextInt();
        Double d = 0.0;
        for (int i = 1; i <= n; i++) {
            double temp = (1.0d / n);
            int t = i;
            while (t < k) {
                t *= 2;
                temp /= 2;
            }
            d += temp;
        }
        System.out.print(BigDecimal.valueOf(d).toPlainString());
    }
}

Measured memory_bytes: 25428
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
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;}


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

//INSERT ABOVE HERE
signed main(){
  Int n,a,b;
  cin>>n>>a>>b;
  if((b-a)%2==0){
    cout<<(b-a)/2<<endl;
  }else{
    Int ans=LLONG_MAX;
    for(Int i=0;i<2;i++){
      Int res=a;
      Int x=1,y=b-a;
      assert((y-x)%2==0);
      chmin(ans,res+(y-x)/2);
      a=n-a+1;
      b=n-b+1;
      swap(a,b);
    }
    cout<<ans<<endl;
  }
  return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll S;
map<ll,int> M;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	ll cur=0;
	M[0]=1;
	ll ret=0;
	cin>>N;
	FOR(i,N) {
		cin>>x;
		cur+=x;
		ret+=M[cur];
		M[cur]++;
	}
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 12800
import Data.List
import Control.Applicative

main = do
  _ <- getLine
  nums <- map read . words <$> getLine :: IO [Int]
  show' [x | x <- nums, f x]
  where
    show' [] = putStrLn "APPROVED"
    show' xs = putStrLn "DENIED"
    f x | x `mod` 2 == 1 = False
        | x `mod` 3 == 0 = False
        | x `mod` 5 == 0 = False
        | otherwise = True


Measured memory_bytes: 892
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n, k = map(int, input().strip().split())
  Hs   = list(map(int, input().strip().split()))
  Hs.sort(reverse=True)
  print(sum(Hs[k:]))

if __name__=='__main__':
  main()

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

using namespace std;



void solve()
{
  string str;
  cin >> str;
  if (str.substr(0, 3) == string(3, str[0]) || str.substr(1, 3) == string(3, str[1])) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}

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

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

int main(void){
	float a,b,c,d,e,f;
	while(cin>>a>>b>>c>>d>>e>>f){
		float delta = -a*e+b*d;
		float y = (-a*f+c*d)/delta;
		float x = (c-b*y)/a;
		printf("%.3f %.3f\n",x,y);
	}
}

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

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

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

    sort(num.begin(), num.end());

    int maxnum = num[N-1];
    vector <int> count_num(maxnum,0);

    for(int i=0; i<N; i++){
        count_num [num[i] - 1] ++;
    }

    sort(count_num.begin(), count_num.end());

    int zerocount = 0;
    int ans=0;
    for(int i=0; i<maxnum; i++){
        if(count_num[i] == 0){
            zerocount++;
        }
    }
    if(maxnum-zerocount <= K){
        cout << 0 << endl;

    }
    else{
        for(int i=zerocount; i<=maxnum-K-1; i++){
            ans += count_num[i];
        }
        cout << ans << endl;
    }
    
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=25;
char s[MAXN];
int l,vis[MAXN],e;
long long ans;
void dfs(int x){
	if(x>=l){
		vis[++e]=l;
		for(int i=1;i<=e;i++){
			long long ret=0;
			for(int j=vis[i-1]+1;j<=vis[i];j++)
				ret=ret*10+(s[j]-'0');
			ans+=ret;
		}
		vis[e--]=0;
		return ;
	}
	dfs(x+1);
	vis[++e]=x;
	dfs(x+1);
	vis[e--]=0;
}
int main(){
	scanf("%s",s+1);
	l=strlen(s+1);dfs(1);
	printf("%lld\n",ans);
}

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

int gcd(int a, int b) {
	if (a > b) {
		swap(a, b);
	}
	while (1) {
		int c = b % a;
		if (c == 0) {
			return a;
		}
		else {
			b = a;
			a = c;
		}
	}
	return 1;
}

int sk(int a, int b, int c) {
	int m = a;
	m = min(m, b);
	m = min(m, c);
	while (1) {
		if (a % m == 0 && b % m == 0 && c % m == 0) {
			break;
		}
		else {
			int y = gcd(a, b);
			m = gcd(y, c);
		}
	}
	return m;
}

int main() {
	int K;
	cin >> K;
	long long s=0;
	for (int i = 1; i <= K; ++i) {
		for (int j = 1; j <= K; ++j) {
			for (int k = 1; k <= K; ++k) {
				s += sk(i, j, k);
			}
		}
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 3216
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
	class Program
	{
		static void Main(string[] args)
		{
			string N = Console.ReadLine();
			string A = Console.ReadLine();
			string B = Console.ReadLine();
			string C = Console.ReadLine();
			bool check = true;
			int n = 0;
			try
			{
				n = int.Parse(N);
			}
			catch
			{
				Console.WriteLine("Ｎは1～100までの整数です。");
				check = false;
			}
			if (n < 1 || n > 100)
			{
				Console.WriteLine("Ｎは1～100までの整数です。");
				check = false;
			}
			if(A.Length != n)
			{
				Console.WriteLine("Ａの文字列の長さはＮの整数と等しくします。");
				check = false;
			}
			if (B.Length != n)
			{
				Console.WriteLine("Ｂの文字列の長さはＮの整数と等しくします。");
				check = false;
			}
			if (C.Length != n)
			{
				Console.WriteLine("Ｃの文字列の長さはＮの整数と等しくします。");
				check = false;
			}
			if(	check)
			{
				int count = 0;
				for (int i = 0; i < int.Parse(N); i++)
				{
					if (A.Substring(i, 1) != B.Substring(i, 1) && A.Substring(i, 1) == C.Substring(i, 1))
					{
						count++;
					}
					else if (A.Substring(i, 1) == B.Substring(i, 1) && A.Substring(i, 1) != C.Substring(i, 1))
					{
						count++;
					}
					else if (B.Substring(i, 1) == C.Substring(i, 1) && B.Substring(i, 1) != A.Substring(i, 1) && C.Substring(i, 1) != A.Substring(i, 1))
					{
						count++;
					}
					else if (A.Substring(i, 1) == B.Substring(i, 1) && A.Substring(i, 1) == C.Substring(i, 1))
					{
					}
					else
					{
						count = count + 2;
					}
			}
			Console.Write("{0}", count);
			}
			Console.ReadKey();
		}
	}
}


Measured memory_bytes: 13268
N = int(input())
zoro = 0
ans = 'No'
for _ in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        zoro += 1
        if zoro >= 3:
            ans = 'Yes'
    else:
        zoro = 0

print(ans)


Measured memory_bytes: 9156
#include "bits/stdc++.h"
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i, n) for (int i = (int)(n) - 1; i >= 0; i--)
#define REPS(i, n) for (int i = 1; i <= (int)(n); i++)
#define RREPS(i, n) for (int i = (int)(n); i > 0; i--)
#define mp make_pair
#define pb(a) push_back(a)
typedef long long ll;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> x(N);
  REP(i, N) cin >> x[i];
  int ans = 1e9;
  REP(i, N - K + 1) {
    if (x[i] <= 0 && x[i + K - 1] >= 0) {
      ans = min(ans, x[i + K - 1] - x[i] + min(-x[i], x[i + K - 1]));
    }
    else{
      ans = min(ans, max(abs(x[i]), abs(x[i + K - 1])));
    }
  }
  cout << ans << endl;
  return 0;
}


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

#pragma GCC optimize "O3"
#define rep(i,a,n) for(int i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const ll powll = 1LL<<1;

int main(void){
    int s, w;
    cin >> s >> w;
    if(w >= s) cout << "unsafe\n";
    else cout << "safe\n";
}

Measured memory_bytes: 3636
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val x = sc.nextInt()

  val max = x
  
  var count = 0L
  var sum = 0L
  for (i in 1..x) {
    sum += i
    count++
    if (x <= sum) {
      break
    }
  }

  println(Math.min(max.toLong(), count))

}

Measured memory_bytes: 36424
//
//  main.cpp
//  五个菜
//
//  Created by 姚欣 on 2020/7/29.
//  Copyright © 2020 任奕霏. All rights reserved.
//

#include <iostream>
using namespace std;
int main()
{
    int a[5],i,b = 10,c,t = 0;
    for(i = 0; i < 5; i ++)
    {
        cin >> a[i];
        if(a[i] % 10 != 0)
        {
            t += (a[i] / 10 + 1) * 10;
            c = a[i] % 10;
            if(c < b)
                b = c;
        }
        else
            t += a[i];
    }
    t = t - 10 + b;
    cout << t << endl;
    return 0;
}


Measured memory_bytes: 3572
N,M=map(int,input().split())
H=list(map(int,input().split()))
k=list(range(1,N+1))
d=dict(zip(k,H))
arr=[1]*N
for _ in range(M):
    a,b=map(int,input().split())
    if d[a]>d[b]:
        arr[b-1]=0
    elif d[a]<d[b]:
        arr[a-1]=0
    else:
        arr[a-1]=0
        arr[b-1]=0
print(sum(arr))

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



int main() {
    int a, b;
    cin >> a >> b;
    
    if(a >= 13)
        cout << b << endl;
    else if (a >= 6 && a <= 12)
        cout << b / 2 << endl;
    else
        cout << 0 << endl;
    
    
    return 0;
}


Measured memory_bytes: 3528
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-04-18 18:43:01
                2020-04-18 19:31:28 余計なものを取り除いた版
*/

#include <bits/stdc++.h>
using namespace std;

#define MOD 1000000007

typedef unsigned long ul;

map<int, ul> memo;

ul fib(int n)
{
    if (n >= 2 && memo[n] > 0) return memo[n];
    else if (n >= 2) return memo[n] = fib(n-1)%MOD + fib(n-2)%MOD;
    else return memo[n];
}

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

    memo[-1] = 0;   //上ることができない
    memo[0] = 1;    //そのままジャンプするだけ
    memo[1] = 1;

    ul ans;
    if (m == 0) {
        ans = fib(n)%MOD;
    } else {
        ans = (fib(a[0]-1)*fib(n-a[m-1]-1))%MOD;
        for (int i = 1; i < m; i++) {
            int A = a[i] - a[i-1];
            ans *= fib(A-2);
            ans %= MOD;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 15872
#include <cstdio>
using namespace std;
int main(){
    int N; scanf("%d", &N);
    int T[N], sum = 0;
    for(int i = 0; i < N; i++) {
        scanf("%d", &T[i]);
        sum += T[i];
    }
    int M; scanf("%d", &M);
    int P, X;
    for(int i = 0; i < M; i++) {
        scanf("%d", &P);
        scanf("%d", &X);
        printf("%d\n", sum-T[P-1]+X);
    }
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n) ; i++)
#define rrep(i,n) for(int i = n-1; i >= 0 ; i--)
typedef long long ll;
constexpr auto INFI = 2147483647;
const ll INFL = 9223372036854775807;

int main(){
    ll a;
    string b;
    cin >> a >> b;
    b.erase(b.find('.'), 1);
    int b_int = atoi(b.c_str());
    cout << ((a * b_int)/100) << endl;

  return 0;
}

Measured memory_bytes: 3588
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0
inf = float("inf")

a = k()
b = k()
p = []

p.append(a)
p.append(b)
for i in range(1,4):
    if i not in p:
        print(i)


Measured memory_bytes: 10104
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
template<class Type> void join(const Type &a){for(auto elem:a)cout<<elem<<' ';cout<<endl;}

int main(){
	int a,b;
	cin>>a>>b;
	
	if(a<10 and b<10) cout<<a*b<<endl;
	else cout<<-1<<endl;
}

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

int main() {
    int k;
    cin >> k;
    queue<long long int> q;
    for(int i = 1; i <= 9; ++i) q.push(i);
    int cnt = 1;
    while(1) {
        long long int x = q.front();
        q.pop();
        if(cnt == k) {
            cout << x << '\n';
            return 0;
        }
        for(int i = max(x%10-1, 0ll); i <= min(x%10+1, 9ll); ++i) {
            q.push(x*10+i);
        }
        cnt++;
    }

    return 0;
}


Measured memory_bytes: 1792
using System;

class Rectangle
{
    public static void Main()
    {
        while (true)
        {
            string[] s = Console.ReadLine().Split();

            int H = int.Parse(s[0]);
            int W = int.Parse(s[1]);

            if(H == 0&& W == 0)
            {
                break;
            }

            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    Console.Write("#");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n; cin>>n;
  vector<ll> t(n);
  rep(i,n) cin>>t[i];
  ll ans=1;
  rep(i,n){
    ans = LCM(ans, t[i]);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
from itertools import *
N,M,Q = map(int,input().split())
abcd = [list(map(int,input().split())) for q in range(Q)]
print(max(sum(d for a,b,c,d in abcd if i[b-1]-i[a-1]==c) for i in combinations_with_replacement(range(M),N)))

Measured memory_bytes: 9220
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  for (int i = 1; i <= b; i++) {
    if (i * a % b == c) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int a,b;
	scanf("%d%d",&a,&b);
	if((a+b)>(a-b)){
		if((a+b)>(a*b)) printf("%d",a+b);
		else printf("%d",a*b);
	}else if((a-b)>(a*b)) printf("%d",a-b);
	else printf("%d",a*b);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#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 rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

	int A,B; cin >> A >> B;
	int cnt = 0; int tap = 1;
	while(tap < B) {
		tap += A - 1;
		cnt++;
	}
	cout << cnt << endl;

	return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

template<typename T> inline void getint(T &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

ll N, X, ans = 0;

inline ll calc(const ll &a, const ll &b){
	return !b ? -a : calc(b, a % b) + (a / b * b << 1);
}

int main(){
	getint(N), getint(X);
	return printf("%lld\n", calc(X, N - X) + N), 0;
}

Measured memory_bytes: 256
n,x,y = (int(x) for x in input().split())
count = {v:0 for v in range(1,n)}

for i in range(1,n+1):
  for j in range(i+1,n+1):
    if j <= x or y <= i:
      count[j-i] += 1
    else:
      c1 = j-i
      c2 = abs(i-x) + abs(j-y) + 1
      count[min(c1,c2)] += 1
      
for v in count.values():
	print(v)

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

int main()
{
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i, n) cin >> p.at(i);

    sort(p.begin(), p.end(), greater<int>());

    int answer = p.at(0) / 2;
    for (int i = 1; i < (int)n; i++)
        answer += p.at(i);

    cout << answer << endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
s = [sum(list(map(lambda x: 2**(int(x) - 1), input().split()[1:]))) for _ in range(m)]
p = list(map(int, input().split()))

ans = 0
for i in range(2**n):
    cnt = 0
    for j in range(m):
        if sum([((i & s[j]) >> k) % 2 for k in range(n)]) % 2 == p[j]:
            cnt += 1
    if cnt == m:
        ans += 1
print(ans)

Measured memory_bytes: 41968
//atcoder b - frog2
#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int n,k;
	cin>>n>>k;
	int h[n];
	for(int i=0;i<n;i++){
		cin>>h[i];
	}vector<int>dp(n,INT_MAX);
	dp[0]=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<=i+k;j++){
			if(j<n)dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
		}
	}cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000
#define long long long // for codeforces

int dp[55][55];
int pr[55][55];

int main(){
  int n,d;
  cin>>n>>d;
  vector<vector<int>> p(n,vector<int>(d));
  rep(i,n) rep(j,d) cin>>p[i][j];

  fill(dp[0], dp[d+1], INF);
  rep(i,n) dp[d][i] = 0;

// ???????????????????????????????????¨?????????

  int tot = 0;
  for(int i = d; i>0; i--){
    int mn = INF;
    rep(j,n) mn = min(mn, p[j][i-1]);
    tot += mn;
    rep(j,n) if(dp[i][j]<INF){
      rep(k,n) if(p[k][i-1] == mn){
        int nv = dp[i][j] + (j!=k);
        if(dp[i-1][k] > nv){
          dp[i-1][k] = nv;
          pr[i-1][k] = j;
        }
      }
    }
  }

  int av = INF, ai = -1;
  rep(i,n) if(dp[0][i] < av){ av = dp[0][i]; ai = i; }

  vector<int> ans;
  rep(i,d){
    ans.pb(ai+1);
    ai = pr[i][ai];
  }

  cout << tot << " " << av << "\n";
  rep(i,d) cout << ans[i] << "\n";


  return 0;
}

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

using namespace std;

typedef long long ll;

#ifdef RED
  mt19937 rnd(228);
#else
  mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

const int N = (int)1e6 + 5;

int n;

int main() {
#ifdef RED
  freopen("a.in", "r", stdin);
#endif
  ios_base :: sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    cnt += i % 2;
  }
  cout << fixed << setprecision(10) << (double)cnt / n;
  return 0;
}


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

using namespace std;

struct st {
	long long yen, cans;	
};

int main() {
	long long n, m;
	cin >> n >> m;
	vector<st> myvec(n);
	for (int i = 0; i < n; ++i) {
		cin >> myvec[i].yen >> myvec[i].cans;
	}
	sort(myvec.begin(), myvec.end(), [](const st& n1, const st& n2) {
		return n1.yen < n2.yen;
	});
	
	long long ans = 0;
	
	for (int i = 0; i < n; ++i) {
		long long y = myvec[i].yen, c = myvec[i].cans;
		if (c >= m) {
			ans += m * y;
			cout << ans;
			break;
		}
		m -= c;
		ans += c * y;
	}
	return 0;
}

Measured memory_bytes: 1792
def next(t, f):
    if t % f: return t + f - (t%f)
    else: return t
def time(t, i):
    if i == n-1: return t
    else:
        c, s, f = info[i]
        if t <= s: return time(s+c, i+1)
        else: return time(next(t, f)+c, i+1)
n = int(input())
info = [tuple(map(int, input().split())) for _ in range(n-1)]
for i in range(n):
    print(time(0, i))

Measured memory_bytes: 3444
#include <stdio.h>
int main(void){

    int W,H,i,j,k;
    while(1){   
        scanf("%d %d",&H,&W);{
            if(W==0&&H==0)
            break;
            else{
                    {
                        for (i=1;i<=W;i++){
                        printf("#");
                        }
                        printf("\n");
                    }     
   
                        for(j=1;j<=H-2;j++){
                        printf("#");
       
                            for(k=1;k<W-1;k++){
                            printf(".");
                            }
                        printf("#\n");
                        }
                            for (i=1;i<=W;i++){
                            printf("#");
                            }
                            printf("\n"); 
                            }
            printf("\n");
        }
   }
   
    return 0;
}




Measured memory_bytes: 2100
L=int(input())
A=int(input())
B=int(input())
C=int(input())
D=int(input())
if A//C>=B//D:
    if A%C==0:
        print(L-A//C)
    else:
        print(L-A//C-1)
else:
    if B%D==0:
        print(L-B//D)
    else:
        print(L-B//D-1)


Measured memory_bytes: 5588
//IN THE NAME OF GOD;
//Test By Dev-C++5.11
#include<bits/stdc++.h>
#define ll  long long
#define isc ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ld long double
#define ss string
#define ww while
#define vl vector<ll>
#define pb push_back
#define in insert
#define vec vector
#define itr iterator
#define gt goto
#define rep(i,n,j) for(ll i=n;i<j;i++)
#define tep(i,n,j) for(ll i=n;i>=j;i--)
#define co(n) cout << n ;
#define pll pair<ll,ll>
#define bft bool f=true
#define bff bool f=false 
using namespace std;


ll kmm(ll a, ll b) {
	return(a*b) / __gcd(a, b);
}

const ll mod = 1e9 + 7;
const ll MAXN = 1e3+5;
ll modpower(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return modpower((x*x)%mod,n/2);
    else
        return (x*modpower((x*x)%mod,(n-1)/2))%mod;

}

void solve(){
	ll n;
  	cin >> n;
	cout << kmm(n,2);
}

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


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

const int Mod = 998244353;

int n;
int cnt[100005];

int main() {
	scanf("%d", &n);
	int d;
	scanf("%d", &d);
	if (d) {
		puts("0");
		return 0;
	}
	cnt[0] = 1;
	int mxd = 0;
	for (int i = 2; i <= n; i++) {
		scanf("%d", &d);
		if (!d) {
			puts("0");
			return 0;
		}
		mxd = max(mxd, d);
		cnt[d]++;
	}
	int ans = 1;
	for (int i = 1; i <= mxd; i++) {
		for (int j = 0; j < cnt[i]; j++) {
			ans = 1ll * ans * cnt[i - 1] % Mod;
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 640
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))}
const main=()=>{
  let [a,b,c,d]=tnn(4)
  to(d==1?1:0)
}
main()

Measured memory_bytes: 7500
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
//#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
#define mod 1000000000
//#define mod 998244353
#define inf 1000000000
#define pr1(a) cout << a << "\n"
#define pr2(a,b)cout << a <<  " " <<b<< "\n"
#define pr3(a,b,c) cout << a <<" " << b << " " << c << "\n"

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

int gcd(int a, int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
const int maxn = 2*1e5 + 10;


void solve(){
    int r;
    cin >> r;

    double ans = 2.0*pi*(double)r;

    cout << fixed << setprecision(12) << ans << endl;
    

} 

int main() 
{   
    IOS;
    int t = 1;
    // cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 


Measured memory_bytes: 3800
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

n, W = na()
vmax = 10**5
inf = 10**11
dp = [[inf] * (vmax+1) for _ in range(n)]
#dp[ni][vi] viを超える最小のweight
w, v = na()
for i in range(0, v+1):
    dp[0][i] = w
for i in range(1, n):
    w, v = na()
    for j in range(v+1):
        dp[i][j] = min(dp[i-1][j], w) #選ぶor選ばない
    for j in range(v+1, vmax+1):
        dp[i][j] = min(dp[i-1][j], dp[i-1][j-v] + w) #選ぶor選ばない
#print(dp[n-1][:20])
ans = 0
for i, w in enumerate(dp[n-1]):
    if w <= W:
        ans = max(ans, i)
print(ans)


Measured memory_bytes: 119884
# https://atcoder.jp/contests/abc126/tasks/abc126_e
class UnionFindWithType
  attr_reader :types
  def initialize(size)
    @rank = Array.new(size, 0)
    @parent = Array.new(size, &:itself)
    @types = size
  end

  def unite(id_x, id_y)
    x_parent = get_parent(id_x)
    y_parent = get_parent(id_y)
    return if x_parent == y_parent
    @types -= 1
    if @rank[x_parent] > @rank[y_parent]
      @parent[y_parent] = x_parent
    else
      @parent[x_parent] = y_parent
      @rank[y_parent] += 1 if @rank[x_parent] == @rank[y_parent]
    end
  end

  def get_parent(id_x)
    @parent[id_x] == id_x ? id_x : (@parent[id_x] = get_parent(@parent[id_x]))
  end
end

N, M = gets.split.map(&:to_i)
uf = UnionFindWithType.new(N)
M.times do
  uf.unite(*gets.split.take(2).map { |s| s.to_i - 1 })
end
p uf.types

Measured memory_bytes: 3324
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout<<v<<endl;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;


int main(){
    ll N;
    cin >> N;
    vector<string> S(N);
    ll ans=0;
    ll coua=0;
    ll coub=0;
    ll ex=0;
    for(ll i=0;i<N;i++)cin>>S[i];
    for(ll i=0;i<N;i++){
        ll n=S[i].size();
        for(ll j=1;j<n;j++){
            if(S[i][j-1]=='A'&&S[i][j]=='B')ans++;
        }
        if(S[i][0]=='B'&&S[i][n-1]!='A')coub++;
        else if(S[i][n-1]=='A'&&S[i][0]!='B')coua++;
        else if(S[i][0]=='B'&&S[i][n-1]=='A')ex++;
    }
    ll coua2=coua,coub2=coub;
    if(N==1){print(ans) return 0;}
    if(ex==0){
        print(ans+min(coua,coub))
        return 0;
    }
    ans+=ex-1;
    if(coua2&&coub2){
        coua2--;ans++;coub2--;ans++;ans+=min(coua2,coub2);
    }
    else if(coua2==0&&coub2){
        ans++;
    }
    else if(coub2==0&&coua2){
        ans++;
    }

    print(ans)


    return 0;
}


Measured memory_bytes: 768
import math
x=int(input())
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return n
for i in range(x,x+10000):
    tmp=is_prime(i)
    if tmp:
        print(tmp)
        exit()

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

int a[1007];

signed main(){

	int n,m;
	cin >> n >> m;

	for(int i = 0; i < m; i++){
		int b;
		cin >> b;
		a[b] = 1;
	}

	int cnt = 0;
	for(int i = 1; i <= m; i++){
		if(a[i] == 0) cnt++;
	}
	cout << cnt << endl;

	return 0;
}



Measured memory_bytes: 3116
code = """

# distutils: language=c++
# distutils: include_dirs=[/home/USERNAME/.local/lib/python3.8/site-packages/numpy/core/include, /opt/ac-library]
# cython: boundscheck=False
# cython: wraparound=False

from libcpp cimport bool
from libc.stdio cimport getchar, printf
from libcpp.string cimport string
from libcpp.vector cimport vector
cdef extern from "<atcoder/dsu>" namespace "atcoder":
    cdef cppclass dsu:
        dsu(int n)
        int merge(int a, int b)
        bool same(int a, int b)
        int leader(int a)
        int size(int a)
        vector[vector[int]] groups()

cdef class Dsu:
    cdef dsu *_thisptr
    def __cinit__(self, int n):
        self._thisptr = new dsu(n)
    cpdef int merge(self, int a, int b):
        return self._thisptr.merge(a, b)
    cpdef bool same(self, int a, int b):
        return self._thisptr.same(a, b)
    cpdef int leader(self, int a):
        return self._thisptr.leader(a)
    cpdef int size(self, int a):
        return self._thisptr.size(a)
    cpdef vector[vector[int]] groups(self):
        return self._thisptr.groups()

cpdef inline vector[int] ReadInt(int n):
    cdef int b, c
    cdef vector[int] *v = new vector[int]()
    for i in range(n):
        c = 0
        while 1:
            b = getchar() - 48
            if b < 0: break
            c = c * 10 + b
        v.push_back(c)
    return v[0]

cpdef inline vector[string] Read(int n):
    cdef char c
    cdef vector[string] *vs = new vector[string]()
    cdef string *s
    for i in range(n):
        s = new string()
        while 1:
            c = getchar()
            if c<=32: break
            s.push_back(c)
        vs.push_back(s[0])
    return vs[0]

cpdef inline void PrintLongN(vector[long] l):
    cdef int n = l.size()
    for i in range(n): printf("%ld\\n", l[i])

cpdef inline void PrintLong(vector[long] l):
    cdef int n = l.size()
    for i in range(n): printf("%ld ", l[i])
"""


import os, sys, getpass

if sys.argv[-1] == 'ONLINE_JUDGE':
    code = code.replace("USERNAME", getpass.getuser())
    open('atcoder.pyx','w').write(code)
    os.system('cythonize -i -3 -b atcoder.pyx')
    sys.exit(0)


from atcoder import Dsu, ReadInt

def main():
    N,M = ReadInt(2)
    dsu = Dsu(N)
    for i in range(M):
        a,b = ReadInt(2)
        dsu.merge(a-1,b-1)
    print(len(dsu.groups())-1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 27024