akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define N_PRIME 1000000007
#define ll int64_t

#define N 300000 

bool is_prime[N];

void calc(){
    int n;
    cin >> n;
    int count = 0;
    if( n == 0 )exit(0);
    for(int p = n +1 ; p <= 2 * n ; p++ ){
        if( is_prime[p] )count++;
    }
    cout << count << endl;
}

int main(void){
    for(int i = 0 ;i < N ; i++ ){
        is_prime[i] = true;
    }
    is_prime[0] = is_prime[1] = false;
    
    for(int i = 2 ; i < N ; i++ ){
        if( is_prime[i] ){
            for(int j = i + i ; j < N ; j += i ){
                is_prime[j] = false;
            }
        }
    }
    
    
    while(true)calc();
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <algorithm>
using namespace std;

typedef long long ll;


int main()
{
    int N, K, a, b;
    cin >> N >> K;
    for(int i = 0; i < K; i++) {
        cin >> a >> b;
        a--; b--;
        int mid = (N - 1) / 2;
        if(a > mid) {
            a = mid * 2 - a;
            if(N % 2 == 0) {
                a++;
            }
        }
        if(b > mid) {
            b = mid * 2 - b;
            if(N % 2 == 0) {
                b++;
            }
        }

        int c = (a > b) ? b : a;
        cout << (c % 3 + 1) << endl;
    }
}

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

const ll MOD = 1e9+7;

vector<vector<ll> > dp(1010,vector<ll>(1010));
int h,w;

int main(){
    cin >> h >> w;
    vector<string> a(1010);
    for(int x=1;x<=h;x++){
        string s; cin >> s;
        a[x] = '#' + s + '#';
    }
    a[h+1] = '#'*(w+1);

    dp[1][1] = 1;
    for(int x=1;x<=h;x++){
        for(int y=1;y<=w;y++){

            if(a[x][y]=='#') continue;

            int right = a[x][y+1], down = a[x+1][y];
            if(right=='#' && down=='#'){
                continue;
            }

            if(right=='.'){
                dp[x][y+1] += dp[x][y];
                dp[x][y+1] %= MOD;
            }

            if(down=='.'){
                dp[x+1][y] += dp[x][y];
                dp[x+1][y] %= MOD;
            }
        }
    }
    cout << dp[h][w] << endl;
}

Measured memory_bytes: 13592
#include<stdio.h>

int main()
{
	int n,k;
	scanf("%d %d", &n, &k);
	int result = 1;
	for(int i = 0; i < n; i++)
	{
		if(result < k) result *= 2;
		else result += k;
	}
	printf("%d\n", result);
	return 0;
}

Measured memory_bytes: 1728
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
a, b, k = [int(num) for num in lines.pop(0).split(" ")]
count = 0
for n in range(min(a, b), 0, -1):
    if (a % n == 0) and (b % n == 0):
        count += 1
    if count == k:
        break
print(n)


Measured memory_bytes: 9168
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;	
	for(int i=0;i<n;i++){
		cout<<s[i]<<t[i];
	}
	cout<<"\n";
}	

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

	int t=1;       
	// cin >> t;
	while(t--){
		solve();
	}
	return 0;
}

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

int main(){
  int a, b, c;
  cin >> a >> b >> c;

  if(a == b && b == c) cout << "No" << endl;
  else if(a == b || a ==c || b == c) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin.bytes().map(|c| c.expect("faild") as char).skip_while(|c| c.is_whitespace()).take_while(|c| !c.is_whitespace()).collect();
    token.parse().ok().expect("faild parse")
}
fn main(){
    loop{
        let a: i32 = read();
        let b: i32 = read();
        if a==0 && b==0{
            break;
        }
        for _ in 0..a{
            for _ in 0..b{
                print!("#");
            }
            println!("");
        }
        println!("");
    }
}


Measured memory_bytes: 1056
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S[] = new String[N];
    String answer ="Three";
    for(int i=0;i<N;i++){
      if(sc.next().equals("Y")){
        answer="Four";
      }
    }
    System.out.println(answer);

  }
  

  
}

Measured memory_bytes: 21844
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int n;
  cin >> n;
  string s[n];
  rep(i,n){
    cin >> s[i];
    sort(s[i].begin(),s[i].end());
  }
  ll ans=0;
  sort(s,s+n);
  map<string,ll> m;
  rep(i,n)m[s[i]]++;
    for (auto i=m.begin();i!=m.end();i++){
      ll x=i->second;
      ans+=x*(x-1)/2;
    }  
  cout << ans << endl;
return 0;}

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

using namespace std;

int A,B,C,D,N,M;
//ll A,B,C,D,N,M,K;
string in;
int T;
int main() {
  ios::sync_with_stdio(false);
  cin >> A >> B >> T;
  cout << (T / A)*B;


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    int n,a[100001]={},b,ans=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>b;
        if(b>100000){
            ans++;
        }else{
            a[b]++;
        }
    }
    for(int i=0;i<100001;i++){
        if(a[i]>=i){
            ans+=a[i]-i;
        }else{
            ans+=a[i];
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  vector<bool> table(4,false); // 1,9,7,4
  for(int i = 0; i<4; i++) {
    int a; cin>>a;
    if(a==1) table[0] = true;
    else if(a==9) table[1] = true;
    else if(a==7) table[2] = true;
    else if(a==4) table[3] = true;
  }

  string ans = "YES";
  for(auto v: table) {
    if(!v) {
      ans = "NO";
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <vector>
#include <bitset>
#include <queue>
using namespace std;

int main(){
    int x, a, b;
    cin >> x >> a >> b;
    int difa = abs(x-a);
    int difb = abs(x-b);
    if(difa < difb){
        cout << "A" << endl;
    }else{
        cout << "B" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>

using namespace std;

int main()
{
	long int n;
	scanf("%ld", &n);

	double ceilodd = sqrt(n*1.0);

	bool divisable = false;

	printf("%ld:", n);

	while (n % 2 == 0)
	{
		printf(" 2");
		n /= 2;
	}
	if (n == 1)goto goal;

	while (n % 3 == 0)
	{
		printf(" 3");
		n /= 3;
	}
	if (n == 1)goto goal;

	double tmp;

	for (long int i = 5; i <= ceilodd; i += 2)
	{
		divisable = false;
		
		tmp = sqrt(1.0*i);
		for (long int j = 3; j <= tmp; j += 2)
		{
			if (i%j == 0)
			{
				divisable = true;
				break;
			}
		}

		if (divisable == false)
		{
			while (n%i == 0)
			{
				printf(" %ld", i);
				n /= i;
			}
			if (n == 1)goto goal;
		}

	}
	
	if (n != 1)
		printf(" %ld", n);

	goal:

		printf("\n");
	
	return 0;
}

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

int main(void){
  int loop,op,num,index;
  cin>>num>>loop;
  vector<vector<int>> vec(num);

  for(int i=0;i<loop;i++){
    cin>>op;
    switch(op){
      case 0:
      cin>>index>>num;
      vec.at(index).push_back(num); break;
      case 1:
      cin>>index;
      if(vec.at(index).size()==0){
        cout<<endl;
        break;
      }
      for(int i=0;i<vec.at(index).size()-1;i++){
        cout<<vec.at(index).at(i)<<" ";
      }
      cout<<vec.at(index).at(vec.at(index).size()-1);
      cout<<endl; break;
      case 2:
      cin>>index;
      vec.at(index).clear(); break;
    }
  }
  return 0;
}



Measured memory_bytes: 5764
#include <stdio.h>
int max(int n,int m){
    if(n>m) return n;
    else return m;
}
int min(int n,int m){
    if(n<m) return n;
    else return m;
}
int main(void){
    int a,b,c,i;
    scanf("%d%d%d",&a,&b,&c);
    for(i=a;i<=min(b,a+c-1);i++) printf("%d\n",i);
    for(i=max(b-c+1,a+c);i<=b;i++) printf("%d\n",i);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
 
ll MOD = 1000000007;
ll INF =1<<29;
ll dp[100100];
 
int main() {
     int n,k;
     cin >> n >> k;
     string s;
     cin >>s;
     s[k-1] =tolower(s[k-1]);
     cout << s <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define mp(a,b) make_pair((a),(b))
#define eq ==

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> pii;

// →↑←↓
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};


const double EPS = 1e-9;

int s2i(string s){
    stringstream ss;
    ss << s;
    int ret;
    ss >> ret;
    return ret;
}
int main(){
    while(true){
        string target,input;
        cin >> target >> input;
        if(target == "0") break;
        int itarget = s2i(target);

        if(input.length() == 1){
            int iinput = s2i(input);
            if(iinput <= itarget){
                cout << iinput << " " << iinput << endl;
            }else{
                cout << "error" << endl;
            }
        }else{
            int N = input.size()-1;

            int maxi = -1;
            bool reject = false;
            vector<string> ans;
            for(int i=0;i<(1 << N);i++){
                vector<string> cutup;
                int before=0;
                for(int j=0;j<N;j++){
                    if(i & (1 << j)){
                        cutup.push_back(input.substr(before,j-before+1));
                        before = j+1;
                    }
                }
                cutup.push_back(input.substr(before));
                // for(int j=0;j<cutup.size();j++){
                //     cerr << cutup[j] << " ";
                // }
                // cerr << endl;
                int nyan = 0;
                for(int i=0;i<cutup.size();i++){
                    nyan += s2i(cutup[i]);
                }
                if(nyan > itarget) continue;
                if(maxi == nyan){
                    reject = true;
                }else if(nyan > maxi){
                    maxi = nyan;
                    ans = cutup;
                    reject = false;
                }
            }
            if(reject){
                cout << "rejected" << endl;
            }else if(maxi == -1){
                cout << "error" << endl;
            }else{
                cout << maxi;
                for(int i=0;i<ans.size();i++){
                    cout << " " << ans[i];
                }
                cout << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1236
n = int(input())
arr = [0] * 5
min_p = 10 ** 16
mi = -1
for i in range(5):
    arr[i] = int(input())
    if arr[i] < min_p:
        min_p = arr[i]
        mi = i

import math
print(4 + math.ceil(n / min_p))

Measured memory_bytes: 3064
arr = input()
arr = list(str(arr))

stack = []
for i in range(len(arr)):
    if arr[i] == '0' or arr[i] == '1':
        stack.append(arr[i])
    elif arr[i] == 'B' and len(stack) != 0:
        stack.pop(-1)

print(''.join(stack))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

typedef long long ll;
typedef unsigned long long llu;


int n;

void dfs(string s, char st){
	if(s.length() == n)
		cout<<s<<endl;
	else {
		for(char c='a'; c<=st; c++){
			dfs(s+c, ((c == st)?(char)(st+1):st));
		}
	}
}


int main () {
	FIO
	cin>>n;
	dfs("", 'a');
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a,b,c;
    char d,e;
  	cin>>a>>d>>b>>e>>c;
  if(b<5)
  cout<<"Heisei"<<endl;
  else
    cout<<"TBD"<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x)
{
  S[++top] = x;
}

int pop()
{
  top--;
  return S[top+1];
}

int main()
{
  int a, b, x;
  top = 0;
  char s[100];

  while( scanf("%s", s) != EOF )
  {
    if ( s[0] == '+' )
    {
      a = pop();
      b = pop();
      push(a + b);
    } 
    else if ( s[0] == '-' )
    {
      b = pop();
      a = pop();
      push(a - b);
    } 
    else if ( s[0] == '*' )
    {
      a = pop();
      b = pop();
      push(a * b);
    } 
    else 
    {
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n", pop());

  return 0;
}



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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define UNIQUE(c) sort(ALL(c)), c.erase(unique(ALL(c)), c.end())

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

// graph by adjacency list
template <typename T>
struct Edge {
  int dst; T weight;
  Edge(int dst, T weight) : dst(dst), weight(weight) { }
  bool operator < (const Edge<T> &e) const {
    return weight > e.weight;
  }
};

template <typename T>
struct Graph {
  int V;
  vector<vector<Edge<T>>> E;
  Graph(int V) : V(V) { E.resize(V); }
  void add_edge(int src, int dst, T weight) {
    E[src].emplace_back(dst, weight);
  }
};


template <typename T>
struct Node {
  int v; T dist;
  Node(int v, T dist) : v(v), dist(dist) { };
  bool operator < (const Node<T> &n) const {
    return dist > n.dist; // reverse
  }
};

template <typename T>
struct ShortestPath {
  const Graph<T> g;
  vector<T> dist;
  vector<int> prev;

  ShortestPath(const Graph<T> g) : g(g) { dist.resize(g.V), prev.resize(g.V); }

  void run(int start) {
    priority_queue<Node<T>> que;
    dist.assign(g.V, std::numeric_limits<T>::max());
    dist[start] = 0;
    que.emplace(start, 0);
    prev[0] = -1;

    while (!que.empty()) {
      Node<T> n = que.top(); que.pop();
      int v = n.v; T cost = n.dist;
      if (dist[v] < cost) continue;
      for (Edge<T> e : g.E[v]) {
        if (dist[v] < dist[e.dst] - e.weight) {
          dist[e.dst] = dist[v] + e.weight;
          prev[e.dst] = v;
          que.emplace(e.dst, dist[e.dst]);
        }
      }
    }
  }

  vector<int> build_path(int goal) {
    vector<int> path;
    for (int v = goal; v != -1; v = prev[v]) {
      path.emplace_back(v);
    }
    reverse(path.begin(), path.end());
    return path;
  }
};


int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, M, s, t; cin >> N >> M >> s >> t; s--, t--;
  Graph<ll> yen(N), snu(N);
  REP(i, M) {
    int u, v, a, b; cin >> u >> v >> a >> b; u--, v--;
    yen.add_edge(u, v, a);
    yen.add_edge(v, u, a);
    snu.add_edge(u, v, b);
    snu.add_edge(v, u, b);
  }

  ShortestPath<ll> yen_sp(yen), snu_sp(snu);
  yen_sp.run(s);
  snu_sp.run(t);

  ll min_cost = 1e15;
  vector<ll> ans(N);
  REP(i, N) {
    min_cost = min(min_cost, yen_sp.dist[N-i-1] + snu_sp.dist[N-i-1]);
    ans[N-i-1] = static_cast<ll>(1e15) - min_cost;
  }
  for (ll a : ans) cout << a << endl;
  return 0;
}


Measured memory_bytes: 40472
from sys import stdin, stdout
from collections import defaultdict
def readcase(o):
    line = o.readline()
    if not line: return None, None
    line = line.strip().split()
    # print(len(line))
    # print(line[0], line[1])

    return int(line[0]), int(line[1])

def tarjan(g):
    sources = list(g.keys())
    # visited = set()
    artPoints = set()
    time = {}
    low = {}
    parent = {}
    # ancestors = defaultdict(set)
    children = defaultdict(set)
    visitedTime = defaultdict(int)
    ti=0


    def dfs(u, stack):
        nonlocal ti
        while stack:
            u = stack[-1]
            visitedTime[u]+=1
            # Initialize discovery time and low value 
            if u not in time:
                time[u] = ti
                low[u] = ti
                ti += 1 
            currChildren = 0
            for v in g[u]: 
                if v not in time: 
                    parent[v]=u
                    children[u].add(v)
                    currChildren+=1
                    stack.append(v)
                    break
                if v in children[u]:
                    low[u] = min(low[u], low[v]) 
                    if u in parent and low[v] >= time[u]:
                        artPoints.add(u)
                        # print(time[u], low[u], time[v], low[v])
                    if u not in parent and len(children[u])>1:
                        artPoints.add(u)
                        # print(time[u], low[u], time[v], low[v])
                elif u not in parent or parent[u] != v:
                    low[u] = min(low[u], time[v]) 
            if currChildren == 0:
                stack.pop()
    for s in sources:
        if s not in time:
            stack = [s]
            dfs(s, stack)
            ti=0
    ans = sorted(list(artPoints))
    for i, a in enumerate(ans):
        print(a)

if __name__ == '__main__':
    g = defaultdict(list)
    solutions = None
    u, v = readcase(stdin)
    if not (not u or u == 0):
        while 1:   
            u, v = readcase(stdin)
            if u == None:
                break
            if u != v:
                g[u].append(v)
                g[v].append(u)


        tarjan(g)
        # solutions = [str(y) for y in solutions]
        # solutions = "\n".join(solutions)
        # print(solutions, end="")
    # print("2")
    # print(solutions)



Measured memory_bytes: 15400
// #include "d.h"
#include <bits/stdc++.h>

using namespace std;

const int L = 128;
const string C = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

int query(const string &t)
{
	cout << "? " << t << "\n";
	int r;
	cin >> r;
	return r;
}

int n, cnt[62];

string f(int l, int r)
{
	if (l == r)
		return string(cnt[l], C[l]);
	string a = f(l, (l+r)/2), b = f((l+r)/2+1, r);
	for (size_t i=0, j=0; i <= a.size(); i++)
		for (; j < b.size() && query(a.substr(0, i) +
				b[j] + a.substr(i)) == n - (int)a.size() - 1;
					i++, j++)
			a.insert(a.begin() + i, b[j]);
	return a;
}

string find_password()
{
	for (int i=0; i<62; i++)
		cnt[i] = L - query(string(L, C[i]));
	n = accumulate(cnt, end(cnt), 0);
	return f(0, 61);
}

int main()
{
	ios_base::sync_with_stdio(false);
	string s = find_password();
	cout << "! " << s << "\n";
	return 0;
}

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

// #define ONLINE_JUDGE

#define V vector
#define P pair

using LL = long long;
#define FOR(i, x, y) \
    for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) \
    for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifndef ONLINE_JUDGE
#define dbg(x...)                             \
    do {                                      \
        cerr << "\033[32;1m" << #x << " -> "; \
        err(x);                               \
    } while (0)
void err() { cerr << "\033[39;0m" << endl; }
template <template <typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) {
    for (auto v : a) cerr << v << ' ';
    err(x...);
}
template <typename T, typename... A>
void err(T a, A... x) {
    cerr << a << ' ';
    err(x...);
}
#else
#define dbg(...)
#endif
#define sz(x) (int)x.size()

LL bin(LL a, LL b, LL p) {
    LL res = 1;
    a = (a % p + p) % p;
    for (; b; b >>= 1, a = a * a % p)
        if (b & 1) res = res * a % p;

    return res;
}

const int N = 1e5+50;


void solve() {
    set<string> S;
    int n;
    scanf("%d", &n);
    for (int i=0; i<n; ++i) {
        static char s[20];
        scanf("%s", s);
        S.insert(string(s));
    }
    printf("%d\n", sz(S));
}

int main() {

    // int t;
    // cin >> t;
    // while (t--) solve();

    solve();

    return 0;
}

Measured memory_bytes: 19420
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define FOR(i, a, b) for(int i=(a);i<=(b);++i)
#define REP(i, n) for(int i=0;i<n;++i)
#define FOREACH(x, a) for(auto& (x) : (a))
#define ALL(a) (a).begin(),(a).end()
#define OUT(x) out << (x) << endl;
#define M0(x) memset(x,0,sizeof(x))
#define MINF(x) memset(x,0x3f,sizeof(x))
#define MMINUS(a) memset(a,0xff,sizeof(a))
#define ten(n) ((int)1e##n)

const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double EPS = 1.0/LINF;
const char ENDL = '\n'; // for JetBrains IDE only supports yen

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

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

using namespace std;

class DXXOR {
public:
    int N;
    ll K;
    ll A[ten(5)+1];
    int bit[ten(5)+1][41];
    int bit_K[41]{0};

    void solve(std::istream& in, std::ostream& out) {
        in >> N >> K;
        REP(i, N) in >> A[i];
        M0(bit);

        // O(1e6)
        ll b = 0;
        int keta = -1;
        while(b <= K) {
            keta++;
            b = 1ll << keta;
            REP(i, N) {
                bit[i][keta] = ((A[i] & b) > 0);
            }
        }

        ll max_x = 0;

        // keta_K * N = O(1e6)
        int keta_K = keta-1;
        FOR(k, 0, keta_K) {
            int cnt_z = 0;
            int cnt_o = 0;
            FOR(i, 0, N-1) {
                if (bit[i][k] == 0) cnt_z++;
                else if (bit[i][k] == 1) cnt_o++;
                else OUT("wwwwwww");
            }
            if (cnt_z > cnt_o) {
                bit_K[k] = 1;
                max_x |= (1ll << k);
            } else {
                bit_K[k] = 0;
            }
        }

        // herasu
        ll argmax = 0;
        for (int k = keta_K; k >= 0; k--) {
            if (bit_K[k] == 0) continue;
            else {
                ll tmp = argmax + (1ll << k);
                if (tmp <= K) argmax = tmp;
                else continue;
            }
        }

        OUT(f(argmax));
    }

    ll f(ll xi) {
        ll ans = 0;
        REP(i, N) {
            ans += A[i] ^ xi;
        }
        return ans;
    }
};

int main() {
    DXXOR solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

#define ll long long
#define ld long double
#define COIN const int
#define ite iterator
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)

#define ALL(c) (c).begin(), (c).end()
#define sz(s) (s).size()
#define CLEAR(x) memset(x,0,sizeof x);

#define MP make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/
const ll mod=1e9+7;
const ll INF=1e18;
/*****************************************************************************/

using namespace std;

ll f1(ll a, ll b) {
	if (a>=0) {
		return (a+b-1)/b;
	}
	else {
		return a/b;
	}
}

ll f2(ll a, ll b){
	if (a<0) {
		return (a-b+1)/b;
	}
	else {
		return a/b;
	}
}

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ll n,k;
	cin >>n >>k;
	vector <ll> a(n);
	for(int i=0;i<n;i++) cin >>a[i];
	sort(a.begin(),a.end());
	ll l=INF,h=-INF-1;
	while (l-h>1) {
		ll m=(l+h)/2;
		ll num=0;
		for(int i=0;i<n;i++) {
			if (a[i]<0) {
				ll v=f1(-m,-a[i]);
				num+=a.begin()+i-lower_bound(a.begin(),a.begin()+i,v);
			}
			else if (a[i]==0) {
				if(m>=0) num+=i;
			}
			else {
				ll v=f2(m,a[i]);
				num+=upper_bound(a.begin(),a.begin()+i,v)-a.begin();
			}
		}
		(num>=k?l:h)=m;
	}
	cout <<l <<endl;
	return 0;
}
/******************************************************************************
******************************************************************************/


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

using namespace std;

int main() {
    ll n;
    cin >> n;
    ll p[n][3];
    for (ll i = 0; i < n; i++) {
        cin >> p[i][0] >> p[i][1] >> p[i][2];
    }
    ll dp[n][3] = {0};
    for (int i = 0; i < 3; i++) {
        dp[0][i] = p[0][i];
    }
    for (ll i = 1; i < n; i++) {
        for (ll j = 0; j < 3; j++) {
            for (ll k = 0; k < 3; k++) {
                if (j != k) {
                    dp[i][k] = max(dp[i][k], dp[i-1][j] + p[i][k]);
                }
            }
        }
    }
    cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]}) << "\n";
    return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#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 showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    int n;
    cin >> n;
    int ans = 1000 - (n%1000);
    if (ans == 1000) ans = 0;
    cout << ans << endl;


}



Measured memory_bytes: 3628
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;

int main() {
	int n,k;

	cin >> n>>k;

	int a[100];

	int b[100];

	for (int i = 0; i < 100; i++) b[i] = 0;

	for (int i = 0; i < k; i++) {
		int d;
		cin >> d;
		for (int j = 0; j < d; j++) {
			cin >> a[j];
		}
		for (int j = d; j < 100; j++) {
			a[j] = 0;
		}

		for (int j = 0; j < d; j++) {
			b[a[j]-1]++;
		}

	}

	int c = 0;
	for (int i = 0; i < n; i++) {
		if (b[i] == 0) c++;

		
	}

	cout << c << endl;

	

	


}

Measured memory_bytes: 3596
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))


for i in range(n):
    p[i] -= 1

def score(a, k):
    now = p[a]
    s = c[now]
    cnt = 1
    ans = s
    while now != a and cnt < k:
        now = p[now]
        s += c[now]
        ans = max(ans, s)
        cnt += 1
    if cnt == k:
        return ans
    if k % cnt == 0:
        return (k // cnt - 1) * s + ans
    s = (k // cnt) * s
    k %= cnt
    cnt = 0
    while cnt < k:
        now = p[now]
        s += c[now]
        ans = max(ans, s)
        cnt += 1
    return ans

print(max(score(i, k) for i in range(n)))


Measured memory_bytes: 69140
n=int(input())
a=list(reversed(list(map(int,input().split()))))
p,q=2,2
for i in range(n):
	q2=((q-1)//a[i]+1)*a[i]
	p2=(p//a[i]+1)*a[i]-1
	p=p2
	q=q2
	if p<q:
		print(-1)
		break
else:
	print(q,p)

Measured memory_bytes: 14224
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

int main(){
    string s,t;
    cin >> s >> t;
    ll ans = 0;
    rep(i,s.size()){
        if(s[i]!=t[i])ans++;
    }
    cout << ans << endl;
    return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
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; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int n,l; scanf("%d%d",&n,&l);
    vector<int> t(n);
    rep(i,0,n)scanf("%d",&t[i]);
    double ans[2];
    rep(i,0,n-1)rep(j,i+1,n){
        ans[0]+=(n-2*(j-i))*cos(M_PI*(t[i]+t[j])/l);
        ans[1]+=(n-2*(j-i))*sin(M_PI*(t[i]+t[j])/l);
    }
    ans[0]/=1LL*n*(n-1)*(n-2)/6;
    ans[1]/=1LL*n*(n-1)*(n-2)/6;
    printf("%.12f %.12f\n",ans[0],ans[1]);
    return 0;
}

Measured memory_bytes: 256
// Mr. betrue12 さん


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

struct UnionFind{
    vector<int> par;
    vector<int> sz;
    
    UnionFind(int n = 0){
        if(n) initialize(n);
    
    }
    
    void initialize(int n){
        par.resize(n);
        sz.resize(n);
        for (int i = 0; i < n; i++){
            par[i] = i;
            sz[i] = 1;
        }
    }
    
    int find(int x){
        if(par[x] == x) return x;
        else return par[x] = find(par[x]);
    }
    
    bool unite(int x, int y){
        x = find(x);
        y = find(y);
        
        if (x == y) return false;
        
        if (sz[x] > sz[y]) swap(x, y);
        par[x] = y;
        sz[y] += sz[x];
        return true;
    }
    
    bool same(int x, int y){
        return find(x) == find(y);
    }
    
    int size(int x){
        return sz[find(x)];
    }
};




int n;
string s[210];
vector<int> edges[210];


bool bipart(){
    UnionFind uf(2*n);
    
    for (int i = 0; i < n; i++){
        for (int j : edges[i]){
            
            uf.unite(i+n, j);
            uf.unite(j+n, i);
        }
    }
    
    for (int i = 0; i < n; i++) if(uf.same(i, i+n)) return false;
    return true;
}





int main(){
    cin >> n;
    
    for (int i = 0; i < n; i++){
        cin >> s[i];
        for (int j = 0; j < n; j++){
            if (s[i][j] == '1') edges[i].push_back(j);
        }
    }
    
    if(!bipart()){
        cout << -1 << endl;
        return 0;
    }
    
    int ans = 0;
    
    for (int s = 0; s < n; s++){
        vector<int> dist(n, -1);
        dist[s] = 1;
        
        queue<int> que;
        que.push(s);
        while(que.size()){
            int i = que.front();
            que.pop();
            for (int j : edges[i]){
                if (dist[j] == -1){
                    dist[j] = dist[i] + 1;
                    que.push(j);
                }
            }
        }
        
        int res = *max_element(dist.begin(), dist.end());
        ans = max(ans, res);
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
package main

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

func main() {
	var N int
	fmt.Scan(&N)
	A := make([]int, N+1)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 1; i <= N; i++ {
		sc.Scan()
		A[i], _ = strconv.Atoi(sc.Text())
	}
	// fmt.Println("N", N, "A", A)
	ans := 0
	for i := 1; i < N; i++ {
		p := A[i] / 2
		rest := A[i] - 2*p
		ans += p
		if A[i+1] >= rest {
			A[i+1] -= rest
			ans += rest
		}
		// fmt.Println("i", i, "ans", ans)
	}
	if A[N] >= 2 {
		ans += A[N] / 2
		// fmt.Println("N", N, "ans", ans)
	}
	fmt.Println(ans)
}


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

#define mx 1000006
#define ll long long
int n, m, mm, tc=1, sz;
int cnt[2*mx];
vector <int> pr;
bool pairwise, setwise, atLeastOne; 

void sieve(int n) 
{ 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          pr.push_back(p);
} 
  

void primeFactor(int x)
{
    //cout << "Here is : " << x << "\n";
    int X=x;
    for(auto it : pr){
        if(it*it>X || x == 1)
            break;
        if(x%it == 0){
            cnt[it]++;
            if(cnt[it]>1){
                pairwise=1;
            }
            while(x%it == 0){
                //cout << it << " ";
                x/=it;
            }
        }
    }
    if(x>1){
        cnt[x]++;
        if(cnt[x]>1){
                pairwise=1;
        }
        //cout << x << " ";
    }
    //exit(0);
    
}

void solve(int kk)
{
    cin >> n;
    for(int i=1; i<=n; i++){
        int aa;
        cin >> aa;
        primeFactor(aa);
    }
    for(auto it : pr){
        if(cnt[it] == n)
            atLeastOne=1;
    }
    if(!pairwise)
        cout << "pairwise coprime\n";
    else
        (!atLeastOne) ? cout << "setwise coprime\n" : cout << "not coprime\n";
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("D:\\Codings\\CPP\\input.in", "r", stdin);
    freopen("D:\\Codings\\CPP\\output.in", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int kk = 0;
    sieve(1e6);
    while (++kk <= tc)
        solve(kk);

    return 0;
}

Measured memory_bytes: 8640
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  string S;
  cin >> S;
  int rain = 1;
  if (S == "RRR") rain = 3;
  else if (S == "SRR" || S == "RRS") rain = 2;
  else if (S == "SSS") rain = 0;
  cout << rain << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
inline bool read(ll &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
string s;ll ans;

int main(){
cin>>s;
for (int st=0;st<(1<<s.size()-1);++st){
  int last=0;
  for (int j=0;j<s.size();++j){
    if ((1<<j)&st){
      ll now=stoll(s.substr(last,j-last+1));
	  ans+=now,last=j+1;
	  }
	}
  ll now=stoll(s.substr(last,s.size()-last));
  ans+=now;
  }
printf("%lld",ans);
}

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

def is_prime(x):
    if x <= 1: 
        return False
    for i in range(2,math.ceil(x**0.5)):
        if x%i==0: 
            return False
    return True
def main():
    x = int(input())
    p = x
    while not is_prime(p):
        p += 1
    print(p)

if __name__ == "__main__":
    main()

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

int main() {
	string s;
	cin >> s;
	long long ans = 0;
	for(int i=0,w=0;i<s.size();i++) {
		if(s[i] == 'W') {
			ans += i - w;
			w++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,ans;
  char c;
  cin>>a>>c>>b;
  if(c=='+') ans=a+b;
  else ans=a-b;
  cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

signed main(){
    cin.tie(0); 
    ios::sync_with_stdio(false);
    int n,k;
    int h[100010];
    int dp[100010];
    cin >> n >> k;
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    dp[0] = 0;
    for(int i=1;i<n;i++){
        dp[i] = dp[i-1] + abs(h[i-1] - h[i]);
        for(int j=2;j<=min(i,k);j++){
            dp[i] = min(dp[i],dp[i-j] + abs(h[i-j] - h[i]));
        }
    }
    cout << dp[n-1] << "\n";
    return 0;
}


Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i,s,n) for(int i=s; i<(n); ++i)
#define ALL(n) begin(n),end(n)
using ll = long long;
const ll INF = 1e18;
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; }

int main(){
    ll K;
    cin >> K;

    if (K % 2 == 0){
        cout << -1 << endl;
        return 0;
    }

    if (K == 1 || K == 7){
        cout << 1 << endl;
        return 0;
    }

    ll sevens = 0;
    for (ll i = 0; i < K + 100; ++i){
        // sevens += 7 * pow(10, i);
        sevens = sevens * 10 + 7;
        sevens %= K;
        if (sevens == 0){   
            cout << i + 1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;

    return 0;
}


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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;

	char buf[bufl],*s=buf,*t=buf;

	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline int ty()
	{
		int a=0;int b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 200007;

int n,val[_],tar[_];
priority_queue<pair<int,int>> q;

int main()
{
	n=ty();
	for(int i=0;i<n;i++)tar[i]=ty();
	for(int i=0;i<n;i++)val[i]=ty();

	lint cnts=0;
	for(int i=0;i<n;i++)if(val[i]!=tar[i])q.emplace(val[i],i);
	while(!q.empty())
	{
		int a=q.top().second,sv=val[(a+1)%n]+val[(a-1+n)%n];q.pop();
		int tim=(val[a]-tar[a])/sv;
		if(tim<=0){puts("-1");return 0;}
		val[a]-=sv*tim,cnts+=tim;
		if(val[a]!=tar[a])q.emplace(val[a],a);
	}
	printf("%lld\n",cnts);

	return 0;
}


Measured memory_bytes: 3956
// g++ -std=c++11 temp.cpp
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EACH(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3

#define MAX_N 1000

ll N, X;

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

int main(){
	cin>>N>>X;
	cout<<3*(N-gcd(N,X))<<endl;
	return 0;
}




Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;


int main()
{
    double minv = 1000001, maxv = 0, t;
    while (scanf("%lf", &t) != EOF) {
        minv = min(minv, t);
        maxv = max(maxv, t);
    }
    printf("%.3lf\n", maxv-minv);
    return 0;
}



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

namespace codeTester.contest190804
{
    class ProblemD
    {
        static readonly long remainderBase = 1000000007;

        static string s = "";
        static List<long> answers = new List<long>();

        public static void Main(string[] args)
        {
            Input();
            Logic();
            Output();
        }

        static void Input()
        {
            s = Console.ReadLine();
        }

        static void Logic()
        {
            int sLength = s.Length;
            long oddWalk = 0;
            long evenWalk = 0;


            // 答えを入れる枠を用意
            List<long> rightGoingTerminals = new List<long>();
            List<long> leftGoingTerminals = new List<long>();

            for (int i = 0; i < sLength; i++)
            {
                rightGoingTerminals.Add(0);
                leftGoingTerminals.Add(0);
            }


            // まずは左端から右に向かって考える。
            for (int i = 0; i < sLength; i++)
            {
                // R が表示されている限りはその子供を連れていく。
                if (s[i] == 'R')
                {
                    evenWalk++;
                }
                // L が表示されているマスが見つかったら、最終地点が判明。（Lマスの上の子供は今回の処理ではカウントしない）
                else
                {
                    rightGoingTerminals[i - 1] += oddWalk;
                    rightGoingTerminals[i] += evenWalk;
                    oddWalk = 0;
                    evenWalk = 0;
                }

                // evenWalk と addWalk 入れ替え
                long tmp = evenWalk;
                evenWalk = oddWalk;
                oddWalk = tmp;
                // DebugPrint("EVEN : " + evenWalk + " / ODD : " + oddWalk);
            }

            // 次に右端から左に向かって考える
            oddWalk = 0;
            evenWalk = 0;
            for (int i = sLength - 1; i >= 0; i--)
            {
                // L が表示されている限りはその子供を連れていく。
                if (s[i] == 'L')
                {
                    evenWalk++;
                }
                // R が表示されているマスが見つかったら、最終地点が判明。（Lマスの上の子供は今回の処理ではカウントしない）
                else
                {
                    leftGoingTerminals[i + 1] += oddWalk;
                    leftGoingTerminals[i] += evenWalk;
                    oddWalk = 0;
                    evenWalk = 0;
                }

                // evenWalk と addWalk 入れ替え
                long tmp = evenWalk;
                evenWalk = oddWalk;
                oddWalk = tmp;
            }

            DebugPrint("RIGHT : " + string.Join(" ", rightGoingTerminals));
            DebugPrint("LEFT  : " + string.Join(" ", leftGoingTerminals));

            // Right 上の child と Left 上の child を合計
            answers = rightGoingTerminals.Zip(leftGoingTerminals, (l, r) => l + r).ToList();
        }

        static void Output()
        {
            Console.WriteLine(string.Join(" ", answers));
        }

        static void DebugPrint(string msg)
        {
            // 提出時に消す
            // Console.WriteLine(msg);
        }
    }
}


Measured memory_bytes: 24800
#include<stdio.h>
int main()
{
	int n,i,sum=0;
	int a[20],b[20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++)
	{
		scanf("%d",&b[i]);
	}
	for(i=0;i<n;i++)
	{
		if(a[i]>b[i])
			sum=sum+a[i]-b[i];
	}
	printf("%d\n",sum);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long
bool ex[13][1<<(12*2)];
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    string s,t;
    cin>>s>>t;
    int k=t.size(),tmp=0;
    for(int j=0;j<k;j++){
      tmp*=4;
      if(t[j]=='A') tmp+=0;
      if(t[j]=='C') tmp+=1;
      if(t[j]=='G') tmp+=2;
      if(t[j]=='T') tmp+=3;
    }
    if(s=="insert") ex[k][tmp]=1;
    else cout<<(ex[k][tmp]?"yes":"no")<<endl;
  }
  return 0;
}



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

using namespace std;

int main(){
    double r,a,b;
    cin >> r;
    a=r*r*3.14159265358979323846;
    b=r*2*3.14159265358979323846;
    printf("%.6lf ", a);
    printf("%.6lf\n", b);



    return 0;
}

Measured memory_bytes: 3204