akhauriyash/Code-Regression huggingface dataset:
N = int(input())

adict = {}

for i in range(N):
  A = int(input())
  if A not in adict:
    adict[A] = True
  else:
    adict[A] = not adict[A]
    
ans = 0
for key in adict:
  if adict[key]:
    ans += 1
print(ans)


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

int main() {
  while(true){
    string s;
    cin >> s;
    if(s == "0") return 0;
    int sum = 0;
    for(int i = 0;i < s.size();i++){
      sum += s[i]-'0';
    }
    cout << sum << endl;
  }
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m=0;cin>>n;
  vector<pair<string,int>>a(n);
  for(int i=0;i<n;i++)cin>>a.at(i).first>>a.at(i).second;
  string s;cin>>s;
  for(int i=0;i<n;i++){
    if(i<n-1 && a.at(i).first==s){
      for(int j=i+1;j<n;j++)m+=a.at(j).second;
      break;
    }
  }
  cout<<m<<endl;
}


Measured memory_bytes: 256
import sys
from collections import deque
H,W=map(int,input().split())
s=[[c for c in l.strip()] for l in sys.stdin]
maze=[[-1]*W for i in range(H)]
dy=[1,0,-1,0]
dx=[0,1,0,-1]
q=deque([])
q.append((0,0))
maze[0][0]=0
kabe=0
while(q):
  c=q.popleft()
  for i in range(4):
    if(c[0]+dy[i]>=0 and c[0]+dy[i]<H and c[1]+dx[i]>=0 and c[1]+dx[i]<W):
      if(s[c[0]+dy[i]][c[1]+dx[i]]=="." and maze[c[0]+dy[i]][c[1]+dx[i]]==-1):
        q.append((c[0]+dy[i],c[1]+dx[i]))
        maze[c[0]+dy[i]][c[1]+dx[i]]=maze[c[0]][c[1]]+1
        
for i in range(H):
  kabe+=s[i].count("#")
if(maze[H-1][W-1]==-1):
  print(-1)
else:
  print(H*W-kabe-1-maze[H-1][W-1])

Measured memory_bytes: 3316
n = int(input())
def gcd(a, b):
  if not b:
    return a
  else:
    return gcd(b, a % b)
def lcm(a, b):
  return a * b // gcd(a, b)
ans = 1
for _ in range(n):
  c = int(input())
  ans = lcm(ans, c)
print(ans)


Measured memory_bytes: 2940
n = int(input())
s = [input() for _ in range(n)]
 
d = {}
for i in s:
    if i not in d:
        d[i] = 1
    else:
        d[i] += 1
        
m = max(d.values())

l = []
for i in d.keys():
  if d[i] == m:
  	l.append(i)
    
l_s = sorted(l)
for i in l_s:
  print(i)

Measured memory_bytes: 38492
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
int n;
ll f(int x) {
	int e=x%10;
	int s=0;
	while(x>0) {
		if(x<10) s=x;
		x/=10;
	}
	if(e==0) return 0;
	ll res=0;
	if(s==e&&s<=n) res++;
	for(int pw=10;;pw*=10) {
		int v=(pw*e+s);
		if(v>n) break;
		res+=min((n-v)/10+1,pw/10);
	}
	return res;
}
int main() {
	int i,j;
	scanf("%d",&n);
	ll res=0;
	for(i=1;i<=n;i++) {
		res+=f(i);
	}
	printf("%lld",res);
	return 0;
}

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

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

  vector<int> cnt(100010);
  for (int i = 0; i < n; i++) cnt[a[i]]++;

  int ans = 0;
  for (int i = 1; i < 100000; i++) {
    ans = max(ans, cnt[i] + cnt[i - 1] + cnt[i + 1]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3964
#include <bits/stdc++.h>
#define int long long
using namespace std;

typedef pair<int,int> P;

vector<P> v;
int n, m;

signed main(){
  
  cin>>n>>m;
  
  for(int i=0;i<n;i++){
    int a, b;
    cin>>a>>b;
    int t = m - a;
    if( t < 0 ) continue;
    v.push_back( P( -t, -b ) );
  }
  
  sort( v.begin(), v.end() );
  
  priority_queue<int> Q;
  
  int idx = 0;
  int ans = 0;
  
  for(int i=m-1;i>=0;i--){
    
    while(idx<(int)v.size()){
      
      int I = -v[idx].first;
      int cost = -v[idx].second;
      
      if( I < i ) break;
      
      Q.push( cost );
      
      idx++;
      
    }
    
    if( Q.empty() ) continue;
    
    ans += Q.top();
    Q.pop();
        
  }

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


Measured memory_bytes: 3568
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/3/21
Solved on 2019/3/
@author: shinjisu
"""


# ABC 0xx C xxx
#import math
#import numpy as np

def getInt(): return int(input())

def getIntList(): return [int(x) for x in input().split()]
# def getIntList(): return np.array(input().split(), dtype=np.longlong)

def zeros(n): return [0]*n
# def zeros(n): return np.zeros(n, dtype=np.longlong)

def getIntLines(n): return [int(input()) for i in range(n)]
"""
def getIntLines(n):
    data = zeros(n)
    for i in range(n):
        data[i] = getInt()
    return data
"""

def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替

def getIntMat(n, m):  # n行に渡って、1行にm個の整数
    #mat = zeros((n, m))
    mat = zeros2(n, m)
    for i in range(n):
        mat[i] = getIntList()
    return mat

ALPHABET = [chr(i+ord('a')) for i in range(26)]
DIGIT = [chr(i+ord('0')) for i in range(10)]
N1097 = 10**9 + 7
INF = 10**18

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                print(cmt, ':  ', end='')
            print(x)
        return x


def prob():
    d = Debug()
    d.off()
    N = getInt()
    d.dmp((N), 'N')
    A = zeros(N+2)
    A[1:N+1] = getIntList()
    d.dmp((A), 'A')
    yenAll = 0
    for i in range(1, N+2):
        yenAll += abs(A[i]-A[i-1])
    d.dmp((yenAll), 'A')
    yenOmit = yenAll
    for i in range(1, N+1):
        yenOmit = yenAll - abs(A[i]-A[i-1]) - abs(A[i+1]-A[i])
        yenOmit += abs(A[i+1]-A[i-1])
        print(yenOmit)
    return None


ans = prob()
if ans is None:
    pass
elif type(ans) == tuple and ans[0] == 1:  # 1,ans
    for elm in ans[1]:
        print(elm)
else:
    print(ans)


Measured memory_bytes: 15064
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    int a,b;
    cin>>a>>b;
    cout<<a/b<<endl;
    cout<<a%b<<endl;
    cout<<fixed<<setprecision(6)<<(a*1.0)/(b*1.0)<<endl;
    return 0;
}



Measured memory_bytes: 3280
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#include <cstring>
#define FOR(i,a,n) for (int i = a; i < n; i++)
#define IFOR(i,n,a) for (int i = n; i >= a; i--)
#define mp make_pair
#define full(a) a.begin(), a.end()
#define sz(x) ((int)(x).size())
#define pii pair<int, int>
#define trav(a,x) for (auto& a : x)
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 998244353;
const int N = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n; cin >> n;
    double res = 0;
    FOR(i, 0, n)
    {
        double a; cin >> a;
        res += (1 / a);
    }
    res = 1 / res;
    cout << res;

    return 0;
}



Measured memory_bytes: 3788
#include<stdio.h>
#define N 101
int main(){

  int ary[N][N];
  int i,j,n,hs,hn,h;
  scanf("%d",&n);
  for(i=1;i<N;i++){
    for(j=1;j<N;j++){
      ary[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&hs,&hn);
    for(j=0;j<hn;j++){
      scanf("%d",&h);
      ary[hs][h]=1;
    }
  }
  for(i=1;i<=n;i++){
    for(j=01;j<=n;j++){
      if(j>1)printf(" ");
      printf("%d",ary[i][j]);
    }
    printf("\n");
  }
  return 0;
}

      
    
    



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

int main(){
  int a[3];
  int sum = 0;
  
  for (int i = 0; i < 3; i++){
    cin >> a[i];
    if (a[i] != 5 && a[i] != 7){
      cout << "NO" << endl;
      return 0;
    }
    sum += a[i];
  }
  if (sum == 17){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <sstream> //C++
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
#include <map> //C++

using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)



/*
int N, i;
int H[100];
scanf("%d", &N);
for (i = 0; i < N; i++) scanf("%s", &H[i]);
*/



int main()
{
	
	string s;
	cin >> s;
	if (s == "ABC") {
		cout << "ARC";
	}
	else
		cout << "ABC";
	


	

}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int a, x[30];
int main() {
	for(int i = 0; i < 28; i++) {
		cin >> a;
		x[a - 1] = 1;
	}
	for(int i = 0; i < 30; i++) {
		if(x[i] == 0) cout << i + 1 << endl;
	}
}

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

int main(void)
{
  std::string S;
  std::cin >> S;

  if (S[S.size()-1] == 's') {
    S += "es";
  }
  else {
    S += "s";
  }

  std::cout << S << std::endl;

  return 0;
}

Measured memory_bytes: 3592
N = int(raw_input())
X = [map(int, raw_input().split()) for i in range(N)]

def update(n, x):
    t, a = x
    n1, n2 = n
    c = 1
    i0 = max(n1/t, n2/a)
    for i in xrange(i0, 10**18):
        if i * t >= n1 and i * a >=n2:
            c = i
            break
    return c * t, c* a

n = (1, 1)
for x in X:
    n = update(n, x)
print(sum(n))


Measured memory_bytes: 2692
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

int main() {

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

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

    map<int, int> M;
    for (int i = 0; i < N; i++) M[A[i]]++;

    vector<int> D;
    for (auto x : M) D.push_back(x.second);

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

    long long ans = 0;
    for (int i = 0; i < max(0, (int) D.size() - K); i++) ans += D[i];

    cout << ans << endl;

    return 0;
}











































































Measured memory_bytes: 11516
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;
const int FIVE = 101010;

//=============================
int N,M,K;
string S,T;
vector<int> A;
vector<int> B;
//=============================
void input()
{
    cin>>S;
    cin>>T;
}
//=============================
void func(){}
//=============================
void solve()
{
    vector<vector<char>>  v(2,vector<char>(3));
    rep(i,3){
        v[0][i] = S[i];
        v[1][i] = T[i];
    }

    rep(i,2)rep(j,3){
        int revi = 2-i-1;
        int revj = 3-j-1;
        if (v[i][j] != v[revi][revj]){
             cout<<"NO"<<endl;return;
        }
    }
    cout<<"YES"<<endl;

}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
N, M, K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ruisekiA = [0] * (N + 1)
for i in range(N):
    ruisekiA[i + 1] = ruisekiA[i] + A[i]
ruisekiB = [0] * (M + 1)
for i in range(M):
    ruisekiB[i + 1] = ruisekiB[i] + B[i]
ans = 0
for i in range(N + 1):
    if ruisekiA[i] > K: break
    else:
        time = K - ruisekiA[i]
        lb = -1
        ub = M + 1
        while ub - lb > 1:
            mid = (ub + lb) // 2
            if ruisekiB[mid] <= time: lb = mid
            else: ub = mid
        ans = max(ans,i + lb)
print(ans)


Measured memory_bytes: 111108
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

string toString(int x)
{
	stringstream ss; ss << x;
	return ss.str();
}

string rootString(int f, int t)
{
	int b = f < t ? 1 : -1;
	
	string res;
	
	for(int i = f; i != t; i += b)
		res += toString(i);
	
	return res + toString(t);
}

void print(string s)
{
	rep(i, s.size())
		cout << s[i] << (i == s.size() - 1 ? "\n" : " ");
}

int main()
{
	int n;
	cin >> n;
	
	while(n--)
	{
		int f, t;
		cin >> f >> t;
		
		if(f < t || f <= 5)	print(rootString(f, t));
		else if(t < 5) 		print(rootString(f, 9) + toString(5) + rootString(4, t));
		else if(t == 5) 	print(rootString(f, 9) + toString(5));
		else 				print(rootString(f, 9) + rootString(5, 0) + rootString(1, t));
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <bitset>
#include <map>
#include <math.h>
#include <utility>

using namespace std;

int main(){

    int N, count = 0;
    cin >> N;
    vector<int> L(N);
    for (int i = 0; i < N; i++){
        cin >> L[i];
    }
    // for (int i = 0; i < N; i++){
    //     L[i] = i+1;
    // }

    // int N = 2000, count = 0;
    // vector<int> L(N, 1);

    sort(L.rbegin(), L.rend());

    int a, b, c;
    for (int i = 0; i < N-2; i++){
        a = L[i];
        for (int j = i+1; j < N-1; j++){
            b = L[j];
            for (int k = j+1; j < N; k++){
                c = L[k];
                if (a < b+c && b < c+a && c < a+b){
                    count++;
                    // cout << a << " " << b << " " << c << " " << endl;
                } else {
                    break;
                }
            }
        }
    }

    cout << count << endl;

    return 0;
}


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


public class Main {
	
	public static void main(String[] args) throws java.lang.Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(in, out);
		out.close();
	}
}

class TaskA {
	
	public void solve(InputReader in, PrintWriter out) {
		int[] a = new int[3];
		int ans = 200000;
		
		for (int i=0; i<3; ++i)
			a[i] = in.nextInt();
		
		for (int i=0; i<3; ++i) {
			for (int j=0; j<3; ++j) {
				if (i == j) continue;
				if (a[i]+a[j] < ans)
					ans = a[i] + a[j];
			}
		}
		
		out.println(ans);
	}
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;
	
	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}
	
	public String next() {
		while (tokenizer==null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

class UnionFind():
    def __init__(self, X):
        self.n = len(X)
        self.parents = [-x for x in X]

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
def main():
  n, m = map(int, input().split())
  X = [0] + list(map(int, input().split()))
  edge = []
  for _ in range(m):
    a, b, y = map(int, input().split())
    edge.append((y, a, b))
  edge.sort()
  G = [[] for _ in range(n+1)]
  for y, a, b in edge:
    G[a].append((b, y))
    G[b].append((a, y))
  uf = UnionFind(X)
  T = []
  for y, a, b in edge:
    uf.unite(a, b)
    if uf.size(a) >= y:
      T.append(1)
    else:
      T.append(0)
  seen = [False]*(n+1)
  used = set()
  cnt = 0

  def dfs(e):
    y, a, b = edge[e]
    res = 0
    seen[a] = True
    stack = [a]
    while stack:
      v = stack.pop()
      for nv, cost in G[v]:
        if cost > y:
          continue
        if (v, nv) in used:
          continue
        res += 1
        used.add((v, nv))
        used.add((nv, v))
        if seen[nv]:
          continue
        stack.append(nv)
        seen[nv] = True
    return res
  for i in range(m-1, -1, -1):
    if T[i] and not seen[edge[i][1]]:
      cnt += dfs(i)
  ans = m - cnt
  print(ans)
if __name__ == "__main__":
  main()

Measured memory_bytes: 77944
s = list(input())
t = list(input())

length_1 = len(s)
length_2 = len(t)


def check_word(num1, length):
    a = s[num1:num1+length]
    b = t[:]
    flag = True
    for i in range(length):
        if a[i] == '?':
            continue
        elif a[i] == b[i]:
            continue
        else:
            flag = False
            break
    if flag is True:
        c = s.copy()
        c[num1:num1+length] = t[:]
        c = fill_a(c)
        return c
    elif flag is False:
        return []


def fill_a(li):
    for i in range(len(li)):
        if li[i] == '?':
            li[i] = 'a'
    return li


word_list = []
for i in range(length_1 - length_2 + 1):
    x = check_word(i, length_2)
    if x != []:
        word_list.append(x)

if word_list == []:
    print('UNRESTORABLE')
else:
    word_list.sort()
    while word_list[0] == []:
        x.pop(0)
    for i in word_list[0]:
        print(i, end='')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
    vector<int> x(5);
    rep(i, 5) cin >> x[i];
    rep(i, 5) {
        if (x[i] == 0) {
            cout << i+1 << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}

signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    rep(i,365)cout<<(i%26)+1<<endl;
    return 0;
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

void solve(){
    int N;
    cin >> N;
    
    map<int,int> count;
    rep(i,0,N){
        int a;
        cin >> a;
        ++count[a];
    }

    int ans=0;
    for(auto p:count){
        rep(i,-1,2){
            int X=p.first+i,tmp=0;
            if(count.find(X-1)!=count.end()) tmp+=count[X-1];
            if(count.find(X)!=count.end()) tmp+=count[X];
            if(count.find(X+1)!=count.end()) tmp+=count[X+1];
            ans=max(ans,tmp);
        }
    }
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


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

using namespace std;

int main() {
  int N;

  cin>>N;

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

  sort(d, d+N);

  if(d[N/2-1]<d[N/2]) {
    cout<<d[N/2]-d[N/2-1]<<endl;
  } else {
    cout<<0<<endl;
  }

  return 0;
}

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

int main() {
  int H,W;
  cin >> H >> W;
  
  vector<vector<char>> A(H, vector<char>(W));
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> A.at(i).at(j);
    }
  }
  
  vector<bool> row(H,false);
  vector<bool> col(W,false);
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(A.at(i).at(j) == '#'){
        row.at(i) = true;
        col.at(j) = true;
      }
    }
  }
  
  for(int i=0; i<H; i++){
    if(row.at(i)){
      for(int j=0; j<W; j++){
        if(col.at(j)){
          cout << A.at(i).at(j);
        }
      }
      cout << endl;
    }
  }
  
  
  
}


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

int main()
{
  string s;
  cin >> s;
  vector<char> Ans;
  for (int i = 0; i < s.size(); i++)
  {
    switch (s.at(i))
    {
    case '0':
      Ans.push_back('0');
      break;
    case '1':
      Ans.push_back('1');
      break;
    case 'B':
      if (Ans.size() > 0)
      {
        Ans.pop_back();
      }
      break;
    default:
      break;
    }
  }
  for (int i = 0; i < Ans.size(); i++)
  {
    cout << Ans.at(i);
  }
  cout << endl;
}


Measured memory_bytes: 3632
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
A = list(map(int, readline().split()))

B = [0] * (N + 1)
for i in range(N, 0, -1):
    j = i
    total = 0
    while j <= N:
        total += B[j]
        j += i
    if A[i - 1]:
        if total % 2 == 0:
            B[i] = 1
        else:
            B[i] = 0
    else:
        if total % 2 == 0:
            B[i] = 0
        else:
            B[i] = 1

print(sum(B))
for i in range(len(B)):
    if B[i] == 1:
        print(i)

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

using namespace std;

typedef long long int ll;
ll n, maxi=0;
ll value[100005][3];
ll  memo[100005][4];
ll dp(ll day, int activity)
{
	if(day==n)
		return 0;
	if(memo[day][activity]!=-1)
		return memo[day][activity];
	ll ans = 0;
	for(int i = 0 ; i < 3; i++)
		if(i!=activity)
			ans = max(ans, dp(day+1, i)+value[day][activity]);

	return memo[day][activity] =ans;
}
int main()
{
	cin>>n; 
	for(int i = 0; i < n ; i++)
		for(int j = 0 ; j < 3; j++)
			cin>>value[i][j];
	for(ll i = 0 ; i < 3; i++)
	{
		memset(memo, -1, sizeof memo);
		maxi = max(maxi,dp(0,i));
	}
	cout<<maxi<<endl;
}


Measured memory_bytes: 13568
import math
 
N = int(input())
Prime = []
ans = 0
 
def func(n):
    while n % 2 == 0:
        n = n // 2
        Prime.append(2)
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        while n % i == 0:
            n = n //i
            Prime.append(i)
    if n > 2:
        Prime.append(n)
 
func(N)
 
for i in set(Prime):
    c = i
    while N % c == 0:
        N = N // c
        ans += 1
        c = c * i
 
print(ans)

Measured memory_bytes: 9176
#define _USE_MATH_DEFINES // M_PI
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2147483647;
constexpr ll mod = 1000000007;

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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	string N; cin >> N;
	map<pair<char, char>, ll>mp;
	REP(i, 1, stoi(N) + 1) {
		string s = to_string(i);
		auto p = make_pair(s[0], s[s.size() - 1]);
		mp[p]++;
	}
	ll ans = 0;
	for (auto p:mp) {
		auto a = p.first;
		auto key = make_pair(a.second, a.first);
		ans += p.second * mp[key];
	}
	cout << ans << "\n";

	return 0;
}

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

using namespace std;

typedef long long int64;
const int64 INF = 1LL << 60;
typedef tuple< int64, int, int > Pi;

struct edge
{
  int to, cost;
};

int main()
{
  int N, M, S1, S2, T;

  int64 dp[1000][101];

  while(cin >> N >> M >> S1 >> S2 >> T, N) {
    vector< edge > G[1000];
    --S1, --S2, --T;

    int edged = 0;
    for(int i = 0; i < M; i++) {
      int a, b;
      string c;
      cin >> a >> b >> c;
      --a, --b;
      if(c == "x") {
        G[a].emplace_back((edge) {b, -1});
        G[b].emplace_back((edge) {a, -1});
        ++edged;
      } else {
        G[a].emplace_back((edge) {b, stoi(c)});
        G[b].emplace_back((edge) {a, stoi(c)});
      }
    }

    priority_queue< Pi, vector< Pi >, greater< Pi > > que;
    fill_n(*dp, 101 * 1000, INF);
    dp[T][0] = 0;
    que.emplace(0, T, 0);
    while(!que.empty()) {
      int64 cost, now, slow;
      tie(cost, now, slow) = que.top();
      que.pop();
      if(cost > dp[now][slow]) continue;
      for(auto &e : G[now]) {
        int64 ncost = cost, nslow = slow;
        if(e.cost == -1) ++nslow;
        else ncost += e.cost;
        if(nslow > edged || ncost >= dp[e.to][nslow]) continue;
        dp[e.to][nslow] = ncost;
        que.emplace(ncost, e.to, nslow);
      }
    }

    vector< int64 > latte;
    latte.push_back(0);
    latte.push_back(10000000000000LL);
    for(int i = 0; i <= edged; i++) {
      for(int j = i + 1; j <= edged; j++) {
        latte.emplace_back((dp[S1][i] - dp[S1][j]) / (j - i));
        latte.emplace_back((dp[S2][i] - dp[S2][j]) / (j - i));
        latte.emplace_back((dp[S1][i] - dp[S2][j]) / (j - i));
        latte.emplace_back((dp[S2][i] - dp[S1][j]) / (j - i));
      }
    }

    int64 ret = INF;
    auto get = [&](int64 v)
    {
      v = max(v, 0LL);
      int64 aa = INF, bb = INF;
      for(int i = 0; i <= edged; i++) aa = min(aa, dp[S1][i] + i * v);
      for(int i = 0; i <= edged; i++) bb = min(bb, dp[S2][i] + i * v);
      return (llabs(aa - bb));
    };

    for(int i = -10; i <= 10; i++) {
      for(auto &cost : latte) ret = min(ret, get(cost + i));
    }
    // zinsei
    cout << ret << endl;
  }
}

Measured memory_bytes: 5620
N,M=map(int,input().split())
edge=[set([]) for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    edge[a-1].add(b-1)
    edge[b-1].add(a-1)

visit=set([0])
ans=[0]
pos=0
while True:
    for i in edge[pos]:
        if i not in visit:
            ans.append(i)
            visit.add(i)
            pos=i
            break
    else:
        break

ans=ans[::-1]
pos=ans[-1]
while True:
    for i in edge[pos]:
        if i not in visit:
            ans.append(i)
            visit.add(i)
            pos=i
            break
    else:
        break

for i in range(len(ans)):
    ans[i]+=1

print(len(ans))
print(*ans)

Measured memory_bytes: 77088
def main():
    n = int(input())
    s = input()
    x = 0
    max_s = 0

    for i in range(n):
        if s[i] == 'I':
            x += 1
        elif s[i] == 'D':
            x -= 1

        if max_s < x:
            max_s = x

    print(max_s)


if __name__ == "__main__":
    main()


Measured memory_bytes: 61880
#include <stdio.h>
#define N 100
#define W 0
#define G 1
#define B 2

int n;
int M[N][N];
int c[N];
int d[N];
int f[N];
int t;

void dfs_visit(int u){
  int v;
  c[u] = G;
  d[u] = ++t;
  for( v = 0; v < n; v++){
    if( M[u][v] == 0 ) continue;
    if( c[v] == W ){
      dfs_visit(v);
    }
  }
  c[u] = B;
  f[u] = ++t;
}

void dfs(){
  int u;
  for(u=0;u<n;u++) c[u] = W;
  t = 0;

  for(u = 0; u < n; u++){
    if( c[u] == W ) dfs_visit(u);
  }
  for(u = 0; u < n; u++){
    printf("%d %d %d\n",u+1,d[u],f[u]);
  }
}

int main() {
  int u, v,k,i,j;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++) M[i][j] = 0;
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0; j<k; j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }

  dfs();

  return 0;
}



Measured memory_bytes: 2108
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
#include <sstream>
using namespace std;
const constexpr int INF = 1e9;
#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
const constexpr ll MOD = 1e9+7;
struct Less{
   bool operator()(const pair<string, int>&a, const pair<string, int>&b){
        if(a.first==b.first){
            return a.second < b.second;
        }
       return a.first < b.first;
    }
};

ll extGCD(ll a, ll b, ll& x, ll& y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a/b*x;
    return d;
}
ll GCD(ll a, ll b){
    if(a<b) swap(a, b);
    if(b==0) return a;
    return GCD(b, a%b);
}
int par[100010], rr[100010];
void init(){
    for(int i=0; i<100010; ++i){
        par[i]=i;
        rr[i]=0;
    }
}
int root(int x){
    return par[x] == x ? x:par[x] = root(par[x]);
}
bool same(int x, int y){
    return root(x)==root(y);
}
void unite(int x, int y){
    x = root(x);
    y = root(y);
    if(x==y) return ;
    
    if(rr[x]<rr[y]){
        par[x] = y;
    }else{
        par[y] = x;
        if(rr[x]==rr[y]) rr[x]++;
    }
}

ll pow_mod(ll x, ll n){
    ll res = 1;
    while(n>0){
        if(n&1){
            res = res*x%MOD;
        }
        x = x*x%MOD;
        n>>=1;
    }
    return res;
}
int p[11], c[11];
int main() {
    int D, G; cin >> D >> G;
    REP(i, D) cin >> p[i] >> c[i];
    
    int minV=INF;
    for(int bit=0; bit<(1<<D); ++bit){
        int sum=0;
        int cnt=0;
        for(int i=0; i<D; ++i) {
            if(1&(bit>>i)){ 
                sum += 100*(i+1)*p[i]+c[i];
                cnt += p[i];
            }
        }
        if(sum>=G){
            minV = min(minV, cnt);
        }else{
            int max_idx=0;
            for(int i=0; i<D; ++i){
                if(1&(bit>>i)) continue;    
                max_idx=i;
            }
            
            for(int i=0; i<p[max_idx]; ++i){
                if(sum+100*(max_idx+1)*i>=G){
                    minV = min(minV, cnt+i);
                }
            }
        }
    }
    cout << minV << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n, k;
	cin >> n >> k;
	int ans = 0;
	rep(i, n){
		int h;
		cin >> h;
		if(h >= k) ans++;
	}
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll bgrid[2005][2005]={0},wgrid[2005][2005]={0};
ll bsum[2005][2005]={0},wsum[2005][2005]={0};
ll get_b(ll x1,ll y1,ll x2,ll y2){
  ll res=bsum[x2][y2]+bsum[x1][y1];
  res-=bsum[x1][y2];
  res-=bsum[x2][y1];
  return res;
}
ll get_w(ll x1,ll y1,ll x2,ll y2){
  ll res=wsum[x2][y2]+wsum[x1][y1];
  res-=wsum[x1][y2];
  res-=wsum[x2][y1];
  return res;
}
int main(){
  ll n,k;
  cin>>n>>k;
  const ll mod=2*k;
  for(int i=0;i<n;i++){
    ll x,y;
    cin>>x>>y;
    x%=mod;
    x++;
    y%=mod;
    y++;
    char c;
    cin>>c;
    if(c=='B') {
      bgrid[x][y]++;
      bsum[x][y]++;
    }
    else{
      wgrid[x][y]++;
      wsum[x][y]++;
    }
  }
  for(int i=1;i<=2*k;i++){
    for(int j=1;j<=2*k;j++) {
      bsum[i][j]+=bsum[i-1][j];
      wsum[i][j]+=wsum[i-1][j];
    }
  }
  for(int i=1;i<=2*k;i++){
    for(int j=1;j<=2*k;j++) {
      bsum[i][j]+=bsum[i][j-1];
      wsum[i][j]+=wsum[i][j-1];
    }
  }

  ll ans=0;
  P p1=P(1,1),p2=P(2*k,1),p3=P(1,2*k),p4=P(2*k,2*k);
  for(int i=0;i<k;i++){
    for(int j=0;j<k;j++){
      ll kans1=0;
      kans1+=get_b(i,j,i+k,j+k);
      kans1+=get_b(0,0,i,j);
      kans1+=get_b(2*k,2*k,i+k,j+k);
      kans1+=get_b(i+k,0,2*k,j);
      kans1+=get_b(0,j+k,i,2*k);
      kans1+=get_w(0,j,i,j+k);
      kans1+=get_w(i,0,i+k,j);
      kans1+=get_w(i+k,j,2*k,j+k);
      kans1+=get_w(i,j+k,i+k,2*k);

      ll kans2=0;
      kans2+=get_w(i,j,i+k,j+k);
      kans2+=get_w(0,0,i,j);
      kans2+=get_w(2*k,2*k,i+k,j+k);
      kans2+=get_w(i+k,0,2*k,j);
      kans2+=get_w(0,j+k,i,2*k);
      kans2+=get_b(0,j,i,j+k);
      kans2+=get_b(i,0,i+k,j);
      kans2+=get_b(i+k,j,2*k,j+k);
      kans2+=get_b(i,j+k,i+k,2*k);

      ans=max({ans,kans1,kans2});
    }
  }
  cout<<ans<<endl;
}


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

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

    for(int i=0; i<n; i++)
        for(int l=0; l<n; l++) {
            int a = ns[i];
            int b = ns[l];
            if (i!=l && abs(a-b) % (n-1) == 0) {
                cout << a << " " << b << endl;
                return 0;
            }
        }
}



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

int main()
{
	int H, N;

	cin >> H >> N;

	for (int i = 0; i < N; i++)
	{
		int A;
		cin >> A;
		H = H - A;
	}

	if (H <=0)
	{
		cout << "Yes";
	}

	else
	{
		cout << "No";
	}

}


Measured memory_bytes: 256
a=[list(map(int,input().split())) for i in range(3)]
n=int(input())
b=[int(input()) for j in range(n)]
for j in range(n):
  for i in range(3):
    for k in range(3):
      if b[j] == a[i][k]:
        a[i][k]=0
x="yet"
sum=0
for i in range(3):
  sum+=a[i][i]
if sum==0:
  print("Yes")
  x="done"  

if x=="yet":
  sum=0
  for i in range(3):
    sum+=a[2-i][i]
  if sum==0:
    print("Yes")
    x="done"
    
if x=="yet":
  for i in range(3): 
    sum=0
    for k in range(3):  
      sum+=a[i][k]
    if sum==0:
      print("Yes")
      x="done"
      break

if x=="yet":
  for k in range(3): 
    sum=0
    for i in range(3):  
      sum+=a[i][k]
    if sum==0:
      print("Yes")
      x="done"
      break
if x=="yet":
      print("No")

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

#define int long long 
#define pb push_back
#define sz size()
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define pii pair<int,int>
#define bg being()
#define ed end()
#define pf(x) cout << x << endl;
#define for0(n) for(int i=0;i<n;i++)
#define ln length()
#define disp(x) for(auto y:x)cout << y << ' ';cout << endl;


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

    string a;
    cin >> a;
    int res=0;
    
    for0(a.ln){
        res+=(a[i]-'0');
        res%=9;
    }
	if(res%9==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
	return 0;
} 

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


int top, S[100];


void push(int x)
{
    /* topを加算してからその位置へ挿入 */
    S[++top] = x;
}

int pop()
{
    top--;
    /* topが指していた要素を返す */
    return S[top+1];
}
int main()
{
    int a, b;
    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 {
            push(atoi(s));
        }
    }

    printf("%d\n", pop());

    return 0;
}

Measured memory_bytes: 548
import heapq
Q = int(input())
L = []
R = []
B = 0
n = 0
res = 0
for _ in range(1, Q + 1):
  q = input()
  if q == "2":
    print(-L[0], res + B)
  else:
    n += 1
    t, a, b = map(int, q.split())
    B += b
    if len(L) == 0 or a <= -L[0]:
      heapq.heappush(L, -a)
      res += -L[0] - a
    else:
      heapq.heappush(R, a)
      res += a + L[0]
    if len(R) > len(L):
      res -= R[0] + L[0]
      heapq.heappush(L, -heapq.heappop(R))
    elif len(L) - len(R) >= 2:
      heapq.heappush(R, -heapq.heappop(L))

Measured memory_bytes: 88792
#include<bits/stdc++.h>
#define N 500009
#define PI acos(-1.0)
using namespace std;
typedef long long ll;
int main(void)
{
    //freopen("in.txt","r",stdin);

    double r,ans;
    cin>>r;
    ans=2*PI*r;
    printf("%.30lf",ans);

    //main();
    return 0;
}


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

int main(int argc, char const *argv[])
{
  double x1, x2, y1, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout << fixed << setprecision(10) << sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)) << endl;
  return 0;
}

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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

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

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

void solve() {
    const i64 mod = 1'000'000'007;
    i64 N,K;
    cin >> N >> K;

    vector<i64> a(N);
    rep(i,0,N) cin >> a[i];

    const i64 maxn=110,maxk=100010;
    static i64 dp[maxn][maxk];
    static i64 sum[maxn][maxk];
    fill_n((i64*)dp,maxn*maxk,0);
    fill_n((i64*)sum,maxn*maxk,0);
    rep(i,0,K+1){
        if(i<=a[0]) dp[0][i]=1;
        if(i>0) sum[0][i]=sum[0][i-1];
        sum[0][i]+=dp[0][i];
        sum[0][i]%=mod;
    }
    rep(i,1,N){
        rep(j,0,K+1){
            dp[i][j]=((sum[i-1][j]-(j-a[i]-1<0?0:sum[i-1][j-a[i]-1]))%mod+mod)%mod;
            if(j>0) sum[i][j]=sum[i][j-1];
            sum[i][j]+=dp[i][j];
            sum[i][j]%=mod;
        }
    }

    cout << dp[N-1][K] << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 172160
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

int p[100005];

int main()
{
	IO_OP;
	
	int n, q;
	string s;
	cin >> n >> q >> s;
	for(int i=1;i<s.size();i++) {
		p[i] = p[i-1];
		if(s[i-1] == 'A' && s[i] == 'C')
			p[i]++;
	}
	while(q--) {
		int l, r;
		cin >> l >> r;
		l--, r--;
		cout << p[r] - p[l]<< endl;
	}
	
	
}



Measured memory_bytes: 1488
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    ll N;
    cin >> N;
    ll a[N],b[N],c[N];
    ll i;
    for(i=0;i<N;i++){
      cin >>a[i];
    }
    for(i=0;i<N;i++){
      cin >>b[i];
    }
    ll ans=0;
    ll rem=0;
    for(i=0;i<N;i++){
      c[i]=a[i]-b[i];
      if(c[i]<0){
        ans++;
        rem-=c[i];
      }
    }
    sort(c,c+N);
    i=N-1;
    while((c[i]>0)&&(rem>0)){
      rem-=c[i];
      ans++;
      i--;
    }
    if(rem<=0){
      cout << ans;
    }else{
      cout << -1;
    }
    return 0;
}


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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int[] arr = new int[3];
		for(int i=0;i<3;i++)
		{
			arr[i]=sc.nextInt();
		}
		
		Arrays.sort(arr);
		
		for(int i=0;i<3;i++)
		{
			if(i==arr.length-1)
			{
				System.out.println(arr[i]);
			}
			else
			{
				System.out.print(arr[i]+" ");
			}
		}
		
		
		
	}
}



Measured memory_bytes: 26252
#include<stdio.h>
#include<stdlib.h>
int main(){
  int n,m,a[55],b[55],c[55],d[55],i,j;
  scanf("%d%d",&n,&m);
  for(i=0;i<n;i++){
    scanf("%d%d",&a[i],&b[i]);
  }
  for(i=0;i<m;i++){
    scanf("%d%d",&c[i],&d[i]);
  }
  for(i=0;i<n;i++){
    int min=200000000,t;
    for(j=0;j<m;j++){
      if(min>abs(a[i]-c[j])+abs(b[i]-d[j])){
        min=abs(a[i]-c[j])+abs(b[i]-d[j]);
        t=j;
      }
    }
    printf("%d\n",t+1);
  }
}

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

int main(){

string string;

getline(cin , string);

for(int i = 0;i < string.size(); i++){
  if (string[i] >= 'A' && string[i] <= 'Z') {
    string[i] += 32;
  }else if(string[i] >= 'a' && string[i] <= 'z'){
    string[i] -= 32;
  }
  cout << string[i];
}
cout << endl;


return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  ll d, n; cin >> d >> n;
  ll cnt = 0;
  ll cur = 1;
  while(true){
    ll div = 0;
    ll tmp = cur;
    while(tmp > 0){
      if(tmp%100 == 0) div++;
      else break;
      tmp /= 100;
    }
    if(div == d) cnt++;
    if(cnt == n){
      cout << cur << endl;
      return 0;
    }
    cur++;
  }
}

Measured memory_bytes: 256
while True:
    a,op,b = input().split()
    a = int(a)
    b = int(b)
    if op == '?':
        break
    if op == '+':
        print(a+b)
    if op == '-':
        print(a-b)
    if op == '*':
        print(a*b)
    if op == '/':
        print(a//b)


Measured memory_bytes: 5596
package main

import (
	"fmt"
)

func main() {
	var str string
	fmt.Scan(&str)

	var fin bool
	var ok bool
	for !fin {
		if len(str) < 5 {
			ok = len(str) == 0
			fin = true
			break
		}

		switch {
		case len(str) >= 11 && str[:11] == "dreameraser":
			str = str[11:]
		case len(str) >= 10 && str[:10] == "dreamerase":
			str = str[10:]
		case len(str) >= 7 && str[:7] == "dreamer":
			str = str[7:]
		case len(str) >= 6 && str[:6] == "eraser":
			str = str[6:]
		case len(str) >= 5 && str[:5] == "dream":
			str = str[5:]
		case len(str) >= 5 && str[:5] == "erase":
			str = str[5:]
		default:
			ok = false
			fin = true
			break
		}

	}

	if ok {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


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

Measured memory_bytes: 580