akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static int s1, s2;
	static int [][] store;
	public static void main(String[] args) {
		while(read()){
			solve();
		}
	}
	static boolean read(){
		s1 = sc.nextInt(); s2 = sc.nextInt();
		if(s1 == 0 && s2 == 0)return false;
		store = new int[2][5];
		store[1][0] = s1 + s2;
		store[0][0] = 'A';
		for(int i = 1; i < 5; i++){
			s1 = sc.nextInt(); s2 = sc.nextInt();
			store[1][i] = s1 + s2;
			store[0][i] = 'A' + i;
		}
		return true;
	}
	static void solve(){
		int max = store[1][0];
		char index = (char) store[0][0];
		for(int i = 1; i < 5; i++){
			if(max < store[1][i]){
				max = store[1][i];
				index = (char) store[0][i];
			}
		}
		System.out.print(index + " ");
		System.out.println(max);
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> V(N);
  vector<int> C(N);
  for(int i=0;i<N;i++){
    cin>>V.at(i);
  }
  for(int i=0;i<N;i++){
    cin>>C.at(i);
  }
  int sum=0;
  for(int i=0;i<N;i++){
    if(V.at(i)>=C.at(i)){
      sum+=V.at(i)-C.at(i);
    }
  }
  cout<<sum<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int i,j,n,m,d,x,mas[100005],rez;
int main()
{
    std::cin.sync_with_stdio(false);
    std::cin.tie(0);
    cin >> n;
    cin >> d >> x;
    i=0;
    while (i<n)
    {
        cin >> mas[i];
        rez+=(d-1)/(mas[i]);
        rez++;
        //cout << rez << "\n";
        i++;
    }
    i=0;
    while (i<n)
    {

        i++;
    }
    cout << rez+x;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X))
#define rrep(X, Y) for (int(X) = (Y)-1; (X) >= 0; --(X))
#define itrep(X, Y) for (auto(X) = (Y).begin(); (X) != (Y).end(); (X)++)
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

void solve(long long N, long long A, long long B) {
  if ((B - A) % 2 == 0) {
    print("Alice");
  } else {
    print("Borys");
  }
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  solve(N, A, B);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fr(i,k,n) for(int i=k;i<n;i++)
#define read(x) cin>>x
#define ll long long int
#define mod 1000000007 
#define print(x) cout<<x<<endl
#define pb(x) push_back(x)
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
pair<unsigned ll,unsigned ll> sum(int n){
  unsigned ll ans1,ans2;
  pair<unsigned ll,unsigned ll>ans;
  ans1=(unsigned ll )((n*(n+1))/2);
   ans.first=ans1 ;
  ans2=(unsigned ll)(n*(n+1)*(2*n+1))/6;
  ans.second=ans2 ;
 
  return ans;
   
  
}
int main() { 
    fastIO;
     int t=1,n,k;
    // cin>>t;
     while(t--){cin>>n>>k;
                unsigned ll ans=0;
      fr(i,k,n+2){
        ans+=(unsigned ll)  (n-i+1)*i +1 ;
         ans=ans% mod;
      }
      // ans=ans% mod;
              //  if(k==0)
                //  ans=0;
         cout<<ans <<endl;       
         
         
     }
	 
	return 0;
}
     

Measured memory_bytes: 3664
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 == 1) {
			System.out.println(1);
			return;
		}

		if (a <= b) {
			System.out.println(a);
		} else {
			System.out.println(a - 1);
		}

		sc.close();

	}

}


Measured memory_bytes: 35652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

ll gap(ll x, ll h, ll w) {
	ll a = x * w;
	ll b1 = w / 2 * (h - x);
	ll c1 = h * w - a - b1;
	ll b2 = (h - x) / 2 * w;
	ll c2 = h * w - a - b2;
	ll ans1 = max({a, b1, c1}) - min({a, b1, c1});
	ll ans2 = max({a, b2, c2}) - min({a, b2, c2});
	return min(ans1, ans2);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll h, w;
	cin >> h >> w;

	ll ans = inf;
	for (ll i = 1; i < h; i++) ans = min(ans, gap(i, h, w));
	for (ll j = 1; j < w; j++) ans = min(ans, gap(j, w, h));
	cout << ans << endl;
}


Measured memory_bytes: 256
//include,using,define等
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>

// ===============================================================
//using系
#pragma region header
using namespace std;
using ll = long long;
using lint = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using qul = queue<ll>;
using pql = priority_queue<ll>;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#pragma region header
//#define int long long
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define INF (ll)10000000000000000
#define mod (ll)1000000007
#define P pair<lint,lint>
#pragma endregion
#pragma endregion



int main(void) {
	string s; cin >> s;
	set<char> se;
	se.insert('A');
	se.insert('G');
	se.insert('C');
	se.insert('T');
	lint cnt = 0;
	lint ans = 0;
	for (int i = 0; i < s.size(); i++) {
		if (se.count(s[i])) cnt++;
		else cnt = 0;
		ans = max(ans, cnt);
	}
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 3624
n, m = map(int, input().split())
a = [list(input()) for i in range(n)]
b = [list(input()) for i in range(m)]

for i in range(n - m + 1):
    for j in range(n - m + 1):
        ans = 0
        for k in range(m):
            if b[k] == a[i+k][j:j+m]:
                ans += 1
        if ans == m:
            print('Yes')
            exit()
print('No')


Measured memory_bytes: 39536
n = int(input())
d = [list(map(int, input().split())) for _i in range(n)]

c = 0
for i, j in d:
    if i==j:
        c += 1
        if c == 3:
            print('Yes')
            import sys
            sys.exit()
    else:
        c = 0
print('No')
        

Measured memory_bytes: 9168
/*input
999
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define REP(i,j,k)     for(int i = j ; i < k ; ++i)
#define RREP(i,j,k)    for(int i = j ; i >=k ; --i)
#define A    first
#define B    second
#define mp   make_pair
#define pb   emplace_back
#define PII pair<int , int>
#define MEM(i,j)   memset(i , j , sizeof i)
#define ALL(i)     i.begin() , i.end()
#define DBGG(i,j)     cout << i << " " << j << endl
#define DB4(i,j,k,l)  cout << i << " " << j << " " << k << " " << l << endl
#define IOS cin.tie(0) , cout.sync_with_stdio(0)
#define endl "\n"
///------------------------------------------------------------
#define MAX 
#define INF 0x3f3f3f3f

int n , ans = 1;
int32_t main(){
	IOS;
	cin >> n;
	REP(i , 2 , n + 1){
		int val = i , cnt = 1;
		while(val * i <= n){
			val *= i;
			cnt ++;
			ans = max(ans , val);
		}
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
task = []
for i in range(N):
  task.append(tuple(map(int,input().split())))
task = sorted(task,key=lambda x:x[1])

worktime = 0
for work, limit in task:
  worktime += work
  if worktime > limit:
    print("No")
    break
else:
  print("Yes")

Measured memory_bytes: 83256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;
  vector<int> vec(n);
  rep(i, n) {
    cin >> vec[i];
  }
  bool ok = true;
  for(int j = 0; j < n-1; j++) {
    if (vec[j] >= vec[j+1]) {
      ok = false;
      break;
    }
  }
  if (ok) {
    cout << "YES" << endl;
    return 0;
  }
  rep(i, n) {
    for(int j = i+1; j < n; j++) {
      swap(vec[i], vec[j]);
      bool ok = true;
      for(int k = 0; k < n-1; k++) {
        if (vec[k] >= vec[k+1]) {
          ok = false;
          break;
        }
      }
      if (ok) {
        cout << "YES" << endl;
        return 0;
      }
      swap(vec[i], vec[j]);
    }
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int sosu(int n){
	int i;
	if(n==1)return 0;
	if(n==2)return 1;
	for(i=2; i<=sqrt(n); i++){
		if(n%i==0)return 0;
	}
	return 1;
}

int a[1000000];
int b[1000000];

int main(){
	int i;
	for(i=2; i<1000000; i++)a[i]=sosu(i);
	for(i=2; i<1000000; i++){
		b[i]=b[i-1];
		if(a[i]==1)b[i]++;
	}
	while(scanf("%d",&i)!=EOF){
		printf("%d\n",b[i]);
	}
	return 0;
}

Measured memory_bytes: 8404
def solver(s, k):
    res = 0
    cnt = [1]
    for i in range(1, len(s)):
        if s[i] == s[i - 1]:
            cnt[-1] += 1
        else:
            cnt.append(1)
    for x in cnt:
        res += (x // 2) * k

    if len(cnt) == 1: #全部同じ場合はここでおわり
        return (len(s) * k) // 2

    if s[0] == s[-1]:
        res -= (cnt[0] // 2) * (k - 1) + (cnt[-1] // 2) * (k - 1)
        res += ((cnt[0] + cnt[-1]) // 2) * (k - 1)
    return res

def solver2(s, k):
    t = []
    for _ in range(k):
        t += s
    res = 0
    cnt = 1
    for i in range(1, len(t)):
        if t[i] == t[i - 1]:
            cnt += 1
        else:
            res += cnt // 2
            cnt = 1
    res += cnt // 2
    return res

s = input()
k = int(input())

#ss = s
#kk = k
print(solver(s, k))
#print(solver2(ss, kk))

#　ランダムな英小文字列の生成
import random
import string

# n := 文字列の長さ
def randomCharacter(n):
   alphabet_m = string.ascii_lowercase
   return ''.join([random.choice(alphabet_m) for _ in range(n)])


#for i in range(40):
#    if i == 0:
#        st = 'aaaaaaaaa'
#    elif i == 1:
#        st = 'a'
#    else:
#        l = random.randrange(1, 10)
#        st = randomCharacter(l)
#    sstt = st
#    cnt = 4
#    cnst_st = st[:]
#    res1 = solver(st, cnt)
#    res2 = solver2(sstt, cnt)
#    if res1 == res2:        
#        print("OK!")
#    else:
#        print(''.join(cnst_st), res1, res2)
        


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

int a[200010];
int main()
{
   int mn=INT_MAX;
    int i,j,n,m,cnt=0;

    cin>>n;

    for(i=0; i<n; i++)
        cin>>a[i];

    for(i=0; i<n; i++)
    {
        if(mn>a[i])
        {
            mn=a[i];
            cnt++;
        }
    }
    cout<<cnt<<endl;

}


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

int main() { 
  int a, b, c, n;
  cin >> a >> b >> c >> n;
  int count = 0;
  
  for (int i = 0; i <= a; i++) {
    for (int j = 0; j <= b; j++) {
      for (int k = 0; k <= c; k++) {
        int total = (500 * i) + (100 * j) + (50 * k);
        if (total == n) count++;
      }
    }
  }
  
  cout << count << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n, t;
	cin >> n >> t;
	
	vector<int> x(n);
	for(int i = 0; i < n; i++)
	{
		cin >> x[i];
	}
	
	int ans = 0;
	for(int i = 0; i < n; i++)
	{
		if(i == 0)
		{
			ans += t;
		}
		if(x[i] - x[i - 1] >= t)
		{
			ans += t;
		}
		else
		{
			ans += t - (t - (x[i] - x[i - 1]));
		}
	}
	
	cout << ans << endl;
	return 0;
}	

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

typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define foreach(itr,a) for(__typeof((a).begin()) itr=(a).begin(); itr!=(a).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define pb push_back

int w, h, ans=0;
int sx, sy;
int f[21][21];
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

bool ng(int x, int y) {
    return (x<0 or y<0 or x>=w or y>=h);
}

void dfs(int x, int y, int depth) {
    if(depth+1 >= ans) return;

    rep(i, 4) {
        int nx = x + dx[i], ny = y + dy[i];

        if(!ng(nx,ny) and f[ny][nx] != 1) {
            while(!ng(nx,ny)) {
                // goal
                if(f[ny][nx] == 3) {
                    ans = min(ans, depth+1);
                    return;
                }

                if(f[ny][nx] == 1) {
                    f[ny][nx] = 0;
                    dfs(nx - dx[i], ny - dy[i], depth+1);
                    f[ny][nx] = 1;
                    break;
                }
                nx += dx[i]; ny += dy[i];
            }
        }
    }

    return ;
}

int main() {
    while(cin>>w>>h and w) {
        rep(i,h) rep(j,w) {
            cin >> f[i][j];
            if(f[i][j] == 2) {
                sx=j; sy=i;
                f[i][j] = 0;
            }
        }
        
        ans = 11;
        dfs(sx, sy, 0);
        if(ans <= 10)
            cout << ans << "\n";
        else
            cout << -1 << "\n";
    }

    return 0;
}

Measured memory_bytes: 1160
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
#pragma GCC target("avx2")  //Enable AVX

using namespace std;

using ll = long long;

#define mp make_pair

const int p = 1000000007;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

/*struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};*/

/*const int N = 1000000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

bool ask(int a, int b)
{
    cout<<"?"<<' '<<a<<' '<<b<<endl;
    string s;
    cin>>s;
    if (s=="Y") return true;
    else return false;
}

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

    int a, b;
    cin>>a>>b;
    if (a<=b) {cout<<"Impossible"; return 0;}
    stack<int> st;
    st.push(0);
    for (int i = 1; i<a+b; i++)
    {
        if (st.empty()) st.push(i);
        else
        {
            int x = st.top();
            if (ask(i, x)) st.push(i);
            else st.pop();
        }
    }
    while (st.size()>1) st.pop();
    int good = st.top();
    string s;
    for (int i = 0; i<a+b; i++) if (ask(good, i)) s+='1'; else s+='0';
    cout<<"! "<<s<<endl;
}

Measured memory_bytes: 848
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var A = int.Parse(Console.ReadLine());
            var B = int.Parse(Console.ReadLine());
            var C = int.Parse(Console.ReadLine());
            var X = int.Parse(Console.ReadLine());
            var count = 0;
            for (int a = 0; a <= A; a++)
            {
                for (int b = 0; b <= B; b++)
                {
                    for (int c = 0; c <= C; c++)
                    {
                        if (500 * a + 100 * b + 50 * c == X)
                        {
                            count++;
                        }
                    }
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1e9+7
using namespace std;
typedef long long ll;
const double pi=acos(-1);

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;}

int main(){
    int x;
    cin >> x;
    if(x==0) cout << 1 << endl;
    else cout << 0 << endl;
}

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

int main() {
  int N; cin >> N;
  string s; cin >> s;
  vector<int> dp1(N+1,0), dp2(N+1,0);
  for (int i = 0; i < N; i++) {
    dp1[i+1] += dp1[i];
    dp2[N-i-1] += dp2[N-i];
    if (s[i] == '#') dp1[i+1]++;
    if (s[N-i-1] == '.') dp2[N-i-1]++;
  }
  int ans = 1e9;
  for (int i = 0; i <= N; i++) {
    ans = min(ans, dp1[i] + dp2[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2180
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, char> P;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k; cin >> n >> k;
    string s; cin >> s;
    vector<P> v;
    char ch = s[0];
    int cnt = 0;
    if(s[0] == '0') v.push_back(P(0, '1'));
    for(int i = 0; i < s.size(); i++)
    { 
        if(s[i] != ch)
        {
            v.push_back(P(cnt, ch));
            ch = s[i];
            cnt = 0;
        }
        cnt++;
    }
    if(s.back() == '0') v.push_back(P(0, '1'));
    if(cnt != 0) v.push_back(P(cnt, ch));
    vector<int> sum(v.size() + 1, 0);
    for(int i = 0; i < v.size(); i++) sum[i + 1] = sum[i] + v[i].first;
    //for(int i = 0; i < v.size(); i++) cout << v[i].first << " " << v[i].second << " " << endl;
    //for(int i = 0; i < sum.size(); i++) cout << sum[i] << " "; cout << endl;
    int ans = 0;
    for(int i = 1; i < sum.size(); i += 2)
    {
        while(i + 2 * k >= sum.size()) k--;
        int tmp = sum[i + 2 * k] - sum[i - 1];
        //cout << i + 2 * k << " " << tmp << endl;
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1604
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a,b;
    cin>>a>>b;
    if(a==b)
    {
    	cout<<"="<<endl;
    	return 0;
	}
	if(a<b)
	{
		cout<<"<"<<endl;
		return 0;
	}
	cout<<">"<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n; cin>>n;
    set<int> st;
    for(int i=1; i<=9; i++){
        for(int j=1; j<=9; j++){
            st.emplace(i * j);
        }
    }

    if(st.find(n) != st.end()){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> v(m);
    rep(i, m){
        cin >> v[i].first >> v[i].second;
    }
    auto w = v;
    sort(all(w));
    map<pair<int, int>, string> mp;
    int x = 1, y = 1;
    repe(i, w){
        if(x < i.first){
            x = i.first; y = 1;
        }
        ostringstream sout;
        sout << setfill('0') << setw(6) << x << setw(6) << y;
        mp[i] = sout.str();
        // cout << sout.str() << endl;
        y++;
    }
    repe(i, v){
        cout << mp[i] << endl;
    }
}

Measured memory_bytes: 14208
#include <bits/stdc++.h>
    #define REP(i, n) for(int i = 0;i < n;i++)
    #define REPR(i, n) for(int i = n;i >= 0;i--)
    #define FOR(i, m, n) for(int i = m;i < n;i++)
    #define FORR(i, m, n) for(int i = m;i >= n;i--)
    #define SORT(v, n) sort(v, v+n);
    #define VSORT(v) sort(v.begin(), v.end());
    #define llong long long
    #define pb(a) push_back(a)
    #define INF
    using namespace std;
    typedef pair<int, int> P;
    typedef pair<llong, llong> LP;
    typedef pair<int, P> PP;
    typedef pair<llong, LP> LPP;
    //vector<tuple<long long, long long, long long>>vec;

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


    int main()
    {
        int a,b,c;
        cin>>a>>b>>c;
        if(a<=c&&c<=b) cout<<"Yes"<<endl;
        else if(a>=c&&c>=b) cout<<"Yes"<<endl;
        else    cout<<"No"<<endl;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
const ll ATCODER_AMARI = 1000000007; //10^9 + 7
const ll INF = 10000000000000;

//階乗関数　ATCODER_AMARIに注意
ll factorial(ll k){
  ll sum = 1;
  for(int i = 1 ; i < k + 1; i++) {
    sum *= i;
    //sum = sum % ATCODER_AMARI;
  }
  return sum;
}

int main() {
  vector<ll> alp(3);
  cin >> alp.at(0) >> alp.at(1) >> alp.at(2);

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

  ll maxnum = alp.at(2);
  ll midnum = alp.at(1);
  ll minnum = alp.at(0);

  ll ans_count = 0;

  if( ( maxnum - midnum ) % 2 == 0 && (maxnum - minnum) % 2 == 0){
    ans_count += (maxnum - midnum) / 2 + (maxnum - minnum) / 2;
  }
  else if(( maxnum - midnum ) % 2 != 0 && (maxnum - minnum) % 2 != 0) {
    ans_count++;
    midnum++;
    minnum++;
    ans_count += (maxnum - midnum) / 2 + (maxnum - minnum) / 2;
  }
  else if(( maxnum - midnum ) % 2 == 0 && (maxnum - minnum) % 2 != 0){
    ans_count += (maxnum - midnum) / 2;
    ans_count++;
    maxnum++;
    midnum++;

    ans_count += (maxnum - minnum) / 2;
  }
  else if(( maxnum - midnum ) % 2 != 0 && (maxnum - minnum) % 2 == 0){
    ans_count += (maxnum - minnum) / 2;
    ans_count++;
    maxnum++;
    minnum++;

    ans_count += (maxnum - midnum) / 2;
  }

  cout << ans_count << endl;
}


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

using namespace std;

#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()

const int MX = (int)1e5 + 10;
// const int mod = (int)1e9 + 7;

int main(int argc, char* argv[]){

    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(0);

    int n, m;
    cin >> n >> m;

    vector<pair<int, int>> a(n);
    set<int> st;
    for(int i = 0; i < m; ++i) st.insert(i);
    for(int i = 0; i < n; ++i){
        cin >> a[i].Y >> a[i].X;
    }

    sort(all(a), [&](pair<int, int> x, pair<int, int> y){
        if(x.X != y.X) return x.X > y.X;
        else return x.Y > y.Y;
    });

    int res = 0;

    for(int i = 0; i < n; ++i){
        if(st.empty()) break;
        auto it = st.lower_bound(m - a[i].Y);
        if(it == st.end() || *it > m - a[i].Y) it--;
        if(it != st.end() && *it <= m - a[i].Y){
            res += a[i].X;
            st.erase(it);
        }
    }

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

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<int, int> pii;
const int M = 1e5+7;
const ll MAX = 1e15;
const ll MOD = 1e9+7;

ll modpow(ll a, ll n) {
    if(n==0) return 1;
    ll x = modpow(a, n/2);
    if(n&1LL) return x*x%MOD*a%MOD;
    return x*x%MOD;
}

void solve() {
    ll n;
    cin>>n;
   // cout<<modpow(10, n)<<endl;
    ll ans = modpow(10, n) - 2*modpow(9, n)%MOD + modpow(8, n);
    cout<<(ans + MOD*5)%MOD;
}

int main() {
    ios::sync_with_stdio(0);
  //  freopen("input.txt","r",stdin);
    if(0) {
        int t;
        cin>>t;
        for(int i=1; i<=t; i++) {
            solve();
            cout<<"\n";
        }
    } else solve();
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define SORT(a) sort(a.begin(),a.end())

int main() {
	
	//vector<int> a(n);
	//cout << "test" << endl;

	cin.tie(0);
	ios::sync_with_stdio(false);
	
	//string ans="YES";


	int n,l;
	cin >> n >> l;
	
	int ans=0;
	
	
	vector<int> a(n);
	
	rep(i,n) {
		a[i]=l+i;
		//cout << a[i] << endl;
	}
		
	
	rep(i,n+l){
		rep(j,n){
			if(a[j]==i) {
				a.erase(a.begin() + j);
				//cout << "j" << j << endl;
				i=n+l;
				j=n;
			}
		}
	}
	
	rep(i,n-1) ans+=a[i];
		
	
	cout << ans << "\n";
	
	
	return 0;

    }

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

int main(int argc, char **argv)
{
	ll N; cin >> N;
	vector<ll> A(N);
	REP(i, N) cin >> A[i];
	auto mat = max_element(ALL(A));
	auto mit = min_element(ALL(A));
	ll maid = mat - A.begin();
	ll miid = mit - A.begin();
	ll ma = *mat;
	ll mi = *mit;

	vector<pair<ll, ll>> res;
	if (ma >= 0 && mi >= 0)
	{
		REP(i, N-1)
			res.push_back(P(i, i+1));
	}
	else if (ma <= 0 && mi <= 0)
	{
		for (ll i = N-1; i > 0; --i)
			res.push_back(P(i, i-1));
	}
	else if (abs(ma) >= abs(mi))
	{
		REP(i, N)
		{
			if (i == maid) continue;
			res.push_back(P(maid, i));
		}

		REP(i, N-1)
			res.push_back(P(i, i+1));
	}
	else
	{
		REP(i, N)
		{
			if (i == miid) continue;
			res.push_back(P(miid, i));
		}

		for (ll i = N-1; i > 0; --i)
			res.push_back(P(i, i-1));
	}

	std::cout << res.size() << std::endl;
	for (auto &p : res)
	{
		std::cout << p.first+1 << " " << p.second+1 << std::endl;
	}
}


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

using namespace std;
using ll = long long int;

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


Measured memory_bytes: 256
/// Happy BANGLA NEW YEAR TO EVERYONE
/// Date: 14-April-2018
/// MD:NUR ALAM
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main(){


    ll a,b,c;
    cin>>a>>b>>c;
    if(a==c || (c>a && a+b>=c))cout<<"YES";
    else cout<<"NO";
}


Measured memory_bytes: 256
X,Y,Z,K = list(map(int,input().split()))
A = sorted(list(map(int,input().split())),reverse=True)
B = sorted(list(map(int,input().split())),reverse=True)
C = sorted(list(map(int,input().split())),reverse=True)

ma,mb,mc = A[0],B[0],C[0]
sA = [a-ma for a in A] + [-10**15]
sB = [b-mb for b in B] + [-10**15]
sC = [c-mc for c in C] + [-10**15]

ia,ib,ic = 0,0,0
while min(10**7,(X)*(Y)*(Z)) > (ia+1)*(ib+1)*(ic+1):
    m = max(sA[ia+1],sB[ib+1],sC[ic+1])
    if ia < (X-1) and sA[ia+1] == m:
        ia = min(ia+1,X-1)
    if ib < (Y-1) and sB[ib+1] == m:
        ib = min(ib+1,Y-1)
    if ic < (Z-1) and sC[ic+1] == m:
        ic = min(ic+1,Z-1)
ans = []
for a in A[:ia+1]:
    for b in B[:ib+1]:
        for c in C[:ic+1]:
            ans.append(a+b+c)
ans.sort(reverse=True)
for out in ans[:K]:
    print(out)


Measured memory_bytes: 245928
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
inline void read(ll &x){
    x=0;static char ch;static bool flag;flag = false;
    while(ch=getchar(),ch<'!');if(ch == '-') ch=getchar(),flag = true;
    while(x=10*x+ch-'0',ch=getchar(),ch>'!');if(flag) x=-x;
}
#define rg register int
#define rep(i,a,b) for(rg i=(a);i<=(b);++i)
#define per(i,a,b) for(rg i=(a);i>=(b);--i)
const ll maxn = 100010;
ll a[maxn],d[maxn],n,m;
inline ll f(ll x){
    ll res = 0;
    rep(i,2,n){
	res += min(d[i],(a[i]-x+m) % m);
    }return res;
}
ll lazy[maxn<<2],tag[maxn<<2],num[maxn<<2];
void modify(ll rt,ll l,ll r,ll L,ll R,ll v){
    if(L <= l && r <= R){
	lazy[rt] += v;
	return ;
    }
    ll mid = l+r >> 1;
    if(L <= mid) modify(rt<<1,l,mid,L,R,v);
    if(R >  mid) modify(rt<<1|1,mid+1,r,L,R,v);
}
void insert(ll rt,ll l,ll r,ll L,ll R,ll s){
    if(L <= l && r <= R){
//	printf("[%d,%d] <= %d\n",l,r,s);
	tag[rt] += s;++ num[rt];
	return ;
    }
    ll mid = l+r >> 1;
    if(R <= mid) insert(rt<<1,l,mid,L,R,s);
    else if(L > mid) insert(rt<<1|1,mid+1,r,L,R,s);
    else{
	insert(rt<<1,l,mid,L,mid,(R-mid)+s);
	insert(rt<<1|1,mid+1,r,mid+1,R,s);
    }
}
ll res;
void query(ll rt,ll l,ll r,ll p){
//    printf("lazy[%d,%d] = %d\n",l,r,lazy[rt]);
//    printf("tag[%d,%d] = %d\n",l,r,tag[rt]);
//    printf("num[%d,%d] = %d\n",l,r,num[rt]);
    res += lazy[rt];
    res += tag[rt] + num[rt]*(r - p);
    if(l == r) return ;
    ll mid = l+r >> 1;
    if(p <= mid) query(rt<<1,l,mid,p);
    else query(rt<<1|1,mid+1,r,p);
}
int main(){
    read(n);read(m);
    rep(i,1,n){
	read(a[i]);
	if(i > 1){
	    ll x = (a[i] - a[i-1] + m) % m;
	    if(a[i] > a[i-1]){
		modify(1,1,m,1,a[i-1],x);
		if(a[i]+1 <= m) modify(1,1,m,a[i]+1,m,x);
		if(a[i-1]+1 <= a[i]) insert(1,1,m,a[i-1]+1,a[i],1);
	    }else{
		modify(1,1,m,a[i]+1,a[i-1],x);
		insert(1,1,m,1,a[i],1);
		if(a[i-1]+1 <= m) insert(1,1,m,a[i-1]+1,m,a[i]+1);
	    }
	}
    }
    ll ans = 1LL << 60;
    rep(i,1,m){
	res = 0;query(1,1,m,i);
	ans = min(ans,res);
	//printf("at i = %d,res = %d\n",i,res);
    }
    //rep(x,1,m) printf("f(%d) = %d\n",x,f(x));
    printf("%lld\n",ans);
    return 0;
}


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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100005;

ll par[MAX],cnt[MAX];

void init(ll n){
    for(int i=0;i<n;i++){
        par[i]=i;
        cnt[i]=1;
    }
}

int root(int a){
    if(par[a]==a) return a;
    else return par[a]=root(par[a]);
}

void unite(int a,int b){
    if(root(a)!=root(b)){
        cnt[root(a)]+=cnt[root(b)];
        par[root(b)]=root(a);
    }
}

bool check(int a,int b){
    return root(a)==root(b);
}

int main(){
    
    ll N;
    int M;cin>>N>>M;
    ll ans=N*(N-1)/2;
    vector<ll> S;
    vector<pair<int,int>> T(M);
    
    S.push_back(ans);
    
    for(int i=0;i<M;i++){
        int a,b;cin>>a>>b;
        a--;b--;
        T[i]=make_pair(a,b);
    }
    
    init(N);
    
    for(int i=M-1;i>=0;i--){
        int a=T[i].first,b=T[i].second;
        if(check(a,b)){
             if(i) S.push_back(ans);
        }else{
            ans+=cnt[root(a)]*(cnt[root(a)]-1)/2;
            ans+=cnt[root(b)]*(cnt[root(b)]-1)/2;
            //ans-=cnt[root(a)]*cnt[root(b)];
            unite(a,b);
            ans-=cnt[root(a)]*(cnt[root(a)]-1)/2;
            if(i) S.push_back(ans);
        }
    }
    
    reverse(all(S));
    
    for(int i=0;i<S.size();i++){
        cout<<S[i]<<endl;
    }
    
    //cout<<S.size()<<endl;
}


Measured memory_bytes: 4596
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

string s[100001];
ll a[5] = {};
int main() {
	ll n; cin >> n;
	rep(i, 0, n) {
		cin >> s[i];
		if (s[i][0] == 'M') a[0] ++;
		else if (s[i][0] == 'A') a[1] ++;
		else if (s[i][0] == 'R') a[2] ++;
		else if (s[i][0] == 'C') a[3] ++;
		else if (s[i][0] == 'H') a[4] ++;
	}

	ll ans = 0;
	rep(i, 0, 5) {
		rep(j, i + 1, 5) {
			rep(k, j + 1, 5) {
				ans += a[i] * a[j] * a[k];
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6144
#include<iostream>
using namespace std;
int main()
{
    int n,i,c=0;
    cin>>n;
    int a[n];
    for(i=1;i<=n;i++)
    {
        cin>>a[i];

    }
    for(i=1;i<=n;i+=2)
    {
        if(a[i]%2==1)
        {
            c++;
        }
    }
    cout<<c<<endl;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main() {
	ll n,p;
	cin>>n>>p;
	string s;
	cin>>s;
	reverse(s.begin(),s.end());
	ll ch[200010];
	if(p==2||p==5){
		ll ans=0;
		for(ll i=0;i<n;i++){
			ll now=s[i]-'0';
			if(now%p==0){
				ans+=n-i;
			}
		}
		cout <<ans;
		return 0;
	}
    // 3^45 mod. 1000000007 を計算してみる
    //cout << modpow(3, 45, 1000000007) << endl;	
	for(ll i=0;i<n;i++){
		ll now=s[i]-'0';
		now=now*modpow(10,i,p);
		now%=p;
		ch[i]=now;
		//cout << ch[i]<<endl;
	}
	//cout <<endl;
	ll ch2[200010];
	ch2[0]=0;
	map<ll,ll>q;
	ll ans=0;
	for(ll i=0;i<n;i++){
		ch2[i+1]=ch2[i]+ch[i];
		ch2[i+1]%=p;
		q[ch2[i+1]]++;
		if(ch2[i+1]==0){
			ans+=q[ch2[i+1]];
		}
		else{
			ans+=q[ch2[i+1]]-1;
		}
		//cout << ch2[i+1]<<" "<<ans<<endl;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 7344
#include <iostream>
#include <array>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>

using namespace std;
using ll = long long;

ll W, H;
vector<string> grid;

void input() {
    cin >> H >> W;
    grid.resize(H);
    for (int i = 0; i < H; i++) {
        cin >> grid[i];
    }
}

struct Data {
    ll h, w;
    ll r;
};

ll solve() {
    vector<vector<ll>> costmap(H, vector<ll>(W, numeric_limits<ll>::max()));
    int dp[4][2] = {
        {0,-1},
        {-1,0},
        {0,1},
        {1,0}
    };
    queue<Data> Q;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (grid[i][j] == '.')
                continue;
            Q.push({i,j,0});
            costmap[i][j] = 0;
        }
    }
    while (not Q.empty()) {
        auto q = Q.front(); Q.pop();
        for (auto ddp : dp) {
            auto nh = q.h+ddp[0], nw = q.w+ddp[1];
            if (min(nh, nw) < 0 or nh >= H or nw >= W or
                grid[nh][nw] == '#' or
                costmap[nh][nw] <= q.r+1)
                continue;
            costmap[nh][nw] = q.r+1;
            Q.push({nh, nw, q.r+1});
        }
    }
    ll ans = 0;
    for (auto& l : costmap) {
        for (auto c : l) {
            ans = max(ans, c);
//            cerr << c << ' ';
        }
//        cerr << endl;
    }
    return ans;
}

int main() {
    input();
    cout << solve() << endl;
    //    solve();
    
    return 0;
}



Measured memory_bytes: 33280
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
using namespace std;




int main() {


	int a,n;

	

	cin >> a;
	cin >> n;

	a = a * 3;
	a += n;

	a /= 2;






	printf("%d\n",a);
	
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please



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


	ll N, P;
	cin >> N >> P;

	int A[1000001] = {};
	for (int i = 2; i <= 1000000; i++) {
		while (P % i == 0) {
			P /= i;
			A[i]++;
		}
	}

	ll kotae = 1;
	if (P != 1 && N == 1) kotae *= P;
	rep1(i, 1000000) {
		int kari = A[i] / N;
		kotae *= pow(i, kari);
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 4224
N=int(input())
A=[0]*N
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      if x**2+y**2+z**2+x*y+y*z+z*x<=N:
        A[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1
for i in range(N):
  print(A[i])

Measured memory_bytes: 9076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz=1e6+5;

int fnc(int n)
{
    return n * (n-1) / 2;
}

int main()
{
    int n,m;
    cin >> n >> m;
    cout << fnc(n) + fnc(m) << endl;
}


Measured memory_bytes: 256
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,a,b = map(int,ipt().split())
    if a > b:
        print(0)
    else:
        print(max(0,(n-2)*b-(n-2)*a+1))

    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 68808
def check(b):
    for x in b:
        if x%2 == 0:
            if x%3 == 0 or x%5 == 0:
                pass
            else:
                return False
    return True

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


if check(a):
    print("APPROVED")
else:
    print("DENIED")


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

int main(int argc,char* argv[]){
  int N;
  long long count=0;
  cin >> N;
  vector<int> L(N);
  for(int i=0;i<N;i++){
    cin >> L[i];
  }
  sort(L.begin(),L.end());
  for(int i=0;i<N-2;i++){
    for(int j=i+1;j<N-1;j++){
      for(int k=j+1;k<N;k++){
	if(L[i]+L[j]>L[k]) {
	  count++;
	}
      }
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF=1001001001;
 
long long int answ(long long int x){
  if(x==1) return 1;
  if(x>1) return 2*answ(x/2)+1;
}

int main() {
    string s;
    cin>>s;
    if(s=="SUN") cout<<7<<endl;
    if(s=="MON") cout<<6<<endl;
    if(s=="TUE") cout<<5<<endl;
    if(s=="WED") cout<<4<<endl;
    if(s=="THU") cout<<3<<endl;
    if(s=="FRI") cout<<2<<endl;
    if(s=="SAT") cout<<1<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}

typedef long long ll;
typedef pair<ll, ll> P;

ll memo[2100][2100];

int main()
{
  ll N, x; cin >> N >> x;
  vector<ll> a(N);
  REP(i, N) cin >> a[i];

  vector<ll> b(a);
  ll ans = LLINF;
  REP(k, N) {
    ll cost = 0;
    REP(i, N) {
      b[i] = min(b[i], a[(N + (i - k)) % N]);
      cost += b[i];
    }
    ans = min(ans, cost + k*x);
  }
  cout << ans << endl;

  return 0;
}

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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);

int n, d;

int main() {

	FAST;

	cin >> n >> d;
	vector <int> x(n + 1), y(n + 1);
	for (int i = 1; i <= n; i ++) {
		cin >> x[i] >> y[i];
	}	
	int ans = 0;
	for (int i = 1; i <= n; i ++) {
		if (1LL * x[i] * x[i] + 1LL * y[i] * y[i] <= 1LL * d * d) ans ++;
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 4780
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    string ans1="";
    for(int i=0;i<tx-sx;i++)ans1+='R';
    for(int i=0;i<ty-sy;i++)ans1+='U';
    for(int i=0;i<tx-sx+ty-sy;i++){
        if(ans1[i]=='R')ans1+='L';
        else ans1+='D';
    }
    string ans2="D";
    for(int i=0;i<tx-sx+1;i++)ans2+='R';
    for(int i=0;i<ty-sy+1;i++)ans2+='U';
    ans2+='L';
    for(int i=0;i<tx-sx+ty-sy+4;i++){
        if(ans2[i]=='R')ans2+='L';
        else if(ans2[i]=='L')ans2+='R';
        else if(ans2[i]=='U')ans2+='D';
        else ans2+='U';
    }
    cout<<ans1<<ans2<<endl;
}


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

int main(void){
  int n,m;
  long long int tmpn=1,tmpm=1,ans;
  int i;
  scanf("%d %d",&n,&m);
  if(abs(n-m)>=2){
    printf("0\n");
    return 0;
  }else{
    for(i=1;i<=n;i++){
      tmpn*=i;
      tmpn%=1000000007;
    }
    for(i=1;i<=m;i++){
      tmpm*=i;
      tmpm%=1000000007;
    }
    ans=tmpn*tmpm;
    ans%=1000000007;
    if(abs(n-m)==0){
      ans*=2;
      ans%=1000000007;
    }
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

bool sortbysec(const pair < pair <string, int>, int > &a, 
              const pair < pair <string, int>, int > &b) 
{
    return (a.first.first < b.first.first) || (a.first.first == b.first.first && a.first.second > b.first.second) || (a.first.first == b.first.first && a.first.second == b.first.second);
}


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

    vector< pair < pair <string, int>, int > > vect;
    for(int i=0; i<n; ++i){
        char str[10];
        cin >> str;
        int temp;
        cin >> temp;
        vect.push_back( make_pair( make_pair(str, temp), i+1) );
    }

    sort(vect.begin(), vect.end(), sortbysec);

    for (vector< pair < pair <string, int>, int > >::iterator it = vect.begin() ; it != vect.end(); ++it){
        // cout << (*it).first.first << " " << (*it).first.second << " " << (*it).second << endl;
        cout << (*it).second << endl;
    }
    
    return 0;
}


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

int main(){
  string S;cin>>S;
  int l=S.size();
  vector<bool> A(26,false);
  for(int i=0;i<l;i++) A.at(S.at(i)-'a')=true;
  int m=-1;
  for(int j=0;j<26;j++){
    if(!A.at(j)){
      m=j;
      break;
    }
  }
  if(m==-1) cout<<"None"<<endl;
  else cout<<(char)('a'+m)<<endl;
}


Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
	string s;
	cin >> s;
    if(s.back()=='s') s += "es";
    else s += "s";
	cout << s << "\n";
	return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>


int temp[5000000],count=0;

void MergeSort(int x[ ], int left, int right);
int main(void);

void MergeSort(int x[ ], int left, int right)
{
    int mid, i, j, k;

    if (left >= right)
        return;


    mid = (left + right) / 2;
    MergeSort(x, left, mid);
    MergeSort(x, mid + 1, right);

    for (i = left; i <= mid; i++)
        temp[i] = x[i];

    for (i = mid + 1, j = right; i <= right; i++, j--)
        temp[i] = x[j];

    i = left;
    j = right;

    for (k = left; k <= right; k++){
        if (temp[i] <= temp[j])
            x[k] = temp[i++];
        else
            x[k] = temp[j--];
        count++;
      }
}

int main(void)
{
    int i,n;
    scanf("%d",&n);
    int x[n];
    for(i=0;i<n;i++){
      scanf("%d",&x[i]);
    }

    MergeSort(x, 0,n - 1);

    for (i = 0; i < n; i++){
        if(i<n-1){
          printf("%d ",x[i]);
        }
        else{
          printf("%d\n",x[i]);
        }
      }
    printf("%d\n",count);
}



Measured memory_bytes: 5588