akhauriyash/Code-Regression huggingface dataset:
/***************************************************************
	File name: A.cpp
	Author: ljfcnyali
	Create time: 2020年01月12日 星期日 19时58分22秒
***************************************************************/
#include<bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for ( int i = (a), _end_ = (b); i <= _end_; ++ i ) 
#define mem(a) memset ( (a), 0, sizeof ( a ) ) 
#define str(a) strlen ( a ) 
#define pii pair<int, int>
typedef long long LL;

int main()
{
    char c;
    cin >> c;
    cout << char(c + 1);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    char str[15]={0};
    scanf("%s", str);

    long ans=0;
    long len=strlen(str);
    long i, j;
    for(i=0; i<len; i++) {
        if(str[i]=='A' || str[i]=='C' || str[i]=='G' || str[i]=='T') {
            for(j=i; j<len; j++) {
                if(str[j]=='A' || str[j]=='C' || str[j]=='G' || str[j]=='T') {
                    ;
                }
                else {
                    break;
                }
            }
            long cnt=(j-i);
            ans = MAX(ans,cnt);
        }
    }

    printf("%ld\n", ans);
    return 0;
}


Measured memory_bytes: 128
n, k = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
cnt = [0 for _ in range(100)]
m = A[0]

for i in range(100):
    ten = 2 ** i
    if ten > m:
        break
    for a in A:
        if a < ten:
            break
        if (a >> i) & 1:
            cnt[i] += 1

for m in range(100):
    if 2 ** m > k+1:
        j = m-1
        break

initial = 0
if i > j:
    for m, c in enumerate(cnt[j + 1: i + 1], j + 1):
        initial += 2 ** m * c

best = [0, ]
for m, c in enumerate(cnt[: j + 1]):
    best.append(best[-1] + max(c, n - c) * 2 ** m)

K = list()
equal = [initial, ]
for m, c in enumerate(cnt[j::-1]):
    y = (k+1 >> (j-m)) & 1
    K.append(y)
    if y==1:
        equal.append(equal[-1] + (n - c) * 2 ** (j-m))
    else:
        equal.append(equal[-1] + c * 2 ** (j-m))

ans = 0
K.reverse()

for i in range(j+1):
    if K[i]:
        ans = max(ans, best[i] + 2 ** i * cnt[i] + equal[-(i + 2)])

print(ans)


Measured memory_bytes: 20332
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=1000000007;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

int main(){
    char c;
    cin>>c;
    if('a'<=c&&c<='z')cout<<'a'<<endl;
    else cout<<'A'<<endl;
}


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

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 1000000007;

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

  LL N, D;
  cin >> N >> D;
  vector<vector<LL>> X(N, vector<LL>(D));
  
  REP(i,N){
    REP(j,D){
      cin >> X[i][j];
    }
  }

  LL cnt = 0;
  
  REP(i,N){
    FOR(j,i+1,N){
      LL dist = 0;
      REP(k,D){
        dist += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
      }
      REP(k,1000){
        if(dist==k*k){
          cnt++;
        }
      }
    }
  }

  cout << cnt << endl;
}


Measured memory_bytes: 256
def divisor(i):
    s = []
    for j in range(1, int(i ** (1 / 2)) + 1):
        if i % j == 0:
            s.append(i // j)
            s.append(j)
    return sorted(set(s))

import math

n = int(input())
a = list(map(int, input().split()))
ans = ["pairwise coprime", "setwise coprime", "not coprime"]
"""
if n >= 200000:
    g = a[0]
    for i in a:
        g = math.gcd(i, g)
        if g == 1:
            print(ans[1])
            exit()
    print(ans[2])
    exit()
"""
if n <= 1000000:
    x = [0] * 1000005
    for i in a:
        s = divisor(i)
        t = 1
        for j in s:
            if j == 1:
                continue
            if x[j] == 1:
                t = 0
                break
            x[j] = 1
        if t == 0:
            break
    if t == 1:
        print(ans[0])
        exit()
    g = a[0]
    for i in a:
        g = math.gcd(i, g)
        if g == 1:
            print(ans[1])
            exit()
    print(ans[2])
    exit()

Measured memory_bytes: 205536
from sys import stdin
from itertools import permutations as per
def check(queen):
    for r1, c1 in queen:
        if not all((r1 == r2 and c1 == c2) or (r1 + c1 != r2 + c2 and r1 - c1 != r2 - c2) for r2, c2 in queen):
            return False
    return True
k = int(stdin.readline())
R, C = [[i for i in range(8)] for _ in range(2)]
q = []
for _ in range(k):
    r, c = map(int, stdin.readline().split())
    q.append((r, c))
    R.remove(r)
    C.remove(c)
for l in per(C):
    q_tmp = q[:] + list(zip(R, l))
    if check(q_tmp):
        for i, j in sorted(q_tmp):
            print("." * j + "Q" + "." * (8 - j - 1))
        break

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

int n;
int A[1005][1005];
int L[1005];
bool uda[1005];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cin >> n;
  for(int i=1;i<=n;i++){
    for(int j=1;j<n;j++){
      cin >> A[i][j];
    }
    L[i] = 1;
  }
  bool beda = 1;
  vector<int> ch;
  ch.clear();
  for(int i=1;i<=n;i++) ch.push_back(i);
  int cnt = 0;
  while(beda){
   	beda = 0;
    cnt++;
//    cout << "DAY " << cnt  << endl;
    memset(uda,0,sizeof(uda));
    vector<int> vtmp;
    vtmp.clear();
    for(int j=0;j<ch.size();j++){
    	int i = ch[j];
      if((uda[i]) || (L[i]>=n)) continue;
      	int tmp = A[i][L[i]];
//      	cout << i << " " << tmp << endl;
		if((L[tmp]<n) && !(uda[tmp]) && (i == A[tmp][L[tmp]])){
          L[i]++;
          L[tmp]++;
          uda[tmp]=1;
          uda[i] = 1;
          beda = 1;
          vtmp.push_back(i);
          vtmp.push_back(tmp);
//          cout << i << " AND " << tmp << endl;
        }
    }
    ch = vtmp;
  }
  cnt--;
  for(int i=1;i<=n;i++){
    if(L[i]<n){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << cnt << endl;
  return 0;
}


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

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
ll n, m, x, answer = LLONG_MAX, c[13] = {}, a[13][13] = {};
void BuyBook(ll buyBookNumber, ll paidYen, vector<ll> understandingSums)
{
	paidYen += c[buyBookNumber];
	for (ll i = 1; i <= m; i++)
	{
		understandingSums[i] += a[buyBookNumber][i];
	}
	for (ll i = 1; i <= m; i++)
	{
		if (understandingSums[i] < x)
		{
			break;
		}
		if (i == m)
		{
			answer = min(answer, paidYen);
			return;
		}
	}
	for (ll i = buyBookNumber + 1; i <= n; i++)
	{
		if (i <= n)
		{
			BuyBook(i, paidYen, understandingSums);
		}
	}
	return;
}
int main() {
	cin >> n >> m >> x;
	for (int i = 1; i <= n; i++)
	{
		cin >> c[i];
		for (int j = 1; j <= m; j++)
		{
			cin >> a[i][j];
		}
	}
	for (ll i = 1; i <= m; i++)
	{
		ll understandingSum = 0;
		for (ll j = 1; j <= n; j++)
		{
			understandingSum += a[j][i];
		}
		if (understandingSum < x)
		{
			cout << -1 << endl;
			return 0;
		}
	}
	for (ll i = 1; i <= n; i++)
	{
		vector<ll> tmpUnderstandingSum(13, 0);
		BuyBook(i, 0, tmpUnderstandingSum);
	}
	cout << answer << endl;
	return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define INF 100000000
const int MOD = 1000000009;

//マクロ
#define FOR(i, a, b) for(int i = (a); i < (b), i++)
#define REP(i, n) FOR(i, 0, n);
#define ALL(a) (a).begin(),(a).end()

// 最長共通部分列問題
// 入力
// S T

// dp[i + 1][j + 1] := Sのi文字目までと、Tのj文字目までのLCSの長さ
// 計算量 O(|S||T|)

int main(){

    //入力
    int n; cin >> n;
    for(int roop = 0; roop < n; roop++){
        string S, T; cin >> S >> T;
        vector<vector<int> > dp(S.size() + 1, vector<int> (T.size() + 1, 0));

        //dp初期条件
        dp[0][0] = 0;

        //dp
        for(int i = 0; i < S.size(); i++){
            for(int j = 0; j < T.size(); j++){
                if(S[i] == T[j]) dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
                dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j]);
                dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j + 1]);
            }
        }

        cout << dp[S.size()][T.size()] << endl;
        
    }

    return 0;
}


Measured memory_bytes: 6764
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

long long int opt(const vector<long long int>&w, int mod) {
	//cout << mod << endl;
	long long int sum = 0;
	for (auto j : w)sum += (mod - j) % mod;
	long long int ret = sum;
	long long int bag = 0;
	for (auto i : w) {
		bag += i;
		sum -= (mod - i) % mod;
		//cout << bag << " " << sum << endl;
		ret = min(ret, max(bag, sum));
	}
	//cout << "ret " << ret << endl;
	return ret;
}

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

	cin >> N >> K;
	vector<long long int>v(N);
	for (auto &i : v)cin >> i;
	M = accumulate(v.begin(), v.end(), 0);
	int ans = 1;
	for (int i = 1; i*i <= M; i++) {
		if (M%i)continue;
		auto w = v;
		for (auto &j : w)j %= i;
		sort(w.begin(), w.end());
		auto box = opt(w, i);
		if (box <= K)ans = max(ans, i);
		w = v;
		for (auto &j : w)j %= M / i;
		sort(w.begin(), w.end());
		box = opt(w, M / i);
		if (box <= K)ans = max(ans, (int)M/i);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef unsigned long long ul;
int n;
ll dp[20001];
struct obj { 
	int w, s; ll v; 
	bool operator<(const obj &b)const {
		if (w + s != b.w + b.s)return w + s < b.w + b.s;
		return v < b.v;
	}
};
obj x[1000];
int main() {
	cin >> n;
	rep(i, n) {
		int w, s; ll v;
		cin >> w >> s >> v;
		x[i] = { w,s,v };
	}
	sort(x, x + n);
	fill(dp, dp + 20001, -1);
	dp[0] = 0;
	rep(i, n) {
		per(j, x[i].s+1) {
			if (dp[j] < 0)continue;
			dp[j + x[i].w] = max(dp[j + x[i].w], dp[j] + x[i].v);
		}
	}
	ll ans = 0;
	rep(i, 20001) {
		ans = max(ans, dp[i]);
	}
	cout << ans << endl;
	//stop
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define N 205
using namespace std;
typedef pair<int,int> P;
typedef pair<long double,P> P1;

struct point{
  long double x,y,z;
};

int n;
point p[N],v[N];
long double r[N],vr[N];
const long double EPS=(1e-9);

long double getd(long double T,int a,int b){
  
  long double X=(p[a].x+T*v[a].x)-(p[b].x+T*v[b].x);
  long double Y=(p[a].y+T*v[a].y)-(p[b].y+T*v[b].y);
  long double Z=(p[a].z+T*v[a].z)-(p[b].z+T*v[b].z);
  
  return sqrt(X*X+Y*Y+Z*Z);
}

long double getTime2(long double T,int a,int b){
  
  long double L=0,R=T;
  
  int cnt=100;
  
  while(cnt--){
    
    long double M=(L+R)/2.0;
    long double X=r[a]-M*vr[a]+r[b]-M*vr[b];
    
    if(getd(M,a,b)>X) L=M;
    else R=M;
    
  }
  
  return L;
}

long double getTime(int a,int b){
  
  long double L=0,R=min(r[a]/vr[a],r[b]/vr[b]);
  
  int cnt=100;
  
  while(cnt--){
    
    long double M=(L+R)/2.0;
    long double pX=r[a]-M*vr[a]+r[b]-M*vr[b];
    long double X=r[a]-(M+EPS)*vr[a]+r[b]-(M+EPS)*vr[b];
    
    if(getd(M,a,b)-pX>getd(M+EPS,a,b)-X) L=M;
    else R=M;
    
  }
  
  long double X=r[a]-L*vr[a]+r[b]-L*vr[b];
  
  if(getd(L,a,b)<X) return getTime2(L,a,b);
  return (1e9);
}

int main(){
  
  while(1){
    
    cin>>n;
    if(!n) break;
    
    for(int i=0;i<n;i++){
      cin>>p[i].x>>p[i].y>>p[i].z;
      cin>>v[i].x>>v[i].y>>v[i].z;
      cin>>r[i]>>vr[i];
    }
    
    bool used[N];
 
    memset(used,0,sizeof(used));

    priority_queue<P1,vector<P1>,greater<P1> > q;
    
    for(int i=0;i<n;i++)
      q.push(P1(r[i]/vr[i],P(i,i)));
    
    for(int i=0;i<n;i++)
      for(int j=i+1;j<n;j++)
	q.push(P1(getTime(i,j),P(i,j)));
    
    long double ans[N];
    
    while(!q.empty()){
      
      P1 t=q.top(); q.pop();
      
      long double T=t.first;
      int a=t.second.first;
      int b=t.second.second;
      
      if(used[a]||used[b]) continue;
      
      used[a]=used[b]=true;
      
      ans[a]=ans[b]=T;
      
    }
    
    for(int i=0;i<n;i++) printf("%.10Lf\n",ans[i]);
    
  }
  
  return 0;
}

Measured memory_bytes: 4528
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


long long A[111111], B[111111], C[111111], AB[111111], BC[111111], acc1[111111], acc2[111111];


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int N;

  std::cin >> N;

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

  for (int i = 0; i < N; i ++)
    std::cin >> B[i];

  for (int i = 0; i < N; i ++)
    std::cin >> C[i];

  std::sort(A, A + N);
  std::sort(B, B + N);
  std::sort(C, C + N);

  for (int i = 0; i < N; i ++) {
    AB[i] = std::lower_bound(B, B + N, A[i] + 1) - B;
    BC[i] = std::lower_bound(C, C + N, B[i] + 1) - C;
  }

  acc1[0] = acc2[0] = 0;

  for (int i = 0; i < N; i ++)
    acc2[i + 1] = (N - BC[i]) + acc2[i];

  for (int i = 0; i < N; i ++)
    acc1[i + 1] = (acc2[N] - acc2[AB[i]]) + acc1[i];

  std::cout << acc1[N] << std::endl;

  return 0;
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int n;
    ll x;
    cin >> n >> x;
    vl m(n);
    rep(i, n) cin >> m[i];
    sort(all(m));
    ll sum = 0LL;
    rep(i, n) sum += m[i];
    cout << n + (x - sum) / m[0] << endl;
    return 0;
}

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

int main() {
  
  int W, H, N; cin >> W >> H >> N;
  
  bool table[H][W]; int ans = 0;
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      table[i][j] = true;
    }
  }
  
  for (int i = 0; i < N; i++) {
    
    int x, y, a; cin >> x >> y >> a;
    
    for (int j = 0; j < H; j++) {
      for (int k = 0; k < W; k++) {
        if (a == 1 && k < x) table[j][k] = false;
        if (a == 2 && x <= k) table[j][k] = false;
        if (a == 3 && j < y) table[j][k] = false;
        if (a == 4 && y <= j) table[j][k] = false;
      }
    }
    
  }
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (table[i][j]) ans++;
    }
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 3592
(defun compute(n)
  (zerop (logand #x03 n)))

(defun splitat (c line)
  (labels ((rec (line acc)
				(let ((pos (position-if (lambda(cc) (char= c cc)) line)))
				  (if pos
					  (rec (subseq line (1+ pos)) (cons (subseq line 0 pos) acc))
					(nreverse (cons line acc))))))
	(rec line nil)))
	;(splitat #\a "john mccarthy")
(defun readline (callback)
  (labels ((rec (i)
				(let ((line (read-line nil nil)))
				  (when (not (zerop (length line)))
					(funcall callback line i)
					(rec (1+ i))))))
	(rec 0)))
	;(readline (lambda(line i)))
(defun start()
  (let ((limit 0)
        (lst nil))
    (readline (lambda(line i)
                (format t "~A~%" (if (compute (reduce #'+ (mapcar #'* '(100 10 1) (mapcar #'parse-integer (splitat #\space line))))) "YES" "NO"))))))
(start)

Measured memory_bytes: 16356
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
	vector<int> v;
	int N; cin >> N;
	rep(i,N){
		int a; cin >> a;
		if(a==0){
			int b; cin >> b;
			v.push_back(b);
		}
		else if(a==1){
			int b; cin >> b;
			cout << v[b] << endl;
		}
		else{
			v.erase(v.end()-1);
		}
	}

	return 0;
}


Measured memory_bytes: 4980
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstring>
#include <stdio.h>

using namespace std;

int main() {
	int N, K, H[200005];
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}

	sort(H, H + N);
	long long int result = 0;
	for (int i = N - 1 - K; i >= 0; i--) {
		result += H[i];
	}
	cout << result << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, a, n) for (int i = a; i <= (n); ++i)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

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

    int A[N];
    rep(i, N) A[i] = 0; // 初期化
    rep(i, N) {
        int a; cin >> a;
        A[a - 1]++;
    }

    // 降順に並び替え
    sort(A, A + N, greater<int>());
    
    // 書き換える必要のないボールの最大値
    int sum = 0;
    rep(i, K) {
        sum += A[i];
    }

    // 少なくとも書き換える必要のある個数
    int ans = N - sum;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#import <math.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vii vector<int, int>
#define po pop_back
#define hell 1000000007
#define PI 3.1415926535897
using namespace std;

void solve(){
	double n;
	cin>>n;
	cout<<2*n*PI;
}

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

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N=in();
	vector<pair<int,int>> P(N);
	REP(i,N){
		P[i].first=in();
		P[i].second=in();
	}
	sort(ALL(P),[](pair<int,int>& l,pair<int,int>& r){return l.first==r.first ? l.second<r.second : l.first<r.first;});

	REP(i,N){
		out(P[i].first,P[i].second);
	}
	return 0;
}


Measured memory_bytes: 3528
import java.util.*;
import java.util.Map.Entry;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String w = in.next();
		
		HashMap<Character,Integer> hm = new HashMap<Character,Integer>();
		for (int i=0;i<w.length();i++) {
			if(hm.containsKey(w.charAt(i))) {
                  hm.put(w.charAt(i), hm.get(w.charAt(i))+1);}
              else { hm.put(w.charAt(i), 1);}}
		
		boolean flag = true;
		for (Entry<Character, Integer> entry : hm.entrySet()) {
            int value = entry.getValue(); 
            char key = entry.getKey(); 
            if (value%2!=0) {
            	flag = false;
            	break;}}
            
            if (flag) {
            	System.out.println("Yes");}
            else {
            	System.out.println("No");}
            }
		}
	



Measured memory_bytes: 35836
#include <iostream>
#include <algorithm>
#include <string>
#include <stdlib.h>
#include <vector>
#include <math.h>
#include <map>
#include <set>
using namespace std;
int main()
{
    int x,y,z;
    cin>>x>>y>>z;
    swap(x,y);
    swap(x,z);
    cout<<x<<" "<<y<<" "<<z;
}

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

LL big_mod(LL val,LL pow,LL mod);
LL mod_inverse(LL val,LL mod);






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int a,p;
    cin >> a >> p;
    cout << (a*3+p)/2;
    return 0;
}







LL big_mod(LL val,LL pow,LL mod)
{
    LL res = 1;
    val = val % mod;
    while(pow > 0)
    {
        if(pow & 1)
        {
            res = (res*val) % mod;
        }
        pow = pow >> 1;
        val = (val*val) % mod;
    }
    return res;
}

LL mod_inverse(LL val,LL mod)
{
    LL mod1 = mod;
    if(mod == 1)
    {
        return 0;
    }
    LL y = 0;
    LL x = 1;
    LL quotient,temp;
    while(val > 1)
    {
        quotient = val / mod;
        temp = mod;
        mod = val % mod;
        val = temp;
        temp = y;
        y = x - quotient * y;
        x = temp;
    }
    if(x < 0)
    {
        x += mod1;
    }
    return x;
}


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

using namespace std;

const int N = 1<<17;

int n,a[N],ans;

int main() {
    int i;
    
    scanf("%d", &n);
    for(i=1;i<=n;i++) scanf("%d", &a[i]);
    for(i=1;i<=n;i++) if(a[a[i]]==i) ++ans;
    printf("%d\n", (ans>>1));

    return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define P pair<int,int>
int k,x;
signed main(){
    cin>>k>>x;
    if(k*500>=x)puts("Yes");
    else puts("No");
    return 0;
}




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

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

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

    long long k=__gcd(a,b);

    vector<long long>v;

    for(int i=2;i<=sqrt(k);i++)
    {
        if(k%i==0)
        {
            v.push_back(i);
            while(k%i==0)
            {
                k/=i;
            }
        }
    }

    if(k>2)
    {
        v.push_back(k);
    }

    cout<<v.size()+1<<endl;
}


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

const int dx[]={-1,-1,-1,0,0,1,1,1},dy[]={-1,0,1,-1,1,-1,0,1};
int p[1001][1001];
string s[1002];
vector<pint> v0,v1;
int main(){
    int h,w;
    cin>>h>>w;
    rep(i,h) cin>>s[i];
    FOR(i,1,h-1)FOR(j,1,w-1){
        if(s[i][j]=='.') continue;
        int cnt=0,cur=s[i][j]-'0';
        rep(k,8){
            int tx=j+dx[k],ty=i+dy[k];
            if(s[ty][tx]=='.') ++cnt;
        }
        if(cur<=cnt) v0.pb(i-1,j-1);
        else p[i-1][j-1]=cur-cnt;
    }
    int ans=0;
    while(!v0.empty()){
        v1.clear();
        for(auto it:v0){
            rep(i,8){
                int ty=it.first+dy[i],tx=it.second+dx[i];
                if(ty<0||tx<0||p[ty][tx]<=0) continue;
                --p[ty][tx];
                if(p[ty][tx]==0) v1.pb(ty,tx);
            }
        }
        swap(v0,v1);
        ++ans;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 8016
package main

import "fmt"

func main() {
	var n int

	fmt.Scan(&n)
	a := make([]int, n)
	b := make([]int, n)
	c := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
		fmt.Scan(&b[i])
		fmt.Scan(&c[i])
	}

	fmt.Println(solve(n, a, b, c))
}

func solve(n int, a, b, c []int) int {
	x, y, z := 0, 0, 0

	for i := 0; i < n; i++ {
		x, y, z = max(y, z)+a[i], max(x, z)+b[i], max(x, y)+c[i]
	}

	return max(x, max(y, z))
}

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


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

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double eps = 1e-9;
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1};

const int MAX_N = 300000;
bool prime[MAX_N];
void eratos() {
	rep(i, MAX_N) prime[i] = true;
	prime[0] = false;
	prime[1] = false;
	REP(i, 2, sqrt(MAX_N)) {
		if (prime[i]) {
			for (int j = 0; i * (j + 2) < MAX_N; ++j) {
				prime[i * (j + 2)] = false;
			}
		}
	}
}

int main() {
	int n;
	eratos();
	while (cin >> n, n) {
		int ans = 0;
		for (int i = n + 1; i <= 2 * n; ++i) {
			if (prime[i]) ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

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

int main(){
    int N,K; cin >> N >> K;
    int v[N];
    for(int i=0;i<N;i++) cin >> v[i];
    int ans=0;
    for(int left=0;left<=K;left++){
        for(int right=0;right<=K-left;right++){
            if(left+right>N) continue;
            priority_queue<int,vector<int>,greater<int>> que;
            int th=K-right-left;
            int sum=0;
            for(int i=0;i<left;i++){
                sum+=v[i];
                que.push(v[i]);
            }
            for(int i=0;i<right;i++){
                sum+=v[N-1-i];
                que.push(v[N-1-i]);
            }
            while(th--){
                if(que.empty()) break;
                int res=que.top(); que.pop();
                if(res>=0) break;
                sum-=res;
            }
            ans=max(ans,sum);
        }
    }
    cout << ans << endl;
}

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

int main(){
   bool S[31]={false};
   int n;
   
   for(int i=0; i<28; i++){
      cin >> n;
      S[n]=true;
   }
   for(int i=1; i<31; i++){
      if(S[i]==false) cout << i << endl;
   }
}


Measured memory_bytes: 3088
n, k = map(int, input().split())
A = list(map(int, input().split()))
dp = [0]*(k+1)
for i in range(1, k+1):
    for j in range(n):
        if i-A[j] < 0:
            continue
        dp[i] |= not dp[i-A[j]]
print('First' if dp[k] else 'Second')

Measured memory_bytes: 43552
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<int,int>
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define FORR(I,A,B) for(int I = ((B)-1); I >= (A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
int gcd(int a,int b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
int lcm(int a,int b){int c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	string c = "Christmas";
	string e = " Eve";
	cout << c;
	while(n!=25){
		cout << e;
		n++;
	}
	cout << endl;
}

Measured memory_bytes: 256
n = int(input())

x_ls = list(map(int, input().split()))
x_ls.sort()
#print(x_ls)
sub_num = 10**10+7
for i in range(1,101):
    _max = 0
    #print(i)
    for j in range(n):
        #print(j)
        #print(x_ls[j])
        _max+=((i-x_ls[j])**2)
    sub_num = min(sub_num, _max)
print(sub_num)


Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static int[] hs;
        static long ans;
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            int[] s = ReadLine().Split(' ').Select(int.Parse).ToArray();
            long ans = 0;
            for (int i = 0; i < n; i++)
            {
                ans += s[i] - 1;
            }
            WriteLine(ans);
        }
    }
}



Measured memory_bytes: 13396
#include <vector>
#include <algorithm>
#include <functional>
#include <iostream>
#include <cmath>
#include <string>

using namespace std;

int b, c1, c2, q1, q2;

int c(int x)
{
    int y = (b - c1 * x) / c2;
	if(b-c1*x<0) return -1; 
	if(q1>(x+y)) return -1;
	if(q2<x) return -1;
	if(y<0) return -1;
	return y;
}

int main()
{
    while(cin >> q1 && q1) {
        cin >> b >> c1 >> c2 >> q2;
        int y;
        bool flag = false;
        for(int x = q2; !flag && x > 0; x--) {
            if((y = c(x)) != -1) {
                cout << x << " " << y << endl;
                flag = true;
            }
        }
        if(!flag) cout << "NA" << endl;
        
    }
    return 0;
}

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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;
typedef vector<int>				V;
typedef vector<V>				VV;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define MAX 		100050

const ll LINF = (ll)1e18+7;		//
const int INF = 1e9+7;			//2,147,483,647 (Max int)
const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//

ll DIGIT[13];

//
int main(){
	string S;
	cin >> S;
	int N = S.size();

	V M(N+1);
	M[1] = 1;
	REPS(i,2,N+1){
		M[i] = (M[i-1]*10)%13;
	}

	DIGIT[0] = 1;

	REP(i,N){
		vector<ll> nextDP(13,0);
		REP(j,13){
			if(S[N-i-1]=='?'){
				REP(k,10){
				//	cout << " " << ((j+M[i+1]*k)%13);
					nextDP[(j+M[i+1]*k)%13] += DIGIT[j];
					nextDP[(j+M[i+1]*k)%13] %= MOD;
				}
				//cout << endl;
			}else{
				//printf("%d [%d:%d]\n",((j+M[i+1]*(S[N-i-1]-'0'))%13) ,j, DIGIT[i][j] );
				nextDP[(j+M[i+1]*(S[N-i-1]-'0'))%13] += DIGIT[j];
				nextDP[(j+M[i+1]*(S[N-i-1]-'0'))%13] %= MOD;
			}
		}
		REP(j,13)DIGIT[j] = nextDP[j];
	}

	cout << DIGIT[5]  << endl;

	return 0;
}




Measured memory_bytes: 896
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
B = [list(map(int,input().split())) for _ in range(Q)]
numList = [0]*(10**5+1)
res=sum(A)
for i in A:
    numList[i] += 1

for i in range(Q):
    dev = B[i][1]-B[i][0]
    res += numList[B[i][0]]*dev
    numList[B[i][1]] +=numList[B[i][0]]
    numList[B[i][0]] = 0
    print(res)
    

Measured memory_bytes: 32256
A=[input() for i in range(5)]
B=[0,0,0,0,0]
C=[0,0,0,0,0]
for j in range (0,5):
  if int(A[j])%10 == 0:
    C[j]=10
  else:
    B[j]=int(A[j])%10
    C[j]=B[j]
ans=0
for k in range(0,5):
  ans += int(A[k])-C[k]+10
m=min(C)
print(ans+m-10)

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

using namespace std;
typedef long long ll;

int main()
{
    ll n;vector<ll> arr;map<ll,ll> freq;ll res = 0;
    cin >> n;
    for(ll i=0;i<n;i++){ll tmp;cin >> tmp;arr.push_back(tmp);freq[tmp]++;}
    map<ll,ll>::iterator itr;
    for(itr = freq.begin();itr != freq.end();itr++){
        ll f = itr->second;
        if(f > 1) res += f*(f-1)/2;
    } 
    vector<ll>::iterator itr2;
    for (itr2 = arr.begin(); itr2 != arr.end(); itr2++){
        ll k = *itr2;
        ll f = freq[k];
        if (f > 1) cout << (res - (f*(f-1)/2) + ((f-1)*(f-2)/2)) << endl;
        else cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 11376
#include<bits/stdc++.h>
typedef double          D;
typedef long long int   LL;
typedef long double     LD;
#define OR              ||
#define AND             &&
#define nl              '\n'
#define S               string
#define inf             INT_MAX
#define SQR(a)          (a) * (a)
#define pb              push_back
#define GCD(a, b)       __gcd(a, b)
#define PI              2.0*acos(0.0)
#define LCM(a, b)       (a * b) / GCD(a, b)
#define mem(a,b)        memset(a,b,sizeof(a))
#define srtv(v)         sort(v.begin(),v.end())
#define T               int t; cin>>t; while(t--)
#define Rep(i,a,b)      for(int i = a; i <= b; i++)
#define rep(i,a,b)      for(int i = a; i >= b; i--)
#define boost		    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inout           freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)

#define si(x)           scanf("%d",&x)
#define pi(x)           printf("%d",x)
#define ss(str)         scanf("%s",str)
#define pl(x)           printf("%lld",x)
#define sl(x)           scanf("%lld",&x)
#define sii(x,y)        scanf("%d %d",&x,&y)
#define sll(x,y)        scanf("%lld %lld",&x,&y)
#define siii(x,y,z)     scanf("%d %d %d",&x,&y,&z)
#define slll(x,y,z)     scanf("%lld %lld %lld",&x,&y,&z)
using namespace std;



/*
int bs(int l,int r)
{
    int mid,res=inf;

    while(l<=r)
    {
        mid=l+(r-l)/2;

        if(check(mid,0)|| check(mid,1))
        {
            res=min(res,mid);
            r=mid-1;
        }
        else
            l=mid+1;

    }


    return res;
}*/


int main()
{

    int a;
    si(a);

    printf("%d",a+(a*a)+(a*a*a));




    return 0;

}
/*

*/


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

#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;

const ll MOD=1000000007ll;
const int MAX=5100000;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    for(int i=0;i<a;i++){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    for(int i=0;i<a;i++){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

ll fact[MAX], fact_inv[MAX];

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

// nCr
ll comb(ll n, ll r){
	ll t=1000000;
	fact[0]=1;
	    for(int i=0;i<t;i++){ fact[i+1]=fact[i]*(i+1)%MOD;}
	fact_inv[t]=power(fact[t], MOD-2);
	for(int i=0;i<t;i++){ fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;}
	return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}
  
int main()
{
	//cin.tie(0);	ios::sync_with_stdio(false);

  int i,j;
  int D; cin >> D;
  int C[26]; rep(i,26){cin >> C[i];}
  int S[D][26]; 
  rep(i,D){rep(j,26){cin >> S[i][j];}}
  
  ll ans = 0;
  rep(i,D){
      int max=0,idx=0;
      rep(j,26){
          if(max<S[i][j]){max=S[i][j];idx=j+1;}
      }
      cout << idx << endl;
  }

  /*for(i=0;i<D;i++){
      ans += S[i][T[i]]; last[T[i]]=i+1;
      rep(j,26){
          ans -= C[j] * (i+1 - last[j]);
      }
      cout << ans << endl;
  }*/

  return 0;

}


Measured memory_bytes: 3664
// header {{{
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <queue>
#include <map>
#include <list>
#include <stack>
#include <tuple>
#include <cstdio>
#include <cmath>
using namespace std;

#define kita            cout << "kita\n"
#define print2(i, n)    cout << (i) << ": " << (n) << endl
#define print3(i, j, n)     cout << "(" << (i) << ", " << (j) << ") : " << (n) << endl
#define print4(i, j, n, m)  cout << "(" << (i) << ", " << (j) << ") : " << (n) << ", " << (m) << endl
#define print_mat(mat, h, w) for(int i=0;i<(h);i++){for(int j=0;j<(w);j++){cout << mat[i][j] << " ";}cout << endl;}

#define EPS (1e-10)
#define EQ(a, b) (fabs((a)-(b)) < eps)

typedef long long ll;
typedef unsigned long long ull;
// }}}

#define SIZE      100005
#define MOD 1000000007LL

ll pow(ll a, ll b) {
    if(b == 0) return 1;
    ll aa = pow(a, b/2);
    return aa*aa%MOD*(b%2 == 1 ? a : 1)%MOD;
}

ll fact[SIZE] = {1, 1};
ll finv[SIZE] = {1, 1};

void fact_init() {
    // fact
    for(ll i=2;i<SIZE;i++){
        fact[i] = fact[i-1]*i%MOD;
    }

    // finv
    finv[SIZE-1] = pow(fact[SIZE-1], MOD-2);
    for(ll i=SIZE-1;i>=3;i--){
        finv[i-1] = finv[i]*i%MOD;
    }
}

ll comb(int n, int r) {
    if(r > n) return 0;
    return fact[n]*(finv[r]*finv[n-r]%MOD)%MOD;
}


int main() {
    fact_init();
    int n;

    cin >> n;

    vector<int> pos(n, -1);

    int l, r;

    for(int i=0;i<n+1;i++){
        int aa;
        cin >> aa;
        aa--;
        if(pos[aa] != -1){
            l = pos[aa];
            r = i;
        }
        pos[aa] = i;
    }

    for(int k=1;k<=n+1;k++){
        ll ans = comb(n+1, k) - comb(l+n-r, k-1);
        if(ans < 0){
            ans += MOD;
        }
        cout << ans << endl;
        // cout << comb(n+1, k) << endl;
    }

    return 0;
}


Measured memory_bytes: 3200
import sys

def solve():
    num_rect, num_rhom = 0, 0
    for line in sys.stdin:
        a, b, c = map(int, line.split(','))
        if c ** 2 == a ** 2 + b ** 2:
            num_rect += 1
        elif a == b:
            num_rhom += 1
    
    print(num_rect)
    print(num_rhom)

if __name__ == "__main__":
    solve()



Measured memory_bytes: 5596
import java.io.*;
public class Main {
    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(
                new InputStreamReader (System.in));
        String line=br.readLine();
        String[] str = line.split(" ");
        int a=Integer.parseInt(str[0]);
        int b=Integer.parseInt(str[1]);
        System.out.println(a*b+" "+(a+b)*2);
    }
}

Measured memory_bytes: 24120
#include<bits/stdc++.h>
using namespace std;
int n,m,a[100005],ans;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=m;i++) ans+=a[i];
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 3748
#include <iostream>

using namespace std;

int main()
{
    int time = 0;
    int input;

    for (int i = 0; i < 4; ++i) {
        cin >> input;
        time += input;
    }
    cout << time / 60 << "\n" << time % 60 << endl;

    return 0;
}

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

int main() {
  int N;
  std::cin >> N;
  int x;
  std::cin >> x;
  int sum = 0;
  int min;
  std::vector<int> m(N);
  for (int i=0; i < N; i++) {
    std::cin >> m.at(i);
    sum += m.at(i);
    if (i==0) {
      min = m.at(i);
    }
    else {
      min = std::min(min,m.at(i));
    }
  }
  x -= sum;
  std::cout << N + x / min << std::endl;
}
  

Measured memory_bytes: 256
<?php 
      fscanf(STDIN, "%s", $S);
      fscanf(STDIN, "%s", $T);
     
    $arr1 = str_split($S);
    $arr2 = str_split($T);
     
    if($S === $T){
    echo 3;
    }elseif($arr1[0] === $arr2[0] && $arr1[1] === $arr2[1] || $arr1[0] === $arr2[0] && $arr1[2] === $arr2[2] || $arr1[2]=== $arr2[2] && $arr1[1] === $arr2[1]){
    echo 2;
    }elseif($arr1[0] !== $arr2[0] && $arr1[1] !== $arr2[1] && $arr1[2] !== $arr2[2]){
    echo 0;
    }else{
    echo 1;
    }
    ?>

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

using namespace std;

int main()
{
  string s;
  cin>>s;
  
  int i;
  int ans = 0;
  for(i=0;i<s.length();i++)
  {
    if(s[i]=='R')
    {
      int count = 0; 
      while(i<s.length() && s[i]=='R')
        {i++;count++;}
      ans = max(ans, count);
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3628
import math
n = int(input())
s = sorted([sorted(input()) for _ in range(n)])

s.insert(len(s), "")

current = 0
ans = 0
for i in range(len(s)):
    if s[current] != s[i]:
        num = i - current
        if num >= 2:
            ans += math.factorial(num)//(math.factorial(2)*math.factorial(num-2))

        current = i

print(ans)


Measured memory_bytes: 27280
#include <iostream>
#include <algorithm>
#include <unordered_map>
using namespace std;

int main() {
    unordered_map<int, int> dict1;
    for(int a = 0; a <= 1000; a++) {
        for(int b = 0; b <= 1000; b++) {
            dict1[a + b]++;
        }
    }
    unordered_map<int, int> dict2;
    for(int c = 0; c <= 1000; c++) {
        for(int d = 0; d <= 1000; d++) {
            dict2[c + d]++;
        }
    }
    for(int N; cin >> N; ) {
        int ans = 0;
        for(auto it : dict1) {
            if(dict2.count(N - it.first)) {
                ans += dict1[N - it.first] * it.second;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1392
#include <bits/stdc++.h>
    using namespace std;
 
    #define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
    #define mod 1000000007
    #define qmod 998244353
    #define M 1000001
    #define endl "\n"
    #define all(a) (a).begin(),(a).end()
    #define rep(i,a,b) for(int i=a;i<b;++i)
    #define repr(i,a,b) for(int i=a;i>=b;--i)
    #define F first
    #define S second
    #define pb push_back
    #define mp make_pair
 
    typedef long long ll;
    typedef pair<ll,ll> pii;
    typedef vector<int> vi;
    typedef vector<string> vs;
    typedef vector<pii> vii;
    typedef vector<vi> vvi;

    int main(){
        
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);
    // #endif  

        fast; 
        int k,x;
        cin>>k>>x;
        cout<<(k*500>=x?"Yes":"No");
        return 0;  
    }   
 
 
    //keep it simple stupid


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int W, a, b;
  cin >> W >> a >> b;
  
  int d =  abs(a - b) - W;
  
  if(d > 0){
    cout << abs(a - b) - W << endl;
  }else{
    cout << "0" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	string s;
	cin>>a>>s>>b;
	char c=s[b-1];
	for(int i=0;i<a;i++)
	if(s[i]==c)
	cout<<c;
	else
	cout<<"*";
	return 0;
} 

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
typedef pair<int, int> P;
int d[5005];
int cd[5005];
signed main() {
	int k, q; cin >> k >> q;
	rep(i, k)cin >> d[i];
	rep(Q, q) {
		int n, x, m; cin >> n >> x >> m;
		x %= m; n--;
		int sumd = 0;
		rep(i, k) {
			cd[i] = d[i] % m;
			if (!cd[i])cd[i] = m;
			sumd += cd[i];
		}
		int fin = x + sumd*(n / k);
		rep(i, n%k)fin += cd[i];
		fin /= m;
		cout << n - fin << endl;
	}
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int cal(int a)
{
	if(a<=1)return 0;
	int ans=1;
	for(int i=a-1;i<=a;++i) ans*=i;
	ans/=2;
	return ans;
}
int main()
{
	int n,m;
	cin>>n>>m;
	int sum=0;
	sum+=cal(n)+cal(m);
	cout<<sum;
	return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  
  int r = (B - 1) % (A - 1);
  
  if (r == 0) cout << (B - 1) / (A - 1);
  else cout << (B - 1) / (A - 1) + 1;
}

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

#define int long long
#define rep(i,a,n) for(int i = a; i < n; i++)
#define pb push_back
#define eb emplace_back
#define dump(x) cout << #x << " = " << (x) << endl
#define chk() cout << "now" << endl;
#define ALL(x) (x).begin(),(x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTG(c) sort((c).begin(), (c).end(), greater<int>());
#define fi first
#define se second
#define INF (1e9)

typedef pair<int,int> P;
typedef vector<int> vi;

bool pairCompare1(const P& firstElof, const P& secondElof)
{
        return firstElof.fi < secondElof.fi;
}
bool pairCompare2(const P& firstElof, const P& secondElof)
{
        return firstElof.se > secondElof.se;
}

int N,M;
int num[10] = {2,5,5,4,5,6,3,7,6};
vector<P> A;

signed main() {
    cin>>N>>M;
    int dp[N+1]; // dp[i] i本使って作れる最大桁数
    rep(i,0,N+1) dp[i]=INF;
    dp[0]=0;

    rep(i,0,M) {
        int a; cin>>a;
        A.pb(P(num[a-1],a));
        dp[num[a-1]] = 1;
    }

    sort(A.begin(),A.end(),pairCompare1);
    rep(i,0,N+1) {
        rep(j,0,M) {
            if(i-A[j].fi>=0 and dp[i-A[j].fi] != INF) {
                if(dp[i]!=INF) {
                    dp[i]=max(dp[i-A[j].fi]+1,dp[i]);
                }else{
                    dp[i]=dp[i-A[j].fi]+1;
                }
            }
        }
    }
   
    sort(A.begin(),A.end(),pairCompare2);


    int digit=dp[N];
    vi ans;
    while(N>0) {
        rep(i,0,M) {
            if(N-A[i].fi>=0 and dp[N-A[i].fi]==dp[N]-1) {
                N-=A[i].fi;
                ans.pb(A[i].se);
                break;
            }
        }
    }
    rep(i,0,ans.size()) cout<<ans[i];
    cout<<endl;
    return 0;
}





Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
#define VECIN(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;

int main(){
	int r;
    cin>>r;
    OUT(r*r*3);
	return 0;
}

Measured memory_bytes: 256