akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Volume0008
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = "";
            while ((str = Console.ReadLine()) != null)
            {
                int n = int.Parse(str);
                int Counter = 0;
                for (int a = 0; a < 10; ++a)
                {
                    for (int b = 0; b < 10; ++b)
                    {
                        for (int c = 0; c < 10; ++c)
                        {
                            for (int d = 0; d < 10; ++d)
                            {
                                if (a + b + c + d == n)
                                {
                                    Counter++;
                                }
                            }
                        }
                    }
                }
                Console.WriteLine(Counter);
            }
        }
    }
}



Measured memory_bytes: 13828
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll a;
string s;
int32_t main(){
cin>>a;
cin>>s;
if(a>=3200){
    cout<<s<<endl;
}else cout<<"red";
}


Measured memory_bytes: 256
let N = Int(readLine()!)!
var tasks = [(Int, Int)]()
for _ in 0..<N {
    let input = readLine()!.characters.split(" ").map{Int(String($0))!}
    tasks += [(input[0], input[1])]
}
tasks.sortInPlace{$0.1<$1.1}
var ans = "Yes"
var time = 0
for AB in tasks {
    time += AB.0
    if time > AB.1 {
        ans = "No"
        break
    }
}
print(ans)

Measured memory_bytes: 7012
N=int(input())
d=[]
for n in range(N):
    d.append(list(map(int,input().split())))
d_1=sorted(d,key=lambda d:d[1])
t=0
for n in range(N):
    t+=d_1[n][0]
    if t>d_1[n][1]:
        print("No")
        exit(0)
print("Yes")

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

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

const long long INF = 1LL << 60;

typedef unsigned long long ll;

const long long MOD = 1000000000 + 7;

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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d; 
    while(true){
        c -= b;
        if ( c <= 0 ) {
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if ( a <= 0) {
            cout << "No" << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll bg=1234567890123;
int main()
{
  ll i,n;
  cin>>n;
  ll arr[n],dp[n];
  
  for(i=0;i<n;i++)
  {cin>>arr[i];dp[i]=bg;}
  dp[0]=0;
  for(i=0;i<n;i++)
  {
    if(i+1<n)
       dp[i+1]=min(dp[i+1],dp[i]+abs(arr[i+1]-arr[i]));
    if(i+2<n)
       dp[i+2]=min(dp[i+2],dp[i]+abs(arr[i+2]-arr[i]));
  }
  cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 1792
X=int(input())

N=120
for i in range(N):
  for j in range(N):
    if i**5-j**5==X:
      print(i,j)
      break
    elif -i**5-j**5==X:
      print(-i,j)   
      break 
    elif i**5+j**5==X:
      print(i,-j)
      break
    elif -i**5+j**5==X:
      print(-i,-j)
      break 
  else:
    continue
  break


Measured memory_bytes: 9188
s=input()
ans=0
a=[0 for i in range(len(s))]
bc=[0 for i in range(len(s))]
if len(s)<3:
  print(0)
else:
  for i in range(len(s)-2):
    if s[i]=="A":
      a[i]+=1
    if s[i+1]=="B" and s[i+2]=="C":
      a[i+2]+=a[i]
    if s[i+1]=="A":
      a[i+1]+=a[i]
      
  for i in range(len(s)-1):
    if s[i]=="B" and s[i+1]=="C":
      bc[i]=1
  #for i in range(len(s)-1):
   # if a[i+1]>0:
    #  a[i+1]+=a[i]
     # a[i]=0
  #for i in range(len(s)-2):
   # if a[i]>0 and bc[i+1]>0:
    #  a[i+2]=a[i]
  #for i in range(len(s)-2,-1,-1):
   # if bc[i-2]>0:
    #  bc[i-2]+=bc[i]
     # bc[i]=0
  #for i in range(len(s)-1):
   # if a[i+1]>0:
    #  a[i+1]+=a[i]
     # a[i]=0
  
  for i in range(len(s)-2):
    if a[i]>0 and bc[i+1]>0:
      ans+=a[i]*bc[i+1]
  print(ans)
  

Measured memory_bytes: 56188
#include <iostream>
#include<vector>
#include<map>
#include<string>
#include<stdio.h>
#include<math.h>
#include <algorithm>

using namespace std;

int main(void) {

	int a;
	int s, t;
	vector<int>vi;
	int ans = 2147483647;
	cin >> a;

	for (int i = 0; i < a; i++) {
		int tmp;
		cin >> tmp;
		vi.push_back(tmp);
	}

	for (int i = 0; i < a; i++) {
		int sum1 = 0;
		int sum2 = 0;
		
		for (int j = 0; j <= i; j++) {
			sum1 += vi[j];
		}
		for (int j = i+1; j < a; j++) {
			sum2 += vi[j];
		}
		if (ans > abs(sum1 - sum2)) ans = abs(sum1 - sum2);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vll vector<ll>
#define vpll vector<pair<ll,ll> >
#define vst vector<string>
ll mx=INT_MAX;
ll mi=INT_MIN;
const ll mod=1e9+7;
int main()
{
    vll v,vv(250000,0),vvv[250000],so(250000,0);
    ll i,j,k,n,x;
    string s;
    cin>>s;
    if(s=="ABC") cout<<"ARC";
    else cout<<"ABC";
    
}

Measured memory_bytes: 12848
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#include <climits>

#define DEBUG if(false)

using namespace std;

int main(){
  vector<int> A(3);
  cin >> A[0] >> A[1] >> A[2];
  sort(A.begin(), A.end());
  cout << abs(A[0] - A[1]) + abs(A[2] - A[1]) << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] X = new int[]{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
		int K = sc.nextInt();
		
		System.out.println(X[K-1]);
    }
}

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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

LL a[2 * mx5];

int main()
{
    int n;
    cin >> n;

    for(int i = 1; i <= n; i++)
        cin >> a[i], a[i] -= i;

    sort(a + 1, a + n + 1);

    LL m1 = a[n / 2], m2 = a[n / 2 + 1], m3 = a[n / 2 - 1];
    LL r1 = 0, r2 = 0, r3 = 0;

    for(int i = 1; i <= n; i++){
        r1 += abs(a[i] - m1);
        r2 += abs(a[i] - m2);
        r3 += abs(a[i] - m3);
    }

    cout << min(r1, min(r2, r3)) << '\n';
    return 0;
}


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

int main()
{
	int a, b;
	bool flag = 0;
	cin >> a;
	cin >> b;
	if (a % 3 == 0){
		flag = 1;
	}else if (b % 3 == 0){
		flag = 1;
	}else if ((a + b) % 3 == 0){
		flag = 1;
	}

	if (flag == 1){
		cout << "Possible" << endl;
	}else {
		cout << "Impossible" << endl;
	}

}

Measured memory_bytes: 256
n,m=map(int,input().split())
N=3*n
d=[[0]*(N+1) for i in range(N+4)]
d[0][0]=1
for i in range(N):
  a,b,c,e=d[i:i+4]
  for j in range(N):
    J=j+1
    b[j]=(b[j]+a[j])%m
    c[J]=(c[J]+a[j]*(i+1))%m
    e[J]=(e[J]+a[j]*(i+1)*(i+2))%m
print(sum(d[N][:n+1])%m)


Measured memory_bytes: 317832
#include <bits/stdc++.h>
using namespace std;
 
#define LLINF (1LL<<60)
typedef long long ll;
 
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
 
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void sort2vectors(vector<int> &av, vector<int> &bv){
    int n = av.size();
    vector <int> p(n);
    vector<int> av2(n), bv2(n);
    iota(p.begin(), p.end(), 0);
    sort(p.begin(), p.end(), [&](int a, int b) { return av[a] < av[b]; });
    for (int i = 0; i < n; i++) {
        av2[i] = av[p[i]];
        bv2[i] = bv[p[i]];
    }
    av = av2;
    bv = bv2;
}
//C++14 (GCC 5.4.1)
int main() {
    int N,M;
    cin >>N>>M;
 
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    vector<int> B(M+1),C(M+1);
    B[0]=0;C[0]=0;
    repd(i,1,M+1) cin >> B[i]>>C[i];

    sort(A.begin(),A.end());
    sort2vectors(C,B);

    ll ans=0;
    int k=M,//C用カウンタ
        i=N-1,//A用カウンタ
        j=N;//残りカード数
    while (j>0){
        if(A[i]>=C[k]){
            ans+=A[i];
            j--;
            i--;
        }else{
            ll l=min(B[k],j);
            ans+=C[k]*l;
            j-=l;
            k--;
        }
    }
    cout << ans <<endl;
    return (0);
}

Measured memory_bytes: 2560
# Try AtCoder
# author: Leonardone @ NEETSDKASU
############################################################
def gs() gets.chomp end
def gi() gets.to_i end
def gf() gets.to_f end
def gss() gs.split end
def gis() gss.map(&:to_i) end
def nmapf(n,f) n.times.map{ __send__ f } end
def ngs(n) nmapf n,:gs end
def ngi(n) nmapf n,:gi end
def ngss(n) nmapf n,:gss end
def ngis(n) nmapf n,:gis end
def arr2d(h,w,v=0) h.times.map{[v] * w} end
def for2p(hr,wr,&pr) hr.each{|i|wr.each{|j| yield(i,j)}} end
def nsum(n) n * (n + 1) / 2 end
def vcount(d,r=Hash.new(0)) d.inject(r){|m,e| m[e]+=1;m} end
MV4 = [[0, 1], [1, 0], [0, -1], [-1, 0]]
MV8 = MV4 + [[1, 1], [1, -1], [-1, -1], [-1, 1]]
DV7 = 7 + 10 ** 9
############################################################

A, B = gis

if (A .. B).include? 0
    puts 'Zero'
    exit
end

if A > 0
    puts 'Positive'
    exit
end

if (B - A).odd?
    puts 'Positive'
else
    puts 'Negative'
end






Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <complex>
#include <vector>
using namespace std;

typedef complex<double> P;

struct Circle{
  double r;
  P c;
  Circle(double r=0.0, P c = P(0,0)):r(r),c(c){}
  bool operator < (const Circle &c) const {
    return r < c.r;
  }
};

const double EPS = 1e-8;
const double EPS2 = 0.0000001;

int n;
double ri;
Circle v[11];

bool equal(double a, double b){ return fabs(a-b) < EPS;}

double dot(P a, P b){ return real(conj(a)*b);}
double cross(P a, P b){ return imag(conj(a)*b);}

int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

bool isIntersectCP(P p, Circle c){
  return abs(c.c-p) < c.r || equal(abs(c.c-p),c.r);
}

vector<P> intersectCC(Circle C1, Circle C2){
  vector<P> res;
  double r1 = C1.r, r2 = C2.r, d;
  P p1 = C1.c, p2 = C2.c;
  d = abs(p1-p2);
  if(d < EPS && abs(r1-r2) < EPS) return res;
  if(r1 + r2 < d - EPS || d + EPS < abs(r1-r2)) return res;

  double a = (r1*r1 - r2*r2 + d*d) / (2*d);
  double h = sqrt(max(r1*r1 - a*a, 0.0));
  P tmp1 = p1 + a / d * (p2-p1);
  P tmp2 = h / d * (p2-p1);

  if(abs(tmp2) < EPS) res.push_back(tmp1);
  else{
    res.push_back(P(real(tmp1) - imag(tmp2), imag(tmp1) + real(tmp2)));
    res.push_back(P(real(tmp1) + imag(tmp2), imag(tmp1) - real(tmp2)));
  }
  return res;
}

bool func(vector<Circle> w){
  bool f = false;
  int ws = w.size();
  if(ws == 1) return true;

  //外側の円を消す
  /*
  for(int i=0;i<ws-1;i++) {
    if(abs(w[ws-1].c-w[i].c) > w[ws-1].r-w[i].r && !equal(abs(w[ws-1].c-w[i].c),w[ws-1].r-w[i].r)){
      f = true;
      break;
    }
  }
  if(!f) {
    w.pop_back();
    return func(w);
  }
  */

  //内側の円を消す
  f = false;
  for(int i=1;i<ws;i++) {
    if(abs(w[i].c-w[0].c) > w[i].r-w[0].r && !equal(abs(w[i].c-w[0].c),w[i].r-w[0].r)){
      f = true;
      break;
    }
  }
  if(!f) {
    //w.erase(w.begin());
    //return func(w);
    return true;
  }


  //円の交点を求め、１つでも全ての円の内側・境界に存在するならtrue
  vector<P> p;
  for(int i=0;i<ws;i++){
    for(int j=i+1;j<ws;j++){
      vector<P> aa = intersectCC(w[i],w[j]);
      //if(aa.size() == 0) return false;
      for(int k=0;k<aa.size();k++) p.push_back(aa[k]);
    }
  }

  for(int i=0;i<p.size();i++){
    int j;
    for(j=0;j<ws;j++){
      if(!isIntersectCP(p[i],w[j])) break;
    }
    if(j == ws) return true;
  }
  return false;
}

bool check(double h){
  if(n == 1) return h < v[0].r;
  vector<Circle> w;

  for(int i=0;i<n;i++) w.push_back(Circle(sqrt(v[i].r*v[i].r - h*h), v[i].c));
  sort(w.begin(),w.end());
  return func(w);
}

void solve(){
  double c,le=0.0;
  for(int i=0;i<100;i++){
    c = (ri + le) / 2.0;
    if(check(c)) le = c;
    else ri = c;
  }
  printf("%.7f\n",ri);
}

int main(){
  while(cin >> n && n){
    ri = 400.0;
    for(int i=0;i<n;i++){
      double x,y;
      cin >> x >> y >> v[i].r;
      v[i].c = P(x,y);
      ri = min(ri, v[i].r);
    }
    solve();
  }

}

Measured memory_bytes: 1280
#include <stdio.h>
// dirty!!!
int x[3],y,a;
int main(void){
int i,j;
for(i=0;i<10;i++){
scanf("%d",&y);
for(j=0;j<3;j++){
if(y>=x[j]){
a=x[j];
x[j]=y;
y=a;
}
}
}
printf("%d ",x[0]+x[1]+x[2]);
x[0]=x[1]=x[2]=0;
for(i=0;i<10;i++){
scanf("%d",&y);
for(j=0;j<3;j++){
if(y>=x[j]){
a=x[j];
x[j]=y;
y=a;
}
}
}
printf("%d\n",x[0]+x[1]+x[2]);
return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
  ll N; cin >> N;
  ll K; cin >> K;
  ll ans = 0;
  ll count[100001]; for (ll j=0; j < 100001; ++j) count[j] = 0;
  for (ll j=0; j < N; ++j) {
    ll a, b; cin >> a >> b;
    count[a] += b;
  }
  for (ll j=1; j <= 100000; ++j) {
    if (K <= count[j]) {
      cout << j << endl;
      break;
    } else {
      K -= count[j];
    }
  }
  return 0;
}


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    int n, k;
    cin >> n >> k;

    if(n * (n - 1) / 2 - k < n - 1){
        cout << -1 << endl;
        return 0;
    }

    vector< P > ans;
    rep(i, n){
        REP(j, i + 1, n){
            ans.emplace_back(i + 1, j + 1);
        }
    }

    while(k--){
        ans.pop_back();
    }

    cout << ans.size() << endl;
    for(auto e : ans){
        cout << e.first << " " << e.second << endl;
    }

    return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

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

    PR(N*(N-1)/2);

    return 0;
}

/*



*/

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

#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
typedef map<string, int> MAPSI;

int main() {

	string in,s;
	long long int  max_length = 0;
	string max_s;
	map<string,int> ms;
	while (getline(cin,s,' ')) {
		// getline???????????????????°?????????????????????????????????????
		if (s[s.size() - 1] == '\n'|| s[s.size() - 1] == '\r') {
			s.erase(s.length() - 1);
		}
		// ????????°???????????????
		if (max_length < s.length()) {
			max_s = s;
			max_length = s.length();
		}
		// ???????????????????????????
		if (ms.find(s)!=ms.end()) {
			ms[s]++;
		}
		else {
			ms.insert(make_pair(s, 1));
		}
	}

	// ??????
	string max_hindo_s;
	int max_hindo = 0;
	foreach_it(MAPSI, it, ms) {
		if (max_hindo < it->second) {
			max_hindo_s = it->first;
			max_hindo = it->second;
		}
	}
	cout << max_hindo_s << " " << max_s << endl;
	return 0;
}

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

int main() {
    ll N,D,ans = 0;
    cin >> N >> D;

    vl X(N), Y(N);
    rep(i,N){
        cin >> X[i] >> Y[i];
        if(X[i] * X[i] + Y[i] * Y[i] <= D * D){
            ans ++;
        }
    }

    cout << ans << endl;
}

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

using namespace std;
const int inf=0x3f3f3f3f;
int mp[200015],a[200015],b[200015];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    int f=0;
    for(int i=0;i<m;i++)
    {
        scanf("%d%d",&a[i],&b[i]);
        if(a[i]==1) mp[b[i]]=1;
      //  if(b==1) mp[a]=1;
       // if(a==n&&mp[b]) f=1;
    }
    for(int i=0;i<m;i++)
    {
        if(b[i]==n&&mp[a[i]]) f=1;
    }
    if(f==1) printf("POSSIBLE\n");
    else printf("IMPOSSIBLE\n");
    return 0;
}


Measured memory_bytes: 2560
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
s = [0 for i in range(N)]
for i in range(N):
    s[i] = list(str(input()))
# print(s)

for i in range(N):
    s[i].sort()
    s[i] = "".join(s[i])
# print(s)

dic = {}
for i in range(N):
    if s[i] in dic.keys():
        dic[s[i]] += 1
    else:
        dic[s[i]] = 1

ans = 0
for key in dic.keys():
    if dic[key] > 1:
        ans += dic[key]*(dic[key] - 1)//2

print(ans)


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


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		
		int n = s.length;

		char[] ch = new char[26];
		for (char c = 'a'; c <= 'z'; c++) {
			ch[c - 'a'] = c;
		}
		
		for (int i = 0; i < n; i++) {
			if (ch[s[i] - 'a'] != t[i]) {
				int j;
				for (j = 0; j < 26 && ch[j] != t[i]; j++) {
				}
				
				char tmp = ch[s[i] - 'a']; ch[s[i] - 'a'] = ch[j]; ch[j] = tmp;
			}
		}

		for (int i = 0; i < n; i++) {
			if (ch[s[i] - 'a'] != t[i]) {
				pr.println("No");
				return;
			}
		}
		
		pr.println("Yes");
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes()));
		pr = new Printer(System.out);

		solve();

//		pr.close();
		pr.flush();
//		sc.close();
	}

	static String INPUT = null;

	private static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


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

int main()
{
    int n, k;

    while( cin >> n >> k )
    {
        if( n + k == 0 )
            break;

        int* a = new int[k];
        int b;
        for( int i = 0; i < k; i++ )
            cin >> a[i];

        bool judge = true;
        for( int i = 0; i < n; i++ )
            for( int j = 0; j < k; j++ )
            {
                cin >> b;
                a[j] -= b;
                if( a[j] < 0 )
                    judge = false;
            }
        if( judge == 1 )
            cout << "Yes" << endl;
        else
            cout << "No" << endl;

        delete a;
    }

    return 0;
}


Measured memory_bytes: 2984
#include <bits/stdc++.h> 
 
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<long, long> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
const double EPS=1e-10;
 
typedef int Weight;
//typedef
//------------------------------------------
 
typedef int Weight;
//typedef
//------------------------------------------

int main(){
    int N,A,B;
    cin>>N>>A>>B;
    cout<<min(A,B)<<" "<<max(0,(A+B)-N)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
using namespace std;
int main() {
	string S,T;
	cin>>S>>T>>S;
	cout<<'A'<<T[0]<<'C';
}


Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

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

#define int long long

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(0, MAXN); \
                 auto rnd = bind(__dis, __gen);

const int MAXN = 1E6;
const int maxn = 1 << 19;

int BIT[26][maxn];

int lb(int x) {
    return x & -x;
}

void Add(int alpha, int idx, int val) {
    for (; idx < maxn; idx += lb(idx)) BIT[alpha][idx] += val;
}

int Sum(int alpha, int idxL, int idxR, int sum = 0) {
    --idxL;
    for (; idxR; idxR -= lb(idxR)) sum += BIT[alpha][idxR];
    for (; idxL; idxL -= lb(idxL)) sum -= BIT[alpha][idxL];
    return sum;
}

int32_t main() {
    fastIO();
    
    int n, q, op, idx, l, r, cnt;
    char c;
    string s;
    cin >> n >> s >> q;
    for (int i = 0; i < n; ++i) Add(s[i] - 'a', i + 1, 1);
    
    while (q--) {
        cin >> op;
        if (op == 1) {
            cin >> idx >> c, --idx;
            Add(s[idx] - 'a', idx + 1, -1);
            s[idx] = c;
            Add(s[idx] - 'a', idx + 1,  1);
        }
        else {
            cin >> l >> r, cnt = 0;
            for (int i = 0; i < 26; ++i) cnt += (Sum(i, l, r) > 0);
            cout << cnt << "\n";
        }
    }
    
    return 0;
}


Measured memory_bytes: 107420
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 100010
using namespace std;
typedef long long ll;
int n;
ll c;
ll x[maxn],v[maxn];
ll sum1[maxn],sum2[maxn],ans=0;
int main()
{
	scanf("%d%lld",&n,&c);
	for(int i=1;i<=n;i++)   scanf("%lld%lld",&x[i],&v[i]);
	for(int i=1;i<=n;i++)   sum1[i]=sum1[i-1]-(x[i]-x[i-1])+v[i];
	x[n+1]=c;
	for(int i=n;i>=1;i--)   sum2[i]=sum2[i+1]-(x[i+1]-x[i])+v[i];
	for(int i=1;i<=n;i++)   sum1[i]=max(sum1[i],sum1[i-1]);
	for(int i=n;i>=1;i--)   sum2[i]=max(sum2[i],sum2[i+1]);
	ans=max(ans,max(sum1[n],sum2[1]));
	for(int i=0;i<=n;i++)
	{
		ans=max(ans,sum1[i]-x[i]+sum2[i+1]);
	}
	for(int i=n;i>=0;i--)
	{
		ans=max(ans,sum2[i]-(c-x[i])+sum1[i-1]);
	}
	printf("%lld\n",ans);
	return 0;
}
/*
15 100
4 10
8 10
19 10
24 10
29 10
33 10
37 10
38 10
40 10
41 10
52 10
66 10
80 10
93 10
97 10
*/

Measured memory_bytes: 3328
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(){
    int x[10];
    int i,r,D,x2000;

    scanf("%d %d %d",&r,&D,&x2000);

    x[0]=r*x2000-D;
    printf("%d\n",x[0]);
    for(i=0;i<9;i++){
        x[i+1]=r*x[i]-D;
        printf("%d\n",x[i+1]);
    }

    return 0;
}

Measured memory_bytes: 128
// Amazing Implementation!
#include <bits/stdc++.h>
using namespace std;

#define FAST std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M 1000000007
#define mp make_pair
#define pb push_back
#define PB pop_back
#define sl(a) (int)a.length()
#define sz(a) (int)a.size()
#define lcase(a) (char)tolower(a)
#define ucase(a) (char)toupper(a)
#define precise(a) fixed<<setprecision(a)<<
#define F first
#define S second
#define I insert
#define pii pair<int,int>
#define trav(a, x) for(auto& a : x)
#define rep(n) for(int i = 0;i<n;i++)
#define rrep(n) for(int i = n-1;i>=0;i--)
#define time cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
#define invect(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.pb(tmp);commands}
#define inset(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.I(tmp);commands}
#define display(x) trav(a,x) cout<<a<<" "; cout<<endl;
#define ingrid(data,n,commands) for(int i = 0; i<n; i++){cin>>data[i];commands}
#define section(a,b,w) set_intersection(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define union(a,b,w) set_union(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define copy(a,w) copy(a.begin(), a.end(),back_inserter(w));
#define all(data) data.begin(), data.end()
#define PI 3.14159265358979323844
#define endl '\n'
#define last(a) a[sz(a)-1]

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); std::cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

// Graph DFS
const int fx[] = { +1, -1, +0, +0};
const int fy[] = { +0, +0, +1, -1};

//primes for hashing 937,991,1013,1409,1741

//Returns index of first element not less than key and more than key respectively
#define lb(data,key) lower_bound(all(data),key) - data.begin();
#define up(data,key) upper_bound(all(data),key) - data.begin();
#define fnd(data,key) find(all(data),key) - data.begin();
/* Long Long Int */
#define int long long int



void solve() {
    int n, wt;
    cin >> n >> wt;

    int w[n], v[n];
    int mv = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> w[i] >> v[i];
        mv += v[i];
    }

    vector<int> dp((int)1e5 + 5);
    fill(all(dp), INT_MAX);
    dp[0] = 0;

    for (int i = 0; i < n; ++i)
    {
        for (int j = mv; j >= v[i]; --j)
        {
            // trace(i, j);
            // trace(dp[j], dp[j-v[i]]+w[i]);
            dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
            // trace(dp[j]);
        }
    }

    int ans = 0;
    for (int i = 0; i <= mv; ++i)
    {
        if (dp[i] <= wt) {
            ans = i;
        }
    }
    cout << ans << endl;


    return;

}

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

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

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

    string s;
    cin >> s;
    const string correct = "CODEFESTIVAL2016";
    
    int res = 0;
    rep(i, s.size()){
        if(s[i]!=correct[i])++res;
    }

    cout << res << endl;
    
    return 0;
}

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

const int maxn = 1e3+10, maxm = 2e5+10;

int n, m;
vector<int> g[maxn];
int a[maxm], b[maxm];
int v[maxn][maxn], w[maxn][maxn], vis2[maxn];
int rt;

inline void add(int a,int b){g[a].push_back(b);}

inline void dfs2(int u) {
	v[rt][u] = vis2[u] = 1;
	for (auto y: g[u]) {
		if (!vis2[y]) dfs2(y);
	}
}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; ++i) {
		scanf("%d%d", a+i, b+i);
		add(a[i], b[i]);
	}
	for (rt = 1; rt <= n; ++rt) {
		memset(vis2, 0, sizeof(vis2));
		vis2[rt] = 1;
		for (auto x: g[rt]) {
			if (!vis2[x]) dfs2(x);
			else w[rt][x] = 1;
		}
		memset(vis2, 0, sizeof(vis2));
		vis2[rt] = 1;
		reverse(g[rt].begin(), g[rt].end());
		for (auto x: g[rt]) {
			if (!vis2[x]) dfs2(x);
			else w[rt][x] = 1;
		}
	}
	for (int i = 1; i <= m; ++i) {
		puts(v[b[i]][a[i]]^w[a[i]][b[i]]?"diff":"same");
	}
}


Measured memory_bytes: 12288
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
vector<int> h(100000);
vector<int> cost(100000);

int ans(int n){
  if (cost.at(n) != -1)
    return cost.at(n);
  cost.at(n) = min(ans(n - 1) + abs(h.at(n) - h.at(n - 1)),
                   ans(n - 2) + abs(h.at(n) - h.at(n - 2)));
  return cost.at(n);  
}

int main(){
  int N = 0;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> h.at(i);
    cost.at(i) = -1;
  }
  
  cost.at(0) = 0;
  cost.at(1) = abs(h.at(1)-h.at(0));
  int sumcost = ans(N-1);
  cout << sumcost;
  return 0;
}

Measured memory_bytes: 4096
function myout(text){console.log(text);}//standard output
function Main(input) {
	input = parseInt(input);
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	//input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  var output = 1000000000;
  for(var i = 1; i < input; i++){
    var a = i.toString().split("");
    var b = (input - i).toString().split("");
    var tmp = 0;
    var c = a.concat(b).map((a)=>Number(a));
    for(var j = 0; j < c.length; j++){
      tmp += c[j];
    }
    output = Math.min(output, tmp);
  }
  myout(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


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

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

int main(){
  int x,y;
  cin >> x >> y;
  int g = gcd(x,y);

  cout << (x+1)+(y+1)-(g+1) << endl;

  return 0;
}


Measured memory_bytes: 3100
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            var NML = Sarray();
            var N = NML[0];
            var M = NML[1];
            var L = NML[2];

            var G = new long[N, N];
            for (var i = 0; i < N; ++i) for (var j = 0; j < N; ++j) G[i, j] = i == j ? 0 : long.MaxValue;
            for (var i = 0; i < M; ++i)
            {
                var ABC = Sarray();
                var A = ABC[0] - 1;
                var B = ABC[1] - 1;
                var C = ABC[2];
                if (L < C) continue;
                G[A, B] = C;
                G[B, A] = C;
            }
            floyd(G);
            for (var i = 0; i < N; ++i)
                for (var j = 0; j < N; ++j)
                    if (G[i, j] <= L) G[i, j] = 1;
            floyd(G);
            var Q = Sarray()[0];
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            for (var i = 0; i < Q; ++i)
            {
                var st = Sarray();
                var s = st[0] - 1;
                var t = st[1] - 1;
                if (long.MaxValue <= G[s, t])
                    WriteLine(-1);
                else
                    WriteLine(G[s, t] - 1);
            }
            Out.Flush();
        }
        static void floyd(long[,] M)
        {
            var n = M.GetLength(0);
            for (var k = 0; k < n; ++k)
                for (var i = 0; i < n; ++i)
                {
                    if (M[i, k] == long.MaxValue) continue;
                    for (var j = 0; j < n; ++j)
                    {
                        if (M[k, j] == long.MaxValue) continue;
                        M[i, j] = Min(M[i, j], M[i, k] + M[k, j]);
                    }
                }
            return;
        }

    }
}

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

const int maxn = 2e5 + 1;
vector<set<int>> adj(maxn);
vector<int> comp;
vector<bool> used(maxn, false);

void dfs(int n) {
 if(used[n] == true) return;
 used[n] = true;
 comp.push_back(n);
 for(int i: adj[n]) {
  dfs(i);
 }
}

int main() 
{
 ios_base::sync_with_stdio(false);
 cin.tie(nullptr);
 cout.tie(nullptr);
 int n, m;
 cin >> n >> m;
 while(m--) {
  int x, y; 
  cin >> x >> y;
  adj[x].insert(y);
  adj[y].insert(x);
 }
 int ans = 0;
 for(int i = 1; i <= n; i++) {
  if(used[i] == false) {
   dfs(i);
   ans = max(ans, (int) comp.size());
   comp.clear();
  }
 }
 cout << ans << '\n';
 return 0;
}


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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    ll d,t,s; cin>>d>>t>>s;
    if(s*t>=d)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

int main(){
  int H, W;
  cin >> H >> W;
  vector<vector<char>> C(H, vector<char>(W));
  for(auto& row : C){
    for(auto& cell : row){
      cin >> cell;
    }
  }
  vector<vector<int>> count_row(H, vector<int>(W, 0));
  for(int ii = 0; ii < H; ii++){
    int counter = 0;
    for(int jj = 0; jj < W; jj++){
      if(C[ii][jj] == '.'){
        counter++;
        count_row[ii][jj] = counter;
      }
      if(C[ii][jj] == '#'){
        counter = 0;
      }
    }
    counter = 0;
    for(int jj = W-1; jj >= 0; jj--){
      if(C[ii][jj] == '.'){
        counter = max(counter, count_row[ii][jj]);
        count_row[ii][jj] = counter;
      }
      if(C[ii][jj] == '#'){
        counter = 0;
      }
    }
  }

  vector<vector<int>> count_col(H, vector<int>(W, 0));
  for(int jj = 0; jj < W; jj++){
    int counter = 0;
    for(int ii = 0; ii < H; ii++){
      if(C[ii][jj] == '.'){
        counter++;
        count_col[ii][jj] = counter;
      }
      if(C[ii][jj] == '#'){
        counter = 0;
      }
    }
    counter = 0;
    for(int ii = H - 1; ii >= 0; ii--){
      if(C[ii][jj] == '.'){
        counter = max(counter, count_col[ii][jj]);
        count_col[ii][jj] = counter;
      }
      if(C[ii][jj] == '#'){
        counter = 0;
      }
    }
  }

  int ans = 0;
  for(int ii = 0; ii < H; ii++){
    for(int jj = 0; jj < W; jj++){
      ans = max(ans, count_row[ii][jj] + count_col[ii][jj]);
    }
  }
  cout << ans - 1 << endl;
  return 0;
}


Measured memory_bytes: 35584
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <deque>
#include <string>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define REP(i, N) for (int i = 0; i < (N); ++i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    // ll a = 2;
    // ll b = 1;
    // REP(i, 87){
    //     cout << a << ", ";
    //     tie(a, b) = make_tuple(b, a + b);
    // }
    // cout << endl;
    scanInt(N);
    vector<ll> answer = {2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843, 1364, 2207, 3571, 5778, 9349, 15127, 24476, 39603, 64079, 103682, 167761, 271443, 439204, 710647, 1149851, 1860498, 3010349, 4870847, 7881196, 12752043, 20633239, 33385282, 54018521, 87403803, 141422324, 228826127, 370248451, 599074578, 969323029, 1568397607, 2537720636, 4106118243, 6643838879, 10749957122, 17393796001, 28143753123, 45537549124, 73681302247, 119218851371, 192900153618, 312119004989, 505019158607, 817138163596, 1322157322203, 2139295485799, 3461452808002, 5600748293801, 9062201101803, 14662949395604, 23725150497407, 38388099893011, 62113250390418, 100501350283429, 162614600673847, 263115950957276, 425730551631123, 688846502588399, 1114577054219522, 1803423556807921, 2918000611027443, 4721424167835364, 7639424778862807, 12360848946698171, 20000273725560978, 32361122672259149, 52361396397820127, 84722519070079276, 137083915467899403, 221806434537978679, 358890350005878082, 580696784543856761, 939587134549734843};
    cout << answer[N] << endl;
}


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



public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long[] H = new long[N];
		long min =Long.MAX_VALUE;

		for (int i = 0; i < H.length; i++) {
			H[i] = sc.nextLong();
		}

		Arrays.sort(H);

		for (int i = K-1; i < H.length; i++) {
		 	long let = H[i] - H[i - K + 1];
			min = Math.min(min, let);
		}

		System.out.println(min);


	}
}


Measured memory_bytes: 59384
import math
n = int(input())
ai = [int(i) for i in input().split()]

ai.sort()

sqr_max_val = int(ai[n-1]**0.5)
max_val = ai[n-1]
#print(ai)
ai_ex = [0]*(2*10**6)
#ai_ex = [0]*(30)

for i in range(n):
    ai_ex[ai[i]-1] += 1

for i in range(n):
    if ai_ex[ai[i]-1] == 0:
        continue
    if ai_ex[ai[i]-1] > 1:
        ai_ex[ai[i]-1] = 0
    """
    if ai[i] > sqr_max_val:
        break
    """
    tmp = ai[i]
    baisu = 2
    #print(ai[i])
    while tmp * baisu <=  max_val:
        ai_ex[tmp*baisu-1] = 0
        #print(tmp*baisu)
        baisu += 1
"""
for i in range(100):
    if ai_ex[i] == 1:
        a = 1
        #print(i)
"""
print(sum(ai_ex))
#print(ai_ex)

Measured memory_bytes: 117412
import java.util.*;
public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long [] A = new long[n];
        for(int i=0;i<n;i++) A[i] = sc.nextLong();
        int q = sc.nextInt();
        for(int i=0;i<q;i++){
            int b = sc.nextInt();
            int e = sc.nextInt();
            int t = sc.nextInt();
            for(int j=0;j<e-b;j++){
                long num = A[b+j];
                A[b+j] = A[t+j];
                A[t+j] = num;
            }
        }
        System.out.print(A[0]);
        for(int j=1;j<n;j++) System.out.print(" "+A[j]);
        System.out.println();
    }
}


Measured memory_bytes: 36792
#include <stdio.h>

int main(void){
  char s[5] = { '\0' };
  scanf("%4s", s);
  int num = 0;
  for(int i = 0; i < 4; i++){
    if(s[i] == '+') num++;
    else num--;
  }
  printf("%d\n", num);
  return 0;
}

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

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

	int32_t P, Q, R;

	cin >> P >> Q >> R;

	vector<int32_t> v={P+Q, Q+R, R+P};

	int32_t min = *std::min_element(v.begin(), v.end());

	cout << min << endl;
}


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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, x;
  cin >> n >> x;
  int a[n];
  rep(i, n) cin >> a[i];
  int ans = 0;
  reps(i, 1, n) {
    if(a[i] + a[i-1] > x) {
      ans += a[i] + a[i-1] - x;
      a[i] = max(0LL, x - a[i-1]);
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
typedef long long ll;
const int maxn=2e5+9;
const int mod=10000;
const double ep=1e-7;
using namespace std;
const double pi=acos(-1);
int main()
{
	int n,a[maxn]={0},x;
	scanf("%d",&n);
	for(int i=1;i<n;i++)scanf("%d",&x),a[x]++;
	for(int i=1;i<=n;i++)printf("%d\n",a[i]);
}

Measured memory_bytes: 4604
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

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

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#ifdef LOCAL
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll N, K;
    cin >> N >> K;
    ll INF = 1LL << 60;

    vector<ll> A(N);
    REP(i, N) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());

    ll t = INF;
    ll b = -INF;

    while(t - b > 1) {
        ll m = (t + b) / 2;
        ll c = 0;
        REP(i, A.size()) {
            if (A[i] * A[i] <= m) --c;
            if (A[i] < 0) {
                ll mn = (m / A[i]) - 1;
                while (mn * A[i] > m) ++mn;
                int pos = lower_bound(A.begin(), A.end(), mn) - A.begin();
                c += N - pos;
            } else if (A[i] > 0) {
                ll mx = (m / A[i]) + 1;
                while (mx * A[i] > m) --mx;
                int pos = upper_bound(A.begin(), A.end(), mx) - A.begin();
                c += pos;
            } else {
                if (m >= 0) {
                    c += N;
                }
            }
        }

        c /= 2;
        if (c < K) {
            b = m;
        } else {
            t = m;
        }
    }

    cout << b + 1 << endl;




    
}


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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

// M (type, id, op): Monoid of value
template <typename M>
class SegmentTree {
   public:
    using value_type = typename M::type;

    explicit SegmentTree(int64_t n)
            : n(n), cap(pow(2, ceil(log2(n)))), values(2 * cap - 1, M::id()) {}

    void set(int64_t pos, value_type v) {
        int64_t idx = cap - 1 + pos;

        values[idx] = v;

        while (idx > 0) {
            idx = (idx - 1) / 2;
            fix_value(idx);
        }
    }

    value_type query(int64_t a, int64_t b) { return query(a, b, 0, 0, cap); }

    value_type query(int64_t a, int64_t b, int64_t idx, int64_t l, int64_t r) {
        if (a >= r || b <= l) {
            // no overlap
            return M::id();
        }

        if (a <= l && r <= b) {
            return get_node_value(idx);
        }

        auto left_idx = 2 * (idx + 1) - 1;
        auto right_idx = 2 * (idx + 1);

        auto left_v = query(a, b, left_idx, l, (l + r) / 2);
        auto right_v = query(a, b, right_idx, (l + r) / 2, r);

        return M::op(left_v, right_v);
    }

   private:
    value_type get_node_value(int64_t idx) { return values[idx]; }

    void fix_value(int64_t idx) {
        auto left_idx = 2 * (idx + 1) - 1;
        auto right_idx = 2 * (idx + 1);
        values[idx] =
                M::op(get_node_value(left_idx), get_node_value(right_idx));
    }

    int64_t n;
    int64_t cap;
    vector<value_type> values;
};

struct Max {
    using type = int64_t;

    static type id() { return 0L; }
    static type op(type v1, type v2) { return max(v1, v2); }
};

using ST = SegmentTree<Max>;

int main() {
    int64_t n, k;
    cin >> n >> k;

    vector a(n, 0L);
    for (auto&& aa : a) {
        cin >> aa;
    }

    constexpr auto M = 300000L;
    ST st(M + 1);
    for (auto i : irange(0L, n)) {
        auto p = st.query(max(0L, a[i] - k), min(M, a[i] + k) + 1);

        st.set(a[i], p + 1);
    }

    cout << st.query(0L, M + 1) << endl;
}

Measured memory_bytes: 13824
INF = 10**9 + 1


def merge(A, left, mid, right):
    n1 = mid - left
    n2 = right - mid
    L = []
    for i in range(left, mid):
        L.append(A[i])
    L.append(INF)
    R = []
    for i in range(mid, right):
        R.append(A[i])
    R.append(INF)

    i = 0
    j = 0
    k = left
    cnt = 0  # inversions between left half and right half
    for k in range(left, right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
            cnt += n1 - i
    return cnt


def merge_sort(A, left, right):
    if right - left == 1:
        # only one element, already sorted, and inversion is zero
        return 0
    mid = (left + right) / 2
    cnt1 = merge_sort(A, left, mid)  # inversions within left half
    cnt2 = merge_sort(A, mid, right)  # inversions within right half
    # inversions between left half and right half
    cnt3 = merge(A, left, mid, right)
    return cnt1 + cnt2 + cnt3


if __name__ == '__main__':
    n = int(raw_input())
    A = map(int, raw_input().split())
    print merge_sort(A, 0, n)


Measured memory_bytes: 22052