akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
int n;
int data[2001];
bool xx[2001];

int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		memset(xx,false,sizeof(xx));
		memset(data,0,sizeof(data));
		for(int i=0;i<n;i++){
			string str;
			cin >> str;
			if(str=="x")xx[i]=true;
			else{
				int num=0;
				bool pm=true;
				for(int j=0;j<str.size();j++){
					if(str[j]=='-'){
						pm=false;
						continue;
					}
					num*=10;
					num+=str[j]-'0';
				}
				data[i]=num;
				if(!pm)data[i]*=-1;
			}
		}
		int lx=-2e9,rx=2e9;
		bool flag=true;
		for(int i=0;i<n;i++){
			if(i%2==0){
				if(!xx[i]){
					if(i+1<n && !xx[i+1] && data[i]>=data[i+1]){
						flag=false;
					}
					if(i-1>=0 && !xx[i-1] && data[i]>=data[i-1]){
						flag=false;
					}
					if(i+1<n && xx[i+1]){
						lx=max(lx,data[i]+1);
					}
					if(i-1>=0 && xx[i-1]){
						lx=max(lx,data[i]+1);
					}
				}else{
					if(i+1<n && !xx[i+1]){
						rx=min(rx,data[i+1]-1);
					}
					if(i-1>=0 && !xx[i-1]){
						rx=min(rx,data[i-1]-1);
					}
					if(i+1<n && xx[i+1]){
						flag=false;
					}
					if(i-1>=0 && xx[i-1]){
						flag=false;
					}
				}
			}
			/*
			if(i%2==1){
				if(!xx[i]){
					if(i+1<n && !xx[i+1] && data[i]<=data[i+1]){
						flag=false;
					}
					if(i-1>=0 && !xx[i-1] && data[i]<=data[i-1]){
						flag=false;
					}
					if(i+1<n && xx[i+1]){
						rx=min(rx,data[i]-1);
					}
					if(i-1>=0 && xx[i-1]){
						rx=min(rx,data[i]-1);
					}
				}else{
					if(i+1<n && !xx[i+1]){
						lx=max(lx,data[i+1]+1);
					}
					if(i-1>=0 && !xx[i-1]){
						lx=max(lx,data[i-1]+1);
					}
					if(i+1<n && xx[i+1]){
						flag=false;
					}
					if(i-1>=0 && xx[i-1]){
						flag=false;
					}
				}
			}
			*/
		}
		if(!flag || lx>rx)printf("none\n");
		else if(lx!=rx)printf("ambiguous\n");
		else printf("%d\n",lx);
	}
	return 0;
}

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

#define double long double
#define int long long
#define vec vector
#define pb push_back
#define unset unordered_set
#define ii pair<int, int>
#define X first
#define Y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first,l.second+r.second};
} 
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;

inline int Pow(int a, int k) {
  int s = 1; 
  for(; k; k >>= 1) {
    k & 1 ? s = 1LL * s * a % MOD : 0;
    a = 1LL * a * a % MOD;
  }
  return s;
}

const int N = 1e6 + 7;

// 29gg


void input() {
  //freopen("??.in", "r", stdin);
  //freopen("??.out", "w", stdout);
  // 34gg

}

void preprocess() {

}

void debug() {
  //  44gg
  if (true) {
  
  }
}

void solve() {
  preprocess();
  // 50gg
  int a, b, c; cin >> a >> b >> c;
  cout << min(b / a, c) << endl;
  //debug();
  // read the question correctly (is y a vowel?)
  // look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
}

void output() {

}

#undef int
int main() {
#define int long long
	ios_base::sync_with_stdio(false);
	cin.tie();
  //auto beginProgram = chrono::steady_clock::now();

  {
    input();
    solve();
    output();
  }

  //auto endProgram = chrono::steady_clock::now();

  return 0;
}



Measured memory_bytes: 256
import sys 

def A():
  n = int(sys.stdin.readline().rstrip())
  charge = (n+999)//1000 * 1000 - n
  print(charge)


from collections import Counter
def B():
  n, *s = sys.stdin.read().split() 
  c = Counter(s)
  for v in 'AC, WA, TLE, RE'.split(', '):
    print(f'{v} x {c[v]}')


def C():
  h, w, k = map(int, sys.stdin.readline().split())
  c = [sys.stdin.readline().rstrip() for _ in range(h)]
  tot = 0
  for i in range(1<<h):
    for j in range(1<<w):
      cnt = 0
      for y in range(h):
        for x in range(w):
          if i>>y & 1 or j>>x & 1:
            continue 
          cnt += c[y][x] ==  '#'
      tot += cnt == k
  print(tot)


def D():
  pass


def E():
  pass


def F():
  pass

if __name__ == "__main__":
  # A() 
  # B()
  C()
  D()
  E()
  F()

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

int64 Solve() {
  int n;
  int64 x, d;
  cin >> n >> x >> d;

  if (d == 0) {
    if (x == 0) return 1;
    else return n + 1;
  }

  if (d < 0) {
    x *= -1;
    d *= -1;
  }

  map<int64, vector<pair<int64, int64>>> map;
  for (int64 k = 0; k <= n; k++) {
    int64 b = x * k;
    int64 mod = (b % d + d) % d;
    int64 l = b + d * (k - 1) * k / 2;
    int64 r = b + d * (2 * n - k - 1) * k / 2;
    map[mod].push_back(make_pair(l, r));
  }

  int64 ans = 0;
  for (const auto& kv : map) {
    vector<pair<int64, int>> es;
    for (const auto& s : kv.second) {
      es.push_back(make_pair(s.first, -1));
      es.push_back(make_pair(s.second, 1));
    }
    sort(es.begin(), es.end());
    int64 start = INT64_MIN;
    int cur = 0;
    for (const auto& e : es) {
      if (e.second == -1) {
        if (cur == 0) {
          start = e.first;
        }
        cur += e.second;
      }

      if (e.second == 1) {
        cur += e.second;
        if (cur == 0) {
          if (start == INT64_MIN) {
            cerr << "Unexpected!" << endl;
            exit(1);
          }

          if (DEBUG) cout << start << " " << e.first << endl;
          ans += (e.first - start) / d + 1;

          start = INT64_MIN;
        }
      }
    }
  }

  return ans;
}

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

  cout << Solve() << endl;
}

Measured memory_bytes: 22144
"""#################################################################
【ABC085】
C - Otoshidama
#################################################################"""

#インポート
import sys
from collections import Counter

#入力用
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))  #リスト(int型)
def MI(): return map(int, sys.stdin.readline().rstrip().split())        #多変数(int型)
def II(): return int(sys.stdin.readline().rstrip())                     # 1変数(int型)
def S(): return sys.stdin.readline().rstrip()                           #文字列(str型)

N, Y = MI()
ans = 0, 0, 0
for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        if z >= 0:
            if 10000*x + 5000*y + 1000*z == Y:
                ans = x, y, z
if sum(ans) == 0:
    ans = -1, -1, -1
print(*ans)

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

#define int long long
#define fi first
#define se second
#define otp(n) cout << n;
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define ctv(v) rep(i,(v).size()) ct(v[i])
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define repv(i,v) for(int i=0;i<(v).size();i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);

int N,W,w,v,dp[100][100001],ans;

main() {
    cin >> N >> W >> w >> v;
    rep(i,100) rep1(j,100000) dp[i][j] = 10000000000;
    dp[0][v] = w;
    rep1(i,N-1) {
        cin >> w >> v;
        rep1(j,100000) {
            if (j<v) dp[i][j] = dp[i-1][j];
            else dp[i][j] = min(dp[i-1][j],dp[i-1][j-v]+w);
        }
    }
    rep1(i,100000) if (dp[N-1][i] != 10000000000 && dp[N-1][i] <= W) ans = max(ans,i);
    ct(ans)
}


Measured memory_bytes: 78336
using System;
class Program
{
	static void Main()
  {
	string[] input = Console.ReadLine().Split(' ');
	int h = int.Parse(input[0]);
	int w = int.Parse(input[1]);
    string[] masu = new string[h];//入力マスを受け取る
    int result = 1;
	for(int i = 0; i < h; i++)
        {
          masu[i] = Console.ReadLine();	
        }
      
       
        for(int i = 0; i < h; i++)
        {
          for(int j = 0; j < w; j++)
          {
          	if(masu[i][j] == '#')
            {
              result = 0;
           		 if(i-1 >= 0)
           	 {
              if(masu[i-1][j] == '#')result = 1;
            }
               if(i+1<h)
            {
              if(masu[i+1][j] == '#')result = 1;
            }
               if(j-1 >= 0)
            {
              if(masu[i][j-1] == '#')result = 1;
            }
               if(j+1<w)
            {
              if(masu[i][j+1] == '#')result = 1;
            }

            }
              
            if(result == 0)break;
                
       	  }
          if(result == 0)break;
          
          
        }
      Console.WriteLine((result == 1) ? "Yes" : "No");
  }
  
}

Measured memory_bytes: 13140
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    rep(i,n){
        if(i != k - 1){
            cout << s[i];
        }else{
            cout << (char)(s[i] ^ 32);
        }
    }
    cout << endl;
}

Measured memory_bytes: 256
n=int(input())
s=input()
l=0
r=n-1
ans=0
while(l<r):
    while(s[l]=='R' and r>l):l+=1
    while(s[r]=='W' and r>l):r-=1
    if l>=r:break
    r-=1
    l+=1
    ans+=1
print(ans)


Measured memory_bytes: 9468
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, m;
    cin >> n >> m;
    cout << (n - 1) * (m - 1) << endl;
    
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

/* ???????????????????????????????????? extgcd */
ll extgcd(ll a, ll b, ll& x, ll& y){
    ll g = a; x = 1; y = 0;
    if(b!=0) { g = extgcd(b, a%b, y, x); y -= (a/b)*x;}
    return g;
}
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll a,b; cin >> a >> b;
    ll x,y;
    extgcd(a,b,x,y);
    cout << x << " " << y << endl;
    return 0;
}

Measured memory_bytes: 3136
n = int(input())
p=[]
for i in input().split() :
	p.append(int(i))

ans = 0

for i in range(1,n-1) :
	if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]) : ans += 1
print(ans)

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

void solve() {
    int mod = 1e9 + 7;
    string S;
    cin >> S;
    int n = S.size();
    long long all = 1;
    vector<long long> a(n + 1), ab(n + 1), abc(n + 1);
    rep(i,n) {
        a[i + 1] = a[i];
        ab[i + 1] = ab[i];
        abc[i + 1] = abc[i];
        char c = S.at(i);
        if (c == 'A') a[i + 1] += all;
        if (c == 'B') ab[i + 1] += a[i];
        if (c == 'C') abc[i + 1] += ab[i];
        if (c == '?') {
            a[i + 1] = a[i] * 3 + all;
            ab[i + 1] = ab[i] * 3 + a[i];
            abc[i + 1] = abc[i] * 3 + ab[i];
            all *= 3;
        }
        all += mod;
        all %= mod;
        a[i + 1] %= mod;
        ab[i + 1] %= mod;
        abc[i + 1] %= mod;
    }
    cout << abc[n] << endl;
    return;
}

int main() {
    solve();
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
#include <string>
using namespace std;
 
typedef long long ll;
 
int like_cnt[31] = {0};




int main(){
    int n;

    cin >> n;
    double ans = 0;
    for(int i = 0; i < n; i++)
    {
        string tmp1;
        string tmp2;

        cin >> tmp1 >> tmp2;

        if (tmp2 == "JPY"){
            ans += stoi(tmp1);
        } else {
            ans += stod(tmp1) * 380000.0;
        }


    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int sx, sy, tx, ty;

int main(void) {

	cin >> sx >> sy >> tx >> ty;

	for (int i = 1; i <= ty - sy; i++) {
		cout << "U";
	}
	for (int j = 1; j <= tx - sx; j++) {
		cout << "R";
	}
	for (int i = 1; i <= ty - sy; i++) {
		cout << "D";
	}
	for (int j = 1; j <= tx - sx; j++) {
		cout << "L";
	}

	cout << "L";
	for (int i = 1; i <= ty - sy + 1; i++) {
		cout << "U";
	}
	for (int i = 1; i <= tx - sx + 1; i++) {
		cout << "R";
	}
	cout << "DR";
	for (int i = 1; i <= ty - sy + 1; i++) {
		cout << "D";
	}
	for (int i = 1; i <= tx - sx + 1; i++) {
		cout << "L";
	}
	cout << "U" << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

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

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

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  int n, m;
  std::cin >> n >> m;
  std::vector<int> a(m);
  std::vector<int> b(m);
  std::vector<std::vector<int>> c(m);
  for (int i = 0; i < m; ++i) {
    std::cin >> a[i] >> b[i];
    c[i].resize(b[i]);
    for (int j = 0; j < b[i]; ++j)
      std::cin >> c[i][j];
  }

  std::vector<int> dp(1 << n, IINF);
  dp[0] = 0;

  for (int k = 0; k < (1 << n); ++k) {
    for (int i = 0; i < m; ++i) {
      int nk = k;
      for (int j = 0; j < b[i]; ++j)
        nk |= (1 << (c[i][j] - 1));
      chmin(dp[nk], dp[k] + a[i]);
    }
  }

  if (dp[(1 << n) - 1] == IINF)
    std::cout << -1 << std::endl;
  else
    std::cout << dp[(1 << n) - 1] << std::endl;

  return 0;
}


Measured memory_bytes: 384
#include<iostream>

#define P (1000000000 + 7)
#define HALF (500000000 + 4)

using namespace std;

typedef struct val_T
{
        long n;
        long sq5;
}val;

val mul(val a, val b);
val sub(val a, val b);
val add(val a, val b);
val pow(val v, int n);
long pow(long v, int n);
long fibo(int n);

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

        long ans = 1;
        int c;
        int last = -1;
        for(int i=0;i<m;i++){
                cin >> c;
                ans *= fibo(c - 1 - last);
                ans %= P;
                last = c;
        }
        ans *= fibo(n - last);
        ans %= P;

        cout << ans << endl;
}


long fibo(int n)
{
        val ans = {0};
        val a = {1, 1};
        val b = {1, -1};

        a = sub(pow(a, n), pow(b, n));

        return (a.sq5 * pow(HALF, n)) % P;
}

val sub(val a, val b)
{
        val ret;
        ret.n = (a.n - b.n) % P;
        ret.sq5 = (a.sq5 - b.sq5)%P;
        return ret;
}

val add(val a, val b)
{
        val ret;
        ret.n = (a.n + b.n) % P;
        ret.sq5 = (a.sq5 + b.sq5)%P;
        return ret;
}
val mul(val a, val b)
{
        val ret;
        ret.n = (a.n * b.n + 5 * a.sq5 * b.sq5) % P;
        ret.sq5 = (a.n * b.sq5 + a.sq5 * b.n) % P;

        return ret;
}

val pow(val v, int n)
{
        val ans = {1,0};
        while(n>0){
                if(n%2){
                        ans = mul(ans, v);
                }

                v = mul(v,v);
                n/=2;
        }

        return ans;
}

long pow(long v, int n)
{
        long ans = 1;
        while(n>0){
                if(n%2){
                        ans = v * ans;
                        ans %= P;
                }

                v = v * v;
                v %= P;
                n/=2;
        }

        return ans;
}

Measured memory_bytes: 384
/*
　　　　　　 ＿＿
　　　　　／＞　　 フ
　　　　　|   _　 _l
　 　　　／` ミ＿x ノ   Zzz..
　　 　 /　 　 　 |   コード見ちゃだめ！！
　　　 /　 ヽ　　  ﾉ
　 　 │　　|　|  |
　／￣|　　 |　|  |
　| (￣ヽ＿_ヽ_)_ _)
　＼二つ
*/

#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define REP(i, n) for (int i = 0; i < n; i++)
const int MOD = 1e9 + 7;
typedef long long ll;
const long long INF = 1LL << 60;
using Graph = vector<vector<int>>;

int main() {
  int x;
  cin >> x;
  int time = 0;
  int position = 0;
  while (position < x) {
    time++;
    position = (time * (time + 1)) / 2;
  }
  cout << time << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if(a < b && b < c)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 2596
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
using ll = long long int;

const ll MOD = 1e9 + 7;

ll pow_fast(ll n, ll k) {
  if (k == 0) {
    return 1LL;
  }
  if (k == 1) {
    return n;
  }

  if (k % 2 == 0) {
    ll tmp = pow_fast(n, k / 2);
    return tmp * tmp % MOD;
  } else {
    ll tmp = pow_fast(n, (k - 1) / 2);
    tmp *= tmp;
    tmp %= MOD;
    return tmp * n % MOD;
  }
}

template <typename T>
class stack {
 private:
  vector<T> _vec;

 public:
  stack(){};

  void push(T n) {
    _vec.push_back(n);
    return;
  }

  void pop() {
    if (this->empty()) {
      return;
    }
    _vec.erase(_vec.end() - 1);
    _vec.shrink_to_fit();
    return;
  }

  size_t size() { return _vec.size(); }

  T top() { return _vec[this->size() - 1]; }
  bool empty() { return _vec.empty(); }
};

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

  ll sum = 1;
  for (ll i = 1; i <= N; i++)
  {
    sum *= i;
    sum %= MOD;
  }
  cout << sum << endl;
}

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

const int N = 100000;
int Q;
int L[100010], R[100010];

bool IsPrime(int p) {
    bool flg = true;
    for (int i = 2; i * i <= p; ++i) {
        if (p % i == 0) flg = false;
    }

    return flg;
}

int main() {
    cin >> Q;
    for (int i = 0; i < Q; ++i) cin >> L[i] >> R[i];

    // Nまでの素数を取得
    // 素数の場合は、該当要素を1にする
    vector<int> p(N + 1, 0);
    for (int i = 2; i <= N; ++i) {
        if (IsPrime(i)) p[i] = 1;
    }

    // 2017に似た数を取得する
    // 似た数は、該当要素を2にする
    vector<int> pp(N + 1, 0);
    for (int i = 2; i <= N; ++i) {

        // 奇数を対象とする
        if (i % 2 != 0) {
            if (p[i] == 1 && p[(i + 1) / 2] == 1) pp[i] = 1;
        }
    }

    // 累積和を算出する
    vector<int> s(N + 2, 0);
    for (int i = 0; i <= N; ++i) {
        s[i + 1] = s[i] + pp[i];
    }

    // 条件に合致する要素を検索する
    for (int i = 0; i < Q; ++i) {
        cout << s[R[i] + 1] - s[L[i]] << endl;
    }

    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,flag=1;
    cin>>n;
  	int a[n];
  	for(int i=0; i<n; i++)
      cin>>a[i];
  	for(int i=0; i<n; i++)
    {
      if(a[i] % 2 ==0)
      {
        if((a[i]%3!=0) && (a[i]%5!=0))
        {
          flag=0;
          break;
        }
      }
    }
  	if(flag == 1)
      cout<<"APPROVED";
  	else
      cout<<"DENIED";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cassert>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)

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

int sx, sy, gx, gy;
int n;
vector<int> xs, ys;
int lx, ly;

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

#define INF (1<<29)

#define MAX 300
#define OFFSET 150
int brd[MAX][MAX];

int dist[MAX][MAX][6];

class node
{
public:
	int x, y, t;
	node(){}
	node(int x, int y, int t):x(x), y(y), t(t) {}

	bool operator<(const node& r) const {
		return dist[x][y][t] > dist[r.x][r.y][r.t];
	}
};

int dijkstra()
{
	rep(i, MAX) rep(j, MAX) rep(k, 6) dist[i][j][k] = INF;

	priority_queue<node> que;
	dist[sx][sy][0] = 0;
	que.push(node(sx, sy, 0));

	while (!que.empty()) {
		node n = que.top(); que.pop();
		int x = n.x, y = n.y, t = n.t;

		rep(i, 6) {
			int nx = x+dx[i], ny = y+dy[x%2][i];
			if (brd[nx][ny]) continue;
			if (!(abs(x-OFFSET) <= lx)) continue;
			if (!(abs(y-OFFSET) <= ly)) continue;
			int nt = (t + 1)%6;

			int direction = abs((x-OFFSET)*(y-OFFSET)*t)%6;
			int dd = dist[x][y][t] + (i==direction?0:1);
			if (dist[nx][ny][nt] > dd) {
				dist[nx][ny][nt] = dd;
				que.push(node(nx, ny, nt));
			}
		}
		{
			int nt = (t+1)%6;
			if (dist[x][y][nt] > dist[x][y][t]+1) {
				dist[x][y][nt] = dist[x][y][t]+1;
				que.push(node(x, y, nt));
			}
		}
	}

	int ans = INF;
	rep(i, 6)
		ans = min(ans, dist[gx][gy][i]);
	return ans==INF?-1:ans;
}

int main(void)
{
	cin >> sx >> sy >> gx >> gy;
	cin >> n;
	memset(brd, 0, sizeof(brd));
	rep(i, n) {
		int x, y;
		cin >> x >> y;
		x += OFFSET;
		y += OFFSET;
		brd[x][y] = 1;
	}
	cin >> lx >> ly;

	sx += OFFSET;
	sy += OFFSET;
	gx += OFFSET;
	gy += OFFSET;
	cout << dijkstra() << endl;

	return 0;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
using namespace std;
LL n,A[100005],B[100005],ans;
int main(){
	scanf("%lld",&n);
	for(int i=0;i<n;++i) {
		scanf("%lld %lld",&A[i],&B[i]);
	}
	for(int i=n-1;i>=0;--i) {
		A[i]+=ans;
		ans+=(B[i]-(A[i]%B[i]))%B[i];
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
	int i,j,p;
	int a[100];
	
	for (i = 0; i < 3; i++){
		cin >> a[i];
	}
	
	for (j = 0; j < 2; j++){
		for (i = 0; i < 2; i++){
			if (a[i]>a[i + 1]){
				p = a[i + 1];
				a[i + 1] = a[i];
				a[i] = p;
			}
		}
	}

	cout << a[0] << " " << a[1] << " " << a[2] << endl;

	return 0;
}


Measured memory_bytes: 3080
def solve():
    N = int(input())
    a = [int(x) for x in input().split()]

    count = {}
    for x in a:
        count[x] = count.get(x, 0) + 1
        count[x-1] = count.get(x-1, 0) + 1
        count[x+1] = count.get(x+1, 0) + 1

    # print(count)
    ans = max(count.values())
    return ans


def main():
    print(solve())


if __name__ == '__main__':
    main()

Measured memory_bytes: 19748
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define forn(i, n) for (ll i = 0; i < (n); i++)
#define fori(i, b, e) for (ll i = (b); i < (e); i++)
#define forr(i, b, e) for (ll i = (b); i >= (e); i--)
#define allele(v) v.begin(), v.end()
#define fi first
#define se second
#define Mat vector<vector<ll>>
#define Arr vector<ll>
#define Matd vector<vector<ld>>
#define Arrd vector<ld>

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    map<string, ll> m;
    string s;
    forn(i, n)
    {
        cin >> s;
        sort(allele(s));
        m[s]++;
    }
    ll ans = 0;
    for(auto p : m) ans += p.se * (p.se - 1) / 2;
    cout << ans;
    return 0;
}

Measured memory_bytes: 11264
N,K=[int(i) for i in input().split()]
h=sorted([int(input()) for _ in range(N)])

ans=10**9

for i in range(N-K+1):
    if ans>h[i+K-1]-h[i]:
        ans=h[i+K-1]-h[i]
    else:
        continue
print(ans)


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

#define int long long
#define INF ((int)1e17)
#define MAX 110000

int N, K;
int a[MAX], hoge[MAX], fuga[MAX];
vector<int> node[MAX];


signed main(){
  int ans = 0, temp = 0;
  stack<pair<int,pair<int,int> > > st;

  cin>>N>>K;

  for(int i = 0; i < N; i++){
    hoge[i] = -1;
  }

  for(int i = 0; i < N; i++){
    cin>>a[i];
    a[i]--;
    if(i) node[a[i]].push_back(i);
  }

  st.push(make_pair(0,make_pair(0,0)));

  while(!st.empty()){
    pair<int,pair<int,int> > p = st.top(), t; st.pop(); 
    int num = p.first;

    if(p.second.second >= node[num].size()){      
      if(num == 0) break;
      else {
	t = st.top(); st.pop();
	if(p.second.first+1 == K && a[num]){
	  ans++;
	  p.second.first = -1;
	}
	t.second.first = max(t.second.first,p.second.first+1);
      }
      st.push(t);
    } else {
      st.push(make_pair(num,make_pair(p.second.first,p.second.second+1)));
      st.push(make_pair(node[num][p.second.second],make_pair(0,0)));
    }

  }

  if(a[0] != 0) ans++;

  
  cout<<ans<<endl;

  

  return 0;
}


Measured memory_bytes: 10752
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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 ctoi(char c){return c - '0';}


// TODO: write
int main() {
  #define int ll 
  int n,W;cin>>n>>W;
  vector<int> w(n),v(n);rep(i,n)cin>>w[i]>>v[i];
  vector<vector<int>> dp(n+10,vector<int>(W+10));
  rep(i,n+10)dp[i][0] = 0;
  rep(i,n){
    rep(j,W+1){
      chmax(dp[i+1][j],dp[i][j]);
      if(j - w[i] >= 0)chmax(dp[i+1][j],dp[i][j-w[i]] + v[i]);
    }
  }
  print(dp[n][W]);
  return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

ll N;
ll A, B, C;
vector<ll> L;

// 現在 i 番目を見ていて、そのときの値が a, b, c のときの
// 最小コスト
ll dfs(ll i, ll a, ll b, ll c) {
    if(i >= N) {
        // 全く値が減っていない場合は不正
        if(a == A || b == B || c == C) { return LLINF; }
        return abs(a) + abs(b) + abs(c);
    }
    ll ret = LLINF;

    // a に対して L[i] をつかう
    ll cand_a = dfs(i+1, a - L[i], b, c);
    if(a == A) { ret = min(ret, cand_a); }
    else { ret = min(ret, cand_a + 10); }

    // b に対して L[i] をつかう
    ll cand_b = dfs(i+1, a, b - L[i], c);
    if(b == B) { ret = min(ret, cand_b); }
    else { ret = min(ret, cand_b + 10); }

    // c に対して L[i] をつかう
    ll cand_c = dfs(i+1, a, b, c - L[i]);
    if(c == C) { ret = min(ret, cand_c); }
    else { ret = min(ret, cand_c + 10); }

    // L[i] は使わない
    ret = min(ret, dfs(i+1, a, b, c));
    return ret;
}

ll solve() {
    return dfs(0, A, B, C);
}

signed main()
{
    cin >> N >> A >> B >> C;
    L.resize(N);
    REP(i, N) { cin >> L[i]; }
    ll ans = solve();
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())

h = []
diff = 10000000000

for i in range(n):
    h.append(int(input()))

h = sorted(h)

for i in range(n-k+1):
    if h[i+k-1] - h[i] <= diff:
        diff = h[i+k-1] - h[i]

print(diff)

Measured memory_bytes: 8280
#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a); i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl
 
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const double PI = acos(-1);
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
int main()
{   
    //freopen("exercise.in", "r", stdin);
    //freopen("exercise.out", "w", stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0)->sync_with_stdio(0);
    int n;
    cin>>n;
    map<string, int> mp;
    mp["AC"] = 1;
    mp["TLE"] = 1;
    mp["WA"] = 1;
    mp["RE"] = 1;
    
    string s;
    owo(i, 0, n) {
        cin>>s;
        mp[s]++;
    }
    for(auto it: mp) {
        if(it.first=="AC") cout<<"AC x "<<(it.second-1)<<"\n";
    }
    for(auto it: mp) {
        if(it.first=="WA") cout<<"WA x "<<(it.second-1)<<"\n";
    }
    for(auto it: mp) {
        if(it.first=="TLE") cout<<"TLE x "<<(it.second-1)<<"\n";
    }
    for(auto it: mp) {
        if(it.first=="RE") cout<<"RE x "<<(it.second-1)<<"\n";
    }
    return 0;
}


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

int main()
{
  int a, b;
  cin >> a >> b;

  int cnt = 0;
  for(int i = a; i<= b; i++){
    if((i % 10 == i / 10000) && (i / 1000)%10 == (i % 100)/10) cnt++;
  }

  cout << cnt << endl;

  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    #define int long long
    #define endl '\n'
    ///Yeah, I am the backupguy!
    using namespace std;
    int32_t main()
    {
    iostream::sync_with_stdio(0);
    cin.tie(0);
    int n,counter=2;
    cin>>n;
    if(n==2){
    cout<<1;
    exit(0);
    }
    n--;
    for(int i=2;i*i<=n;i++){
    if(n%i==0){
    counter++;
    }
    if(n%(n/i)==0&&n/i!=i){
    counter++;
    }
    }
    n++;
    for(int i=2;i*i<=n;i++){
    if(n%i==0){
    int nn=n;
    while(nn%i==0){
    nn/=i;
    }
    if((nn-1)%i==0){
    counter++;
    }
    }
    if(n%i==0&&n/i!=i){
    int nn=n;
    while(nn%(n/i)==0){
    nn/=(n/i);
    }
    if((nn-1)%(n/i)==0)
    counter++;
    }
    }
    cout<<counter;
    return 0;
}


Measured memory_bytes: 384
def examA():
    S = SI()
    ans = 0
    for s in S:
        if s=="+":
            ans +=1
        else:
            ans -=1
    print(ans)

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

examA()


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair

int main(){
	ll x;
	cin >> x;
	ll a=360;
	while(1){
		if(a%x==0){
			cout << a/x << endl;
			return 0;
		}
		a+=360;
	}
}


Measured memory_bytes: 3636
inf = 10000000000

def merge_sort(A, left, right, count):
    if left + 1 < right:
        mid = (left + right) // 2
        count_l = merge_sort(A, left, mid, count)
        count_r = merge_sort(A, mid, right, count)
        return merge(A, left, mid, right) + count_l + count_r
    return 0

def merge(A, left, mid, right):
    L = A[left:mid] + [inf]
    R = A[mid:right] + [inf]

    i = j = 0
    for k in range(left, right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
    
    return right - left

if __name__ == "__main__":
    n = int(input())
    *A, = map(int, input().split())
    ans = merge_sort(A, 0, n, 0)
    print(*A)
    print(ans)


Measured memory_bytes: 61644
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,k;
  cin>>a>>b>>k;
  if(a==b){cout<<a<<endl;return 0;}
  k=min(b-a,k);
  vector<int> is(0);
  for(int i=a;i<a+k;i++){is.push_back(i);}
  for(int i=b;i>(b-k);i--){is.push_back(i);}
  sort(is.begin(),is.end());
  is.erase(unique(is.begin(),is.end()),is.end());
  for(int x:is){cout<<x<<endl;}
}

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

#define MAX_NUM (1000000000 + 7)

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

u64 dec_dig(u64 num) {
  u64 res = 0;
  while (num > 0) {
    num /= 10;
    ++res;
  }
  return res;
}

u64 gcd(u64 a, u64 b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }

  return b ? gcd(b, a % b) : a;
}

int main() {
  cout << setprecision(18);
  u32 N;
  cin >> N;
  string S;
  cin >> S;
  map<char, u32> Num;
  Num['R'] = 0;
  Num['G'] = 0;
  Num['B'] = 0;
  vector<map<char, u32>> NumSum(N);
  for (u32 i = 0; i < N; ++i) {
    Num[S[i]]++;
    NumSum[i] = Num;
  }
  u64 res = 0;
  for (u32 i = 0; i < N - 2; ++i) {
    for (u32 j = i + 1; j < N - 1; ++j) {
      if (S[i] == S[j]) continue;
      char target;
      if ('R' != S[i] && 'R' != S[j]) target = 'R';
      if ('G' != S[i] && 'G' != S[j]) target = 'G';
      if ('B' != S[i] && 'B' != S[j]) target = 'B';
      res += NumSum[N - 1][target] - NumSum[j][target];
      if ((2 * j - i) < N) {
        if (S[2 * j - i] == target) res--;
      }
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 4108
#include <ios>
#include <iostream>
#define MOD 1000000000000000000LL

long long int ways[1005][1005] = {};

int main()
{
    for (int i = 0; i < 1005; i++)
    {
        for (int j = 0; j <= i; j++)
        {
            if (i == 0 && j == 0)
                ways[i][j] = 1;
            else if (j == 0)
                ways[i][j] = 1;
            else if (j == i)
                ways[i][j] = 1;
            else
                ways[i][j] = ways[i-1][j] + ways[i-1][j-1];
        }
    }
    int n, p, x, odd = 0, even = 0;
    long long int ans = 0;
    std::cin >> n >> p;
    for (int i = 0; i < n; i++)
    {
        std::cin >> x;
        if (x & 1)
            odd++;
        else
            even++;
    }
    for (int i = 0; i <= odd; i++)
        if (i % 2 == p % 2)
            for (int j = 0; j <= even; j++)
                ans += ways[odd][i]*ways[even][j];
    std::cout << ans << '\n';
}


Measured memory_bytes: 7424
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(ll i = 0; i < (n); i++)
typedef long long ll;
const ll MOD = 1000000007;
int main()
{
    int n;
    string s, t;
    string ans = "";
    cin >> n >> s >> t;
    rep(i,n){
        ans += s[i];
        ans += t[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                           \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
  cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long A;
  string s;
  cin >> A >> s;
  int B = (s[0] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
  A *= B;
  cout << A / 100 << endl;
  return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int,  int>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

ll dp[404][404];
int flag [404][404];
vector<ll> a, sum;
int n;

ll f(int l,int r){
	if(flag[l][r])return dp[l][r];
	flag[l][r]=1;
	if(l==r)return 0;
	//どこで切るか全通り試す
	ll fans=INF64;
	for(int m = l; m < r; ++m){
		fans = min(fans, f(l, m) + f(m+1, r));
    }
	
	return dp[l][r]=fans+sum[r+1]-sum[l];
}

int main(){
	cin >> n;
	a.resize(n); sum.resize(n+1);
	for(int i = 0; i < n; ++i){
        cin >> a[i]; sum[i+1] = sum[i] +a[i];
    } 
	
	ll ans = f(0, n-1);
    cout << ans << endl;
}

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

int main()
{

    int hour = 0, minute = 0;
    double hangle, mangle;
    double difangle = 0;
    int i;
    int num;
    
    scanf("%d",&num);
    if (0 < num && num <= 10000) {
        for(i = 0; i < num; i++){
            scanf("%d:%d",&hour ,&minute);
            if ((0 <= hour && hour < 12) && (0 <= minute && minute < 60)) {
                hangle = (hour * 30) + ((double)minute / 2);
                mangle = minute * 6;
                difangle  = (hangle - mangle);
                if (difangle < 0) {
                    difangle *= -1;
                }
               // printf("%lf\n",hangle);
                //printf("%lf\n",mangle);
                if (difangle > 180) {
                    if (hour < 6 && 30 < minute) {
                        difangle = hangle + 360 - mangle;
                    }
                    else{
                        difangle = mangle + 360 - hangle;
                    }
                }
                if (0 <= difangle && difangle < 30) {
                    printf("alert\n");
                   // printf("%lf\n",difangle);
                }
                else if (90 <= difangle && difangle <= 180){
                    printf("safe\n");
                  //  printf("%lf\n",difangle);
                }
                else {
                    printf("warning\n");
                  //  printf("%lf\n",difangle);
                }
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 576
#include <cstdio>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
	int t, a[3];
	scanf("%d", &t);
	while (t --) {
		scanf("%d%d%d", &a[0], &a[1], &a[2]);
		sort(a, a + 3);
		if (a[2] * a[2] == a[0] * a[0] + a[1] * a[1]) printf("YES\n");
		else printf("NO\n");
	}

	return 0;
}

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

#define all(container) container.begin(), container.end()
#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))

typedef long long       ll;

typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvll;
typedef vector<vd>		vvd;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;
typedef vector<vs>		vvs;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;

typedef struct edge_ {
	ll to;
	ll cost;
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

template <typename T>
using mat2d = vector<vector<T>>;

constexpr double	PI = 3.14159265358979323846;
constexpr ll		INF = 1 << 15;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template<typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

istream& operator >> (istream& is, point& p) {
	is >> p.x >> p.y;
	return is;
}

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

template<typename T>
ostream& operator << (ostream& os, const set<T>& s) {
	for (const T& x : s) os << x << " ";
	return os;
}

ostream& operator << (ostream& os, const edge e) {
	os << "{to: " << e.to << ", cost: " << e.cost << "}";
	return os;
}

ostream& operator << (ostream& os, const point& p) {
	os << "(" << p.x << " " << p.y << ")";
	return os;
}

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/


int main()
{
	int W, H, N;
	cin >> W >> H >> N;
	vi x(N), y(N), a(N);
	for (int i = 0; i < N; i++)
		cin >> x[i] >> y[i] >> a[i];

	int l = 0, t = H, b = 0, r = W;

	for (int i = 0; i < N; i++) {
		switch (a[i])
		{
		case 1:
			l = max(l, x[i]);
			break;
		case 2:
			r = min(r, x[i]);
			break;
		case 3:
			b = max(b, y[i]);
			break;
		case 4:
			t = min(t, y[i]);
			break;
		}
	}

	cout << max(r - l, 0) * max(t - b, 0) << endl;
	
	return 0;
}

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

using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

int main(){
  int n, q;
  cin >> n >> q;
  vector< vector<int> > v(n, vector<int>(0));
  // vector<int> output;
  int tmp;
  int tmp2;
  int tmp3;
  rep_i(i, q){
    cin >> tmp;
    if(tmp == 0){
      cin >> tmp2;
      cin >> tmp3;
      v[tmp2].push_back(tmp3);
    }else if(tmp == 1){
      cin >> tmp2;
      if(v[tmp2].empty()){
          cout << endl;
      }
      rep_i(i, v[tmp2].size()){
        if(i == v[tmp2].size() - 1){
          cout << v[tmp2][i] << endl;
        }else{
          cout << v[tmp2][i] << " ";
        }
      }
    }else{
      cin >> tmp2;
      if (!v[tmp2].empty()){
        v[tmp2].clear();
      }
    }
  }
}


Measured memory_bytes: 5748
#include<bits/stdc++.h>
using namespace std;
int main(){
    int f1=0,f2=1,n,xx;
    cin>>n;
    for (int i=1;i<=n;i++)
    {
       xx=f2;
        int next = f1 + f2;
        f1 = f2;
        f2 = next;
}
printf("%d\n",f2);
}



Measured memory_bytes: 3224
#include<bits/stdc++.h>
using namespace std;
long long n;
long long x,m;
int sa[100100];
long long add[100010];
int main()
{
	cin>>n>>x>>m;
	int Bit=1;
	long long l,r;
	for(long long a=x;;a=(a*a)%m,Bit++)
	{
		if(!sa[a]) sa[a]=Bit;
		else
		{
			l=sa[a],r=Bit-1;
			break;
		}
		add[Bit]=add[Bit-1]+a;
	}
	long long len=r-l+1;
	long long ans=add[min(n,l-1)];
	n=max(0ll,n-l+1);
	if(n) ans+=(add[r]-add[l-1])*(n/len)+(add[n%len+l-1]-add[l-1]);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4408
N=int(input())
W=[input() for _ in range(N)]
flg=1
flg_1=1
for i in W:
    if W.index(i)!=0:
        if i[0]!=W[W.index(i)-1][-1]:
            flg=0
            break
if len(set(W))!=len(W):
    flg_1=0
    
print("Yes" if flg and flg_1 else "No")

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

int main() {
	int n,k;
	int h[100000];
	int min = 1000000000;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}

	sort(h, h + n);

	for (int i = 0; i <= n - k; i++) {
		if (h[i + k - 1] - h[i] < min) {
			min = h[i + k - 1] - h[i];
		}
	}
	cout << min << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<vector<int>> g(n);
    map<P,int> w;
    rep(i,n-1){
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
        w[P(a,b)] = c;
        w[P(b,a)] = c;
    }

    vector<ll> dist(n, -1);
    queue<int> que;
    
    dist[0] = 0;
    que.push(0);
    while(!que.empty()){
        int v = que.front();
        que.pop();

        for(auto nv : g[v]){
            if(dist[nv] != -1) continue;
            dist[nv] = dist[v] + w[P(v,nv)];
            que.push(nv);
        }
    }

    rep(i,n){
        if(dist[i] % 2 == 0) cout << 0 << endl;
        else cout << 1 << endl;
    }
}

Measured memory_bytes: 21916
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
#define ll long long
#define MAX 100100
inline int read()
{
	int x=0;bool t=false;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=true,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return t?-x:x;
}
int n,x[MAX],m,d[MAX],ans[MAX],tmp[MAX];ll K;
double a[MAX];
int main()
{
	n=read();
	for(int i=1;i<=n;++i)x[i]=read();
	m=read();cin>>K;
	for(int i=1;i<=n;++i)d[i]=i,ans[i]=i;
	for(int i=1;i<=m;++i)
	{
		int x=read();
		swap(d[x],d[x+1]);
	}
	while(K)
	{
		if(K&1)
		{
			for(int i=1;i<=n;++i)tmp[i]=ans[d[i]];
			for(int i=1;i<=n;++i)ans[i]=tmp[i];
		}
		for(int i=1;i<=n;++i)tmp[i]=d[d[i]];
		for(int i=1;i<=n;++i)d[i]=tmp[i];
		K>>=1;
	}
	for(int i=1;i<=n;++i)a[i]=x[ans[i]]-x[ans[i]-1];
	for(int i=1;i<=n;++i)printf("%.1lf\n",a[i]+=a[i-1]);
	return 0;
}



Measured memory_bytes: 3840
def main():
    n, x = map(int, input().split())
    m = list()
    for _ in range(n):
        m.append(int(input()))

    left = x

    ans = len(m)
    left -= sum(m)

    ans += left // min(m)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060