akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

map<ll, int> factorize(ll N) {
    map<ll, int> fac;
    while (N % 2 == 0) {
        fac[2] += 1;
        N /= 2;
    }
    ll N2 = N;
    for(ll i = 3; i*i <= N; i+= 2) {
        while (N2 % i == 0) {
            fac[i] += 1;
            N2 /= i;
        }
        if (N2 == 1)
            break;
    }
    if (N2 > 1)
        fac[N2] += 1;
    return fac;
}
void get_fac(vector<ll>& prime, vector<int>& freq, int depth, ll cur, ll N, ll& ans) {
    if (depth == prime.size()) {
        // cout << "fac: " << cur << endl;
        if (cur > 1 && N %(cur-1) != 0) {
            ll div = cur-1;
            if (N / div == N % div)
                ans += div;
        }
        return;
    }
    for(int i = 0; i <= freq[depth]; i++) {
        get_fac(prime, freq, depth+1, cur, N, ans);
        cur *= prime[depth];
    }
}
int main() {
    ll N, ans = 0;
    cin >> N;
    // a * r + a = N
    // a * (r+1) = N
    // 2 * 3 + 2 = 8 => 2 (3+1)
    // 1 * 7 + 1 = 8 => 1 (7+1)
    // satisfy N % r != 0
    auto primes = factorize(N);
    vector<ll> prime;
    vector<int> freq;
    for(auto& p: primes) {
        // cout << "p = " << p.first << ", " << p.second << endl;
        prime.push_back(p.first);
        freq.push_back(p.second);
    }
    get_fac(prime, freq, 0, 1, N,  ans);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
R_list = []

for i in range(n):
    Ri = int(input())
    R_list.append(Ri)

maxv = (-1)*10**9
minv = R_list[0]

for j in range(1, n):
    maxv = max(maxv, R_list[j] - minv)
    minv = min(minv, R_list[j])
    
print(maxv)


Measured memory_bytes: 13588
n=int(input())
l=[int(i) for i in input().split()]
cnt=[0]*9
ans=0
for i in l:
    if i>3199:
        i=3200
    cnt[i//400]+=1
for p in range(8):
    i=cnt[p]
    if i!=0:
        ans+=1
print(ans if ans!=0 else 1,ans+cnt[-1])

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

#define int long long
#define INT int
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}
typedef long long ll;
const long long INF = 1LL << 60;

signed main()
{
    vector<int> x(5);
    rep(i, 5)
    {
        cin >> x[i];
    }

    rep(i, 5)
    {
        if (x[i] == 0)
        {
            cout << i + 1 << endl;
        }
    }

    return 0;
}


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

long long N;
long long H[100005];

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

	long long ans = 0;
	long long count = 0;

	for(long long i = 1; i < N; i++){
		if(H[i-1] >= H[i]){
			count++;
			ans = max(ans, count);
		}else{
			count = 0;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
import collections
import math
import itertools
import sys
sys.setrecursionlimit(10**6)
def f(x):
  return (a*x)//b - a*(x//b)
ma = lambda :map(int,input().split())
ni = lambda:int(input())
a,b,n = ma()
if n>=b-1:
    print(f(b-1))
else:
    print(f(n))


Measured memory_bytes: 9464
#include<iostream>
#include<stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
using namespace std;

int main() {
	int N,M,X,Y;
	cin >> N >> M >> X >> Y;
	int xMax = INT_MIN;
	int yMin = INT_MAX;
	for (int i = 0; i < 2;++i) {
		for (int j = 0; j < N; ++j) {
			if (i == 0) {
				int x;
				cin >> x;
				xMax = max(xMax,x);
			}
			else {
				int y;
				cin >> y;
				yMin = min(yMin,y);
			}
		}
	}
	string ans= "War";
	if (xMax < yMin) {
		for (int i = xMax + 1; i <= yMin; ++i) {
			if (X < i&&i <= Y)ans = "No War";
		}
	} 
	cout << ans << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define faster_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
#define bug(a)       cerr << #a << " : " << a << endl;
template<class T>void ExEuclid(T n, T m, T &a, T &b, T &gcd){if(m==0){gcd=n;a=1;b=0;return;}ExEuclid(m,n%m,a,b,gcd);T x=a;a=b;b=x-(n/m)*a;}
template<class T>T gcd(T n, T m){if(m==0){return n;}gcd(m,n%m);}
template<class T>T lcm(T n, T m){return (n*m)/gcd(n,m);}
template<class T>string to_string(T n){string s="";while(n)s+=((n%10)+'0'),n/=10;reverse(s.begin(),s.end());return s;}
template<class T>ll to_int(T s){ll num=0,power=0;for(int i=s.size()-1; i>=0; i--)num+=(pow(10.0,power++)*(s[i]-'0'));return num;}
template<class T>bool is_mod(T n, T m){if(n%m==0)return true;return false;}
template<class T>bool is_upper(T s){for(int i=0; i<s.size(); i++)if(s[i]>90 || s[i]<65)return false;return true;}
template<class T>bool is_lower(T s){for(int i=0; i<s.size(); i++)if(s[i]>122 || s[i]<97)return false;return true;}
template<class T>T mod(T n, T m){return ((n%m)+m)%m;}
template<class T>T Big_mod(T base, T power, T MOD){
    if(power==1)return base;
    if(power & 1)return ((base%MOD)*(Big_mod(base,power-1,MOD))%MOD)%MOD;
    else {T temp=(Big_mod(base,power>>1,MOD));return ((temp%MOD)*(temp%MOD))%MOD;}
}



int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    faster_io;
    ll n,mx=1000000000,cnt=0;
    cin>>n;
    ll x,ans=0;
    for(int i=0; i<n; i++){
        cin>>x;
        if(x<0)cnt++;
        mx=min(mx,abs(x));
        ans+=abs(x);
    }
    if(cnt & 1)ans-=(2*mx);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
//#define MOD 1000000007
#define MOD 1000000007
#define INF (1e9)

#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; }
typedef pair <ll,ll> P;

int main()
{
    ll N;
    cin >> N;
    map<ll, ll> m;
    rep(i, N) {
        ll a;
        cin >> a;
        m[a-1]++;
        m[a]++;
        m[a+1]++;
    }
    ll ma = 0;
    for(P p : m) {
        ma = max(ma, p.second);
    }
    print(ma);
    return 0;
}

Measured memory_bytes: 6144
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	int a, b;
	cin >> a >> b;
	if (a >= 13) cout << b << endl;
	else if (a >= 6) cout << b / 2 << endl;
	else cout << 0 << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;


/*
dp[i]=最後の高さがhである最大価値
*/

ll n,a[200010],h[200010],ans=0;
vector<mp> dp;

//再帰タイプ
//RmQ
template<typename T_n>
struct segment_tree{
	typedef struct node_{
		T_n value;
		int left,right; //[left,right)
		struct node_ *left_child,*right_child;
	}* node;
	node parent_node = new node_;
	T_n default_value;//範囲外の場合の評価値
	T_n eval(T_n a, T_n b){//segment_treeの評価関数
		return max(a,b);
	}
	T_n back_propagation(T_n before, T_n after){//伝播する値を計算
		return max(before,after);
	}
	segment_tree(int left,int right,T_n _default){//どんな範囲でも作れる
		default_value = _default;
		make_segtree_(parent_node,left,right);
	};
	void make_segtree_(node p,int left,int right){
		p->left=left;
		p->right=right;
		p->value=default_value;
		if(left+1!=right){
			node q=new node_, r=new node_;
			p->left_child=q;
			p->right_child=r;
			make_segtree_(q,left,(left+right)/2);
			make_segtree_(r,(left+right)/2,right);
		}else{//要素数が1個
			p->left_child=NULL;
			p->right_child=NULL;
		}
	}
	T_n query(int left,int right){
		return query_(parent_node,left,right);
	}
	T_n query_(node p,int left,int right){
		if(p->right<=left || right<=p->left)return default_value;
		if(left<=p->left && p->right<=right)return p->value;
		return eval( query_(p->left_child,left,right), query_(p->right_child,left,right) );
	}
	void change(int pos,T_n value){
		change_(parent_node,pos,value);
	}
	T_n change_(node p,int pos,T_n value){
		if(p->left<=pos && pos<p->right){//入っているなら関係するノード全て更新
			if(p->left==pos && pos+1==p->right){//justなら
				p->value = value;
			}else{
				p->value = eval(change_(p->left_child,pos,value), change_(p->right_child,pos,value));
			}
		}
		return p->value;//差分が上に伝播する
	}
};

int main(void){
	cin>>n;
	rep(i,n)cin>>h[i];
	rep(i,n)cin>>a[i];
	//
	segment_tree<ll> f(1,n+1,0);
	//
	rep(i,n){
		ll next = f.query(1,h[i])+a[i];
		f.change(h[i],next);
		ans=max(ans,next);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 22144
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Sugoroku
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while (!(line = br.readLine()).equals("0 0")) {
			short n = Short.parseShort(line.substring(0, line.indexOf(' ')));
			short m = Short.parseShort(line.substring(line.indexOf(' ') + 1));
			short[] s = new short[n];
			for (int i = 0; i < n; i++) {
				s[i] = Short.parseShort(br.readLine());
			}
			//
			int t = 0, c = 0;
			for (int i = 0; i < m; i++) {
				if (t < n) {
					t += Short.parseShort(br.readLine());
					if (t < n) {
						t += s[t];
					}
					c = i;
				} else {
					br.readLine();
				}
			}
			System.out.println(c + 1);
		}
	}
}

Measured memory_bytes: 21556
#include<iostream>
#include<sstream>
#include<ios>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<string>
#include<numeric>
#include<set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using vi = vector<int>;
using vl = vector<long>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
using vpii = vector<pii>;
using vpll = vector<pll>;

long euclid(long m, long n){
  long m1, n1, tmp;
  m1 = m;
  n1 = n;

  while(n1 != 0){
    tmp = n1;
    n1 = m1 % n1;
    m1 = tmp;
  }

  return m1;
}

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

  cout << A * B / euclid(A, B) << endl;
  
  return 0;
}

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

using ll=long long;

int main() {
  int X; cin >>X;
  int ans=0;
  if (X<600) {ans=8;}
  else if (X<800) {ans=7;}
  else if (X<1000) {ans=6;}
  else if (X<1200) {ans=5;}
  else if (X<1400) {ans=4;}
  else if (X<1600) {ans=3;}
  else if (X<1800) {ans=2;}
  else {ans=1;}
  cout <<ans <<endl;
  return 0;
}


Measured memory_bytes: 3612
/**************
*	Shell Sort
*************/

#include <iostream>
#include <vector>	//??£?¨?
#include <algorithm>
using namespace std;
typedef vector<int> TList;

void insertionSort(TList* A, int g, int* cnt  ){

	for(unsigned int i=g ; i<(A->size()); i++){
		int v = (*A)[i];
		int j = i-g;
		while(j>=0 && (*A)[j]>v){
			(*A)[j+g] = (*A)[j];
			j = j-g;
			(*cnt)++;
		}
		(*A)[j+g] =v;
	}
	return ;
}
//---------------------------------------------------------
void shellSort(TList* A, TList* G, int* cnt){

	for(unsigned int i=0; i<(G->size()); i++){
		insertionSort(A, (*G)[i], cnt);
	}

	return;
}
//--<<???????????¢??°>>-------------------------------------------------------
int main(){

	//??????????¨????
	cin.tie(0);
	ios::sync_with_stdio(false);
	//??\???
	int n;
	cin >> n;
	vector<int> A;
	A.resize(n);
	for(unsigned int i=0; i< A.size(); i++){
		cin >> A[i];
	}
	
	//??????
	TList G;
//	G.reserve(100);//????????????????´???°???????????£??????????????¨????????????
	int sum = 1;
	while(sum <= n){
	    G.push_back(sum);
		sum = sum * 3 + 1;
	}
	reverse(G.begin(), G.end());

	int cnt = 0;
	shellSort(&A, &G, &cnt);

	//??????
	cout << G.size() << endl;
	for(unsigned int i=0; i<(G.size()); i++){
		cout << G[i];
		if(i!=(G.size()-1)){
			 cout <<" " ;
		}
	}
	cout << endl;
	cout << cnt << endl;
	for(int i=0; i< n; i++){
		cout << A[i]<< endl;
	}

	return 0;
}
//-----------------------------------------------

Measured memory_bytes: 6640
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s = input()
    if s[1] == "B":
        print("ARC")
    else:
        print("ABC")
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 65468
import java.util.*;

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

	int n = sc.nextInt();
	int count = 0;

	while(n!=0){
	    count++;
	    int[] x = new int[n];
	    int[] y = new int[n];
	    for(int i=0; i<n; i++){
		x[i] = sc.nextInt();
		y[i] = sc.nextInt();
	    }

	    double[] pro = new double[n];
	    for(int i=0; i<n-1; i++){
		pro[i] = (x[i]-x[i+1])*(y[i]+y[i+1]);
	    }
	    pro[n-1] = (x[n-1]-x[0])*(y[n-1]+y[0]);
	    double ans = 0;
	    for(int i=0; i<n; i++){
		ans += pro[i];
	    }

	    System.out.println(count+" "+(-ans/2.0));

	    n = sc.nextInt();
	}
    }
}

Measured memory_bytes: 12000
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		Integer[] a = new Integer[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		int alice = 0, bob = 0;

		Arrays.sort(a, Collections.reverseOrder());

		for (int i = 0; i < n; i++) {
			alice += a[i];
			i++;
			if (i == n) {
				break;
			}
			bob += a[i];
		}

		System.out.println(alice - bob);
	}
}

Measured memory_bytes: 21972
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();

        if(n==0) {
            System.out.print(x);
            return;
        }
        HashSet<Integer> set = new HashSet<>();

        for(int i=0; i<n; i++) {
            int num = sc.nextInt();
            set.add(num);
        }

        int abs = 101;
        int z = x;
        for(int i=0; i<=101; i++) {
            if(!set.contains(i)) {
                if (Math.abs(x-i) < abs) {
                    abs = Math.abs(x-i);
                    z = i;
                }
            }
        }
        System.out.print(z);
        return;
    }
}

Measured memory_bytes: 35948
#include<cstdio>
#include<cctype>
int n,m,q,sump[2010][2010],sume[2010][2010],sume1[2010][2010],sume2[2010][2010];
char s[2010][2010];
char buffer[1000010],*head,*tail;
char Getchar(){
	return getchar();
    if(head==tail){
        int len=fread(buffer,1,1000000,stdin);
        head=buffer,tail=head+len;
    }
    return *head++;
}
int rd(){
	int x=0;
	char c;
	do c=Getchar();
	while(!isdigit(c));
	do{
		x=(x<<1)+(x<<3)+(c^48);
		c=Getchar();
	}while(isdigit(c));
	return x;
}
void scan(char *str){
	char c;
	do c=Getchar();
	while(!isdigit(c));
	do{
		*(str++)=c;
		c=Getchar();
	}while(isdigit(c));
	*str=0;
	return;
}
int Sump(int x1,int y1,int x2,int y2){
	return sump[x2][y2]-sump[x1-1][y2]-sump[x2][y1-1]+sump[x1-1][y1-1];
}
int Sume(int x1,int y1,int x2,int y2){
	return sume[x2][y2]-sume[x1-1][y2]-sume[x2][y1-1]+sume[x1-1][y1-1]-sume1[x2][y1]+sume1[x1-1][y1]-sume2[x1][y2]+sume2[x1][y1-1];
}
int main(){
	n=rd(),m=rd(),q=rd();
	for(int i=1;i<=n;i++)
		scan(s[i]+1);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++){
			sump[i][j]=sump[i-1][j]+sump[i][j-1]-sump[i-1][j-1]+(s[i][j]=='1');
			sume[i][j]=sume[i-1][j]+sume[i][j-1]-sume[i-1][j-1]+(s[i][j]==s[i-1][j]&&s[i][j]=='1')+(s[i][j]==s[i][j-1]&&s[i][j]=='1');
			sume1[i][j]=sume1[i-1][j]+(s[i][j]==s[i][j-1]&&s[i][j]=='1');
			sume2[i][j]=sume2[i][j-1]+(s[i][j]==s[i-1][j]&&s[i][j]=='1');
		}
	while(q--){
		int x1=rd(),y1=rd(),x2=rd(),y2=rd();
		printf("%d\n",Sump(x1,y1,x2,y2)-Sume(x1,y1,x2,y2));
	}
	return 0;
}

Measured memory_bytes: 68736
import math
import itertools
import numpy as np

def div(n):
    c = 0
    for i in range(1,n+1):
        if n % i == 0:
            c += 1
    return c

def solve():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        if div(i) == 8 and i % 2 == 1:
            ans += 1
    print(ans)
    return 0

if __name__ == "__main__":
    solve()


Measured memory_bytes: 13072
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sum = -n;
        for(int i=0; i<n; i++){
            sum += sc.nextInt();
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 27632
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ff first
#define ss second
int main(void){
    // Your code here!
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);
 int i,k,n;
 cin >> n >> k;
 int a[n];
 for(i=0;i<n;i++)
 cin >> a[i];
 vector<int> b(n,1);
 map<int,set<int>,greater<int>> m;
 for(i=0;i<n;i++)
 {
  for(auto it:m)
  {
   auto itr=m[it.ff].lower_bound(a[i]-k);
   if(itr!=m[it.ff].end() && (*itr)<=(a[i]+k))
   {
    b[i]=it.ff+1;
    break;
   }
  }
  m[b[i]].insert(a[i]);
  //cout << b[i] << " ";
 }
 cout << *max_element(b.begin(),b.end());
 return 0;
}

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

int main() {
  int N;
  int A;
  cin >> N >> A;
  
  string ans = "Odd";
  if (N % 2 == 0 || A % 2 == 0) {
    ans = "Even";
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 200005;

int n, a[MAXN];

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read();
	for (int i = 0; i < n << 1; i ++)
		a[i] = Read();
	sort(a, a + (n << 1));
	LL ans = 0;
	for (int i = 0; i < n << 1; i ++)
		ans += 1LL * a[i] * i;
	return printf("%.9lf\n", (double)ans / ((n << 1) - 1)), 0;
}

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

//Made with <3 by MinumCoklatPanas
typedef long long ll;
const int INF = 1e9;
const ll INFF = 1e18;
const int MAXN = 510;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double INFD = 1E9;
const double EPS = 1e-9;

bool cek(ll k, ll n)
{
    if (k == 1) return 0;
    while (n % k == 0)
        n /= k;
    return (n % k == 1);
}

bool cek2(ll k,ll n)
{
    // cout << k << " " << n << endl;
    if (n == 1) return 1;
    if (n % k == 0)
        return cek2(k,n / k);
    else
    if (n > k)
        return cek2(k,n - k);
    else
        return false;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    // for (ll i = 2 ; i <= n ; i++)
    // {
    //     if (cek2(i,n) && (n % i == 0))
    //         cout << i << endl;
    // }
    ll ans = 0;
    // cout << cek(3,n) << endl;
    for (ll i = 1 ; i * i < n ; i++) if ((n - 1) % i == 0)
    {
        if (i > 1)
            ans++;
        if (i * i != n - 1)
            ans++;
    }
    // cout << ans << endl;
    for (ll i = 1 ; i * i <= n ; i++) if (n % i == 0)
    {
        ans += cek(i,n);
        if (i * i != n)
            ans += cek(n / i,n);
    }
    // cout << ans << endl;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3568
#include <iostream>
#include <complex>
#include <cmath>
using namespace std;

// ?????§?¨?????????¨??????
typedef complex<double> P;
// ???????????
#define PI 3.1415926535898

// ?¨±?????????????????
#define EPS (1e-10)
//XY??§?¨?
#define X real()
#define Y imag()

//?????????double????????°???????????????????????????
bool equal(double a, double b){
	return ( abs( a-b ) < EPS )? true : false ;
}
	
// ????§???¢?????????
class Triangle{

private:
	//????§???¢??????????????§?¨?
	P a, b, c;
	//????§???¢??????????????????
	double edgeA,edgeB,edgeC;
	//????§???¢???????§??????§??????(????????¢???)
	double angleA,angleB,angleC;
	//????????????????????????????§????????±?????????¢??°
	double LawOfCosines(double a,double b, double c){
		return acos( (b*b+c*c-a*a) / (2.0*b*c) );
	}
	
public:
	//?????????????????????(??????????????¨?????¨?§????????????????)
	Triangle(P p1, P p2, P p3){
		a = p1;
		b = p2;
		c = p3;
		edgeB = abs(c-a);
		edgeA = abs(b-c);
		edgeC = abs(a-b);
		angleA = LawOfCosines(edgeA,edgeB,edgeC);
		angleB = LawOfCosines(edgeB,edgeC,edgeA);
		angleC = LawOfCosines(edgeC,edgeA,edgeB);
	}
	double getAngleC(){//?§?C????§????????????????
		return angleC;
	}
};

int main(){
	double x1, x2, x3, y1, y2, y3, xp, yp, angle;

	while( cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp ){
		P a( x1 , y1 );
		P b( x2 , y2 );
		P c( x3 , y3 );
		P p( xp , yp );
		Triangle Tr1(a,b,p);
		Triangle Tr2(b,c,p);
		Triangle Tr3(c,a,p);
		angle = Tr1.getAngleC() + Tr2.getAngleC() + Tr3.getAngleC();
		( equal( 2.0*PI , angle) )? cout << "YES" : cout << "NO" ;
		cout << endl;
	}
}

Measured memory_bytes: 1284
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val d = sc.nextLong()
  val t = sc.nextLong()
  val s = sc.nextLong()

  if (d <= t * s) {
    println("Yes")
    return
  }
  println("No")

}


Measured memory_bytes: 36380
from collections import deque
N, M, X = map(int, input().split())
B = [list(map(int, input().split())) for _ in range(N)]
ans = 10**20
q = deque()
q.append([])
while q:
  x = q.pop()
  if len(x) == N:
    U = [0]*M
    i = 0
    while i < N:
      if x[i]:
        j = 0
        while j < M:
          U[j] += B[i][j+1]
          j += 1
      i += 1
    if len(list(filter(lambda x:x< X, U))) < 1:
      ans = min(ans, sum([B[i][0] if x[i] else 0 for i in range(N)]))
  else:
    q.append(x+[True])
    q.append(x+[False])
print(ans if ans < 10**20 else -1)


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

long long N, T;
int main(){
    cin >> N >> T;
    
    vector<long long> t(N);
    for (int i = 0; i < N; i++) cin >> t[i];
    
    long long time = 0;
    
    for (int i = 1; i < N; i++){
        time += min(T, t[i]-t[i-1]);
    }
    time += T;
    cout << time << endl;
}

Measured memory_bytes: 1792
package main

import "fmt"

func main() {
	var x int
	fmt.Scan(&x)

	max := 1
	for b := 2; b <= x; b++ {
		for p := 2; ; p++ {
			t := pow(b, p)
			if t > x {
				break
			}
			if t > max {
				max = t
			}
		}
	}
	fmt.Println(max)
}

func pow(x, y int) int {
	if y == 0 {
		return 1
	}
	return x * pow(x, y-1)
}

Measured memory_bytes: 512
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        r: i32
    }
    println!("{}", 2.0*3.141592653589*(r as f64));

}

Measured memory_bytes: 2148
#include<iostream>
#include<cstdio>
using namespace std;
int ans,n;
int a[100105],x;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	if (a[1]==1) ans++,swap(a[1],a[2]);
	for (int i=2;i<=n;i++)
	{
		if (a[i]==i) 
		{
			ans++;
			swap(a[i],a[i+1]);
		}
	}
	printf("%d",ans);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  int X, Y, Z;
  cin >> X >> Y >> Z;
  cout << Z<<' ' << X << ' '<< Y << endl;
}

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

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];

		for(int i=0; i<n; i++){
			arr[i] = sc.nextInt();
		}
		
		int min = arr[0];
		int max = arr[0];

		for(int i=1; i<n; i++){
			if(arr[i] < min)
				min = arr[i];
			if(arr[i] > max)
				max = arr[i];
		}

		System.out.println(max-min);
	}
}


Measured memory_bytes: 25044
object Main extends App {
  val in = new java.util.Scanner(System.in)
  val N = in.nextInt
  val counts = Array.ofDim[Int](10, 10)

  (1 to N).map { i =>
    val s = i.toString
    counts(s.head - '0')(s.last - '0') += 1
  }

  println((for {
    i <- 1 to 9
    j <- 1 to 9
  } yield counts(i)(j) * counts(j)(i)).sum)
}

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

int main()
{
    int a[3];
    for(int i = 0; i < 3; i++) cin >> a[i];
    int count_5 = 0;
    int count_7 = 0;
    for(int i = 0; i < 3; i++)
    {
        if(a[i] == 5) count_5++;
        else if(a[i] == 7) count_7++;
    }
    if(count_5 == 2 && count_7 == 1) cout << "YES";
    else cout << "NO";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define vi vector<ll>
#define vb vector<bool>
#define pii pair<ll,ll>
#define mod 1000000007
#define pll pair<ll,ll>
#define rep(i,n) for(ll i=0;i<n;i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define per1(i,n) for(ll i=n;i>0;i--)
#define prll(a,n) for(ll i=0;i<n;i++){ cout<<a[i]<<" "; }
#define ain(a) for(auto &i:a) cin>>i
#define mms(a) memset(a,0,sizeof(a))
// cout << fixed << setprecision(0) << pi <<" "<<npi<<endl; 


ll max_ll(ll a,ll b,ll c){
	return max(a,max(b,c));
}

ll min_ll(ll a,ll b,ll c){
	return min(a,min(b,c));
}


bool sortBySec(pair<ll,ll> a,pair<ll,ll> b){
    if(a.second==b.second)
		return a.first<b.first;
    return (a.second < b.second); 
}

long long binexpmod(long long a, long long b){
    long long res =1;
    while(b>0){
        if(b&1){
            res = res * a % mod;
        }
        a = a * a % mod;
        b>>=1;
    }
    return(res);
}


ll lcm(ll a,ll b){
	ll x=__gcd(a,b);
	a/=x;
	b/=x;
	ll sum=a*b*x;
	return sum;
}
void solve(){
    ll n,res=0;
	cin>>n;
    vi a(3);
    vi new_dp(3,0);
    rep(i,n){
        cin>>a[0]>>a[1]>>a[2];
        vi dp(new_dp.begin(),new_dp.end());
        rep(j,3){
            ll t=0;
            rep(k,3){
                if(j==k) continue;
                t = max(t,dp[k]);
            }
            // cout<<"t="<<t<<" a[j]="<<a[j]<<endl;
            t+=a[j];
            new_dp[j] = t;
        }
    }
    
	cout<<max_ll(new_dp[0],new_dp[1],new_dp[2])<<endl;
	return;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	while(true){
		int N;
		scanf("%d",&N);
		if(N==0)break;
		for(int i=0;i<N;i++){
			int m,e,j;
			scanf("%d%d%d",&m,&e,&j);
			if(m==100||e==100||j==100){
				printf("A\n");
			}
			else if(m+e>=180){
				printf("A\n");
			}
			else if(m+e+j>=240){
				printf("A\n");
			}
			else if(m+e+j>=210){
				printf("B\n");
			}
			else if(m+e+j>=150&&(m>=80||e>=80)){
				printf("B\n");
			}
			else{
				printf("C\n");
			}
			
		}
	}
	return 0;
}

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

int main() {
  char b ; 
  cin >> b ; 
  
  if( b == 'A'){
    cout << "T" << endl ; 
  }
  else if (b == 'C'){
    cout << "G" << endl ; 
  }
  else if (b == 'G'){
    cout << "C" << endl ; 
  }
  else {
    cout << "A" << endl ; 
  }
  
}

Measured memory_bytes: 3556
_ = input()
a = [int(x) for x in input().split()]

p = [False] * 8
q = 0
for i in a:
    if 3199 < i:
        q += 1
    else:
        for j in range(8):
            if 400 * j <= i < 400 * (j + 1):
                p[j] = True
else:
    s = sum(p)
    print(max(s, 1), s + q)

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

#define ll long long int
#define endl '\n'

void solve()
{
    ll n;
    cin>>n;
    ll ans=0;
    ll tmp = 0;
   // cout<<ans<<endl;
    for(ll i=1;i<n;i++)
    {
    	tmp = n/i;
    	if(tmp == 1)
    		ans++;
    	else 
    	{
    		if(n%i == 0)
    		{
    			tmp--;
    		}
    		ans += tmp;
    	}
    	
    }
    cout<<ans<<endl;
    
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    #ifdef JAY
        freopen("C:/Users/jayra/Desktop/cp/input.txt","r",stdin);
        freopen("C:/Users/jayra/Desktop/cp/output.txt","w",stdout);
    #endif

    int t=1;
    while(t--) {
        solve();
   }
}

Measured memory_bytes: 3656
using System;

class Program
{
    static void Main(string[] args)
    {
        string str = Console.ReadLine();
        //string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
        //string str = "<>>><<><<<<<>>><";
        int N = Int32.Parse(str);
        string S = Console.ReadLine();
        //string[] strA = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
        //string[] strB = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得

        //long[] A = new long[N];
        //long[] B = new long[N];

        if( N % 2 != 0 )
        {
            Console.WriteLine("No");
            return;
        }

        int half = N / 2;
        for(int i = 0; i < half; i++ )
        {
            if( S[i] != S[half + i])
            {
                Console.WriteLine("No");
                return;
            }
        }

        Console.WriteLine("Yes");
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <sstream>
#include <cstdio>
using namespace std;

int getCat(int x, int y){
  stringstream ss;
  ss << x << y;
  return atoi(ss.str().c_str());
}

int main(){
  int n;
  scanf("%d", &n);

  priority_queue<int> q[5];

  for(int i = 0; i < n; i++){
    int x;
    scanf("%d", &x);

    for(int j = 10000, idx = 4; j >= 1; j /= 10, idx--){
      if(x < j) continue;

      q[idx].push(x);
      if(q[idx].size() > 4){
        q[idx].pop();
      }
      break;
    }
  }

  vector<int> v;

  for(int i = 0; i < 5; i++){
    while(!q[i].empty()){
      v.push_back(q[i].top());
      q[i].pop();
    }
  }

  vector<int> cat;

  for(int i = 0; i < v.size(); i++){
    for(int j = 0; j < v.size(); j++){
      if(i == j) continue;
      cat.push_back(getCat(v[i], v[j]));
    }
  }

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

  cout << cat[2] << endl;
}

Measured memory_bytes: 1260
#!/usr/bin/env python3
import sys

def solve(N: int, Y: int):
    for i in range(Y//10000+1):
        for j in range(Y//5000+1):
            if i+j>N:
                break
            if 10000*i+5000*j+1000*(N-i-j) == Y:
                print(i,j,N-i-j)
                return

    print(-1,-1,-1)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(N, Y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
#include <complex>
using namespace std;
int main(){
  int H,W,D,N;
  cin >>H >>W >>D;
  N=H*W;
  int x[N];
  int y[N];
  int goal[N];
  int i,j;
  int now;
  for(i=0;i<H;i++){
    for(j=0;j<W;j++){
      cin >> now;
      x[now-1]=i;
      y[now-1]=j;
    }
  }
  for(i=0;i<N;i++){
    if (i<D){
      goal[i]=0;
    }else{
      goal[i]=goal[i-D]+abs(x[i]-x[i-D])+abs(y[i]-y[i-D]);
    }
  }
  int Q,L,R;
  cin >> Q;
  for(i=0;i<Q;i++){
    cin >> L >>R;
    cout << goal[R-1]-goal[L-1] <<"\n";
  }
}


Measured memory_bytes: 2176
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    S = input()
    if S == "ABC":
        print("ARC")
    else:
        print("ABC")


def main():
    solve()


if __name__ == '__main__':
    main()


Measured memory_bytes: 9860
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define  mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    char a,b;cin>>a>>b;
    if(a==b)
        cout<<'H'<<endl;
    else
        cout<<'D'<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
import numpy as np
MOD = 998244353

def main():
    n, s = map(int, input().split())
    a = list(map(int, input().split()))
    dp = np.zeros((n+1, s+1), dtype=np.int64)
    dp[0][0] = 1
    for i in range(n):
        dp[i][dp[i] >= MOD] %= MOD
        dp[i+1] += dp[i]*2
        if a[i] <= s:
            dp[i+1][a[i]:] += dp[i][:-a[i]]
    print(dp[n][s]%MOD)

if __name__ == "__main__":
    main()

Measured memory_bytes: 97532
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
#define rep(i, n) for (i32 i = 0; i < (i32)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;
i64 cnt = 0;
i64 n;
void dfs(i64 x){
    if(x > n) return ;
    i64 tmp = x;
    bool seven = false,three = false,five = false;
    while(tmp > 0){
        if(tmp % 10 == 7)seven = 1;
        if(tmp % 10 == 5)five = 1;
        if(tmp % 10 == 3)three = 1;
        tmp /= 10;
    }
    if(three && five && seven)cnt++;
    dfs(x * 10 + 7);
    dfs(x * 10 + 5);
    dfs(x * 10 + 3);
}
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cin >> n;
dfs(0);
cout << cnt << endl;
}

Measured memory_bytes: 3604
#include<stdio.h>
#include<stdlib.h>

#define NIL NULL

typedef struct node{
  int key;
  struct node *l;
  struct node *r;
  struct node *p;
} Node;

typedef struct node* NodePointer;
 
NodePointer root;

void insert(int key){

  NodePointer x, y, z;

  y = NIL;
  x = root;

  z = malloc(sizeof(struct node));
  z->key = key;
  z->l = NIL;
  z->r = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->l;
    else x = x->r;
    z->p = y;
  }

  z->p = y;

  if(y == NIL) root = z;
  else if(z->key < y->key) y->l = z;
  else y->r = z;

}

void inorder(NodePointer t){

  if(t->l != NIL) inorder(t->l);
  printf(" %d", t->key);
  if(t->r != NIL) inorder(t->r);

}

void preorder(NodePointer t){
 
  printf(" %d", t->key);
  if(t->l != NIL) preorder(t->l);
  if(t->r != NIL) preorder(t->r);

}

void find(NodePointer t, int key){

  while(t != NIL){
    if(key == t->key){
      printf("yes\n");
      break;
    }   
    else if(key < t->key) t = t->l;
    else t = t->r;
  }

  if(t == NIL) printf("no\n");

}

int main(){
     
  int i, n, t, x, key;
  char com[10];
  
  scanf("%d",&n);
  
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if(com[0] == 'i'){
      scanf("%d", &x);
      insert(x);
    } 
    else if(com[0] == 'p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if(com[0] == 'f'){
      scanf("%d", &key);
      find(root, key);
    }
  }
  
  return 0;

}

Measured memory_bytes: 19360
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    
    String a = sc.next();
    String b = sc.next();
    
    String deff = a + b;
    int result = Integer.parseInt(deff);
    
    double check = Math.sqrt(result) - (int)Math.sqrt(result);
    
    if(check == 0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sz size()
#define ll long long
ll n, W;
ll w[110], v[110];
ll dp[(int)1e5+10];
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> W;
	for(int i = 1; i <= n; ++i) cin >> w[i] >> v[i];
	for(int i = 1; i <= 1e5; ++i) dp[i] = 1e12;
	dp[0] = 0;
	for(int i = 1; i <= n; ++i)
        for(int j = 1e5; j >= v[i]; --j) dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
	for(int i = 1e5; i >= 0; --i) if(dp[i] <= W) cout << i, exit(0);
    return 0;
}


Measured memory_bytes: 1024
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//過半数：N/2.0で判定
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll MOD = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1));
}

//Nのd桁目の数
ll dignum(ll N, ll d) {
	ll x = pow(10, d);
	N %= x;
	ll y = pow(10, d - 1);
	N /= y;
	return N;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

int main() {
	ll N, M; cin >> N >> M;
	vector<ll> A(N); rep(i, N)cin >> A[i];

	priority_queue<
		ll,
		vector<ll>
	> q;

	rep(i, N) q.push(A[i]);

	rep(i, M) {
		ll tmp =  q.top();
		q.pop();
		q.push(tmp / 2);
	}

	ll ans = 0;
	rep(i, N) {
		ans += q.top();
		q.pop();
	}

	cout << ans << endl;

}

Measured memory_bytes: 9976
# -*- coding: utf-8 -*-
a, b, c, d = map(int, input().split())


def isTalkable(a, b, c, d):
    if abs(a - c) <= d:
        return "Yes"
    elif(abs(a - b) <= d) and (abs(b - c) <= d):
        return "Yes"
    else:
        return "No"


print(isTalkable(a, b, c, d))


Measured memory_bytes: 2940
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
#define ll long long 
#define d double
using namespace std;

int main()
{
	
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    float n;
    cin>>n;
    cout<<round(n/2)<<endl;
    
    
    return 0;
}

Measured memory_bytes: 3796
while True:

    m,f,r = map(int,input().split())

    if m == -1 and r == -1 and f == -1:
        break


    ans = ""

    if m == -1 or f == -1:
        ans = "F"

    elif m + f >= 80:
        ans = "A"

    elif m + f >= 65:
        ans = "B"

    elif m + f >= 50:
        ans = "C"

    elif m + f >= 30:

        if r >= 50:
            ans = "C"
        else:
            ans = "D"

    else:
        ans = "F"


    print (ans)



Measured memory_bytes: 5588
n=int(input())
C=[0]*(n-1)
S=[0]*(n-1)
F=[0]*(n-1)
for i in range(n-1):
  C[i],S[i],F[i]=map(int,input().split())
for i in range(n-1):
  ans=0
  for j in range(i,n-1):
    ans=max((ans+F[j]-1)//F[j]*F[j],S[j])+C[j]
  print(ans)
print(0)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
using namespace std;
using ll = long long;
const int INF = +100100100;
typedef pair<int,int> P;
const ll MO = 1000000007;

int main(){
    int n;
    cin >> n;
    set<int> b;
    rep(i,n){
        int x; cin>>x;
        if(b.count(x)==1)b.erase(x);
        else b.insert(x);
    }
    // set<int>::iterator it;
    // for(it;it!=b.end();++it){
        
    // }
    cout << b.size() << endl;
    return 0;
}

Measured memory_bytes: 4864