akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n,h,w = map(int, input().split())

a = [0]* n
b = [0]* n
for i in range(n):
    a[i], b[i] = map(int, input().split())

ans = 0
for i in range(n):
    if a[i] >= h and b[i] >= w:
        ans+=1

print(ans)


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

int main()
{
	double t1, t2;
	
	int rank1,rank2;
	
	while(scanf("%lf %lf", &t1, &t2) != EOF){
		
		if (t1 < 35.50) rank1 = 1;
		else if (t1 < 37.50) rank1 = 2;
		else if (t1 < 40.0) rank1 = 3;
		else if (t1 < 43.0) rank1 = 4;
		else if (t1 < 50.0) rank1 = 5;
		else if (t1 < 55.0) rank1 = 6;
		else if (t1 < 70.0) rank1 = 7;
		else rank1 = 8;
		
		if (t2 < 71.0) rank2 = 1;
		else if(t2 < 77.0) rank2 = 2;
		else if(t2 < 83.0) rank2 = 3;
		else if(t2 < 89.0) rank2 = 4;
		else if(t2 < 105.0) rank2 = 5;
		else if(t2 < 116.0) rank2 = 6;
		else if(t2 < 148.0) rank2 = 7;
		else rank2 = 8;
		
		int rank = max(rank1, rank2);
		
		if(rank == 1) puts("AAA");
		if(rank == 2) puts("AA");
		if(rank == 3) puts("A");
		if(rank == 4) puts("B");
		if(rank == 5) puts("C");
		if(rank == 6) puts("D");
		if(rank == 7) puts("E");
		if(rank == 8) puts("NA");
		
	}
}

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

int main()
{
	int n, k;
	cin >> n >> k;
	if(n == 2){
		if(k == 0){
			cout << 1 << endl;
			cout << 1 << " " << 2 << endl;
		}else{
			cout << -1 << endl;
		}
	}else{
		if((n - 1) * (n - 2) / 2 < k){
			cout << -1 << endl;
		}else{
			int rem = (n - 1) * (n - 2) / 2 - k;
			cout << n - 1 + rem << endl;
			for(auto i = 0; i < n - 1; ++i){
				cout << 1 << " " << i + 2 << endl;
			}
			int b = 2;
			while(rem > 0){
				for(auto i = b + 1; i <= n; ++i){
					cout << b << " " << i << endl;
					--rem;
					if(rem == 0) break;
				}
				++b;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;


int main(){
   char c;
   cin >> c;
   c++;
   out(c);
}

Measured memory_bytes: 256
class UnionFind:
  def __init__(self, N):
    self.par=[i for i in range(N)]
    self.rank=[0 for _ in range(N)]
    self.size=[1 for _ in range(N)]
    
  def unite(self, x, y):
    x=self.getroot(x)
    y=self.getroot(y)
    if x!=y:
      if self.rank[x]<self.rank[y]:
        x, y=y, x
      if self.rank[x]==self.rank[y]:
        self.rank[x]+=1
      self.par[y]=x
      self.size[x]+=self.size[y]
      
  def united(self, x, y):
    return self.getroot(x)==self.getroot(y)
      
  def getroot(self, x):
    if self.par[x]==x:
      return x
    else:
      self.par[x]=self.getroot(self.par[x])
      return self.par[x]

  def getsize(self, x):
    return self.size[self.getroot(x)]
  
def LN2NL(N, LN):
  out=[[] for _ in range(N)]
  M=len(LN)
  for i in range(M):
    out[LN[i][0]].append(LN[i][1])
    out[LN[i][1]].append(LN[i][0])
  return out

N, M, K=map(int, input().split())
UF=UnionFind(N+1)
AB=[list(map(int, input().split())) for _ in range(M)]
CD=[list(map(int, input().split())) for _ in range(K)]
ABNL=LN2NL(N+1, AB)
CDNL=LN2NL(N+1, CD)

for i in range(M):
  UF.unite(AB[i][0], AB[i][1])
  
ans=[UF.getsize(i)-len(ABNL[i])-1 for i in range(N+1)]
for i in range(1, N+1):
  for j in range(len(CDNL[i])):
    if UF.united(i, CDNL[i][j]):
      ans[i]-=1
      
print(*ans[1:])

Measured memory_bytes: 78968
import java.util.Scanner;

public class Main {

	static int[] A=new int[2000001];
	static int H=0;
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner scanner=new Scanner(System.in);
		while(true){
			String str=scanner.next();
			if(str.equals("insert")){
				insert(scanner.nextInt());
			}else if(str.equals("extract")){
				System.out.println(extract());
			}else if(str.equals("end")){
				break;
			}
		}
		
	}
	private static int extract() {
		// TODO Auto-generated method stub
		if(H<1)
			return 0;
		int max=A[1];
		A[1]=A[H];
		H--;
		maxHeap(A, 1);
		return max;
	}
	//插入方法需要掌握
	private static void insert(int key) {
		// TODO Auto-generated method stub
		H++;
		A[H]=Integer.MIN_VALUE;
		if(key<A[H])
			return;
		A[H]=key;
		int i=H;
		while(i>1&&A[i/2]<A[i]){
			swap(A, i/2, i);
			i=i/2;
		}
	}

	private static void maxHeap(int num[], int i) {
		// TODO Auto-generated method stub
		int l=2*i;
		int r=2*i+1;
		
		int largest=-1;
		if(l<=H&&num[l]>num[i]){
			largest=l;
		}else {
			largest=i;
		}
		if(r<=H&&num[r]>num[largest])
			largest=r;
		
		if(largest!=i){
			swap(num,largest,i);
			maxHeap(num, largest);
		}
	}
	private static void swap(int[] num, int j, int i) {
		// TODO Auto-generated method stub
		int tmp=num[i];
		num[i]=num[j];
		num[j]=tmp;
	}
}



Measured memory_bytes: 557116
"use strict"

function Main(input) {
  input = input.trim().split('\n');
  const N = Number(input[0]);
  let A = input[1].trim().split(' ').map(Number);

  let ans = 1;
  let up = false;
  let down = false;
  for(let i=0; i<N; i++){
    // console.log(A[i], A[i+1])
    if(A[i] < A[i+1]){
      up = true;
    }

    if(A[i] > A[i+1]){
      down = true;
    }

    if(up && down){
      up = false;
      down = false;
      ans += 1;
    }
  }

  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 17612
S = input()
alphabet = "abcdefghijklmnopqrstuvwxyz"
if S == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
else:
    if len(S)<26:
        for a in alphabet:
            if a not in S:
                print(S + a)
                exit()
    else:#コイツを下回らない程度に辞書順を最低にする
        ordmax = 0
        for n,s in enumerate(reversed(S)):
            if ordmax > ord(s):

                for j in range(alphabet.index(s)+1,26):
                    if alphabet[j] not in S[:-n-1] :
                        print(S[:-n-1] + alphabet[j])
                        exit()
            else:
                ordmax = max(ordmax,ord(s))

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

int main() {
  int A, B,c;
  cin >> A >> B;
  c=A % 500;
  if (B<c) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" <<endl;
  }
  // ここにプログラムを追記
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int memo[202020];
int N;
string S;

int F(int v) {
	if(memo[v]==-1) memo[v]=1+F(v%__builtin_popcount(v));
	return memo[v];
}

int p2[202020][3];
int Q[3];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>S;
	
	MINUS(memo);
	memo[0]=0;
	
	int num=0;
	FORR(c,S) num+=c=='1';
	
	FOR(j,3) {
		x=num-1+j;
		if(x>0) {
			p2[0][j]=1;
			FOR(i,N) {
				p2[i+1][j]=p2[i][j]*2%x;
				Q[j]=(Q[j]*2+(S[i]=='1'))%x;
			}
		}
	}
	
	
	FOR(i,N) {
		if(S[i]=='1') {
			if(num==1) {
				cout<<0<<endl;
			}
			else {
				x=num-1;
				y=((Q[0]-p2[N-1-i][0])%x+x)%x;
				cout<<1+F(y)<<endl;
			}
		}
		else {
			x=num+1;
			y=(Q[2]+p2[N-1-i][2])%x;
			cout<<1+F(y)<<endl;
		}
	}
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 6860
alist = []
for _ in range(5):
    alist.append(int(input()))



#%%
ans = 0
for i in alist:
    ans += ((i-1) // 10 + 1) *10
    # print(ans)

ans_b = 11
for i in alist:
    if i % 10 == 0:
        ans_b = min(ans_b, 10)
    else:
        ans_b = min(ans_b, i%10)

print(ans - (10 - ans_b))
#%%


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	ll n;
	cin >> n;
	if (n == 1)cout << 0 << endl;
	else {
		ll sum = ((n+1LL)*n / 2LL)- n;
		cout << sum << endl;
	}
	return 0;
}


Measured memory_bytes: 3600
# coding: utf-8
# Your code here!
import sys
INF=1001001001
def solve(N,H):
    dp=[INF]*(N)
    dp[0]=0
    for i in range(N):
        if i+1<N:
            dp[i+1]=min(dp[i+1],dp[i]+abs(H[i+1]-H[i]))
        if i+2<N:
            dp[i+2]=min(dp[i+2],dp[i]+abs(H[i+2]-H[i]))
    return dp[N-1]
  
def main(lines):
    N=int(lines[0])
    H=list(map(int,lines[1].split()))
    print(solve(N,H))
    

if __name__ == '__main__':
    lines = []
    for l in sys.stdin:
        lines.append(l.rstrip('\r\n'))
    main(lines)


Measured memory_bytes: 14220
#include<bits/stdc++.h>
using namespace std;
long long int N;
long long int arr[200001];
long long int search(){
  	long long int ini=0,left=0;
    while(left<=N-1){
        bool ok=true;
        for(left;left<=N-1;left++) if(arr[left]==ini+1) {ok=false;ini++;break;}
        if(ok) break;
    }
    return(ini);
}
int main(){
    ifstream in("a.in");
    cin>>N;
    bool ok=false;
    for(long long int i=0;i<N;i++) {cin>>arr[i];if(arr[i]==1) ok=true;}
    if(!ok) cout<<-1;
    else cout<<N-search();
}

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

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
# define ld long double
const ld pi = 3.14159265359;
ld radian(ld angle){
	return angle * pi / (ld)180;
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	ld a, b, h, m;
	cin >> a >> b >> h >> m;   
	ld realH = h + m / (ld)60;
	ld realM = m + h * 60;
	ld ang1 = realH / (ld)12 * 360;
	ld ang2 = realM / (ld)60 * 360;
	ld ang = min(360 - abs(ang1 - ang2), abs(ang1 - ang2));
	ld ans = sqrt(a * a + b * b - 2 * a * b * cos(radian(ang)));
	cout << setprecision(11) << ans << '\n';
}

Measured memory_bytes: 4184
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  //input
  int N,T; cin>>N>>T;
  vector<int>vecC;
  for(int i=0;i<N;i++){
    int c,t; cin>>c>>t;
    if(t<T+1){
      vecC.push_back(c);
    }else{
      continue;
    }
  }
  sort(vecC.begin(),vecC.end());
  if(vecC.size()==0){
    cout<<"TLE"<<endl;
  }else{
    cout<<vecC[0]<<endl;
  }
}
  



Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	int[][] b = new int[8][8];

	boolean canPutAt(int r, int c) {
		// r行に駒がない
		for (int i = 0; i < 8; i++) {
			if (b[i][c] == 1) {
				return false;
			}
		}

		// c列に駒がない
		for (int i = 0; i < 8; i++) {
			if (b[r][i] == 1) {
				return false;
			}
		}

		// 斜めに駒がない
		for (int i = 0; i < 8; i++) {
			int r1 = r - i;
			int r2 = r + i;
			int c1 = c - i;
			int c2 = c + i;

			if ((r1 >= 0 && c1 >= 0 && b[r1][c1] == 1) || 
				(r1 >= 0 && c2 <= 7 && b[r1][c2] == 1) ||
				(r2 <= 7 && c1 >= 0 && b[r2][c1] == 1) || 
				(r2 <= 7 && c2 <= 7 && b[r2][c2] == 1)) {
				return false;
			}
		}

		return true;
	}

	boolean backtrack(int rest) {
		if (rest == 0) {
			return true;
		}
		for (int r = 0; r < 8; r++) {
			for (int c = 0; c < 8; c++) {
				if (canPutAt(r, c)) {
					b[r][c] = 1;
					if (backtrack(rest - 1)) {
						return true;
					}
					b[r][c] = 0;
				}
			}
		}
		return false;
	}

	void print() {
		for (int r = 0; r < 8; r++) {
			for (int c = 0; c < 8; c++) {
				out.print(b[r][c] == 1 ? "Q" : ".");
			}
			out.println();
		}
	}

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int n = sc.nextInt();

		for (int i = 0; i < n; i++) {
			int r = sc.nextInt();
			int c = sc.nextInt();

			b[r][c] = 1;
		}

		sc.close();

		backtrack(8 - n);

		print();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}



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

void hoge(string s, string &new_s, vector<string> &vs) {
    bool in_quote = false;
    string sub_s = "";
    for (char c: s) {
        if (in_quote) {
            if (c == '"') {
                vs.emplace_back(sub_s); sub_s = "";
                in_quote = false;
            } else {
                sub_s += c;
            }
        } else {
            if (c == '"') {
                in_quote = true;
                new_s += "@";
            } else {
                new_s += c;
            }
        }
    }
}

string solve(string s, string t) {
    vector<string> vs, vt;
    string new_s, new_t;
    hoge(s, new_s, vs);
    hoge(t, new_t, vt);
    if (new_s != new_t) return "DIFFERENT";
    int cnt = 0;
    for (int i = 0; i < vs.size(); i++) {
        cnt += vs[i] != vt[i];
    }
    if (cnt == 0) return "IDENTICAL";
    if (cnt == 1) return "CLOSE";
    return "DIFFERENT";
}

int main() {
    string s, t;
    while (cin >> s, s != ".") {
        cin >> t;
        cout << solve(s, t) << endl;
    }
    return 0;
}


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

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

int main() {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    
    long long sum_less_a = (a - 1) / c + (a - 1) / d - (a - 1) / (c * d / gcd(c, d));
    long long sum_less_b = b / c + b / d - b / (c * d / gcd(c, d));
    
    long long ans = (b - a + 1) - (sum_less_b - sum_less_a);
    cout << ans << endl;
}

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

int main() {
    int A,B;
    cin >> A >> B;

    if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
}


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

using ll = long long;

int main() {
  ll N;
  cin >> N;
  for (int i = sqrt(N); i > 0; --i) {
    if (N % i == 0) {
      N /= i;
      break;
    }
  }
  cout << static_cast<int>(log10(N)) + 1 << endl;
  return 0;
}


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

typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    string S;
    cin >> S;
    vector<vector<int>> vec(10,vector<int>());
    for (int i=0;i<N;i++){
        vec[S[i]-'0'].push_back(i);
    }
    int ans = 0;
    for (int i=0;i<10;i++){
        for (int j=0;j<10;j++){
            for (int k=0;k<10;k++){
                int cur = 0;
                if (vec[i].size() == 0) continue;
                auto it = lower_bound(vec[i].begin(),vec[i].end(),cur);
                if (it == vec[i].end()) continue;
                else cur = *it + 1;
                if (vec[j].size() == 0) continue;
                it = lower_bound(vec[j].begin(),vec[j].end(),cur);
                if (it == vec[j].end()) continue;
                else cur = *it + 1;
                if (vec[k].size() == 0) continue;
                it = lower_bound(vec[k].begin(),vec[k].end(),cur);
                if (it == vec[k].end()) continue;
                else cur = *it + 1;
                ans++;
            }
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  string A, B; cin >> A >> B;
  A += B;
  int ia = atoi(A.c_str()), root=int(sqrt(ia));

  string result;
  if (ia==root*root) result = "Yes";
  else result = "No";
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
#define srep(i, j, k) for (int i = j; i < k; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

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

//�G���g�X�e�l�X���
vector<int> estora(vector<int> num) {
    int sel = 0;
    while (sel < num.size()) {
        int d = num[sel];
        for (int i = 0; i < num.size(); i++) {
            if (num[i] % d == 0 && num[i] != d && d != 1) {
                num.erase(num.begin() + i);
                i--;
            }
        }
        sel++;
    }
    return num;
}
/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
//i����ɑf���ɂ��Ă����Ȃ��Ƃ��܂��ł��Ȃ�&&�v�Z�ʃ��o�C
//�G�X�g���l�X��⿂őf����U����Ă����K�v�������肻��
vector<ll> fac(ll n, vector<ll> num) {
    ll kazu = n;
    for (int i = 2; i <= n; i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1)
        num[n]++;
    return num;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return num;
}
const int INF = 1001001001;

//mint�p�̒萔 (10��9�� + 7)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

//string�@�ɂ��Ē��ׂĂ�����

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

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    double a, b, x;
    cin >> a >> b >> x;
    double volume = a * a * b;
    double mid = volume / 2;
    double ans = 0;
    if(x >= mid){
        double denominator = a;
        double numerator = 2 * (volume - x) / (a * a);
        ans = atan2(numerator, denominator);
    }
    else{
        double denominator = 2 * x / (a * b);
        double numerator = b;
        ans = atan2(numerator, denominator);
    }
    double conversion = 180.0 / acos(-1);
    ans *= conversion;
    cout << fixed << setprecision(10);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <numeric>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF (LL)1e15
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

LL change_div_mul_mod(LL divisor, LL mod_minus_2, LL mod){
    if(mod_minus_2 == 0) return 1;
    else if(mod_minus_2 % 2 == 0){
        LL d = change_div_mul_mod(divisor, mod_minus_2/2, mod);
        return (d * d) % mod;
    }else{
        return (divisor * change_div_mul_mod(divisor, mod_minus_2-1, mod)) % mod;
    }
}

//#define int long long

/*************** using variables ***************/
LL n;
string s;
/**********************************************/

int ctoi(char c){
    return (int)(c - '0');
}

signed main(){
    /*cin >> s;

    int z = s.size();
    int ans = 0;
    REP(i, z-1){
        ans += 9;
    }
    
    int ans2 = 0;
    REP(i, z){
        ans2 += ctoi(s[i]);
    }
    
    int ans3 = 0;
    REPR(i, z-1){
        if(ctoi(s[i]) != '9'){
            ans3 += 8;
        }else{
            ans3 += 9;
        }
    }
    cout << max(ans, ans2) << endl;
    
    */
    cin >> n;
    LL ans = 0;
    while(n > 0){
        if(n / 10 != 0 && n % 10 != 9){
            n -= 10;
            n += 9 - n % 10;
        }
        ans += n % 10;
        n /= 10;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include<queue>
#include<set>
#include<climits>
using namespace std;

int main()
{
  while (true)
  {
    long long n, m, result = 0;
    cin >> n >> m;
    if (n == 0 && m == 0)
      exit(0);

    vector<long long> v(n, 0);

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

    for (int i = 0; i < n; i++)
    {
      for (int j = i + 1; j < n; j++)
      {
        if (v[i] + v[j] <= m && result < v[i] + v[j])
          result = v[i] + v[j];
      }
    }

    if (result !=0)
      cout << result << endl;
    else
      cout << "NONE" << endl;

  }

}



Measured memory_bytes: 3084
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
#define MOD 1000000007
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
inline bool BETWEEN(int x, int min,int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}

using namespace std;
#pragma endregion
signed main() {
	int X, A, B;
	cin >> X >> A >> B;
	if ((X*100+A*10+B)%4==0)
		cout << "YES";
	else
		cout << "NO";
}

Measured memory_bytes: 384
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
int main()
{
    int a[101][101], b[101], c[101];
    int i, j;
    int n, m;
 
    scanf("%d%d", &n, &m);
    for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) scanf("%d", &a[i][j]);
    }
    for (j = 0; j < m; j++) scanf("%d", &b[j]);
 
    for (i = 0; i < n; i++) {
        c[i] = 0;
        for (j = 0; j < m; j++) c[i] += a[i][j] * b[j];
    }
 
    for (i = 0; i < n; i++) {
        printf("%d\n", c[i]);
    }
    return 0;
}


Measured memory_bytes: 2096
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define pai 3.141592653589793238462643383279

int main(){
  int H, W; cin >> H >> W; string a[H];
  rep(i, H){
    cin >> a[i];
  }
  queue<pair<int, int>>Q;
  Q.push({0, 0}); int dist[H][W] = {};
  rep(i, H){
    rep(j, W){
      if(i!=0 || j!=0) dist[i][j] = -1;
      else dist[i][j]=1;
    }
  }
  while(!Q.empty()){
      int next[5] = {0, 1, 0, -1, 0};
      auto p = Q.front(); Q.pop();
      int f = p.first; int s = p.second;
      rep(ii, 4){
        int x = f+next[ii]; int y = s+next[ii+1];
        if(x<0 || y<0 || x>=H || y>=W || a[x][y]=='#' || dist[x][y]>0) continue;
        Q.push({x, y}); dist[x][y]=dist[f][s]+1;
      }
  }
  int kuro=0;
  rep(i, H){
    rep(j, W){
      if(a[i][j]=='#') kuro++;
    }
  }
  if(dist[H-1][W-1]==-1){
    cout << -1 << endl; return 0;
  }
  cout << H*W - dist[H-1][W-1] - kuro << endl;
}
  

Measured memory_bytes: 256
// https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/4/ALDS1_4_B
#include <bits/stdc++.h>

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

int binarySearch(vector<int> S, int key) {
  int left = 0, right = S.size();
  int mid;
  while (left < right) {
    mid = (left + right) / 2;
    if (S[mid] == key)
      return mid;
    else if (S[mid] < key)
      left = mid + 1;
    else
      right = mid;
  }
  return -1;
}

int main() {
  int n;
  cin >> n;
  vector<int> S(n, 0);
  rep(i, n) cin >> S[i];

  int q;
  cin >> q;
  vector<int> T(q, 0);
  rep(i, q) cin >> T[i];

  int cnt = 0;
  rep(i, q) if (binarySearch(S, T[i]) >= 0) cnt++;
  cout << cnt << endl;
  return 0;
}



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

using namespace std;



int main() {




int N,X,x,L,ans;
cin>>N>>X;
L=0;
ans=1;

for(int i=0;i<N;i++) {
cin>>x;
L+=x;
if(L<=X) {
ans+=1;
}
}
cout<<ans;

return 0;

}

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

int main() {
    //
    long long n, m, k;
    long long time = 0;

    cin >> n >> m >> k;

    vector<long long> A(n);
    vector<long long> B(m);

    for (long long i = 0; i < n; i++) cin >> A.at(i);
    for (long long i = 0; i < m; i++) {
        cin >> B.at(i);
        time += B.at(i);
    }

    long long j = m;
    long long kekka = 0;

    for (long long i = 0; i < n + 1; i++) {
        while (j > 0 && time > k) {
            j--;
            time -= B.at(j);
        }

        if (time > k) break;
        kekka = max(kekka, i + j);

        if (i == n) break;
        time += A.at(i);
    }

    cout << kekka;
    //
}


Measured memory_bytes: 6404
#include <iostream>
using namespace std;
#define in(v) v; cin >> v;
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)

template<int MOD> struct MInt {
  long long val;
  constexpr MInt(long long val = 0) : val(val % MOD) { if (val < 0) val += MOD; }
  MInt operator-() const { return MInt(-val); }
  MInt operator+(const MInt& n) const { return MInt(val) += n; }
  MInt operator-(const MInt& n) const { return MInt(val) -= n; }
  MInt& operator+=(const MInt& n) { val = (val + n.val) % MOD; return *this; }
  MInt& operator-=(const MInt& n) { val = (MOD + val - n.val) % MOD; return *this; }
  friend ostream& operator<<(ostream& os, const MInt& n) { os<<n.val; return os; }
  friend istream& operator>>(istream& os, MInt& n) { os>>n.val; return os; }
};
constexpr int MOD = 1e9+7;
using mint = MInt<MOD>;

string K;
int D;
constexpr int MAX_N = 10000, MAX_D = 100;
mint dp[MAX_N][MAX_D][2];
bool visited[MAX_N][MAX_D][2];
mint dfs(int i, int r, bool lower) {
  if (!(K.size() - i)) return r == 0;
  if (visited[i][r][lower]) return dp[i][r][lower];

  int n = K[i] - '0';
  mint ans = 0;
  rep(j, (lower ? 9 : n) + 1) {
    ans += dfs(i+1, (r+j) % D, lower || (j < n));
  }
  visited[i][r][lower] = true;
  return dp[i][r][lower] = ans;
}

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

  cout << dfs(0, 0, false)-1 << endl;

  return 0;
}


Measured memory_bytes: 18816
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, a, x5, x4, x2, x1, cnt;
  cin >> A >> B;
  cnt = 0;
  for (int i = A; i <= B; i++) {
    x5 = i / 10000;
    x4 = i / 1000 % 10;
    x2 = i / 10 % 10;
    x1 = i % 10;
    if ( x5 == x1 && x4 == x2)
      cnt++;
  }
  cout << cnt << endl;
}
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
using ll = long long  ;
const int MAX_A = 1000005 ; 

int main(){
  int N ; 
  cin >> N ; 
  vector<int> A(N) ; 
  vector<int> C(MAX_A) ; 
  
  bool pairwaise = 1 ; 
  for(int i = 0 ; i < N ; i++){
    cin >> A.at(i) ; 
    C.at(A.at(i))++ ; 
  }
  
  for(int i = 2 ; i < MAX_A ; i++){
    int cnt = 0 ; 
    for(int j = i ; j < MAX_A ; j += i ){
      cnt += C.at(j) ; 
    }
    if( cnt > 1) pairwaise = 0 ; 
  }
  
  if(pairwaise){
    cout << "pairwise coprime" << endl ; 
    return 0 ; 
  }
  
  int g = 0  ;
  
  for(int i = 0 ; i < N ; i++) g = gcd(g,A.at(i)) ; 
  
  if(g == 1) cout << "setwise coprime" << endl ; 
  else cout << "not coprime" << endl ; 
  
  return 0 ; 
  
  
}

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


int main() {
	string target = "keyence";

	string S;
	cin >> S;

	for(int l=0;l<S.size();l++) {
		for(int r=l;r<S.size();r++) {
			string sub;
			if(1 <= l) {
				sub += S.substr(0, l);
			}
			if(r < S.size()) {
				sub += S.substr(r);
			}
			if(sub == target) {
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;

	return 0;
}


Measured memory_bytes: 256
//“Make it work, make it right, make it fast.” – Kent Beck
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const int siz = 1e6 + 5;
const int MOD = 1e9 + 7;
#define endl '\n'
#define deb(x) cout << #x << " = " << x << endl;
void solve(){
	ll a, b, n;
	cin >> n >> a >> b;
	if(a == 0)
		cout << 0;
	else{
    	ll ans = a*(n/(a+b));
    	if(n%(a+b) <= a)
    		ans += (n%(a+b));
 
    	else
    		ans += a;
	    cout<< ans;
	}
}

int main(){
	#ifndef RAY
		//freopen("input.txt", "r", stdin);
	#endif
		ios::sync_with_stdio(false);
		cin.tie(nullptr);
		int t = 1;
		//cin >> t;
		while(t--){
			solve();
		}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
vector<ll> memo(100,-1);
ll L(int n) {
    if(memo[n]!=-1) return memo[n];
    return (memo[n] = (L(n-1) + L(n-2)));
}
int main() {
    int n; cin >> n;
    memo[0] = 2; memo[1] = 1;
    cout << L(n);
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<ll> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = MOD + 2; //1007681537;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
int modulo(int a, int b) { return (a % b + b) % b; }
#define db(x) cerr << #x << " = " << (x) << " ";
#define endln cerr << "\n";
/*
class Compare
{
  public:
    bool operator()(pi a,pi b)
    {
      if(a.first<b.first || (a.first==b.first && a.second>b.second))
        return true;
      return false;
    }
};
*/
int main() 
{
  ll a,b,h,m;
  cin>>a>>b>>h>>m;
  long double ta=((2*PI)/(12.0*60.0))*(60*h+m);
  long double tb=((2*PI)/60.0)*(60*h+m);
  ld dif=abs(ta-tb);
  ld ans=sqrt(b*b+a*a-2*a*b*cos(dif));
  cout<<fixed<<setprecision(20)<<ans<<endl;
  //printf("%0.020Lf\n",ans);
  return 0;
}






























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

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

    int a = S[0] - '0';
    for (int i = 0; i < (1 << (N - 1)); i++) {
        int sum = 0;
        char op[N-1] = {'+', '+', '+'};
        sum += a;
        for (int j = 0; j < N - 1; j++) {
            if (i & (1 << j)) {
                sum -= S[j+1] - '0';
                op[j] = '-';
            }
            else {
                sum += S[j+1] - '0';
            }
        }
        if (sum == 7) {
            cout << S[0] << op[0] << S[1] << op[1] << S[2] << op[2] << S[3] << "=7" << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>

signed main()
{
int x=0,y=0,z=0,w=0,n=0,m=0;
string s;
std::cin >> s;
std::vector<char> v;
rep(i,s.size()){
  if(s[i]!='B'){
    v.pb(s[i]);
  }else{
    if(v.size()>0){
      v.pop_back();
    }
  }
}
rep(i,v.size()){
  std::cout << v[i] ;
}
std::cout << '\n';
}


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

using namespace std;

int main() {
    int n;

    cin >> n;

    int a, min_a, max_a;
    long sum_a = 0;
    for (int i = 0; i < n; i++){
        // input
        cin >> a;

        // process
        if (i == 0 || min_a > a){
            min_a = a;
        }
        if (i == 0 || max_a < a){
            max_a = a;
        }
        sum_a += a;
    }

    // output
    printf("%d %d %ld\n", min_a, max_a, sum_a);

    return 0;
}



Measured memory_bytes: 3208
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n=n0()
s=s3(n)
[s[i].append(i+1) for i in range(n)]

s.sort(key=lambda x:(x[0],-1*int(x[1])))

[print(x[2]) for x in s]

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    map<int, int> m;
    ll ans = 0;
    rep(i,n){
        ans += m[i-a[i]];
        m[a[i]+i]++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 21080
#include <bits/stdc++.h>
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
lli gcd(lli num1, lli num2){
    return num2 != 0 ? gcd(num2, num1 % num2) : num1;
}
lli lcm(lli num1, lli num2){
    return num1 / gcd(num1, num2) * num2;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,H,W,M,K,L,R,N,num=0,sum=0,flag=0;string S,T;
  cin >> N;
  //cin >> K;
  map<string,int> mp;
    rep(i,0,N){
      cin >> S;
      mp[S]++;
    }
  Out(mp.size());
}

Measured memory_bytes: 19244
#include <bits/stdc++.h>
using namespace std;
vector<int> edge[100000];
int dis_u[100000] = {}, dis_v[100000] = {};

void dfs_u(int n, int p, int dis) {
  dis_u[n] = dis;
  for (auto &e: edge[n]) {
    if (e == p)
      continue;
    dfs_u(e, n, dis+1);
  }
  return ;
}

void dfs_v(int n, int p, int dis) {
  dis_v[n] = dis;
  for (auto &e: edge[n]) {
    if (e == p)
      continue;
    dfs_v(e, n, dis+1);
  }
  return ;
}

int main() {
  int N, u, v;
  cin >> N  >> u >> v;
  u--;
  v--;
  int A, B;
  for (int i=0; i<N-1; i++) {
    cin >> A >> B;
    A--;
    B--;
    edge[A].push_back(B);
    edge[B].push_back(A);
  }
  dfs_u(u, -1, 0);
  dfs_v(v, -1, 0);
  int ans = 0;
  for (int i=0; i<N; i++) {
    if (dis_u[i]<dis_v[i]) {
      ans = max(ans, dis_v[i]-1);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
const int MAX = 2e5 ;
const int INF = 1e9 + 1e5 + 2;
const int mod= 1e9+7;
#define eps 1e-15
#define F first
#define S second
typedef long long ll;
int main()
{
    int n;
    cin>>n;

    ll ans=0;

    for (int i=1; i<=n; ++i)
    {
        if (i%5==0 && i%3==0)
            continue;
        else if (i%3==0 || i%5==0)
            continue;
        else
        {
            ans+=i;
        }
        
        
    }
    cout<<ans;





    
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int i,j,k,n,a,b,c;
	while(cin>>n&&n) {
		for(i=0;i<n;i++) {
			cin>>a>>b>>c;
			if(a==100||b==100||c==100) cout<<"A"<<endl;
			else if((a+b)/2>=90) cout<<"A"<<endl;
			else if((a+b+c)/3>=80) cout<<"A"<<endl;
			else if((a+b+c)/3>=70) cout<<"B"<<endl;
			else if((a+b+c)/3>=50&&a>=80||b>=80) cout<<"B"<<endl;
			else cout<<"C"<<endl;
		}
	}
}
	

Measured memory_bytes: 3068
import Data.List

count _ is [] = is
count p (i:is) (x:xs)
  | p == x = count x (i+1:is) xs
  | otherwise = count x (1:i:is) xs

main = do
  n <- readLn
  xs <- sort . map (map read . words) . lines <$> getContents
  let ds = [zipWith (-) (xs !! i) (xs !! j) | i <- [0..n-1], j <- [0..n-1], i > j]
  print . (n -) . maximum $ count [] [0] (sort ds)


Measured memory_bytes: 1148
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>
typedef long long ll;
using namespace std;

int main() {
	int K,S; cin >> K >> S;
	int x,y,z;
	int ans = 0;
	
	for (int x = 0; x <= K; ++x) {
		for (int y = 0; y <= K; ++y) {
			int z = S - x - y;
			if (0 <= z && z <= K) ++ans;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
from collections import defaultdict as dd
n,m=[int(i) for i in input().split()]
brkn = dd(int)
mod = 10**9+7
for i in range(m):
    num = int(input())
    brkn[num]+=1
dp = [0]*(n+1)
dp[0]=1
if(1 in brkn):
    dp[1]=0
else:
    dp[1]=1
for i in range(2,n+1):
    if(i in brkn):
        dp[i]=0
    else:
        dp[i] = (dp[i-1]+ dp[i-2])%mod
print(dp[n])
        


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

signed main()
{
    int n;
    cin >> n;
    int a[n];

    for(int i = 0; i< n;i++)
        a[i] = 0;
    for(int i = 0;i < n - 1;i++){
        int b;
        cin >> b;
        a[b - 1]++;
    }

    for(int i = 0;i < n;i++)
        cout << a[i] << endl;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

ll N, A, B;

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

    std::cin >> N >> A >> B;

    if(A + B - 1 <= N && N <= A * B){
        std::vector<int> perm;
        
        int cur = 1;
        while(A > 0){
            int n = std::max<ll>(N - B * (A - 1), 1);
            
            for(int i=cur+n-1;i>=cur;--i){
                perm.emplace_back(i);
            }

            cur += n;
            N -= n;
            A -= 1;
        }

        for(int i=0;i<perm.size();++i){
            std::cout << perm[i] << " \n"[i + 1 == perm.size()];
        }
    }else{
        std::cout << -1 << std::endl;
    }
}


Measured memory_bytes: 3440
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>
#include <vector>
#include <queue>

typedef long long ll;

#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
#define fi first
#define se second
const ll mod = 1000000007;
//              123456789

using namespace std;
 

///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

int N;
int a;
int b;

vector<int>p[112345];
queue<int>q;
queue<int>next;

int flag[112345];
int x[112345];
int cnt = 0;
int idx;

int s;
int f;

int main(){
	
	cin>>N;
	fill( flag, flag+N+1, 0 );
	fill( x, x+N+1, 0 );
	
	REP( i, N-1 ){
		scanf("%d %d", &a, &b);
		p[a].push_back(b);
		p[b].push_back(a);
	}
	
	q.push(1);
	flag[1] = 1;
	
	while( !q.empty() ){
		idx = q.front();
		q.pop();
		REP( i, p[idx].size() ){
			if( !flag[p[idx][i]] ){
				q.push(p[idx][i]);
				flag[p[idx][i]] = flag[idx] + 1;
			}
		}
	}
	
	//puts("---1");
	
	cnt = flag[N];
	cnt++;
	cnt/=2;
	
	FOR( i, 1, N+1 ) if( flag[i] <= cnt ) x[i] = 1;
	
	q.push(N);
	x[N] = 2;
	
	while( !q.empty() ){
		idx = q.front();
		q.pop();
		REP( i, p[idx].size() ){
			if( !x[p[idx][i]] ){
				q.push( p[idx][i] );
				x[p[idx][i]] = 2;
			}
		}
	}
	
	//puts("---2");
	
	fill( flag, flag+N+1, 0 );
	
	q.push(1);
	x[1] = 1;
	while( !q.empty() ){
		idx = q.front();
		q.pop();
		REP( i, p[idx].size() ){
			if( x[p[idx][i]] < 2 && !flag[p[idx][i]] ){
				q.push( p[idx][i] );
				flag[p[idx][i]] = 1;
				x[p[idx][i]] = 1;
			}
		}
	}
	
	f = 0;
	s = 0;
	
	//puts("---3");
	
	FOR( i, 1, N+1 ){
		if( x[i] == 1 ) f++;
		if( x[i] == 2 ) s++;
	}
	
	if( s < f ) puts("Fennec");
	else{	  puts("Snuke");}
	
	return 0;

}

Measured memory_bytes: 6912
use std::cmp::max;
use proconio::input;

fn main() {

    input!{
        N:usize,
        _T:usize,
        A:[isize;N]
    }

    let mut R = vec![A[N-1];N];
    let mut D = vec![0;N];
    for i in (0..N-1).rev(){
        R[i] = max(R[i+1],A[i]);
        D[i] = R[i]-A[i];
    }
    let m = *(D.iter().max().unwrap());
    let ans = D.iter().filter(|&&d| d==m).count();
    println!("{}",ans);

}


Measured memory_bytes: 5264
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;

typedef long long ll;

int main()
{
    int N;
    cin >> N;
    vector<int> t(N),x(N),y(N);
    for(int i=0; i<N; i++){
        cin >> t[i] >> x[i] >> y[i];
    }
    int now_x=0,now_y=0,now_time=0;
    bool flag=true;
    for(int i=0; i<N; i++){
        if(abs(x[i]-now_x)+abs(y[i]-now_y)>t[i]-now_time || (t[i]-now_time-abs(x[i]-now_x)-abs(y[i]-now_y))%2!=0){
            flag=false;
            now_x=x[i];
            now_y=y[i];
            now_time=t[i];
        }
    }

    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 1408