akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll = long long;
using namespace std;


int main(){
	ll n;
	cin>>n;
    string s[n];
    rep(i,0,n)cin>>s[i];
    bool p=false,w=false,g=false,y=false;
    rep(i,0,n){
        if(s[i][0]=='P')p=true;
        if(s[i][0]=='W')w=true;
        if(s[i][0]=='G')g=true;
        if(s[i][0]=='Y')y=true;
    }
    ll ans=0;
    if(p)ans++;
    if(w)ans++;
    if(g)ans++;
    if(y)ans++;

    if(ans==4)cout<<"Four";
    else cout<<"Three";


}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<set>
#include<map>
using namespace std;
using ulong = unsigned long;
using ll = long long;
const int M = 1e9 + 7;
#pragma unused(M)

ll next(ll prev, ll thre){
	// for(int i=1;;i++){
	// 	if(prev * i >= thre){
	// 		return i;
	// 	}
	// }
	ll l = 1, r = 1e18 / prev;
	// cout<<"prev:"<<prev<<' '<<thre<<endl;
	// if(prev > thre){ return 1; }
	while(l < r){
		// cout<<l<<' '<<r<<endl;
		// cout<<r<<endl;
		ll piv = (l + r) / 2;
		if(prev * piv < thre){
			l = piv + 1;
		}else{
			r = piv;
		}
	}
	return l;
}

int main(){
	int n;
	cin >> n;
	ll t, a;
	cin >> t >> a;
	for(int i=0;i<n-1;i++){
		ll ti, ai;
		cin >> ti >> ai;
		ll rt = next(ti, t), ra = next(ai, a), r = max(rt, ra);
		t = ti * r;
		a = ai * r;
		// cout<<t<<' '<<a<<endl;
	}
	cout << t + a << endl;
	return 0;
}



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

#define     ll     long long int

ll mod = 1000000007;

map<int, int> mp;
map<int, int>::iterator it;

void get(int n)
{
    int i, j, rt = sqrt(n);
    for (i = 2; i <= rt; i++) {
        if (n % i == 0) {
            int c = 0;
            while (n % i == 0) {
                n /= i;
                c++;
            }
            mp[i] += c;
        }
    }
    if (n > 1) {
        mp[n]++;
    }
}

int main( )
{
    int i, j, k, n;
    cin >> n;
    for (i = 2; i <= n; i++) {
        get(i);
    }
    ll ans = 1;
    for (it = mp.begin(); it != mp.end(); it++) {
        j = (*it).second;
        ans = (ans * (j + 1)) % mod;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(s[K-1])

Measured memory_bytes: 38256
fn main() {
    let v: Vec<i32> = read_vec();
    let (a, b) = (v[0], v[1]);

    println!("{}", a * b - a - b + 1);
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

int main()
{
	unsigned long long int n,ans,tmp;
	cin >> n;

	tmp = n - 1;
	ans = (tmp*(tmp+1))/2;
	if (n == 1)
		ans = 0;
	if (n == 2)
		ans = 1;
	cout << ans;
}


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

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


    ll sum = 0;
    for(int i=0; i<n-1; i++){
        int a;
        cin>>a;
        if(m>a){
            ll ans = m-a;
            sum +=ans;
            a = a+ans;
        }
        m = a;
    }
    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
long long int N,M,K,H,W,L,R;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>N;
	string s;
	map<string, int>mp;
	for (int i=0;i<N;i++){
		cin>>s;
		mp[s]++;
	}
	vector<pair<int,string>>v;
	for(auto i:mp) {
		v.push_back({i.second,i.first});
	}
	sort(v.begin(),v.end());
	for(auto i : v)if(i.first==v.back().first)cout<<i.second<<endl;
	return 0;
}

Measured memory_bytes: 27376
import java.util.Scanner;
import java.util.ArrayList;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        scanner.nextLine();
        int[] array = new int[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextInt();
        }
        boolean isDuplicated = false;
        ArrayList<Integer> newArray = new ArrayList<>();
        for(int i=0; i<array.length; i++) {
            for(int j=0; j<newArray.size(); j++) {
                if(array[i] == newArray.get(j)) {
                    isDuplicated = true;
                    break;
                }
            }
            if(!isDuplicated) {
                newArray.add(array[i]);
            }
            isDuplicated = false;;
        }
        System.out.println(newArray.size());
    }
}


Measured memory_bytes: 23636
N = int(input())
S = input()

answer = prev = S[1:].count('E')
for i in range(1, N):
    _answer = prev if S[i-1] == 'E' else prev+1
    if S[i] == 'E':
        _answer -= 1
    answer = min(answer, _answer)
    prev = _answer

print(answer)

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

// namespace std {
// template <> class hash<pair<int, int>> {
// public:
//   size_t operator()(const pair<int, int> &x) const {
//     return hash<int>()(x.first) ^ hash<int>()(x.second);
//   }
// };
// } // namespace std

using namespace std;

int traverse(int source, unordered_set<int> passed, vector<vector<int>> *edges) {
  if (passed.size() == edges->size()) {
    return 1;
  }
  int sum=0;
  for (auto dest: edges->at(source)) {
    if (passed.find(dest)!=passed.end()) {
      continue;
    }
    unordered_set<int> new_passed;
    new_passed = passed;
    new_passed.insert(dest);
    sum += traverse(dest, new_passed, edges);
  }
  return sum;
}

int main() {
  int n, m;
  cin >> n >> m;
  // unordered_set<pair<int, int>> passed;
  unordered_set<int> passed;
  vector<vector<int>> edges(n, vector<int>(0));
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    edges.at(a - 1).push_back(b - 1);
    edges.at(b - 1).push_back(a - 1);
  }
  passed.insert(0);
  cout << traverse(0, passed, &edges) << endl;
  return 0;
}

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

public class Main  implements Runnable { //Runnableを実装する

    public static void main(String[] args) {

        new Thread(null, new Main(), "", 16 * 1024 * 1024).start(); //16MBスタックを確保して実行

    }

    public void run() {
		Scanner sc = new Scanner(System.in);
		//Scanner sc = new Scanner("1000 1000 1000 8 ");
		//int n = Integer.parseInt(sc.next());
		int x, y, z;
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int ans;
		if(a==b)
		{
			ans = a*2;
		}
		else
		{
			if(a>b)
			{
				ans = a*2-1;
			}
			else
			{
				ans = b*2-1;
			}
			
		}
		PrintWriter out = new PrintWriter(System.out);

		out.println(ans);
		out.flush();
	}
}

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

int count (int n) {
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (n % i == 0) ans++;
  }
  return ans;
}

int main(){
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i % 2 == 0) continue;
    if (count(i) == 8) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main
{
  public static void main(String []args)
  {
    Scanner sc = new Scanner(System.in);
    int d = sc.nextInt();
    int t = sc.nextInt();
    int s = sc.nextInt();
    if(s*t >= d)
      System.out.println("Yes");
    
    else
      System.out.println("No");
  }
}

Measured memory_bytes: 35604
s=list(input())
"""
    奇数文字目がすべて R, U, D のいずれか。
    偶数文字目がすべて L, U, D のいずれか。
"""
for ii in range(len(s)):
  if ii%2==0 and s[ii]=="L":
    print("No")
    exit()
  if ii%2==1 and s[ii]=="R":
    print("No")
    exit()    
print("Yes")
    

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

using namespace std;
#define ll long long
#define all(x) x.begin(), x.end()
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
const int N = 1e5 + 10;
const double eps = 1e-9;

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<ll, pair<ll, ll>>> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i].first >> v[i].second.first >> v[i].second.second;
    }
    ll ans = 0;
    for (ll i = -1; i <= 1; i += 2) {
        for (ll j = -1; j <= 1; j += 2) {
            for (ll k = -1; k <= 1; k += 2) {
                vll nw;
                for (int l = 0; l < n; ++l) {
                    nw.push_back(i * v[l].first + j * v[l].second.first + k * v[l].second.second);
                }
                sort(all(nw), greater<ll>());
                ll tm = 0;
                for (int l = 0; l < m; ++l) {
                    tm += nw[l];
                }
                ans = max(ans, tm);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3644
#include<iostream>
#include<algorithm>
#include<vector>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define pb push_back
using namespace std;
const int INF = 1e9;
typedef long long ll;

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

int main(){
  int n;
  cin >> n;
  vector <ll> t;
  REP(i,n){
    ll a;
    cin >> a;
    t.pb(a);
  }
  ll gg,gd;
  if(t.size() == 1)
    gg = t[0];
  else{
    gg = 1;
    for(int i = 0;i < n;i++){
      gd = gcd(gg,t[i]);
      gg = gg/gd*t[i];
    }
  }
  cout << gg << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include<iomanip>

#define _USE_MATH_DEFINES
#include <cmath>

using namespace std;

double RADIAN = (M_PI / 3);
double COS = cos(RADIAN);
double SIN = sin(RADIAN);

pair<double, double> get_koch_point(pair<double, double>  b, pair<double, double> e) {
  pair<double, double> oe = make_pair(e.first - b.first, e.second  - b.second);

  double x = (oe.first * COS) - (oe.second * SIN);
  double y = (oe.first * SIN) + (oe.second * COS);

  return make_pair(b.first + x, b.second + y);
}

void koch(int i, int n, pair<double, double>  b, pair<double, double> e) {
  if (i >= n) {
    return;
  }
  pair<double, double> l = make_pair(b.first + ((e.first - b.first) / 3), b.second + ((e.second- b.second) / 3));
  pair<double, double> r = make_pair(b.first + 2 * ((e.first - b.first) / 3), b.second + 2 * ((e.second- b.second) / 3));
  pair<double, double> k = get_koch_point(l, r);

  koch(i+1, n, b, l);
  cout << l.first << " " << l.second << endl;
  koch(i+1, n, l, k);
  cout << k.first << " " << k.second << endl;
  koch(i+1, n, k, r);
  cout << r.first << " " << r.second << endl;
  koch(i+1, n, r, e);
}

int main() {
  cout << fixed << setprecision(8);

  int N;
  cin >> N;

  pair<double, double> b = make_pair(0, 0);
  pair<double, double> e = make_pair(100, 0);

  cout << b.first << " " << b.second << endl;
  koch(0, N, b, e);
  cout << e.first << " " << e.second << endl;

  return 0;
}



Measured memory_bytes: 3368
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		long[] a = new long[n];
		HashMap<Long, Integer> map = new HashMap<>();
		
		for(int i = 0; i < n; i++)
		{
			a[i] = sc.nextLong() - i;
			
			if(map.containsKey(a[i]))map.put(a[i], map.get(a[i])+1);
			else map.put(a[i], 1);
		}
		
		long c = 0;
		for(int i = 0; i < n; i++)
		{
			long sum = i * -2;
			long need = sum - a[i];
			if(map.containsKey(need))c+=map.get(need);
		}
		
		System.out.println(c);
		
		
	}

}


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

int main(){
  string A;
  string B;
  cin >> A >> B;
//  cout << A<< endl;
//  cout << B<< endl;

  int n = A.size();
  int m = B.size();
  int cnt =0;
  for (int i=0; i<n;i++){
    if(A.at(i) == B.at(i)) continue;
    cnt ++;

  }
  cout << cnt<<endl;
}


Measured memory_bytes: 3848
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s, t, u;
    cin >> s >> t >> u;
    cout << 'A' << t[0] << 'C';
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int i, K, N, A[1000000], tmp;
  
  scanf("%d %d", &K, &N);
  for(i = 0; i < N; i++)
    scanf("%d", &A[i]);
  
  tmp = K - A[N-1] + A[0];
  for(i=1;i<N;i++)
  	if(tmp < (A[i] - A[i-1]))
      tmp = A[i] - A[i-1];
  
  printf("%d",K-tmp);
  
  return 0;
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int N=1e5+9;
ll mod=998244353;
ll F(ll x,ll y){
    ll sum=x,ret=1;
    while (y){
        if (y&1)
            ret=sum*ret%mod;
        y/=2;
        sum=sum*sum%mod;
    }
    return ret;
}
int main()
{
    FASTINOUT;
    int x;
    cin>>x;
    vector<int>v(x);
    map<int,int>m;
    for (int i=0;i<x;i++){
        cin>>v[i];
        m[v[i]]++;
    }
    if (m[0]!=1||v[0]!=0)
        cout<<0<<endl;
    else{
        ll ans=1;
        for (int i=1;i<x;i++){
            if (m[i]){
                ans=ans*F(m[i-1],m[i])%mod;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

ll n,S,res=0,b[6]={1,3,5,15,25,75};
vl a;

void dfs(int I,int num){
	if(I==S){
		if(num==75) res++;
		return;
	}
	if(num>75) return;
	for(int i=0;i<6;i++) if(a[I]>=b[i]-1) dfs(I+1,num*b[i]);
}

int main(){
	cin>>n;
	for(int i=2;i<100;i++){
		bool B=1;
		for(int j=2;j*j<=i;j++) if(i%j==0) B=0;
		if(B){
			int t=0,N=n;
			while(N) t+=N/i,N/=i;
			if(t>1) a.push_back(t);
		}
	}
	S=a.size();
	dfs(0,1);
	cout<<res<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1100;
int vis[maxn];
int prime[maxn];    //质数数组
void Prime()
{
    memset(vis,0,sizeof(vis));
    memset(prime,0,sizeof(prime));
    for (int i = 2;i < maxn; i++)   //此处和下面的maxn是否取等貌似会对评测结果产生影响，开大点就行了
    {
        if (!vis[i]) 
        {
            prime[++prime[0]] = i;      
        }
        for (int j = 1; j <=prime[0] && i*prime[j] < maxn; j++) 
        {
            vis[i*prime[j]] = 1;
            if (i % prime[j] == 0) 
            {
                break;
            }
        }
    }
}
ll divide(int x)
{
    ll ans=1;
    for (int i = 1; prime[i] <= x / prime[i]; i ++ )
    {
        int s=0;
        if (x % prime[i] == 0)
        {
            while (x % prime[i] == 0) x /= prime[i], s ++ ;
        }
        ans*=(s+1);
    }
    if (x > 1)  ans*=2;
    return ans;
}
void solve(int T)
{
    int n;
    cin >> n;
    Prime();
    ll ans=0;
    for(int i=1;i<n;i++)
    {
        ans += divide(n-i);
    }
    cout << ans;
}



signed main()
{
    int t=1;
    //scanf("%d",&t);
    for(int i=1;i<=t;i++)
    {
        solve(i);
    }
    return 0;
}

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

int main(){
    int A,B;
    cin >> A >> B;
    int s;
    int d;
    int m;
    s = A+B;
    d = A-B;
    m = A*B;
    int max;
    if(s>=d){
        max = s;
        if(m>=s){
            max = m;
        }
    }
    else{
        max = d;
        if(m>=d){
            max = m;
        }
    }
    cout << max << endl;
}

Measured memory_bytes: 256
#!/usr/bin/python
# -*- coding: utf-8 -*-

# 入力はstringで入る．
# intにしたければ int(input())
# floatで受け取ると 1.0 になる．

# 入力 : S
S = input()

if S == "AAA" or S == "BBB":
    print("No")
else:
    print("Yes")



Measured memory_bytes: 2940
def getN():
    return int(input())

def getMN():
    return list(map(int, input().split()))

def getlist():
    return list(map(int, input().split()))

s = input()
total = len(s)
ans = 0
for c in s:
    if c == "o":
        ans += 1

if 15 - total + ans >= 8:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define ff first
#define ss second
const ll mod =   1e9 +7  ;
ll multiply(ll a, ll b ){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
////////////////////////////////////////////////////////////////



///////////////////////////////////////////////////////////////
void solve(){
    int n ;
    cin >> n ;
    ll ans = 0 ;
    for( int i  = 1 ; i <= n ; i++){
        for( int j = 1 ; j <= n ; j++){
            for( int k = 1 ; k <= n ; k++){
                ans += __gcd(i,__gcd(j,k));
            }
        }
    }
    cout << ans ;
}
int main(){
    int t = 1 ;
//    cin >> t ;
//    int cnt = 1 ;
    while(t--){
        //cout << "Case #" << cnt << ": ";
        solve( );
      //  cnt++;
    }
}




Measured memory_bytes: 3636
def examA():
    S = SI()
    if len(S)==3:
        ans = S[::-1]
    else:
        ans = S
    print(ans)
    return

def examB():
    A, B, K = LI()
    for i in range(K):
        if i%2==0:
            B +=A//2
            A //=2
        else:
            A +=B//2
            B //=2
    print(A,B)
    return

def examC():
    N = I()
    A = [I() for _ in range(N)]
    A.sort()
    A1 = A[:N//2]; A2 = A[N//2:]
    ans = 0; cur = 0
    for i in range(len(A2)):
        if i<len(A1):
            cur +=(A2[i]-A1[i])
        if i-1>=0:
            cur +=(A2[i]-A1[i-1])
    if N%2==1:
        cur += (A2[-1] - A2[1])
    ans = max(ans,cur)
#    print(A1,A2)
#    print(ans)
    if N%2==1:
        A1 = A[:1+(N//2)]; A2 = A[1+(N//2):]
        cur = 0
        for i in range(len(A1)):
            if i < len(A2):
                cur += (A2[i] - A1[i])
            if i - 1 >= 0:
                cur += (A2[i-1] - A1[i])
        cur +=(A1[-2]-A1[0])
        ans = max(ans, cur)
#    print(A1,A2)
    print(ans)
    return

def examD():
    N = I()
    ansCandi = []
    for i in range(1, 1000):
        a = (i + 1) * i / 2
        ansCandi.append(a)
    if N not in ansCandi:
        print("No")
    else:
        a = ansCandi.index(N) + 1
        A = [[0] * (a + 1) for _ in range(a + 1)]
    #    print(a)
        k = int(1)
        for i in range(a + 1):
            for j in range(i + 1, a + 1):
                A[i][j] = k
                A[j][i] = k
                k += 1
#        print(A)
        print("Yes")
        print(a + 1)
        for v in A:
            v.remove(0)
            v.insert(0, a)
        for v in A:
            print(*v)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examD()


Measured memory_bytes: 47324
/**
 * Created by abhishek on 8/4/2016.
 */
import java.util.*;
import java.io.*;
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        System.out.println(n*(n + 1)/2);
    }
}


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

int main(){
	int w,h,x,y;
	cin >> w >> h >> x >> y;

	double s = (double)w*h/2.0;
	int multi = 0;
	if (2*x==w && 2*y==h) multi = 1;

	cout << s << ' ' << multi << endl;

	return 0;
}

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

namespace ABC062A
{
    class Program
    {
        static int getGroup(int x)
        {
            switch(x)
            {
                case 1:
                case 3:
                case 5:
                case 7:
                case 8:
                case 10:
                case 12:
                    return 0;

                case 4:
                case 6:
                case 9:
                case 11:
                    return 1;

                case 2:
                    return 2;
            }

            return -1;
        }


        static void Main(string[] args)
        {
            string[] vals = Console.ReadLine().Split(' ');
            int x = int.Parse(vals[0]);
            int y = int.Parse(vals[1]);

            if(getGroup(x) == getGroup(y))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

        }
    }
}


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

#define ll long long
#define int long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf (int)(1e18)
#define ps(x, y) fixed << setprecision(y) << x
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(p) p.begin(), p.end()
#define ub(a, b) upper_bound(all(a), b)
#define lb(a, b) lower_bound(all(a), b)
#define PI 3.14159265
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void run()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
int32_t main()
{
    run();
    vector<string> s = {"AC", "WA", "TLE", "RE"};
    map<string, int> m;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string temp;
        cin >> temp;
        m[temp]++;
    }
    for (auto ele : s)
    {
        cout << ele << " x " << m[ele] << endl;
    }
    return 0;
}

Measured memory_bytes: 3664
import java.util.Scanner;
import java.util.LinkedHashMap;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		while (n != 0) {
			LinkedHashMap<Integer, Long> hm = new LinkedHashMap<Integer, Long>();
			for (int i = 0; i < n; i++) {
				int id = sc.nextInt();
				long a = sc.nextInt();
				long b = sc.nextInt();
				if (hm.containsKey(id)) {
					long c = hm.get(id) + (a * b);
					hm.put(id, c);
				} else {
					hm.put(id, a * b);
				}
			}
			boolean bl = false;
			for (Integer key: hm.keySet()) {
				if (hm.get(key) >= 1000000) {
					bl = true;
					System.out.println(key);
				}
			}
			if (bl == false) {
				System.out.println("NA");
			}
			n = sc.nextInt();
		}
	}
}


Measured memory_bytes: 25392
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <climits>
#include <memory>
#include <sstream>
#include <iomanip>

using namespace std;


int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;

	vector<int> h(n);

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

	vector<int> dp(n);
	dp[0] = 0;
	dp[1] = abs(h[0] - h[1]);

	for (int i = 2; i < n; i++) {
		dp[i] = min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2]) + dp[i - 2]);
	}

	cout << dp[n - 1] << endl;

	return 0;
}

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

const int mod = 1000000007;

int main() {
	int H, W, K;
	cin >> H >> W >> K;

	vector<vector<int> > dp(H+1, vector<int>(W, 0));
	dp[0][0] = 1;

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			for (int k = 0; k < pow(2,W-1); k++) {
				bool ok = true;
				for (int l = 0; l < W-2; l++) {
					if (((k >> l) & 1) && ((k >> (l+1)) & 1)) ok = false;
				}
				if (ok) {
					if ((j >= 1) && ((k >> (j-1)) & 1)) {
						dp[i+1][j-1] += dp[i][j];
						dp[i+1][j-1] %= mod;
					} else if ((j <= W-2) && ((k >> j) & 1)) {
						dp[i+1][j+1] += dp[i][j];
						dp[i+1][j+1] %= mod;
					} else {
						dp[i+1][j] += dp[i][j];
						dp[i+1][j] %= mod;
					}
				}
			}
		}
	}

	cout << dp[H][K-1] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <complex>
#include <iostream>
#include <cmath>
using namespace std;
typedef complex<double> xy_t;
xy_t P[110];
int main() {
  // 入力例 読み込んだ点の個数を N とする
  int N=0;
  double x, y;
  while (scanf("%lf,%lf", &x, &y) != EOF) {
    P[N++] = xy_t(x,y);
  }
  // 面積計算
  double sum = 0.0;
  for (int i=0; i+2<N; ++i) {
    xy_t a=P[0], b=P[i+1], c=P[i+2];
    double a_ = abs(a - b);
    double b_ = abs(b - c);
    double c_ = abs(c - a);
    double z = (a_ + b_ + c_) / 2.0;
    sum += sqrt(z * (z - a_) * (z - b_) * (z - c_));
  }
  printf("%.6f\n", sum);
}


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

const ll mod = 998244353;
ll dp[3030][3030];

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    dp[a][b] = 1;
    for (ll x = a; x <= c; x++) {
        for (ll y = b; y <= d; y++) {
            dp[x][y] += dp[x - 1][y] * y % mod;
            dp[x][y] %= mod;
            dp[x][y] += dp[x][y - 1] * x % mod;
            dp[x][y] %= mod;
            dp[x][y] -= dp[x - 1][y - 1] * (x - 1) * (y - 1) % mod;
            dp[x][y] += mod;
            dp[x][y] %= mod;
        }
    }
    // rep(i, c) {
    //     rep(j, d) {
    //         cout << dp[i + 1][j + 1] << " ";
    //     }
    //     cout << endl;
    // }

    cout << dp[c][d] << endl;
}

Measured memory_bytes: 74528
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


def input():
    return sys.stdin.readline()


def resolve():
    s = input()

    if s[2] == s[3] and s[4] == s[5]:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    resolve()



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

using namespace std;

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	
	int ans = 0;
	for(int i = 1; i < s.size(); i++)
	{
		string sub = s.substr(0, i);
		string sub2 = s.substr(i, n - i);
		sort(sub.begin(), sub.end());
		int tmp = 0;
		for(int j = 0; j < i; j++)
		{
			for(int k = 0; k < sub2.size(); k++)
			{
				if(sub[j] == sub2[k])
				{
					tmp++;
					break;
				}
			}
			while(sub[j] == sub[j + 1] && j != i - 1)
				{
					j++;
				}
		}
		if(ans < tmp)
		{
			ans = tmp;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <deque>     // deque
#include <iomanip>   //setprecsion
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <utility>   // pair, make_pair
#include <vector>    // vector

#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>  //sin, cos, tan

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

void Main()
{
  ll a, b, n;
  cin >> a >> b >> n;
  n = min(n, b - 1);
  cout << a * n / b - a * (n / b) << endl;
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  //cout << setfill('0') << internal << setw(4); 0埋め４桁
  Main();
  return 0;
}


Measured memory_bytes: 3552
# coding: utf-8

c_al = [0] * 26

while True:
    try:
        s = input()
        for i in s:
            if i.isalpha():
                c_al[ord(i.lower()) - ord("a")] += 1
    except EOFError:
        break

for i in range(ord("a"),ord("a")+26):
    print("{0} : {1}".format(chr(i),c_al[i - ord("a")]))

Measured memory_bytes: 7388
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;            //

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

    int temp;
    temp = A;
    A = B;
    B = temp;

    temp = A;
    A = C;
    C = temp;
    printf("%d %d %d\n", A, B, C);
    return (0);
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

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

		long x = sc.nextLong();
		long  dep = 100;
		double rate = 1.01;

		for(int i = 1; i <= 4000; i++) {
			dep *= 1.01;
			if(dep >= x) {
				System.out.println(i);
				break;
			}
		}



	}

}

Measured memory_bytes: 35748
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string S;
    string T;
    int Q;
    cin >> S >> Q;
    int Quer;
    int F;
    char C;
    int judge = 0;

    for (int i = 0; i < Q; i++) {
        cin >> Quer;
        if (Quer == 1){
            judge++;
        }
        else {
            cin >> F >> C;
            if (F == 1){
                if (judge % 2 == 0){
                    T = T + C;
                }
                else {
                    S = S + C;
                }
            }
            else {
                if (judge % 2 == 0){
                    S = S + C;
                }
                else {
                    T = T + C;
                }
            }
        }
    }
    reverse(T.begin(), T.end());
    S = T + S;
    if (judge % 2 == 1){
        reverse(S.begin(), S.end());
    }
    cout << S << endl;
}


Measured memory_bytes: 4792
<?php
$input = explode(" ",trim(fgets(STDIN)));

$roads = array();
$roads = array_pad($roads,$input[0],0);
$i = 0;
while($i < $input[1]){
    $array = explode(" ",trim(fgets(STDIN)));
    if($array[0] != $array[1]){
        $roads[$array[0]-1] += 1;
        ++$roads[$array[1]-1];
    }
    ++$i;
}
foreach ($roads as $value) {
    echo $value."\n";
}

Measured memory_bytes: 3700
#include<stdio.h>
int main(){
 int A[10000];
 int i,j,k;

  for(i=0;i<10000;i++){

   scanf("%d\n",&A[i]);

   if(A[i]==0)
     break;
  }
    k=i-1;

    for(j=0;j<=k;j++){
     printf("Case %d: %d\n",j+1,A[j]);
   }







 

  return 0;
}

Measured memory_bytes: 632
import sys
readline = sys.stdin.readline

N = int(readline().strip())
A = list(map(int, readline().split()))

d = 0
for i in range(1, N):
  if A[i] < A[i-1]:
    d += A[i-1] - A[i]
    A[i] = A[i-1]

print(d)

Measured memory_bytes: 31484
import java.util.Scanner;


public class Main {

	int makeRandom(int value){
		return ((value*value)%1000000)/100;
	}
	
	void io(){
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		for(int i=0;i<n;++i){
			int initial=s.nextInt();
			System.out.println("Case "+(i+1)+":");
			for(int j=0;j<10;++j){
				initial=makeRandom(initial);
				System.out.println(initial);
			}
		}
		s.close();
	}

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

}

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

#define endl "\n"
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first 
#define ss second 
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vii vector<pii>
#define vvi vector<vi>
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

//#define int int64_t
//int a[N+2];

int32_t  main(){
	IOS;
  set<int>ss;
  fori(i,3){
    int va;cin>>va;
    ss.insert(va);
  }
  cout<<ss.size()<<endl;
  return 0;
}



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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define int ll
//#define int __int128
//#define ll __int128
typedef pair<int, int   > pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
//typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < (int)(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef RUS_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}



void smain();

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

#ifdef RUS_HOME
    freopen("input", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef RUS_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

void smain() {

    int n;
    cin >> n;
    vi a(n);
    vpi kek(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        kek[i] = {a[i], i};
    }
    sort(ALL(kek));
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans += (kek[i].second % 2 != i % 2);
    }
    cout << ans / 2;




}

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

int gcd(int x,int y){
    if (y==0) return x;
    return gcd(y,x%y);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int p,q,r=1; cin >> p >> q;
    q/=gcd(p,q);
    for (int i=2;i*i<=q;++i){
        if (q%i==0){
            r*=i;
            while(q%i==0) q/=i;
        }
    }
    cout << q*r << '\n';
}


Measured memory_bytes: 3232
import java.util.Scanner;

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

        if(a<b){
            System.out.println("a < b");
        }else if(a>b){
             System.out.println("a > b");
        }else{
            System.out.println("a == b");
        }
    }
}


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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)
// while (getline(cin, S)) {}

// cout <<fixed <<setprecision(10)

// priority_queue<int> q;
// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less
// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

//
// Notes
//
// When specified less than N, try full scan.
// RE: empty vector
// Check Qs
// long/int
// xor -> count each bit
// Check values
// 	1,000,000 -> Loop
// 	100,000	-> vector(int:400KB, long:800KB) 

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (int i=0; i<n; i++)
#define	Rep1(i, n)	for (int i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

void unique_count(vector<long> &a, vector<vector<long>> &b) {
	// erase(b.begin(), b.end());
	for (long i=0; i<a.size(); i++)
		if ((i>0)&&(a.at(i)==a.at(i-1)))
			b.back().at(1)++;
		else
			b.push_back({a.at(i), 1});
	return;
}

int	main() {
	long N, A, B;
	cin >>N >>A >>B;
	long A0=A;
	vector<long> v(N, 0);
	Rep0(i, N)
		cin >>v.at(i);
	Sort(v);
	vector<vector<long>> w;
	unique_count(v, w);
	long SS=0;
	long S=1;
	if ((1!=w.back().at(0))&&(w.back().at(1)<A)) {
		while(A>=w.back().at(1)) {
			SS +=w.back().at(0)*w.back().at(1);
			A -=w.back().at(1);
			w.pop_back();
		}
		SS +=A*w.back().at(0);
		long K=w.back().at(1);
		long D=1;
		while (A>0) {
			S *=K;
			S /=D;
			K--;
			A--;
			D++;
		}
	} else {
		S=0;
		long K=w.back().at(1);
		B=min(B, K);
		long S0=1;
		long D=1;
		while (A>0) {
			S0 *=K;
			S0 /=D;
			K--;
			A--;
			B--;
			D++;
		}
		S +=S0;
		while (B>0) {
			S0 *=K;
			S0 /=D;
			S +=S0;
			K--;
			B--;
			D++;
		}
		SS=A0*w.back().at(0);
	}
	cout <<fixed <<setprecision(10) <<(double)SS/A0 <<endl;
	cout <<S <<endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/// Typedef
typedef long long           ll;
typedef vector<int>         vi;
typedef pair<int,int>       pii;

#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define sf                  scanf
#define pf                  printf
#define SQR(x)              ((x)*(x))
#define loop(i, y)          for(int i=0; i<int(y); i++)
#define FOR(i, x, y)        for(int i=int(x); i<int(y); i++)
#define ROF(i, x, y)        for(int i=int(x); i>=int(y); i--)
#define all(c)              c.begin(), c.end()
#define sz(c)               int(c.size())
#define clr(x, y)           memset(x, y, sizeof(x))
#define si(x)               scanf("%d", &x)
#define sii(x, y)           scanf("%d %d", &x, &y)
#define siii(x, y, z)       scanf("%d %d %d", &x, &y, &z)
#define sl(x)               scanf("%lld", &x)
#define sll(x, y)           scanf("%lld %lld", &x, &y)
#define slll(x, y, z)       scanf("%lld %lld %lld", &x, &y, &z)

#ifdef VAMP
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cout << name << " = " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cout.write(names, comma - names) << " = " << arg1 <<" | ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif
///******************************************START******************************************

/// Constants
#define MAX                 200005
#define MOD                 1000000007
#define eps                 1e-9
#define INF                 0x3f3f3f3f3f3f3f3f // 4,557,430,888,798,830,399
#define inf                 0x3f3f3f3f // 1,061,109,567
#define PI                  acos(-1.0)  // 3.1415926535897932
#define VT                  int

vector<int> v, pp;
vector<int> valids{3, 5, 15, 25, 75};
int DP[102][102];


void primes(){
    FOR(i, 2, 101){
        bool f = 1;
        FOR(j, 2, i){
            if(i%j == 0) f = 0;
        }
        if(f) pp.pb(i);
    }
}

int getCount(int d, int n){
    int res = 0;
    for(int i = d; i <= n; i*=d){
        res += n/i;
    }
    return res;
}

int solve(int pos, int make){
    if(pos == sz(v)) return make == 1;
    int &ret = DP[pos][make];
    if(~ret) return ret;
    ret = solve(pos+1, make);
    for(auto x: valids){
        if(v[pos]>=x-1 and (make % x == 0)){
            ret += solve(pos+1, make/x);
        }
    }
    return ret;
}

int main(){
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    primes();
    int n; si(n); clr(DP, -1);
    for(auto p: pp){
        int cnt = getCount(p, n);
        if(cnt) v.pb(cnt);//, debug(p, cnt);
    }
    printf("%d\n", solve(0, 75));

    #ifdef VAMP
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
    return 0;
}

Measured memory_bytes: 256
// Aizu Vol-0 0022: Maximum Sum Sequence
// 2017.8.6

#include <stdio.h>
#include <stdlib.h>

char *gets(char *);
char buf[100];

#define MAX 5000
int v[MAX + 2], s[MAX + 2], N;

int main()
{
	int i, k, ans;

	while (1) {
		gets(buf); if (!(N = atoi(buf))) break;
		for (i = 0; i < N; i++) gets(buf), v[i] = atoi(buf);
		s[0] = v[0];
		for (i = 1; i < N; i++) {
			s[i] = ((k = s[i - 1] + v[i]) > v[i]) ? k : v[i];
		}
		for (i = 1, ans = s[0]; i < N; i++) {
			if (s[i] > ans) ans = s[i];
		}
		printf("%d\n", ans);
	}
	return 0;
}

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

const int MAX_N = 100007;

int N;
int A[MAX_N];
int L[MAX_N];
int R[MAX_N];

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

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

  L[0] = 0;
  R[N + 1] = 0;

  for (int i = 0; i < N; i++) L[i + 1] = gcd(L[i], A[i]);
  for (int i = N - 1; i >= 0; --i) R[i] = gcd(R[i + 1], A[i]);

  int ans = 0;
  for (int i = 0; i < N; ++i) ans = max(ans, gcd(L[i], R[i + 1]));
  
  cout << ans << endl;
}


Measured memory_bytes: 1408
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstring>
using namespace std;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 1e6+5;
char s[N];
int f, n, k, bit[N];
int main()
{
    scanf("%s", s); n = strlen(s);
    for(int i = 0; i < n; ++i) bit[i] = (s[n-i-1]-'0')*9;
    for(int i = 0, k = 0; i < n||k; ++i) bit[i] += k, k = bit[i]/10, f += (bit[i] %= 10);
    for(int k = 1; k <= n; ++k)
    {
        for(int i = 0, d = 9; d; ++i) 
            f -= bit[i], bit[i] += d, d = bit[i]/10, f += (bit[i]>=10?(bit[i] -= 10):bit[i]);
        if(f <= 9*k) return printf("%d\n", k), 0;    
    }
    return 0;
}   

Measured memory_bytes: 4480
def num_divisors_table(n):
    table = [0] * (n + 1)

    for i in range(1,n+1):
        for j in range(i,n+1,i):
            table[j] += 1
    return table
def resolve():
    n = int(input())
    print(sum(num_divisors_table((n)-1)))
resolve()

Measured memory_bytes: 75672
#include<bits/stdc++.h>
using ll=long long;
using namespace std;
int main(){
  ll n,k;
  cin>>n>>k;
  vector<ll>a(n);
  for(ll i=0;i<n;i++)cin>>a[i];
  ll j=0;
  for(int i=k;i<n;i++){
    if(a[i]<=a[j]){cout<<"No"<<endl;}
    else cout<<"Yes"<<endl;
    
    j++;
  }
  return 0;
}


Measured memory_bytes: 4840
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Node
{
public:
    int h;
    string key;
    Node* parent;
    vector<Node*> child;
    string s;
    Node(int h0, Node* parent0){
        h = h0;
        parent = parent0;
    }
    ~Node(){
        for(unsigned i=0; i<child.size(); ++i)
            delete child[i];
    }
};

int main()
{
    string key;
    getline(cin, key);

    Node* root = new Node(INT_MIN, NULL);
    Node* curr = root;

    for(;;){
        string s;
        if(!getline(cin, s))
            break;

        int h = s.find_first_not_of(' ');
        while(h <= curr->h)
            curr = curr->parent;
        curr->child.push_back(new Node(h, curr));
        curr = curr->child.back();

        int i = s.find(':');
        curr->key = s.substr(h, i-h);

        if(i != s.size() - 1)
            curr->s = s.substr(i+2);
    }

    curr = root;
    unsigned i = 0;
    while(i < key.size()){
        int j = key.find('.', i+1);
        string s = key.substr(i+1, j-i-1);
        i = j;

        int k = 0;
        while(k < curr->child.size() && curr->child[k]->key != s)
            ++ k;

        if(k == curr->child.size()){
            cout << "no such property" << endl;
            return 0;
        }
        curr = curr->child[k];
    }

    if(curr->child.size() == 0)
        cout << "string \"" << curr->s << '\"' << endl;
    else
        cout << "object" << endl;

    delete root;
    return 0;
}

Measured memory_bytes: 1320
import heapq

n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)

h=[]

heapq.heappush(h,a[0]*(-1))
ans = 0
for i in range(1,n):
    ans-=heapq.heappop(h)
    heapq.heappush(h,a[i]*(-1))
    heapq.heappush(h,a[i]*(-1))
print(ans)


Measured memory_bytes: 31532
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
ll a[200005];
ll l[200005], r[200005];
ll d[200005];
int main() {
  int n, k;
  cin >> n >> k;
  for (ll i = 1; i <= n; i++) {
    cin >> a[i];
    d[max(0LL, i - a[i])]++;
    d[min(1LL * (n + 1), i + a[i] + 1)]--;
  }
  ll sum = 0;
  for (int j = 1; j <= k; j++) {
    sum = 0;
    bool ok = 1;
    for (int i = 0; i <= n; i++) {
      sum += d[i];
      a[i] = sum;
      d[i] = 0;
      if (a[i] != n)
        ok = 0;
    }
    for (ll i = 1; i <= n; i++) {
      d[max(0LL, i - a[i])]++;
      d[min(1LL * (n + 1), i + a[i] + 1)]--;
    }
    if (ok) {
      for (int i = 1; i <= n; i++)
        cout << a[i] << ' ';
      cout << endl;
      return 0;
    }
  }
  for (int i = 1; i <= n; i++)
    cout << a[i] << ' ';
  cout << endl;
  return 0;
}

Measured memory_bytes: 6720