akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using  namespace  std;

#define PI              acos(-1.0)
#define lcm(a,b)        (a * (b / __gcd(a,b)))
#define en '\n'

#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define trace(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define trace(x...)
#endif

typedef long long int  ll;

int main(void)
{
    //READ_IN;
    char c;
    cin >> c;
    c+=1;
    cout << c << endl;

    return 0;
}


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

using ll = int64_t;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n; std::cin >> n;
  map<int, int> cnt;
  rep(i, n) {
    int a; std::cin >> a;
    cnt[a]++;
  }
  bool ok = true;
  for (auto &k : cnt) {
    if (k.se > 1) ok = false;
  }
  std::cout << (ok ? "YES" : "NO") << "\n";
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N, a, b, c, d;
string s;

int main()
{
    cin >> N >> a >> b >> c >> d;
    cin >> s;
    a--, b--, c--, d--;
    bool flaga = 1, flagb = 1;
    if (c < d)
    {
        for (int i = a; i < c; i++)
        {
            if (s[i] == '#' && s[i + 1] == '#')
                flaga = 0;
        }
        for (int i = b; i < d; i++)
        {
            if (s[i] == '#' && s[i + 1] == '#')
                flagb = 0;
        }
        cout << (flaga && flagb ? "Yes" : "No") << "\n";
    }
    else
    {
        bool th = 0;
        for (int i = b - 1; i < d; i++)
        {
            if (s[i] == '.' && s[i + 1] == '.' && s[i + 2] == '.')
                th = 1;
        }
        for (int i = a; i < c; i++)
        {
            if (s[i] == '#' && s[i + 1] == '#')
                flaga = 0;
        }
        for (int i = b; i < d; i++)
        {
            if (s[i] == '#' && s[i + 1] == '#')
                flagb = 0;
        }
        cout << (th && flaga && flagb ? "Yes" : "No") << "\n";
    }
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
#define endl '\n'

#define v(type) vector<type>
#define p(type1, type2) pair<type1 , type2>
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[MAX];

void solve() {
    int n;
    cin>>n;
    int mini = 15;
    for(int i = 1 ; i * i <= n ; i++){
        if(n % i == 0){
            mini = min(mini , max((int)log10(i) , (int)log10(n / i)) + 1);
        }
    }
    cout<<mini<<endl;
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}

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

void main()
{
    auto lrd = readln.split.to!(int[]);
    auto L = lrd[0];
    auto R = lrd[1];
    auto d = lrd[2];
    int c;
    foreach (i; L..R+1) if (i%d == 0) ++c;
    writeln(c);
}

Measured memory_bytes: 2728
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
	int n; scanf("%d", &n);
	int dp[100001];
	for(int i = 0; i <= n; i++) dp[i] = i;
	for(int i = 6; i <= n; i *= 6) for(int j = 0; j < 5; j++) for(int k = n; k >= i; k--){
		dp[k] = min(dp[k], dp[k - i] + 1);
	}
	for(int i = 9; i <= n; i *= 9) for(int j = 0; j < 8; j++) for(int k = n; k >= i; k--){
		dp[k] = min(dp[k], dp[k - i] + 1);
	}
	printf("%d\n", dp[n]);
	return 0;
}

Measured memory_bytes: 512
import java.util.*;

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = a-1;

        if (b==1){
            System.out.println(0);
        }else {

            int n = 1;

            while (a < b) {
                a += c;
                n++;
            }
            System.out.println(n);
        }
    }
}


Measured memory_bytes: 23124
#include<iostream>

using namespace std;

int main (){
	int W,H,x,y,r;
	cin>>W>>H>>x>>y>>r;

	//if(W>=2*r+x && H>=2*r+y){
	if(x-r>=0 && y-r>=0 && x+r<=W &&y+r<=H){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}




	return 0;
}

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

int main() {
  int N, a=0, b;
  cin >> N;
  
  for (int i=0; i<N; i++) {
    int l, r;
    cin >> l >> r;
    b = r-l+1;
    a += b;
  }
  cout << a << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define mset(s,_) memset(s,_,sizeof s)
using namespace std;
const int maxn=2e5+10;
int n,q,a[maxn],mm,head[maxn];

struct node{
	int to,nxt;
}edge[maxn<<1];

void add(int x,int y){
	edge[++mm]={y,head[x]};
	head[x]=mm;
}

void dfs(int x,int f){
	a[x]+=a[f];
	for(int i=head[x];i;i=edge[i].nxt){
		int to=edge[i].to;
		if(to!=f) dfs(to,x);
	}
}

int main(){
	cin>>n>>q;
	rep(i,1,n-1){
		int x,y;
		cin>>x>>y;
		add(x,y);
		add(y,x);
	}
	while(q--){
		int x,w;
		cin>>x>>w;
		a[x]+=w;
	}
	dfs(1,0);
	rep(i,1,n) cout<<a[i]<<' ';
	cout<<'\n';
	return 0;
}


Measured memory_bytes: 13312
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    String c = sc.next();
    if(a.substring(a.length() - 1).equals(b.substring(0, 1)) && b.substring(b.length() -1).equals(c.substring(0,1))){
      System.out.println("YES");
    }
    else
       System.out.println("NO");
  }
}


Measured memory_bytes: 21972
#include <cstdint>
#include <stdexcept>
#include <utility>

using namespace std;

void bubble_sort(int32_t array[], size_t size, void (*callback)(int32_t arrary[], size_t size))
{
  if (array == nullptr) throw runtime_error("array is null");

  for (uint32_t i = 0; i < size; i++) {
    for (uint32_t j = size - 1; j > i; j--) {
      if (array[j] < array[j - 1]) {
        swap(array[j - 1], array[j]);
        if (callback != nullptr) {
          callback(array, size);
        }
      }
    }
  }
}

#if !defined(TEST)
#include <iostream>
static int32_t count;
void callback(int32_t array[], size_t size)
{
  count++;
}

int32_t main(void)
{
  int32_t len;
  cin >> len;

  int32_t array[128];

  for (int32_t i = 0; i < len; i++) {
    cin >> array[i];
  }

  bubble_sort(array, len, callback);
  for (uint32_t i = 0; i < len; i++) {
    if (i != 0) cout << " ";
    cout << array[i];
  }
  cout << endl;

  cout << count << endl;

  return 0;
}
#endif

Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int k;
	cin >> k;
	vector<bool> used(k);
	int st = 0, cnt = 0;
	while (true) {
		st = (st * 10 + 7) % k;
		cnt++;
		if (!st) {
			cout << cnt;
			return 0;
		}
		if (used[st]) {
			cout << -1;
			return 0;
		}
		used[st] = 1;
	}
}

Measured memory_bytes: 3732
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
const ll MOD = 1000000007;

int main() {
    int n; cin >> n;
    cout << n*n*n << endl;
}

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

using LL = long long;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

	int n; cin >> n;
	vector<int> hon(n), dis(n);
	for (int i = 0; i < n; ++i) {
		int s; cin >> s;
		while (s--) {
			int x, y; cin >> x >> y; --x;
			(y == 1 ? hon : dis)[i] |= 1 << x;
		}
	}

	int ans = 0;
	for (int mask = 0; mask < (1 << n); ++mask) {
		int h = 0, d = 0;
		for (int i = 0; i < n; ++i) {
			if (mask & (1 << i)) {
				h |= hon[i];
				d |= dis[i];
			}
		}

		if (((h & mask) == h) && ((d & mask) == 0)) {
			ans = max(ans, __builtin_popcount(mask));
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){

  int n, i, champa, champv;
  int a[30], v[30];

  scanf("%d", &n);

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

    scanf("%d %d", &a[i], &v[i]);

    if(i == 0){

      champa = a[i];
      champv = v[i];

    }

    if(champv < v[i]){

      champa = a[i];
      champv = v[i];

    }else if(champv == v[i]){

      if(champa > a[i])

	champa = a[i];

    }
      
  }

  printf("%d %d\n", champa, champv);
  

  return 0;
}

Measured memory_bytes: 600
import collections,sys
def s():
 d=collections.deque()
 input()
 for e in sys.stdin:
  if'i'==e[0]:d.appendleft(e[7:-1])
  else:
   if' '==e[6]:
    m=e[7:-1]
    if m in d:d.remove(m)
   elif len(e)%2:d.pop()
   else:d.popleft()
 print(*d)
if'__main__'==__name__:s()


Measured memory_bytes: 69732
import sys
input = sys.stdin.readline

n, k = map(int,input().split())
A = list(map(int,input().split()))

for i in range(n):
    A[i] -= 1

B = [0]
F = [-1] * n
F[0] = 0
s = A[0]
i = 0
while F[s] == -1:
    i += 1
    B.append(s)
    F[s] = i
    s = A[s]

# print(F[s], i+1)

if k <= F[s]:
    print(B[k] + 1)
else:
    ind = (k-F[s]) % (i+1-F[s]) + F[s]
    print(B[ind] + 1)

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

int main(void){
    int64_t n; cin >> n;
    int64_t sum = 0;
    
    for(int i = 0; i < n; i++){
        if((i+1)%3 == 0 || (i+1)%5 == 0){
        }else{
            sum += i+1;
        }
    }
    
    cout << sum << endl;
    
    
}


Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main() {
	int K, S, cnt = 0, z_init = 0, s_z;
	scanf("%d %d", &K, &S);

	const int K2 = 2 * K;
	if (S > 2 * K) z_init = S - K2;

	for (int z = z_init; z <= K; ++z) {
		s_z = S - z;
		if (s_z < 0) break;

		if (s_z > K) cnt += (K2 - s_z + 1);
		else cnt += (s_z + 1);
	}
	printf("%d\n", cnt);

	return 0;
}


Measured memory_bytes: 256
cross=lambda a1, b1, a2, b2: a1*b2-a2*b1
try:
	T=0
	while True:
		T+=1
		n=int(raw_input())
		if n==0: break
		a=[[float(e) for e in raw_input().split()] for i in range(n)]
		s=0
		t=0
		for i in range(n-1):
			x=cross(a[i][0],a[i][1],a[i+1][0],a[i+1][1])
			if x>0: s+=abs(x)/2
			else: t+=abs(x)/2
		x=cross(a[n-1][0],a[n-1][1],a[0][0],a[0][1])
		if x>0: s+=abs(x)/2
		else: t+=abs(x)/2
		print('%d %.1f'%(T,abs(s-t)))
		raw_input()
except EOFError:
	pass

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

int main() {
 vector<int> a(3);
 rep(i,2)cin >> a[i];
 int n; cin >> n;
 sort(a.begin(),a.end());
 int  d2=n/a[1], d3=n/a[2];
 long long cnt=0;
 rep(i,d2)rep(j,d3){
   int m=n-a[1]*i-a[2]*j;
   if(m%a[0]==0 && m>=0){
     cnt++;
   }
 }
 cout << cnt << endl;
}


Measured memory_bytes: 256
import Control.Applicative
import Data.List
import Control.Monad

diffs (x:[]) = []
diffs (x:y:xs) = (y - x):(diffs (y:xs))

solve k [] = 1
solve 1 (x:xs) = x + solve 1 xs
solve k (x:xs) = 1 + solve (k - 1) xs

main = do
  [n, k] <- map read . words <$> getLine
  t <- map read <$> replicateM n getLine
  print $ solve k $ sortBy (flip compare) . diffs $ t



Measured memory_bytes: 65596
import java.util.Scanner;


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

        int lIndex;
        int rIndex;
        int x = input.nextInt();
        int[] array = new int[x];

        for(int i = 0; i < x; i++){
            array[i] = input.nextInt();
        }
        for(int i = 0; i < x; i++){
            System.out.print("node " + (i+1) + ": ");
            System.out.print("key = " + array[i] + ", ");
            if(i > 0){
                System.out.print("parent key = " + array[(int)((i-1)/2)]+ ", ");
            }
            if(i < x/2){
                lIndex = 2*(i)+1;
                rIndex = 2*(i)+2;
                if(lIndex < x){
                    System.out.print("left key = " + array[lIndex]+ ", ");
                }
                if(rIndex < x){
                    System.out.print("right key = " + array[rIndex] + ", ");
                }
            }
            System.out.println();
        }
    }
}


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

int main() {
	int n;
	while(cin >> n, n) {
		int a = 1001;
		int b = -1;
		int sum = 0;
		for(int i = 0; i < n; ++i) {
			int t;
			cin >> t;
			sum += t;
			a = min(a, t);
			b = max(b, t);
		}
		
		sum -= a + b;
		
		cout << sum / (n - 2) << endl;
	}
	return 0;
}

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

struct cake{
	//int num;
	int x;
	int y;
};

bool operation(const cake &l,const cake &r){
	return (l.x * l.y) < (r.x * r.y);
}

int main(){
	int n,w,d;
	int p,s,num;
	int x,y;
	vector<cake> v;
	cake c,c2;
	while(1){
		cin >> n >> w >> d;
		if(w == 0)break;
		v.clear();
		//c.num = 1;
		c.x = w;
		c.y = d;
		v.push_back(c);
		num = 1;
		for(int i = 0;i < n;i++){
			cin >> p >> s;
			p--;
			s = s % (v[p].x * 2 + v[p].y * 2);
			if(s > 0 && s < v[p].x){
				c.x = v[p].x - s;
				c.y = v[p].y;
				v[p].x = s;
			}
			else if(s > v[p].x + v[p].y && s < v[p].x*2 + v[p].y){
				c.x = v[p].x - (s - (v[p].x + v[p].y));
				c.y = v[p].y;
				v[p].x = v[p].x - c.x;
			}
			else if(s > v[p].x && s < v[p].x + v[p].y){
				c.x = v[p].x;
				c.y = v[p].y - (s - v[p].x);
				v[p].y = v[p].y - c.y;
			}
			else if(s > v[p].x*2 + v[p].y && s < v[p].x*2 + v[p].y*2){
				c.x = v[p].x;
				c.y = v[p].y - (s - (v[p].x * 2 + v[p].y));
				v[p].y = v[p].y - c.y;
			}
			c2.x = v[p].x;
			c2.y = v[p].y;
			v.erase(v.begin() + p);
			if(c.x*c.y <= c2.x * c2.y){
				v.push_back(c);
				v.push_back(c2);
			}
			else{
				v.push_back(c2);
				v.push_back(c);
			}
		}
		sort(v.begin(),v.end(),operation);
		for(int i = 0;i < v.size();i++){
			if(i != v.size()-1)cout << v[i].x * v[i].y << " ";
			else cout << v[i].x * v[i].y << endl;
		}
	}
	return 0;
}

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

int main(void){
    ll a, b;
    cin >> a >> b;
    if(a % b == 0){
        cout << 0 << endl;
    }else{
        cout << 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
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; }


int main() {
    char x, y; cin >> x >> y;
    if(x < y) cout << '<' << ln;
    else if(x == y) cout << '=' << ln;
    else cout << '>' << ln;
}

Measured memory_bytes: 256
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
//#include<map>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define izryt bool
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const llint mod=1000000007;
const llint gya=500000004;//mod modで2の逆元
const llint big=1e9;
const llint red=0xE869120;
const llint pro=1002001;

int main(void){
	llint n,a,b;
	cin>>n>>a>>b;
	if(a>b){cout<<0<<endl;return 0;}
	if(n==1&&a!=b){cout<<0<<endl;return 0;}
	if(n==1&&a==b){cout<<1<<endl;return 0;}
	if(n==2){cout<<1<<endl;return 0;}
	cout<<1+(n-2)*(b-a)<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define REP(i,n) for(ll i=0; i<(n); i++)
int main(){
    ll N,ans=0;
    cin >> N;
    ll sum[11][11]={0};
    for(int i = 1;i <= N;i++){
        int A=i,B=i%10;
        while(A>=10)A/=10;
        sum[A][B]++;
    }
    REP(i,10)REP(j,10){
        ans+=sum[i][j]*sum[j][i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
    string s;
    cin >> s;

    int a = -1, b = -1;
    rep(i, s.size()) {
	if (s[i] == 'A' && a == -1) a = i;
	if (s[i] == 'Z') b = i;
    }

    cout << b - a + 1 << endl;

    return 0;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int a, b, c;
    cin >> a >> b >> c;

    int count = 0;
    for (int i = a; i <= b; i++)
    {
        if (c % i == 0)
        {
            count++;
        }
        
    }
    
    cout << count << endl;

    return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    map<string, string> tomorrow = {
        {"Sunny", "Cloudy"},
        {"Cloudy", "Rainy"},
        {"Rainy", "Sunny"},
    };
    string S;
    cin >> S;
    cout << tomorrow[S] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
void input(){
    fast_io();
    cin >> N;
}

int calc(int x,int y,int z){
    int ret = (x*x+y*y+z*z+x*y+y*z+z*x);
    if(ret>N) return 0;
    return ret;
}

int solve(){
    vector<int> ans(N+1,0);
    for (int x = 1; x*x <= N; x++)
    for (int y = 1; y*y <= N; y++)
    for (int z = 1; z*z <= N; z++)
    {
        ans[calc(x,y,z)]++;
    }
    for (int i = 1; i <= N; i++)
    {
        cout << ans[i] << "\n";
    }
    
    
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
#define N 140000
#define mod 1000000007
#define pp pair<ll,ll>
typedef long long int ll;
typedef long double ld;
#define MP make_pair

#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++)     
void fastIO(void);

void decimal(int);
ll modmulti(ll, ll, ll);
ll modadd(ll, ll, ll);
ll modpower(ll, ll, ll);
ll gcd(ll, ll );
ll modinv(ll, ll);



int main()
{  
   ll a,b,c;
   cin>>a>>b>>c;
   c = c-a+b;
   if(c<0)
      c = 0;
   cout<<c<<endl;
}























void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}

void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
ll modmulti(ll a, ll b, ll m){
   return ((a%m)*(b%m))%m;
}
ll modadd(ll a, ll b, ll m){
   return ((a%m)+(b%m))%m;
}
ll modpower(ll a, ll n, ll m){
   if(n==0)
      return 1;
   ll result = 1;
   while(n>0){
      if(n%2==1)
         result = modmulti(result,a,m);
      a = modmulti(a,a,m);
      n = n/2;
   }
   return result;
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a, ll m){
   return modpower(a,m-2,m);
}


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

//for loop
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

//abbreviati
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

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

//constant
const int INF = 1<<30;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

/***Snippet**************************************
ifelse, isprime, torad, todeg, lcm, bfs
************************************************/

//adjacency list
vector<int> to[100005];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b,c,k;
    cin >> a >> b >> c >>k;
    int cnt=0;
    while(b<=a){ cnt++; b*=2;}
    while(c<=b){ cnt++; c*=2;}


    if(cnt<=k) cout << "Yes" ENDL;
    else cout << "No" ENDL;
    
    return 0;
}

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

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            bool ret = false;
            string retstr = string.Empty;
            var num = c2i(Console.ReadLine());
            var sin = Console.ReadLine();
            var strlst=sin.Split(' ');
            var lst = strlst.Select(x => c2i(x)).ToArray();
            int count = 1;
            var minlst = new int[num];
            minlst[0]=lst[0];
            
            for (int i = 1; i < num; i++)
            {
                if (lst[i] < minlst[i - 1]) minlst[i] = lst[i];
                else minlst[i] = minlst[i-1];
                if (minlst[i] >= lst[i]) count++;
            }
                Console.WriteLine(count);
            //Console.ReadLine();
        }
      
        static int c2i(string c) { return int.Parse(c); }
    }
}


Measured memory_bytes: 35676
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break


N = list(get_input())
for l in range(len(N)):


    s1,t = N[l].split('+')
    s2,s3 = t.split('=')

    ans = -1
    if (len(s1) > 1 and s1[0] == "X") or (len(s2) > 1 and s2[0] == "X") or (len(s3) > 1 and s3[0] == "X"):
        for i in range(1,10):
            n1 = int(s1.replace("X",str(i)))
            n2 = int(s2.replace("X",str(i)))
            n3 = int(s3.replace("X",str(i)))
            if n1 + n2 == n3:
                ans = i
                break
    else:
        for i in range(10):
            n1 = int(s1.replace("X",str(i)))
            n2 = int(s2.replace("X",str(i)))
            n3 = int(s3.replace("X",str(i)))
            if n1 + n2 == n3:
                ans = i
                break
    if ans >= 0:
        print(ans)
    else:
        print("NA")





Measured memory_bytes: 5628
//p1: max(x-y) means x should be maximum
//p2: min(x-y) means y should be maximum i.e minimize x
//sum of all array elements = x+y
//dp(i,j)->optimal value of x such that we are left with subarray (i,j)
//dp(i,j,turn) => turn=1 (p1) & turn=0(p2)
/*
dp(i,j,1) = max{
                   a[i] + dp(i+1 , j , 0),
                   a[j] + dp(i , j-1 , 0)
                }
here below a[i] will not be added as we are looking for player one score only
dp(i,j,0) = min{
                     dp(i+1 , j , 1),
                     dp(i , j-1 , 1)
                }
*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[3001][3001][2];
ll solve(ll *a , ll i , ll j , ll turn){
   if(i>j){
       return 0;
   } 
   if(dp[i][j][turn] != -1){
       return dp[i][j][turn];
   }
   if(turn == 1){
       ll opt1 = a[i] + solve(a , i+1 , j , 0);
       ll opt2 = a[j] + solve(a , i , j-1 , 0);
       return dp[i][j][turn] = max(opt1 , opt2);
   }else{
       ll opt1 = solve(a , i+1 , j , 1);
       ll opt2 = solve(a , i , j-1 , 1);
       return dp[i][j][turn] = min(opt1 , opt2);
   }
}
int main() {
    ll n ;
    cin>>n;
    ll a[n+1];
    ll sum = 0;
    for(ll i=1 ; i<=n ; i++){
        cin>>a[i];
        sum += a[i];
    }
    memset(dp , -1 , sizeof(dp));
    ll scoreX = solve(a , 1 , n , 1);
    ll scoreY = sum - scoreX;
    cout<<scoreX - scoreY;
    return 0;
}


Measured memory_bytes: 141184
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <iostream>
using namespace std;
void HappyBirthday() {
	int A, B;
	cin >> A;
	cin >> B;

	if (A > 8 || B > 8) {
		cout << ":(";
	}else{
		cout << "Yay!";
	}

}


int main() {
	HappyBirthday();
	return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
 
#include <iostream>
#include <algorithm>
 
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <cstring>
#include <string>
#include <utility>
#include <array>
#include <complex>
#include <valarray>
 
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>
 
 
using namespace std;
#define int long long
 
typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;
 
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
 
const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll INFLL = 1LL<<62;
const double EPS = 1e-12;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;
 
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod
#define inside(y, x, h, w) (0 <= (y) && (y) < (h) && 0 <= (x) && (x) < (w)) ? true : false

int n, k;
int a[200000 + 5], cnt[200000 + 5];
bool used[200000 + 5];
int s;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> k;
    rep(i, n) {
        cin >> a[i];
        if (!used[a[i]]) s++;
        used[a[i]] = true;
        cnt[a[i]]++;
    }
    if (s <= k) {
        cout << 0 << endl;
        return 0;
    }
    sort(cnt, cnt + 200000 + 3);
    int ans = 0;
    rep(i, 200000 + 5) {
        if (s == k) break;
        if (cnt[i] == 0) continue;
        s--;
        ans += cnt[i];
    }
    cout << ans << endl;

}


Measured memory_bytes: 3584
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split()))for _ in range(d)]
class Score:
  def __init__(self,t):
    self.x=[d*[0]for _ in range(26)]
    self.scor=0
    self.ans=[]
    for i in range(d):
      v=t[i]
      self.scor+=s[i][v]
      for j in range(26):
        if j!=v:
          self.x[j][i]+=1
          if i!=0:self.x[j][i]+=self.x[j][i-1]
        self.scor-=c[j]*self.x[j][i]
      self.ans.append(self.scor)
  def solve(self):
    return [self.scor,self.ans]
t=[int(input())-1 for _ in range(d)]
x=Score(t)
_,ans=x.solve()
for i in ans:print(i)

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

def Fib(n):
    a, b = 0, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b

l = []
pre = -1
for x in a:
    if x-pre == 1:
        print(0)
        exit()
    l.append(Fib(x-pre-1 +1))
    pre = x

l.append(Fib(n-pre +1))

res = 1
for x in l:
    res *= x

print(res % 1000000007)

Measured memory_bytes: 49624
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3000;
int hmb[MAXN],p[MAXN], bm[MAXN];
int main() {
    int n, m;
    for (int i = 0, cnt, j; i<=2000; ++i) {
        cnt = 0; 
        j = i;
        while (j) {
            if (j&1) ++cnt;
            j>>=1;
        }
        hmb[i] = cnt;
    }
    scanf("%d %d", &n, &m);
    for (int i = 0, k, c; i<m; ++i) {
        scanf("%d", &k);
        while (k--) {
            scanf("%d", &c);
            bm[i]|=1<<c-1;
        }
    }
    for (int i = 0; i<m; ++i) {
        scanf("%d", p+i);
    }
    int ans = 0;
    for (int mask = 0, f; mask<1<<n; ++mask) {
        f = 1;
        for (int j = 0; j<m && f; ++j) {
            if ((hmb[mask&bm[j]]&1) != p[j]) f = 0;
        }
        ans += f;
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
        for(;;){
            int h,w;
                scanf("%d %d",&h,&w);
                if(h){
                        for(int i=0;i<h;i++){
                                for(int j=0;j<w;j++){
                                        if((i+j)%2){
                                                printf(".");
                                        }else{
                                                printf("#");
                                        }
                                }
                                printf("\n");
                        }
                        printf("\n");
                }else{
                        break;
                }
        }
        return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
vector<int> in_column;
multiset<int> best;
void update(int pos, int delta){
	best.erase(best.find(in_column[pos]));
	in_column[pos] += delta;
	best.insert(in_column[pos]);
}
int main(){
	int h, w, m; cin >> h >> w >> m;
	vector<vector<int>> in_row(h);
	in_column = vector<int>(w);
	for(int i = 0; i < m; i++) best.insert(0);
	for(int i = 0; i < m; i++){
		int x, y; cin >> x >> y;
		x--, y--;
		in_row[x].push_back(y);
		update(y, 1);
	}
	int res = 0;
	for(int i = 0; i < h; i++){
		int cur = in_row[i].size(); 
		for(int x : in_row[i]) update(x, -1);
		if(best.size()) cur += *best.rbegin();
		res = max(res, cur);
		for(int x : in_row[i]) update(x, 1);
	}
	cout << res << '\n';
	return 0;
}



Measured memory_bytes: 34876
using System;
using static System.Console;
using System.Collections.Generic;

namespace abc164
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var pList = new Dictionary<int, int>[3];
            pList[0] = new Dictionary<int, int>();
            pList[1] = new Dictionary<int, int>();
            pList[2] = new Dictionary<int, int>();

            var keyNum = 673;
            var currentMod = 0;
            var multi = 1;
            var numTotal = 0;
            pList[0].Add(0, 1);
            for (var i = s.Length - 1; i >= 0; --i)
            {
                var num = s[i] - '0';
                numTotal += num;
                currentMod = (currentMod + multi * num) % keyNum;
                multi = multi * 10 % keyNum;

                // countup
                var dic = pList[numTotal % 3];
                if (dic.ContainsKey(currentMod))
                {
                    ++dic[currentMod];
                }
                else
                {
                    dic.Add(currentMod, 1);
                }
            }
            // count
            var total = 0L;
            foreach (var dic in pList)
            {
                foreach (var kv in dic)
                {
                    if (kv.Value > 1)
                    {
                        total += (long)kv.Value * (kv.Value - 1) / 2;
                    }
                }
            }
            WriteLine(total);
        }
    }
}


Measured memory_bytes: 26884
#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define MOD 1000000007
#define y1 dskgj
#define y2 dskfj
#define SQ 320
#define N 8388607
typedef int ll;
using namespace std;
ll n,i,j,k,x,y,z,m,q,h,l,timer;
vector<ll> g[1005];
ll a[1005], w[1005], dp[1005][5005];
void dfs(ll v, ll p = -1)
{
    vector<ll> f;
    ll sum = 0;
    for (int i = 0; i < g[v].size(); i++)
    {
        ll to = g[v][i];
        if (to != p)
        {
            dfs(to, v);
            f.push_back(to);
            sum += w[to];
        }
    }
    ll sz = f.size();
    for (int i = 0; i <= sz; i++)
        for (int j = 0; j <= a[v]; j++)
            dp[i][j] = 0;
    dp[0][0] = 1;
    for (int i = 0; i < sz; i++)
        for (int j = 0; j <= a[v]; j++)
            if (dp[i][j])
            {
                if (j + a[f[i]] <= a[v])
                    dp[i+1][j+a[f[i]]] = 1;
                if (j + w[f[i]] - a[f[i]] <= a[v])
                    dp[i+1][j + w[f[i]] - a[f[i]]] = 1;
            }
    int i;
    for (i = a[v]; i >= 0; i--)
        if (dp[sz][i] == 1)
        {
            w[v] = a[v]-i+sum;
            break;
        }
    //cout << v << " " << w[v] << endl;
    if (i == -1)
    {
        cout << "IMPOSSIBLE" << endl;
        exit(0);
    }
}
int main() {
    //freopen("input.txt","r",stdin);
    cin >> n;
    for (i = 2; i <= n; i++)
    {
        cin >> x;
        g[i].push_back(x);
        g[x].push_back(i);
    }
    for (i = 1; i <= n; i++)
        cin >> a[i];
    dfs(1);
    cout << "POSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 17408
xp1,yp1,xp2,yp2=map(int,input().split())

q=int(input())

if xp1==xp2:
    for i in range(q):
        x0,y0=map(int,input().split())
        print('{:.10f}'.format(xp1),'{:.10f}'.format(y0))
else:
    a=float((yp2-yp1)/(xp2-xp1))
    for i in range(q):
        x0,y0=map(int,input().split())
        x=a*((y0-yp1)-a*(x0-xp1))/(1+a**2)+x0
        y=(a*(a*y0+x0-xp1)+yp1)/(1+a**2)
        print('{:.10f}'.format(x),'{:.10f}'.format(y))



Measured memory_bytes: 5632
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,m;
	cin>>n>>m;
	if(n==m && n==1) cout<<1;
	else if(n==1 || m==1) cout<<n*m-2;
	else cout<<(n-2)*(m-2);
}

Measured memory_bytes: 3604
// $%D%$.$%M%$.$%Y%$
// $%h%$:$%m%$:$%s%$

#pragma GCC optimize("O3")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define IOS ios::sync_with_stdio(false); cin.tie(0)
#define ll long long
#define ld long double
#define rep(i,a,n) for (int i=(int)(a);i<(int)(n);i++)
#define per(i,a,n) for (int i=(int)(n-1);i>=(int)(a);i--)
#define mp(a, b) make_pair(a, b)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pil pair<int, ll>
#define pli pair<ll, int>
#define fi first
#define se second


const int MOD = 1e9+7; // 998244353; // = (119<<23)+1
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = 4*atan((ld)1);
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};


template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(max(max(1ll * a * d, 1ll * b * c), 1ll * b * d), 1ll * a * c) << '\n';
}


Measured memory_bytes: 3632
#include<stdio.h>
int main()
{
    int n;
    int all[105];
    scanf("%d",&n);
    for(int i = 0;i<n;i++)
    {
        scanf("%d",&all[i]);
        if(all[i]%2==0)
        {
            if(all[i]%3==0||all[i]%5==0)
                continue;
            else
            {
                printf("DENIED\n");
                return 0;
            }
        }
    }

    printf("APPROVED\n");
    return 0;
}





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

int main(){
    long long a,b,c,k;
    cin >> a >> b >> c >> k;
    long long ans = 0;
    ans = min(a,k) - max(k-a-b,0ll);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define MOD 1000000007
#define MAX 10000
#define INF 1410065408
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge{ll from, to, cost;};

ll d[100][100];
edge es[MAX];

signed main(){
	ll n, m;
	scanf("%lld %lld", &n, &m);
	
	fill(d[0], d[n], INF);
	rep(n){
		d[i][i] = 0;
	}
	
	rep(m){
		ll from, to, cost;
		scanf("%d %d %lld", &from, &to, &cost);
		from--; to--;
		d[from][to] = cost;
		d[to][from] = cost;
		es[i] = {from, to, cost};
	}
	
	repp(k, n){
		repp(j, n){
			repp(i, n){
				if(i == j) continue;
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	
	ll ans = 0;
	rep(m){
		bool flag = false;
		repp(s, n){
			repp(t, n){
				if(s == t) continue;
				if(d[s][es[i].from] + es[i].cost + d[es[i].to][t] == d[s][t]){
					flag = true;
					break;
				}
				if(d[s][es[i].to] + es[i].cost + d[es[i].from][t] == d[s][t]){
					flag = true;
					break;
				}
			}
			if(flag) break;
		}
		if(!flag) ans++;
	}
	
	printf("%lld", ans);
}


Measured memory_bytes: 384
a, b, c, d = map(int, input().split())
while(a>0 or c>0):
  if c>0 and a>0:
    c-=b
  elif a<=0:
    break
  if a>0 and c>0:
    a-=d
  elif c<=0:
    break
if a<=0:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 61628
//abc162_b.cpp
//Sun Apr 12 20:57:50 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

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


	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 3636
# encoding:utf-8

import itertools
from collections import defaultdict


def main():
	n = int(input())
	s = input()

	left = s[:n]
	right = s[n:]
	right = right[::-1]

	ans = 0
	#print(left, right)
	for n_r in range(n+1):
		d_left = defaultdict(lambda: 0)
		d_right = defaultdict(lambda: 0)
		#print([1 if x >= n_r else 0 for x in range(n)])
		pts = itertools.combinations(list(range(n)), r = n_r)
		
		for pt in pts:
			#print(pt)
			b_l = ""
			r_l = ""
			b_r = ""
			r_r = ""
			for i in range(n):
				if i in pt:
					b_l += left[i]
					b_r += right[i]
				else:
					r_l += left[i]
					r_r += right[i]

			d_left[(b_l, r_l)] += 1
			d_right[(b_r, r_r)] += 1

		for key in d_left:
#			print(n_r, key, d_left[key], d_right[key])
			ans += d_left[key] * d_right[key]

	print(ans)

	

if __name__ == '__main__':
	main()


Measured memory_bytes: 38188
#include <bits/stdc++.h>
// #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;

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

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}


int main() {

  string s;cin >> s;
  int k;cin >> k;
  rep(i,k){
    if (s[i]!='1'){
      cout<<s[i]<<endl;
      return 0;
    }
  }
  cout<<1<<endl;  
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<cstdlib>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<vector>
#include<cmath>
#include<string>
#include<deque>
#define lmid l,mid,rt<<1
#define rmid mid+1,r,rt<<1|1
using namespace std;
char s[10];
int main() {
     scanf("%s", s);
     for(int i = 0; i < (1 << 3); i++) {
          int sum = s[0] - '0';
          for(int j = 1; j <= 3; j++) {
               int res = (1 << (j-1));
               if(res & i) sum += (s[j] - '0');
               else sum -= (s[j] - '0');
               //cout<<sum<<endl;
          }
          if(sum == 7) {
               printf("%c", s[0]);
               for(int j = 1; j <= 3; j++) {
                    int res = (1 << (j-1));
                    if(res & i) printf("+");
                    else printf("-");
                    printf("%c",s[j]);
               }
               break;
          }
     }
     printf("=7\n");
     return 0;
}


Measured memory_bytes: 256