akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> many(n, 1);
    vector<bool> red(n, false);
    red[0] = true;
    while(m--){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        if(red[a]){
            red[b] = true;
        }
        many[a]--;
        many[b]++;
        if(!many[a]){
            red[a] = false;
        }
    }
    int ans = 0;
    for(auto&& i : red){
        ans += i;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 640
#include <stdio.h>
//#include <stdlib.h>
#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  int n, m;
  scanf("%d", &n);
  char s[n][11];
  for (int i=0; i<n; i++) scanf("%s", s[i]);
  scanf("%d", &m);
  char t[m][11];
  for (int i=0; i<m; i++) scanf("%s", t[i]);
  int ans=0;
  for (int i=0; i<n; i++) {
    int cnt=1;
    for (int j=i+1; j<n; j++) {
      if (strcmp(s[i], s[j]) == 0) cnt++;
    }
    for (int j=0; j<m; j++) {
      if (strcmp(s[i], t[j]) == 0) cnt--;
    }
    ans = (ans<cnt) ? cnt : ans;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

int main() {
	auto f = [](vector<pair<LL, LL>> v) -> LL {
		multiset<LL> se;
		LL ans = 0;
		inc(i, SI(v)) {
			se.insert(v[i].SE);
			until(SI(se) <= v[i].FI) {
				ans += * se.begin();
				se.erase(se.begin());
			}
		}
		return ans;
	};
	
	IN(int, t);
	inc(tt, t) {
		IN(int, n);
		vector<pair<LL, LL>> L, R;
		LL ans = 0;
		inc(i, n) {
			IN(LL, k, l, r);
			ans += max(l, r);
			if(l >= r) {
				L.EB(    k, l - r);
			} else {
				R.EB(n - k, r - l);
			}
		}
		sort(ALL(L));
		sort(ALL(R));
		ans -= f(L) + f(R);
		OUT(ans);
	}
}


Measured memory_bytes: 14284
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto hw = readln.split.to!(int[]);
    auto H = hw[0];
    auto W = hw[1];
    char[][] P;
    P.length = H;
    foreach (i; 0..H) P[i] = readln.chomp.to!(char[]);

    foreach (i; 0..H) {
        foreach (j; 0..W) {
            if (P[i][j] == '.') continue;

            bool ok;
            foreach (d; [[1,0], [0,1], [-1,0], [0,-1]]) {
                auto x = j+d[0];
                auto y = i+d[1];
                if (x >= 0 && x < W && y >= 0 && y < H && P[y][x] == '#') {
                    ok = true;
                    break;
                }
            }
            if (!ok) {
                writeln("No");
                return;
            }
        }
    }
    writeln("Yes");
}

Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, k, result1, result2;
  int total =1;
  cin >> n >> k;
  for(int i=0; i<n; i++){
    result1 = total * 2;
    result2 = total + k;
    if(result1<result2)
      total = result1;
    else
      total = result2;
  }
  cout << total << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <complex>
#include <numeric>
#include <string.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const ll MOD = 998244353;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

ll N, L;
pl p[200000];
ll dp[400001];
ll sum[400001];
map<ll, int> rev;

int main() {
    cin >> N >> L;
    rep(i,N) cin >> p[i].first >> p[i].second;
    sort(p, p+N);
    set<ll> s;
    rep(i,N) { s.insert(p[i].first); s.insert(p[i].second); }
    {
        int i = 0;
        for (auto it = s.begin(); it != s.end(); it++) {
            rev[*it] = i++;
        }
    }
    rep(i,N) {
        p[i].first = rev[p[i].first];
        p[i].second = rev[p[i].second];
    }
    dp[0] = 0;
    int st = 0;
    int ans = 0;
    ll last = 0;
    while (true) {
        ll M = 0;
        for (; st < N; st++) {
            if (p[st].first > last) break;
            M = max(M, p[st].second);
        }
        ans++;
        last = M;
        if (st == N) break;
        if (last+1 == s.size()) break;
    }
    rep(i,N) {
        sum[p[i].first]++;
        sum[p[i].second+1]--;
    }
    ll ans2 = sum[0];
    for (int i = 1; i < s.size(); i++) {
        sum[i] += sum[i-1];
        ans2 = min(ans2, sum[i]);
    }
    cout << ans << " " << N-ans2+1 << endl;
}


Measured memory_bytes: 51280
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

        

        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            var input = Reads();
            var x = input[0];
            var y = input[1];
            long ans = 0;
            if (x < y)
            {
                if (x >= 0 && y > 0) ans = Math.Abs(y - x);
                if (x < 0 && y > 0) ans = Math.Abs(x + y) + 1;
                if (x < 0 && y <= 0) ans = Math.Abs(y - x);
            }
            else
            {
                if (x > 0 && y > 0) ans = Math.Abs(y - x) + 2;
                if (x >= 0 && y <= 0) ans = Math.Abs(x+y) + 1;              
                if (x < 0 && y < 0) ans = Math.Abs(y - x) +2;          
            }

            Console.WriteLine(ans);
                



            Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 13396
H,W = map(int, input().split())
maze = []
for i in range(H):
    maze.append(input())
    
ans = 0
for i in range(H):
    for j in range(W):
        if maze[i][j] == ".":
            ans += 1
            
Path = [[10**3 for j in range(W)] for i in range(H)]
Path[0][0] = 1
visited = [[0, 0]]

while len(visited) > 0:
    H = len(Path)
    W = len(Path[0])
    i = visited[0][0]
    j = visited[0][1]
    if i != 0:
        if Path[i-1][j] > Path[i][j]+1 and maze[i-1][j] == ".":
            Path[i-1][j] = Path[i][j]+1
            visited.append([i-1, j])
    if i != H-1:
        if Path[i+1][j] > Path[i][j]+1 and maze[i+1][j] == ".":
            Path[i+1][j] = Path[i][j]+1
            visited.append([i+1, j])
    if j != 0:
        if Path[i][j-1] > Path[i][j]+1 and maze[i][j-1] == ".":
            Path[i][j-1] = Path[i][j]+1
            visited.append([i, j-1])
    if j != W-1:
        if Path[i][j+1] > Path[i][j]+1 and maze[i][j+1] == ".":
            Path[i][j+1] = Path[i][j]+1
            visited.append([i, j+1])
    visited.pop(0)
            
if Path[-1][-1] >= 1000:
    ans = -1
else:
    ans -= Path[-1][-1]
    
print(ans)

Measured memory_bytes: 3192
#include <cstdio>
#include <set>

using namespace std;

int main(void){
  int n;
  set<int> s;
  
  scanf("%d", &n);
  for (int i=0; i<n; i++){
    int t;
    scanf("%d", &t);
    s.insert(t);
  }
  
  printf("%d\n", s.size());
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i< (n); i++)
using ll = long long;
using P = pair<int, int>;
int main()
{
int n;
const ll t = 200000;
cin >> n;
ll sum = 0;
vector<ll> a(t);
for(int i = 0; i<n;i++){
    ll l;
    cin >> l;
    a[l]++;
    sum += l;

}

cout << endl;
int q;
cin >> q;
for(int i=0; i < q; i++){
    ll b,c;
    cin >> b >> c;
    sum -= b*a[b];
    sum += c*a[b];
    a[c] += a[b];
    a[b] = 0;
    cout << sum << endl;

}
return 0;
}

Measured memory_bytes: 4828
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int m=s.length();
    int n=t.length();
    int i,j;
    long long **dp=new long long*[m+1];
    for(i=0;i<=m;i++) dp[i]=new long long[n+1];
    for(j=0;j<=n;j++) dp[0][j]=0;
    for(i=0;i<=m;i++) dp[i][0]=0;
    for(i=1;i<=m;i++)
    {
        for(j=1;j<=n;j++)
            if(s[i-1]==t[j-1]) dp[i][j]=dp[i-1][j-1]+1;
            else dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
    }
    i=m,j=n;
    string ans="";
    while(i>0 && j>0)
    {
        if(s[i-1]==t[j-1])
        {
            ans=s[i-1]+ans;
            i--;
            j--;
        }
        else if(dp[i-1][j]>=dp[i][j-1])
            i--;
        else j--;
    }
    cout<<ans;
}


Measured memory_bytes: 70656
n, x, y = list(map(int, input().split()))
x -= 1
y -= 1
cnt = [0] * n
for i in range(n):
    for j in range(i+1, n):
        cnt[min(j - i, abs(i-x) + 1 + abs(y-j))] += 1
for i in range(1, n):
    print(cnt[i])


Measured memory_bytes: 47196
#include<stdio.h>
int main(){
long int i,j,k,n,m,l,a[110][110],b[110][110];
long  long int ans=0;
scanf("%ld %ld %ld\n",&n,&m,&l);
for(i=0;i<n;i++){
for(j=0;j<m;j++){
scanf("%ld",&a[i][j]);
}
scanf("\n");
}
for(i=0;i<m;i++){
for(j=0;j<l;j++){
scanf("%ld",&b[i][j]);
}
scanf("\n");
}
for(i=0;i<n;i++){
for(j=0;j<l;j++){
for(k=0;k<m;k++){
ans=ans+a[i][k]*b[k][j];
}
if(j==0){
printf("%lld",ans);
}
else{
printf(" %lld",ans);
}
ans=0;
}
printf("\n");
}
return 0;
}


Measured memory_bytes: 2092
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int l,r,i,j,c,mi=INT_MAX;
  cin >>l>>r;
 i=(l-1)/2019;j=r/2019;
 if(i!=j)cout <<0<<endl;
 else
 {
     for(long long int i=l;i<=r;i++)
     {
        for(long long int j=l;j<=r;j++)
        {
            if(i!=j){
                c=(i*j)%2019;
                mi=min(c,mi);
            }
        }
     }
     cout <<mi<<endl;
 }
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define pi 3.1415926535898
#define ll long long
#define int long long
typedef std::pair<long long,long long> pll;
typedef std::pair<int,int> pii;
typedef std::vector<int> vi;
typedef std::vector<long long> vll;
typedef double db;
const ll mod=1e9+7;
ll powmod(ll a,ll b,ll p){ll res=1;a%=p;while(b){if(b&1) res=res*a%p;a=a*a%p;b>>=1;}return res;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}

signed main()
{
    int x,y;
    cin>>x>>y;
    cout<<x*y<<endl;

}













Measured memory_bytes: 3584
n,k=map(int,input().split())
l=list(map(int,input().split()))
count=0
if n>1:
  for i in range(n-1):
    if l[i+1]-l[i]>k:
      count+=k
    else:
      count+=l[i+1]-l[i]
count+=k
print(count)

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

const int N = 205;
bool adj[N][N];

int dis[N];
bool inq[N];
int n;

int solve(int s) {
    for (int i=0; i<N; i++){
        dis[i] = N;
        inq[i] = 0;
    }

    queue<int> q;
    q.push(s);
    inq[s] = 1;
    dis[s] = 0;

    int mx = 0;
    while (q.size()) {
        int u = q.front();
        q.pop();

        for (int v=1; v<=n; v++) {
            if (!adj[u][v] || inq[v]) continue;
            q.push(v);
            inq[v] = 1;
            dis[v] = 1 + dis[u];
            mx = max(mx, dis[v]);
        }
    }

    for (int i=1; i<=n; i++)
        for (int j=1; j<=n; j++) {
            if (adj[i][j] == 0)     continue;
            if (abs(dis[i] - dis[j]) != 1)  return -1;

        }

    return 1 + mx;
}

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


    cin>>n;

    for (int i=1; i<=n; i++)
        for (int j=1; j<=n; j++) {
            char c;
            cin>>c;
            adj[i][j] = c-'0';
        }

    int ans = -1;
    for (int i=1; i<=n; i++) {
        int cur = solve(i);
//        cout<<i<<" "<<cur<<endl;
        ans = max(ans, cur);
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 256
'use strict';
var Main = function(stdin) {
  var line = stdin.split('\n');
  var result = (function(data) {
    return Math.pow(data,3);
  }(
    parseInt(line[0],10)
  ));
  console.log(result);
};

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

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




int main()
{
    string s,r;

    int n,x,k=0,m,j,i;
cin>>s;
cin>>r;
s=s+s;
n=s.length();

m=r.length();


for(j=0;j<=n;j++)
{
    k=0;
   for(i=0;i<m;i++)
   {
       if(s[i+j]==r[i]){
        k=k+1;
       }

        else{

           break;
        }
    }
    if(k==m)
    {
        break;
    }
}


    if(k==m)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;





}




Measured memory_bytes: 3180
import java.util.Scanner;

class Main {

    public static void main(String args[]) {
        Scanner Input = new Scanner(System.in);
        int H = Input.nextInt();
        int W = Input.nextInt();
        char[][] A = new char[H][W];
        for (int I = 0; I < H; I++) {
            String S = Input.next();
            for (int J = 0; J < W; J++) {
                if (S.charAt(J) == '.') {
                    A[I][J] = '0';
                } else {
                    A[I][J] = S.charAt(J);
                }
            }
        }

        for (int I = 0; I < A.length; I++) {
            for (int J = 0; J < A[0].length; J++) {
                //System.out.print(A[I][J]);
                if (A[I][J] == '#') {
                    int Z = 0;
                    int X = 0;
                    int C = I + 1;
                    int V = J + 1;
                    if (I - 1 >= 0) {
                        Z = I - 1;
                    }
                    if (J - 1 >= 0) {
                        X = J - 1;
                    }
                    if (I + 1 >= A.length) {
                        C = A.length - 1;
                    }
                    if (J + 1 >= A[0].length) {
                        V = A[0].length - 1;
                    }
                    //System.out.println(Z +" "+X+" "+C+" "+V);
                    for (int K = Z; K <= C; K++) {
                        for (int L = X; L <= V; L++) {
                            if (A[K][L] != '#') {
                                A[K][L]++;
                            }

                        }
                    }
                }
            }
        }
        for (int I = 0; I < A.length; I++) {
            for (int J = 0; J < A[0].length; J++) {
                System.out.print(A[I][J]);
            }
            System.out.println("");
        }
    }
}


Measured memory_bytes: 25044
#include <stdio.h>
#include <string.h>
int main() {
	long long int n;
	scanf("%lld", &n);
	char name[20+1] = {0};
	int i = 0;
	n--;
	while (n >= 0)
	{
		name[i] = n % 26 + 'a';
		n /= 26;
		i++;
		n--;				
	}
	int len = strlen(name);
	for(int j = len - 1; j >= 0; j--)
	{
		printf("%c", name[j]);
	}	
	return 0;
}

Measured memory_bytes: 1660
//is there any case of -1 or any special corner cases ?
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define zeros(arr) memset(arr,0,sizeof(arr));
#define precise(num)  cout<<fixed; cout << std::setprecision(num)
#define nl cout<<"\n";
#define test int t;cin>>t;while(t--) 
int check(int num ){
    
    int num1 = pow(num , 0.2);
    
    int ans = num1;
    
    num1 = pow(num1,5);
    
    if(num1 == num){
        return ans;
    }
    
    return 0;
}
int32_t main(){
    int n,m;
    cin>>n>>m;
    map<int,int>cn;
    for(int i=1;i<=m;i++)   {
        int sz;
        cin>>sz;
        for(int j=1;j<=sz;j++){
            int x;cin>>x;
            cn[x]++;
        }
    }
    int res=0;
    for(int i=1;i<=n;i++){
        if(cn[i]==0)res++;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3668
program main
  implicit none
  integer :: ab
  character(6) :: sa, sb, sab
  read(*, *) sa, sb
  sab = trim(sa) // trim(sb)
  read(sab, *) ab
  if (nint(ab ** 0.5) ** 2 == ab) then
    write(*, "(a)") "Yes"
  else
    write(*, "(a)") "No"
  end if
end program main


Measured memory_bytes: 256
S = input()

a = ('SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT')

if S == "SUN":
    print(7)
elif S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)
elif S == "SAT":
    print(1)


Measured memory_bytes: 38256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using static Input;
using static Util;
class Program
{
    static int N;
    static void INPUT()
    {
        N = NextInt();
    }

    static void OUT()
    {
        Console.WriteLine((1000 - (N % 1000)) % 1000);
    }

    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{
}


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

int main() {
	int n;
	ll a[50];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int l = 0, r = 0;
	ll k = 0;
	do {
		if (a[r] >= n) {
			ll t = a[r] / n;
			a[r] -= t * n;
			for (int i = 0; i < n; i++) {
				if (i != r) {
					a[i] += t;
				}
			}
			k += t;
			l = r;
		}
		r = (r + 1) % n;
	} while (l != r);
	cout << k << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <deque>
#include <functional>

using namespace std;

int main(void)
{
	int a,b,c,d,e;
	int kari[10];
	while(cin>>a>>b>>c>>d>>e)
	{
		deque<int> nums;
		nums.push_back(a);
		nums.push_back(b);
		nums.push_back(c);
		nums.push_back(d);
		nums.push_back(e);
		sort( nums.begin(), nums.end(), greater<int>() );
		deque<int>::iterator it = nums.begin();
		int i=0;
		while( it != nums.end() )
		{
			kari[i]=*it;
			++it,++i;
		}
		nums.clear();
		cout<<kari[0]<<" "<<kari[1]<<" "<<kari[2]<<" "<<kari[3]<<" "<<kari[4]<<endl;
	}
	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL << 62)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll countDigit(ll n) { return floor(log10(n) + 1); } 
typedef pair <ll,ll> P;
static const ll dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};

template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) 
{ 
    for (int i = 0; i < (int)v.size(); ++i) os << v[i] << " ";  
    return os; 
}

template <typename T1, typename T2> 
ostream& operator<<(ostream& os, const map<T1, T2>& m) 
{ 
    for (auto p : m) os << "<" << p.first << ", " << p.second << "> "; 
    return os; 
}


map<ll, ll> primeFactors(ll n)
{
    map<ll, ll> ret;
    while (n % 2 == 0)
    {
        if( ret.find(2) != ret.end() ) {
            ret[2]++;
        }
        else
        {
            ret[2] = 1;
        }
        n = n / 2;
    }
    for (ll i = 3; i <= sqrt(n); i = i+2)
    {
        while (n%i == 0)
        {
            if( ret.find(i) != ret.end() ) {
            ret[i]++;
        }
        else
        {
            ret[i] = 1;
        }
            n = n / i;
        }
    }
    if (n > 2)
        {
            if( ret.find(n) != ret.end() ) {
            ret[n]++;
        }
        else
        {
            ret[n] = 1;
        }
        }
    return ret;
}

int main()
{
    double a, b, x;
    cin >> a >> b >> x;
    double h = x / a / a;
    double ans = 0.;
    if (a*a*b/2. <= x) {
        ans = atan(2./a*(b-h));
    } else {
        ans = atan(b*b/2./a/h);
    }
    ans = ans * 180.0 / PI;
    print(setprecision(20) << ans);
    return 0;
}

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

#define lli long long int
#define pb push_back
#define in insert
#define pi pair<int, int>
#define pii pair<int, pi>
#define mp make_pair
#define fir first
#define sec second
#define MAXN 100001

signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n, k;
  cin >> n >> k;
  vector<int> v(k);

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

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

  lli ans = 0;
  lli maior_dif = (n - v[k - 1]) + v[0];
  int i1 = 0, i2 = k - 1;

  for (int i = 1; i < k; i++)
  {
    if (v[i] - v[i - 1] > maior_dif)
    {
      maior_dif = v[i] - v[i - 1];
      i1 = i;
      i2 = i - 1;
    }
  }

  int finish = i2;
  int source = i1;

  while (1)
  {
    if (source == finish)
    {
      break;
    }
    else if (source == k - 1)
    {
      ans += (n - v[k - 1]) + v[0];
      source = 0;
    }
    else
    {
      ans += (v[source + 1] - v[source]);
      source++;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int a,b,c;
 cin>>a>>b>>c;
  if(a==b&&a!=c){
    cout<<"Yes";
  } else if(a==c&&b!=c){
    cout<<"Yes";
  } else if(b==c&&a!=b){
    cout<<"Yes";
  } else {
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3576
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
using namespace std;
int main()
{
	int a;
	int b;
	int c;
	int d;
	int e;
	int f;
	int g;
	int h;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	cin >> e;
	cin >> f;
	cin >> g;
	cin >> h;
	if (a + b + c + d >= e + f + g + h)
	{
		cout << a + b + c + d << endl;
	}
	else
	{
		cout << e + f + g + h << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
import java.util.Scanner;

    public class Main {
    	public static void main(String[] args) {
    		Scanner sc = new Scanner(System.in);
    		String a = sc.next();
    	    String b = sc.next();
    	    String c = sc.next();

    	    String x = a.substring(0, 1);
    	    String y = b.substring(0, 1);
    	    String z = c.substring(0, 1);

    	    x=x.toUpperCase();
    	    y=y.toUpperCase();
    	    z=z.toUpperCase();
    	    System.out.print(x);
    	    System.out.print(y);
    	    System.out.print(z);

    	}
    }

Measured memory_bytes: 21204
#define _USE_MATH_DEFINES 
#include <iomanip> 
#include <cmath>  
#include<iostream>
#include <fstream>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x;
#define wr(x)  cout << x
#define wrln(x) cout << x << endl

const ll INF = 10000000000;

ll N, P[110][11], ans = -INF;
bitset<10> F[110];

int main() {
	rd(N);
	repi(i, 0, N) {
		repi(j, 0, 10) {
			int temp;
			rd(temp);
			F[i].set(10 - (j + 1), temp);
		}
	}
	repi(i, 0, N) {
		repi(j, 0, 11) {
			ll temp;
			rd(temp);
			P[i][j] = temp;
		}
	}
	repi(i, 1, 1 << 10) {
		bitset<10> x(i);
		ll temp = 0;
		repi(j, 0, N) {
			bitset<10> BS = (x & F[j]);
			temp += P[j][BS.count()];
		}
		ans = max(ans, temp);
	}
	wrln(ans);
	return 0;
}

Measured memory_bytes: 256
r,c=map(int,input().split())
A=[ list(map(int,input().split())) for i in range(r) ]
B=[ list(map(int,input().split())) for i in range(c) ]
C=[ [0] for i in range(r) ]
for i in range(r):
	for j in range(c):
		C[i][0]+=A[i][j]*B[j][0]
for i in range(r):
	print(str(C[i][0]))



Measured memory_bytes: 6032
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    ll n,m;
    in>>n;
    if(n==2)
        return cout<<1<<endl,0;
    m=n-1;
    ll c{1};
    for(ll i=2;i*i<=m;++i) if(m%i==0){
        ++c;
        if(i*i!=m) ++c;
    }
    vector<ll> d(1,n);
    for(ll i=2;i*i<=n;++i) if(n%i==0){
            d.emplace_back(i);
            if(i*i!=n) d.emplace_back(n/i);
        }
    for(auto D:d){
        ll N=n;
        while(N%D==0) N/=D;
        if(N%D==1) ++c;
    }
    cout<<c<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1000000007,dp[222][222][222],r[222];

vector<vector<ll> > Comb(int n){
  vector<vector<ll> > v(n+1,vector<ll>(n+1));
  for(int i=0;i<=n;i++) v[i][i]=v[i][0]=1LL;
  for(int i=2;i<=n;i++) {
    for(int j=1;j<i;j++) v[i][j]=(v[i-1][j]+v[i-1][j-1])%mod;
  }
  return v;
}

vector<vector<ll> > c;
vector<int> v[222];

void dfs(ll x) {
  for(int i=0; i<v[x].size(); i++) dfs(v[x][i]);
  dp[x][0][1]=1;
  ll z=0;
  for(int i=0; i<v[x].size(); i++) {
    int y=v[x][i];
    for(int j=0; j<=z; j++) {
      for(int k=0; k<=r[y]; k++) {
        for(int l=0; l<=j+k; l++) {
          dp[x][i+1][l+1]+=dp[x][i][j+1]*dp[y][v[y].size()][k]%mod*c[j][j+k-l]%mod*c[l][j];
          dp[x][i+1][l+1]%=mod;
        }
      }
    }
    z+=r[y];
  }
  r[x]=z+1;
}

int main() {
  c=Comb(222);
  int n;
  cin >> n;
  int e[n];
  memset(e,0,sizeof(e));
  for(int i=0; i<n-1; i++) {
    int x,y;
    cin >> x >> y;
    v[x].push_back(y);
    e[y]++;
  }
  int t;
  while(t<n&&e[t])t++;
  dfs(t);
  ll ans=0;
  for(int i=0; i<=r[t]; i++) ans=(ans+dp[t][v[t].size()][i])%mod;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4944
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define END(x) do{cout<<(x)<<endl;exit(0);}while(0)
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<int> H(N);
    rep(i, 0, N-1) cin >> H[i];
    int s = H[0]-1;
    rep(i, 1, N-1) {
        if (H[i] < s) END("No");
        if (H[i] > s) s = H[i] - 1;
    }
    END("Yes");
}



Measured memory_bytes: 640
#include<stdio.h>
 
int main(){
	int n;
  	double sum,tmp;
  	while(~scanf("%d",&n)){
    	sum = 0;
      	for(int i = 0; i < n; i++){
        	scanf("%lf",&tmp);
          	sum+=1/tmp;
        }
      	printf("%.6g",1/sum);
    }
  
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int a,b,c;
    int A=0,B=0;
    char d;
     
    while(cin >>a>>d>>b>>d>>c){
        if(a==b) B++;
        if(c*c==a*a+b*b ) A++;
    }
     
    cout << A <<endl << B <<endl;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef vector<long long> vl;
typedef vector<bool> vb;
#define int long long
typedef vector<int> vi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Maxn 4000007
const int INF = 1e9 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
void foo(){
    int a, b, c;
    cin>>a>>b>>c;
    cout<<c<<" "<<a<<" "<<b;   
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)foo();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for (ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

int main(void) {
  ll N, M;
  cin >> N >> M;
  vector<ll> X(M);
  REP(i, 0, M) cin >> X[i];

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

  vector<ll> d;
  REP(i, 0, M - 1) {
    d.push_back(X[i + 1] - X[i]);
  }
  sort(d.begin(), d.end());

  ll ans = 0;
  REP(i, 0, M - N) {
    ans += d[i];
  }
  cout << ans << endl;
}

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

#define is_pos(x) x > 0
#define is_zero(x) x == 0

int main() {

	long long int a, b, c, d;
	cin >> a >> b >> c >> d;

	cout << max(a * c, max(a * d, max(b * c, d * b))) << endl;
	
	return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i=0; i<n; i++)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define reprs(i, s, e) for(int i=e-1; i>=s; i--)

int main(){

    ll n, k, q; cin >> n >> k >> q;

    ll a[q];
    ll cnt[n] = {};
    rep(i, q){
        cin >> a[i];
        a[i]--;
        cnt[a[i]]++;
    }

    ll maxv = *max_element(cnt, cnt+n);

    rep(i, n){
        cnt[i] += k - q;
    }

    rep(i, n){
        if(cnt[i] > 0){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define ff                first
#define ss                second
#define int               long long
#define pb                push_back
#define mp                make_pair
#define li                list<int>
#define pii               pair<int,int>
#define vi                vector<int>
#define mii               map<int ,int>
#define setbits(x)        _builtin_popcountll(x)
#define zrobits(x)        _builtin_ctzll(x)
#define mod               1000000007
#define inf               1e18
#define ps(x,y)           fixed<<setprecision(y)<<x
#define mk(arr,n,type)    type *arr=new type(n);
#define w(x)              int x; cin>>x; while(x--)
#define all(x)            (x).begin(), (x).end()
#define PI                3.14159265358979
void c_p_c()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("ou.txt", "w", stdout);
#endif
}
int FUN1 (int a[], int n, int x) {
	int i;
	for (i = 0; i < n && a[i] != x; i++);
	if (i == n) return -1;
	else return i;
}

void solve()
{

	char a; cin >> a;
	if (isupper(a))cout << "A";
	else cout << "a";
}
int32_t main()
{
	c_p_c();
	solve();
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll i_3=998244353;

struct Node{
    ll x,d;
    ll maxi;
    ll par;
    vector<ll> chi;
};
Node node[200001];
bool comp(Node a,Node b){
    return a.x<b.x;
}
ll sum(ll i){
    if(node[i].chi.size()==0){
        return 2;
    }
    ll ans=1;
    rep(j,0,node[i].chi.size()-1){
        ans=(ans*sum(node[i].chi[j]))%i_3;
    }
    return ans+1;
}

int main(){
    ll n;cin>>n;
    rep(i,0,n-1){
        cin>>node[i].x>>node[i].d;
    }
    sort(node,node+n,comp);
    for(ll i=n-1;i>=0;i--){
        node[i].par=-1;
        ll l=i,r=n;
        ll mid;
        while(r-l>1){
            mid=(r+l)/2;
            if(node[mid].x<node[i].x+node[i].d){
                l=mid;
            }else{
                r=mid;
            }
        }
        node[i].maxi=l;
    }
    deque<ll> v;
    
    
    for(ll i=n-1;i>=0;i--){
        if(i+1<=node[i].maxi){
            ll l=-1,r=v.size();
            ll mid;
            while(r-l>1){
                mid=(r+l)/2;
                if(v[mid]<=node[i].maxi){
                    l=mid;
                }else{
                    r=mid;
                }
            }
            if(l>=0){
                rep(j,0,l){
                    node[i].chi.pb(v[0]);
                    node[v[0]].par=i;
                    v.pop_front();
                }
            }
            v.push_front(i);
        }else{
            v.push_front(i);
        }
    }
    ll ans=1;
    rep(i,0,n-1){
        
        /*cout<<i<<' '<<node[i].par;
        if(node[i].chi.size()>0){
            rep(j,0,node[i].chi.size()-1){
                cout<<' '<<node[i].chi[j];
            }
        }
        cout<<endl;
        cout<<node[i].x<<' '<<node[i].d<<endl;
        */
         if(node[i].par==-1){
            ans=(ans*sum(i))%i_3;
        }
        
    }
    cout<<ans<<endl;
    
    return 0;
}




Measured memory_bytes: 26752
function main (input) {
  let rowArr = input.split('\n');
  rowArr.shift();
  rowArr.sort();
  return rowArr.join('');
}

const input = `3 3
dxx
axx
cxx`;
// console.log(main(input));

console.log(main(require("fs").readFileSync("/dev/stdin","utf8")));



Measured memory_bytes: 29604
s = input()

if s == "SAT":
    print(1)
elif s == "MON":
    print(6)
elif s == "TUE":
    print(5)
elif s== "WED":
    print(4)
elif s== "THU":
    print(3)
elif s== "FRI":
    print(2)
elif s== "SUN":
    print(7)
    

Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(int argc, char **argv)
{
    int N;
    cin >> N;
    int A[N];
    REP(i, N) cin >> A[i];

    int order[N];
    REP(i, N) {
        order[A[i] - 1] = i + 1;
    }
    cout << order[0];
    FOR(i, 1, N) {
        cout << " " << order[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(a) (long long)((a).size())
const double pi = 3.14159265358979323846;

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
    
    ll n,i,j;
    cin>>n;
    vector<ll> a(3*n);
    for(i=0;i<3*n;i++) cin>>a[i];
    priority_queue<ll> pq;
    priority_queue<ll,vector<ll>, greater<ll>> pq2;
    ll sum = 0;
    vector<ll> f,b;
    for(i=0;i<3*n;i++)
    {
        sum+=a[i];
        pq2.push(a[i]);
        if(sz(pq2) > n) 
        {
            sum-=pq2.top();
            pq2.pop();
        }
        if(i>=n-1 && i<2*n) f.pb(sum);
    }
    sum = 0;
    for(i=3*n-1;i>=0;i--)
    {
        sum+=a[i];
        pq.push(a[i]);
        if(sz(pq)>n)
        {
            sum-=pq.top();
            pq.pop();
        }
        if(i>=n && i<=2*n) b.pb(sum);
    }
    reverse(all(b));
    ll ans = -1e18;
    // for(i=0;i<n;i++) cout<<f[i]<<" "<<b[i]<<"\n";
    for(i=0;i<=n;i++) ans = max(ans,f[i]-b[i]);
    cout<<ans;
}


Measured memory_bytes: 6516
#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 All(a) (a).begin(),(a).end()
#define sp " "
#define INF 1e18
#define INT_INF 1e9
#define MAX 400000

typedef long long ll;
const ll MOD = 1000000007;
const ll MOD_9 = 998244353;
const ll MAX_pow_2 = (1 << 17); //2^17 10^5

int n;
int dat[MAX_pow_2*2-1];
// parent of node_n = (n-1)/2;
// children of node_n = 2n+1,2n+2;

void init(){
    for(int i = 0;i < MAX_pow_2*2-1;i++) dat[i] = INT32_MAX;
}

//dat[i] <- x;
void update(int i,int x,int k,int l,int r){
    if(r <= i || i < l || r == l)return;
    if(r-l == 1){
        dat[k] = x;
        return;
    }
    //cout << k << endl;
    update(i,x,k*2+1,l,(l+r)/2);
    update(i,x,k*2+2,(l+r)/2,r);
    dat[k] = min(dat[2*k+1],dat[2*k+2]);
}

//find_min(a,b,0,0,MAX);
//int l,r range of node_k;
//a,a+1,a+2,....b-2,b-1;
int find_min(int a,int b,int k,int l,int r){
    if(r <= a || b <= l)return INT32_MAX;
    if(a <= l && r <= b)return dat[k];
    else{
        int value_l = find_min(a,b,k*2+1,l,(l+r)/2);
        int value_r = find_min(a,b,k*2+2,(l+r)/2,r);
        return min(value_l,value_r);
    }
}

int main(){
    int q;
    cin >> n >> q;
    init();
    //Rep(i,MAX_pow_2*2-1)cout << dat[i] << sp;
    //cout << endl;
    Rep(i,q){
        int o;cin >> o;
        int x,y;
        cin >> x >> y;
        if(o == 0)update(x,y,0,0,MAX_pow_2);
        else cout << find_min(x,y+1,0,0,MAX_pow_2) << endl;
    }
    //cin >> n;
}


Measured memory_bytes: 4140
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;




int main(){
    int N;
    cin >> N;
    int ans=0;
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        ans+=a-1;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int x; cin >>x;
  if(x>=30) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
// ordered_set X;
// *X.find_by_order(i) = ith largest element (counting from zero)
// X.order_of_key(k) = number of items in X < k (strict lt)

bool ok(vll &A, int i) {
    int N = A.size();
    ll sum = 0;
    for (int j=0;j<=i;j++) sum += A[j];
    for (int j=i+1;j<N;j++) {
        if (2*sum < A[j]) return false;
        sum += A[j];
    }

    return true;
}

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

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

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

    int low = 1;
    int high = N+1;

    while (high - low > 1) {
        int mid = (low + high) / 2;
        if (ok(A, N-mid)) {
            low = mid;
        } else {
            high = mid;
        }
    }

    cout << low << endl;


    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	string s;
	cin>>s;
	s+='$';
	int n=s.size();
	vector<int>suff(n);
	iota(suff.begin(),suff.end(),0);
	{
		const char *str=s.c_str();
		sort(suff.begin(),suff.end(),[&](int a,int b){
			return strcmp(str+a,str+b)<0;
		});
	}
	vector<pair<char,int>>sorted(n);
	for(int i=0;i<n;i++)sorted[i]={s[(suff[i]-1+n)%n],i};
	sort(sorted.begin(),sorted.end());

	int T;
	//for(cin>>T;T--;){
		string q;
		cin>>q;
		int start=0,stop=n,idx=q.size()-1;
		for(;idx>=0;idx--){
			pair<char,int> ql={q[idx],start},qr={q[idx],stop};
			start=lower_bound(sorted.begin(),sorted.end(),ql)-sorted.begin();
			stop=lower_bound(sorted.begin(),sorted.end(),qr)-sorted.begin();
			if(start==stop)break;
		}
		if(idx<0){
			{vector<int>v;for(;start<stop;start++)v.push_back(suff[start]);sort(v.begin(),v.end());for(auto &e:v)printf("%d\n",e);}
			//puts("1");
		}else{
			//puts("0");
		}
	//}
}

Measured memory_bytes: 3396
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> v;
string s,t;
int n;
int main(void){
    cin>>n>>s>>t;
    int l=0;
    while(n>l){
        if(s[l]==t[l]){
            v.push_back(1);
            l+=1;
        }
        else{
            v.push_back(0);
            l+=2;
        }
    }
    int cnt=0;
    ll ans;
    for(int i=0;i<v.size();i++){
        if(i==0){
            cnt=v[i];
            if(cnt)ans=3;
            else ans=6;
            continue;
        }
        if(cnt)ans*=2;
        else ans*=(1+2*(!v[i]));
        ans%=1000000007;
        cnt=v[i];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,x,a;
	cin>>n>>x>>a;
	ll ans=(n+x-1)/x;
	ans*=a;
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3616
package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt64() int64 {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}

	return int64(i)
}
func main() {
	sc.Split(bufio.ScanWords)
	x := big.NewInt(nextInt64())
	now := big.NewInt(100)
	cnt := 0

	for {
		compares := x.Cmp(now)
		if (compares == -1) || (compares == 0) {
			fmt.Println(cnt)
			return
		}
		now.Mul(now, big.NewInt(101))
		now.Div(now, big.NewInt(100))
		cnt++
	}

}


Measured memory_bytes: 1936
#include <iostream>
#include <cmath>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
#define INF 1e10
using namespace std;

int D, E;

int main(void) {
  while(cin >> D >> E, D || E) {
    double ans = INF;
    REP(i, 0, 101) REP(j, 0, 101) {
      if(i + j == D) ans = min(ans, abs(sqrt(i * i + j * j) - E));
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3276
import sys
from collections import defaultdict
import bisect
sys.setrecursionlimit(1000000)
d1=defaultdict(list)
d2=defaultdict(list)
n,m=map(int,input().split())
l=list(map(int,input().split()))
la=[[] for i in range(n+1)]
for i in range(m):
  a,b=map(int,input().split())
  la[a].append(b)
  la[b].append(a)
lb=[0 for i in range(n+1)]
def dfs(x,y):
  if lb[x]!=0:
    return
  else:
    lb[x]=y
    s=la[x]
    if s==[]:
      pass
    else:
      for i in s:
        dfs(i,y)
c=1
for i in range(1,n+1):
  dfs(i,c)
  c+=1
lc=set(lb)
for i in range(1,n+1):
  d1[lb[i]]+=[i]
  d2[lb[i]]+=[l[i-1]]
ans=0
for i in d1:
  d11=d1[i]
  d12=d2[i]
  for j in d12:
    index=bisect.bisect_right(d11,j)
    if d11[index-1]==j:
      ans+=1
print(ans)

Measured memory_bytes: 83420
n = 0
dat = []


def input_file():
    global n, dat
    f = open('input', mode='r')
    n = int(f.readline())
    for _ in range(n):
        i = int(f.readline())
        dat.append(i)


def input_cmd():
    global n, dat
    n = int(input())
    for _ in range(n):
        dat.append(int(input()))


input_cmd()
# input_file()

# p = -2e10
# for i in range(n):
#     for j in range(i + 1, n):
#         r = dat[j] - dat[i]
#         if r > p:
#             p = r
minV = dat[0]
maxV = -2e10
for i in range(1, n):
    r = dat[i] - minV
    maxV = r if r > maxV else maxV
    # 从已经遍历过的数据中得到现阶段的最小的价格即可
    minV = dat[i] if dat[i] < minV else minV
print(maxV)



Measured memory_bytes: 13632
def main():
    n = int(input())
    t = [[i for i in range(1,14)] for _ in range(4)]
    S = "SHCD"
    
    for _ in range(n):
        s,r = input().split()
        t[S.find(s)].remove(int(r))
    
    for i,v in enumerate(S):
        for r in t[i]:
            print(v + " " + str(r))


if __name__ == '__main__':
    main()


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

int main() {
  int n, t;
  cin >> n;
  vector<vector<int>> trees(n + 1);
  for (int i = 2; i <= n; ++i) {
    cin >> t;
    trees[t].push_back(i);
  }
  for (int i = 1; i <= n; ++i) {
    cout << trees[i].size() << '\n';
  }
  return 0;
}

Measured memory_bytes: 13988
#include <bits/stdc++.h>
#define adj_list vector<vi>
#define endl "\n"
#define INF_INT 2e9
#define INF_LL 2e18
#define matmax 25
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define pi pair<int, int>
#define pii pair<int, pair<int, int> >
#define pl pair<ll, ll>
#define pll pair<ll, pair<ll, ll> >
#define vi vector<int>
#define vl vector<ll>
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long int ll;

int lsone(int n)
{
	return (n&-n);
}

void mult(ll a[matmax][matmax], ll b[matmax][matmax], ll c[matmax][matmax], int m, int n, int p)
{
	for (int i = 1; i <= m; i++)
	{
		for (int j = 1; j <= p; j++)
		{
			c[i][j] = 0;
			for (int k = 1; k <= n; k++)
			{
				c[i][j] += (a[i][k]*b[k][j])%mod;
				c[i][j] %= mod;
			}
		}
	}
}

void mat_pow(ll a[matmax][matmax], ll c[matmax][matmax], int n, ll p)
{
	if (p == 0)
	{
		for (int i = 1; i <= n; i++)
			c[i][i] = 1;
	}
	else if (p == 1)
	{
		for (int i = 1; i <= n; i++)
		{
			for (int j = 1; j <= n; j++)
				c[i][j] = a[i][j];
		}
	}
	else
	{
		ll d[matmax][matmax];
		mat_pow(a, d, n, p/2);
		if (p % 2)
		{
			ll e[matmax][matmax];
			mult(d, d, e, n, n, n);
			mult(e, a, c, n, n, n);
		}
		else
		{
			mult(d, d, c, n, n, n);
		}
	}
}

ll pow1(ll a, ll b)
{
	if (b == 0)
		return 1ll;
	else if (b == 1)
		return a;
	else
	{
		ll x = pow1(a, b/2);
		x *= x;
		x %= mod;
		if (b%2)
		{
			x *= a;
			x %= mod;
		}
		return x;
	}
}

ll n, arr[210000], ans = 0, num[210000], next_pos[30];

int main()
{
	fastio;		
	cin>>n;
	for (int i = 0; i < n; i++)
	{
		cin>>arr[i];
	}
	num[n] = n;
	for (int i = 0; i < 20; i++)
		next_pos[i] = n;
	for (int i = n-1; i >= 0; i--)
	{
		ll minim = num[i+1];
		for (int j = 0; j < 20; j++)
		{
			if ((1<<j) & arr[i])
			{
				minim = min(minim, next_pos[j]);
			}
		}
		ans += (minim-i);
		num[i] = minim;
		for (int j = 0; j < 20; j++)
		{
			if ((1<<j) & arr[i])
				next_pos[j] = i;
		}
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 3456
import itertools

pair_num = 0
N = int(input())
L_list = list(map(int, input().split()))

if len(L_list) < 3:
    print(0)
else:
    for pair in itertools.combinations(L_list, 3):
        if (pair[0] == pair[1]) or (pair[0] == pair[2]) or (pair[1] == pair[2]):
            continue

        if (pair[0] + pair[1] > pair[2]) and (pair[0] + pair[2] > pair[1]) and (pair[1] + pair[2] > pair[0]):
            pair_num += 1

    print(pair_num)


Measured memory_bytes: 9204