akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define mod 1000000007
#define mx 1000002
mt19937 myrand(time(0));

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(),cout.tie();
    ll a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
    return 0;
}


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

int main(){
  int a,b,x,y,z;
  
  cin >> a >> b;
  
  x = a + a-1;
  y = b + b-1;
  z = a + b;
  
  cout << max( x , max ( y , z ) ) << endl;
  
  return 0;
}

Measured memory_bytes: 256
n,k=list(map(int,input().split()))
p=list(map(int,input().split()))
s=sum(p[0:k])
ans=(k+s)/2

for l in range(n-k):
  s-=p[l]
  s+=p[l+k]
  ans=max(ans,(k+s)/2)
print(ans)

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

#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define lch (o << 1)
#define rch (o << 1 | 1)

typedef double db;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int, int> pint;
typedef tuple<int, int, int> tint;

const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const ll INF_LL = 0x3f3f3f3f3f3f3f3f;

int a[N], c[N];
bool vst[N];
vector<int> vec[N];

int main() {
	ios::sync_with_stdio(0);

	int n, lim;
	cin >> n >> lim;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int i = 1; i <= n; i++)
		cin >> c[i];
	for (int i = 1; i <= n; i++) {
		if (vst[i]) continue;
		int o = i;
		while (!vst[o]) {
			vst[o] = 1;
			vec[i].push_back(o);
			o = a[o];
		}
	}

	ll ans = -INF_LL;
	for (int i = 1; i <= n; i++) {
		if (vec[i].empty()) continue;
		int siz = vec[i].size();

		static ll s[N];
		s[0] = 0;
		for (int j = 1; j <= siz; j++)
			s[j] = s[j + siz] = c[vec[i][j - 1]];
		for (int j = 1; j <= 2 * siz; j++)
			s[j] += s[j - 1];

		ll sum = s[siz];
		for (int j = 1; j <= min(siz, lim); j++) {
			ll maxs = -INF_LL;
			for (int k = 1; k <= siz; k++)
				maxs = max(maxs, s[k + j - 1] - s[k - 1]);
			if (sum > 0) maxs += sum * ((lim - j) / siz);
			ans = max(ans, maxs);
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 6188
import math

D = int(input())
c = list(map(int, input().split()))
S = []
for i in range(D):
    S.append(list(map(int, input().split())))

nocontest = [1 for i in range(26)]

for i in range(D):
    s = S[i]
    contest = [0 for j in range(26)]
    for j in range(26):
        contest[j] = c[j] * nocontest[j] * s[j]
    #print(contest)
    max_contest = max(contest)
    ans = contest.index(max_contest)
    print(ans + 1)
    
    for j in range(26):
        if j == ans:
            nocontest[j] = 1
        else:
            nocontest[j] += math.sqrt(i+1)
    #print(nocontest)

Measured memory_bytes: 9520
#include <bits/stdc++.h>
using namespace std;
int N, M, L, R, result, gate_cnt[101010];
int main(){
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        cin >> L >> R;
        gate_cnt[R]++;
        gate_cnt[L - 1]--;
    }
    for(int i = N - 1; i >= 1; i--){
        gate_cnt[i] += gate_cnt[i + 1];
    }
    for(int i = 1; i <= N; i++){
        if(gate_cnt[i] == M)
            result ++;
    }
    cout << result << '\n';
}


Measured memory_bytes: 640
/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh
#define hash asdgasdgasdgdfrywewery

#define eps 1e-9
#define M_PI 3.141592653589793
#define bsize 300

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 300031;

string st;

int main(){
//    freopen("apache.in","r",stdin);
//    freopen("apache.out","w",stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
 //   cin.tie(0);

    cin>>st;
    for(int i=0;i+1<st.size();i++){
    	if (st[i]==st[i+1])
    	{
    		cout<<"Bad"<<endl;
    		return 0;
    	}
    }

    cout<<"Good"<<endl;

//    cin.get(); cin.get();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define loop(i,n) rep(i,0,n)
using namespace std;
using ll = long long;
int main(){
    string s;
    cin >> s;
    bool ans=true;
    loop(i,s.length()){
        if((i%2==0&&s[i]=='L')||(i%2==1&&s[i]=='R'))ans=false;
    }
    if(ans)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>

using namespace std;

int main()
{
    int a, b;
    scanf("%d%d", &a, &b);
    
    int res = a + b;
    res = max(res, a - b);
    res = max(res, a * b);
    printf("%d", res);
    return 0;
}

Measured memory_bytes: 888
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
INF = 10**9

n, k = map(int, input().split())
p = [int(item) for item in input().split()]
total = 0
for i in range(k):
    total += p[i]
max_t = total
l = 0; r = k
for i in range(k, n):
    total += p[i] - p[i-k]
    if total > max_t:
        max_t = total
        l = i - k
        r = i

print(0.5 * k + max_t / 2.0)

Measured memory_bytes: 24292
#include <iostream>
using namespace std;
 
char a[4];
 
int main(){
  for(int i = 0; i < 4; ++i){
    cin >> a[i];
  }
  
  if(a[0] == a[1] || a[1] == a[2] || a[2] == a[3]){
    cout << "Bad" << endl;
    return 0;
  }
  
  cout << "Good" << endl;
}

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

const string YES = "Yes";
const string NO = "No";

void solve(std::string S, std::string T){
    T.pop_back();
    if(S == T)
        cout << YES << endl;
        else
        {
            cout << NO << endl;
        }
        
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>

int main()
{
	long long int N, A;
	long long int ans;
	std::cin >> N;
	std::cin >> A;
	ans = A;
	for (int i = 0; i < N - 1; i++) {
		std::cin >> A;
		if (A == 0)ans = A;
		if (ans != -1 && ans <= (double)1000000000000000000 / A)
			ans *= A;
		else {
			ans = -1;
		}
	}
	if (ans > 1000000000000000000)ans = -1;
	std::cout << ans << std::endl;

	return 0;
}

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

int main() {
int N;
cin>>N;
int ans=1234567890;
for(int i=1;i<N;i++){
  int a=i;
  int b= N-i;
  int da=0,db=0;
  while(a>0){
    da += a%10;
    a/=10;
  }
  while(b>0){
    db += b%10;
    b/=10;
  }
  ans =min(da+db,ans);
}
cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int i, j, H, W;
    while (cin >> H >> W)
    {
        if (H==0&&W==0) break;
        
        
    
    for ( i = 0; i < H; i++)
    {
    
        for ( j = 0; j < W; j++)
        {
            cout << "#";
        }
        cout << "\n";
        
    
    }
    cout << "\n";
        
    }

    

    
	return 0;
}


Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <iostream>
#define MN 101000

int fa[MN];
long long v[MN];
bool used[MN], ok[MN], del[MN];
int h[MN], nxt[2 * MN], to[2 * MN], K = 1;

void ins(int u, int v) {nxt[++K] = h[u]; h[u] = K; to[K] = v;}

struct xxx{int x, y, c;} e[MN];

int Find(int x) {return fa[x] == x ? x : fa[x] = Find(fa[x]);}

bool cmp(xxx a, xxx b) {return a.c < b.c;}

void dfs(int x, int now)
{
	if(used[x]) return; 
	used[x] = 1;
	for(int i = h[x]; i; i = nxt[i])
	{
		if(i / 2 > now) continue;
		ok[i >> 1] = 1;
		dfs(to[i], now);
	}
}

int main()
{
	int n, m; scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; i++) scanf("%lld", &v[i]), fa[i] = i;
	for(int i = 1; i <= m; i++) scanf("%d%d%d", &e[i].x, &e[i].y, &e[i].c);
	std::sort(e + 1, e + m + 1, cmp);
	for(int i = 1; i <= m; i++)
	{
		int X = Find(e[i].x), Y = Find(e[i].y);
		ins(e[i].x, e[i].y); ins(e[i].y, e[i].x);
		if(X != Y) fa[X] = Y, v[Y] += v[X];
		if(v[Y] < e[i].c) del[i] = 1;
	}
	int ans = 0;
	for(int i = m; i >= 1; i--)
	{
		if(del[i] && !ok[i]) ans++;
		if(!del[i] && !ok[i]) dfs(e[i].x, i);
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 7936
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

vector<string> create(int n) {
  vector<string> ans(n);
  if (n == 4) {
    ans[0] = "aacd";
    ans[1] = "bbcd";
    ans[2] = "cdaa";
    ans[3] = "cdbb";
    return ans;
  }
  
  if (n % 2 == 0) {
    vector<string> block = create(n/2);
    for (int i = 0; i < n/2; ++i) {
      ans[i] = block[i] + block[i];
      ans[i + n/2] = block[i] + block[i];
    }
    return ans;
  }

  if (n == 3) {
    ans[0] = "zz.";
    ans[1] = "..z";
    ans[2] = "..z";
    return ans;
  }    

  if (n == 5) {
    ans[0] = "aabbc";
    ans[1] = "hzz.c";
    ans[2] = "h..zd";
    ans[3] = "g..zd";
    ans[4] = "gffee";
    return ans;
  }

  if (n == 7) {
    ans[0] = "aa..ccd";
    ans[1] = "l.bb..d";
    ans[2] = "l.zz.e.";
    ans[3] = ".k..ze.";
    ans[4] = ".k..z.f";
    ans[5] = "j..hh.f";
    ans[6] = "jii..gg";
    return ans;
  }

  string row;
  rep(i,n) row += '.';
  rep(i,n) ans[i] = row;

  ans[0][0] = 'a';
  ans[0][1] = 'a';
  ans[n-2][n-2] = 'a';
  ans[n-2][n-1] = 'a';
  
  ans[1][0] = 'b';
  ans[1][1] = 'b';
  ans[n-1][n-2] = 'b';
  ans[n-1][n-1] = 'b';
  
  ans[0][n-2] = 'c';
  ans[1][n-2] = 'c';
  ans[n-2][0] = 'c';
  ans[n-1][0] = 'c';
  
  ans[0][n-1] = 'd';
  ans[1][n-1] = 'd';
  ans[n-2][1] = 'd';
  ans[n-1][1] = 'd';

  vector<string> center = create(n - 4);
  for (int i = 0; i < n-4; ++i) {
    for (int j = 0; j < n-4; ++j) {
      ans[i+2][j+2] = center[i][j];
    }
  }
  
  return ans;
}

vector<int> eval(vector<string> g) {
  vector<int> ans;
  for (int i = 0; i < g.size(); ++i) {
    int cnt = 0;
    for (int j = 0; j < g[0].size(); ++j) {
      if (g[i][j] != '.' and (j == 0 or g[i][j] != g[i][j-1])) {
	cnt++;
      }
    }
    ans.push_back(cnt);
  }
  for (int j = 0; j < g[0].size(); ++j) {
    int cnt = 0;
    for (int i = 0; i < g.size(); ++i) {
      if (g[i][j] != '.' and (i == 0 or g[i][j] != g[i-1][j])) {
	cnt++;
      }
    }
    ans.push_back(cnt);
  }
  return ans;
}

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

  if (n == 2) {
    cout << -1 << endl;
    return 0;
  }

  vector<string> ans = create(n);  
  for (string s : ans) {
    cout << s << endl;
  }

  /*
  vector<int> seq = eval(ans);
  for (int a : seq) {
    cerr << a << " ";
  }
  cerr << endl;
  */
}


Measured memory_bytes: 3456
n = int(input())
count = 0
for i in range(1, n+1):
    div_count = 0
    for j in range(1, i+1):
        if i % j == 0 and j % 2 == 1:
            div_count += 1
    if div_count == 8:
        count += 1

print(count)


Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        int a=cin.nextInt();
        int b=cin.nextInt();
        int c=cin.nextInt();
        string ans="win";
        if(a+b+c>21)ans="bust";
        Console.WriteLine(ans);
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
    public void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}

Measured memory_bytes: 13140
#include <iostream>
using namespace std;
int main(){
	long long N,f = 0,ans = 0;
	cin >> N;
	for (int i = 0; i < N; ++i)
	{
		int a;
		cin >> a;
		if(f > a) ans += (f-a);
		else f = a;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3620
import java.util.*;
public class Main {

    public static void main(String[] args){
        Main main = new Main();
        main.input();
        main.solve();
        main.output();
    }

    int S; // 1<=N<=2000
    long[] num;
    long result;

    private void input() {
        Scanner sc = new Scanner(System.in);
        S = sc.nextInt();
        num = new long[S];
    }

    private void solve() {
        if (S < 3) {
            result = 0;
            return;
        }
        if (S < 6) {
            result = 1;
            return;
        }

        num[0] = num[1] = 0;
        num[2] = num[3] = num[4] = 1;

        // S[n] = S[n-3] + S[n-4] + ... + S[3] + 1;
        for (int i=5; i<S; i++) {
            num[i] = 1L;
            for (int n=0; n<i-2; n++) {
                num[i] = (num[i] + num[n]) % 1000000007;
            }
        }
        result = num[S-1];
    }

    private void output() {
        System.out.println(result);
    }
}


Measured memory_bytes: 35740
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (size_t i = 0; i < size_t(n); i++)
#define forn1(i,n) for (size_t i = 1; i <= size_t(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int sx, sy, tx, ty;
string ans;

int main() {
    fastio();

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

    for (int i = sx; i < tx; i++) ans.push_back('R');
    for (int i = sy; i < ty; i++) ans.push_back('U');
    for (int i = sx; i < tx; i++) ans.push_back('L');
    for (int i = sy; i < ty; i++) ans.push_back('D');
    ans.push_back('L');
    for (int i = sy; i < ty + 1; i++) ans.push_back('U');
    for (int i = sx; i < tx + 1; i++) ans.push_back('R');
    ans.push_back('D');
    ans.push_back('R');
    for (int i = sy; i < ty + 1; i++) ans.push_back('D');
    for (int i = sx; i < tx + 1; i++) ans.push_back('L');
    ans.push_back('U');

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

const int MX = 15;
const int MM = 1000000007;

int N, M;
int G[MX][MX];
ll T[1<<MX][MX];

int main()
{
	int N, M, a, b, c;
	scanf("%d%d", &N, &M);
	for(int i = 1; i <= M; i++){
		scanf("%d%d%d", &a, &b, &c); a--, b--;
		G[a][b] = G[b][a] = c;
	}
	for(int i = 0; i < 1<<N; i++){
		for(int j = 0; j < N; j++) T[i][j] = 1e18;
	}
	for(int i = 1; i < 1<<N; i+=2) T[i][0] = 0;
	for(int i = 1; i < 1<<N; i+=2){
		for(int k = i; k; k = (k-1)&i){
			if( k&1 ) continue;
			int b = i^k;
			ll mn = 1e18, tot = 0;
			for(int p = 0; p < N; p++){
				if( ~b&1<<p ) continue;
				for(int q = 0; q < N; q++){
					if( k&1<<q ) tot += G[p][q];
				}
			}

			for(int l = 0; l < N; l++){
				if( ~b&1<<l) continue;
				for(int j = 0; j < N; j++){
					if(k&1<<j && G[l][j]) T[i][j] = min(T[i][j], T[b][l] + tot - G[l][j]);
				}
			}
		}
	}
	printf("%lld\n", T[(1<<N)-1][N-1]);
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int n;cin>>n;
	vector<ll> a(n);
	for(int i = 0; i < n; i++) {
		cin>>a[i];
	}
	vector<ll> s(n + 1,0);
	for(int i = 0; i < n; i++) {
		s[i + 1] = s[i] + a[i];
	}
	map<ll,ll> m;
	for(int i = 0; i < n + 1; i++) {
		m[s[i]]++;
	}
	ll ans = 0;
	for(auto& e:m){
		ans += e.sc * (e.sc - 1) /2;
	}
	cout << ans << endl;
	return 0;
}

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


void solve(long long A, long long B, long long C, long long D){
    ll cnt=0;
    for(ll i=0; i< 100; i++){
        if(A<=i && i<B && C<=i && i<D) cnt++;

    }
    cout << cnt << endl;
}   

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


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#define vector std::vector
#define string std::string
typedef long long ll;
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define min(a, b) std::min(a, b)
#define max(a, b) std::max(a, b)
#define abs(x) std::abs(x)

template <class T = int>
T in() { T x; std::cin >> x; return x; }
#define output(e) std::cout << e << '\n'

#ifdef LOCAL
#define db std::cout << "L" << __LINE__ <<
#define de << "\n"
#define dv(x) << " " << #x << "->" << x
#else
#define db
#define de
#define dv(x)
#endif

//
// Implementation
//

int main() {
  int N = in();
  string s = in<string>();
  int x = 0;
  int ans = 0;
  rep(i, s.size()) {
    if (s[i] == 'I') {
      x++;
    } else {
      x--;
    }
    ans = max(ans, x);
  }
  output(ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int s,w;
	cin >> s >> w;
	if(w >= s)
		cout << "unsafe" << endl;
	else	
		cout << "safe" << endl;
	return 0;
}

Measured memory_bytes: 3560
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
#define diup(a, b) (a % b == 0 ? a / b : a / b + 1)
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

void Main()
{
	string a, b, c;
	cin >> a >> b >> c;
	if (a[a.length()-1] == b[0] && b[b.length() - 1] == c[0])
		cout << "YES";
	else
		cout << "NO";
}

/*****/

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

	std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


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

int main() {
    int W, N;
    while(cin >> W >> N, W) {
        vector<int> x(N), sum(N + 1);
        for(int i = 0; i < N; ++i) {
            cin >> x[i];
            sum[i + 1] = sum[i] + x[i];
        }

        auto check = [&](int space) {
            vector<int> dp(N + 1);
            int limit_r = N, ok_r = N;
            int ok_cnt = 0;
            for(int i = N - 1; i >= 0; --i) {
                while(W - (sum[limit_r] - sum[i]) - (limit_r - i - 1) < 0) {
                    ok_cnt -= dp[limit_r--];
                }
                while(ok_r > limit_r || ok_r - i - 1 > 0 && (W - (sum[ok_r] - sum[i]) + ok_r - i - 2) / (ok_r - i - 1) <= space) {
                    ok_cnt += dp[ok_r--];
                }

                dp[i] = limit_r == N || ok_cnt > 0;
            }

            return dp[0] == 1;
        };

        int lb = 0, ub = W;
        while(ub - lb > 1) {
            const int mid = (ub + lb) / 2;
            if(check(mid)) {
                ub = mid;
            } else {
                lb = mid;
            }
        }

        cout << ub << endl;
    }
}


Measured memory_bytes: 3544
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
g = [set() for i in range(N)]

for i in range(M):
    a, b = list(map(int, input().split()))
    a -= 1; b -= 1
    
    g[a].add(b)
    g[b].add(a)
    
ans = 0
for i in range(N):
    f = True
    
    for v in g[i]:
        if H[i] <= H[v]:
            f = False
            break
    ans += f

print(ans)

Measured memory_bytes: 45200
#include <iostream>
#include <fstream>
#include <algorithm>       // for next_permutation
#include <vector>
#include <queue>
#include <bits/stl_numeric.h>

#define DEBUG 0
#define REP(i, n) for (long long i = 0; i < (n); i++) 
using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;


int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;

    int res;
    REP(i, max(a,b))
    {
        cout << min(a,b);
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k;
int upbit(int x)
{
    for(int i=30;i>=0;i--)
        if(x>>i&1) return i;
    return -1;
}
vector<pair<int,int>>v[55];
long long sum[55];
int main()
{
    //freopen("01.txt","r",stdin);
    scanf("%d%d",&n,&k);
    long long ans=0,res=0;
    int u=upbit(k);
    for(int i=1;i<=n;i++)
    {
        int a,b;scanf("%d%d",&a,&b);
        int k=upbit(a);
        if(k==-1||(a&k)==a) res+=b;
        else v[k].push_back({a,b}),sum[k]+=b;
    }
    for(int i=u;i>=0;i--)
        if(k>>i&1)
        {
            long long s=0;
            for(int j=i-1;j>=0;j--)
                s+=sum[j];
            ans=max(ans,res+s);
            for(pair<int,int>x:v[i])
            {
                x.first^=1<<i;
                int k=upbit(x.first);
                if(k==-1) res+=x.second;
                else v[k].push_back(x),sum[k]+=x.second;
            }
        }
    ans=max(ans,res);
    printf("%lld\n",ans);
}


Measured memory_bytes: 16500
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>


using namespace std;


int main() {
	long long int N, M, tmp, key;
	cin >> N >> M;

	vector<long long int>a(N), b(N), c(M), d(M), ans(N);

	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i];
	}

	for (int i = 0; i < M; i++) {
		cin >> c[i] >> d[i];
	}

	for (int i = 0; i < N; i++) {
		key = pow(10, 10);
		for (int j = 0; j < M; j++) {
			tmp = abs(a[i] - c[j]) + abs(b[i] - d[j]);
			if (tmp < key) {
				key = tmp;
				ans[i] = j + 1;
			}
		}
	}

	for (int i = 0; i < N; i++) {
		cout << ans[i] << "\n";
	}

	return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define f first 
# define s second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)
# define forn(i,n) for(int i=1;i<=n;++i)

using namespace std;

template<class T> void umin(T &a,T b){a=min(a,b);}
template<class T> void umax(T &a,T b){a=max(a,b);}

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

const int inf=1e9,mod=1e9+7,N=2e5+5;

void solve(){
	int n;
	cin>>n;
	vector<int>a(n);
	multiset<int>s;
	rep(i,n){
		cin>>a[i];
		s.insert(a[i]);
	}
	rep(i,n){
		s.erase(s.find(a[i]));
		cout<<*s.rbegin()<<'\n';
		s.insert(a[i]);
	}
}

int main(){
 	Speed();
	int T=1; 
	//cin>>T;	
	while(T--)solve();
}

Measured memory_bytes: 13416
#include <stdio.h>

int main(void)
{
  int a[10], b[10], i, j, tmp;

  for(i = 0; i < 10; i++)
    scanf("%d", &a[i]);

  for(i = 0; i < 10; i++)
    scanf("%d", &b[i]);

  for(i = 0; i < 9; i++){
    for(j = i+1; j < 10; j++){
      if(a[i] < a[j]){
	tmp = a[i];
	a[i] = a[j];
	a[j] = tmp;
      }
      if(b[i] < b[j]){
	tmp = b[i];
	b[i] = b[j];
	b[j] = tmp;
      }
    }
  }

  printf("%d %d\n", a[0]+a[1]+a[2], b[0]+b[1]+b[2]);

  return 0;
}

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

int main(void) {
	
	int N, K;
	string S;

	cin >> N >> S >> K;

	char k = S.at(K - 1);

	for (int i = 0; i < N; i++)
	{
		if (S.at(i) != k) S.at(i) = '*';
	}

	cout << S << endl;

	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main()
{
  int N,K,C[101]={0,};
  scanf ("%d %d",&N,&K);
  for (int k=0;k<K;k++){
    int d; scanf ("%d",&d); while (d--){
int x; scanf ("%d",&x); C[x]++;
    }
  }
  int a = 0;
  for (int i=1;i<=N;i++) if (!C[i]) a++;
  printf ("%d\n",a);
return 0;
}


Measured memory_bytes: 1736
#include <stdio.h>

#define LENGTH 256

int judge(int i, int n[]){
    if(n[i - 1] < n[i] && n[i] < n[i + 1]){
        return 1;
    }else if(n[i + 1] < n[i] && n[i] < n[i - 1]){
        return 1;
    }else{
        return 0;
    }
}

int main(void) {
    char input1[LENGTH];
    char input2[LENGTH];
    int r, i;
    int count = 0;
    fgets(input1, LENGTH-1, stdin);
    sscanf(input1, "%d", &r);
    int n[20]; 
    fgets(input2, LENGTH-1, stdin);
    sscanf(input2, 
            "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d ", 
            &n[0], &n[1], &n[2], &n[3], &n[4], &n[5], &n[6], &n[7], &n[8], &n[9],
            &n[10], &n[11], &n[12], &n[13], &n[14], &n[15], &n[16], &n[17], &n[18], &n[19]);
    for(i = 1; i < r - 1; i++){
        count += judge(i, n);
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 128
#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>;

const int INF = 1001001001;

int a[12][12];

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> c(n);
  rep(i,n) {
    cin >> c[i];
    rep(j,m) cin >> a[i][j];
  }

  int ans = INF;
  rep(s,1<<n) {
    int cost = 0;
    vector<int> d(m);
    rep(i,n) {
      if (s>>i&1) {
        cost += c[i];
        rep(j,m) d[j] += a[i][j];
      }
    }
    bool ok = true;
    rep(j,m) if (d[j] < x) ok = false;
    if (ok) ans = min(ans, cost);
  }
  if (ans == INF) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	// your code goes here
	ll N,t;
	while(cin>>N)
	{
		if(N<100)
		{
			cout<<'0'<<endl;
		}
		else
		{
			bool chk=false;
			int res=N/100;
			//cout<<"res "<<res<<endl;
			for(int i=1;i<=5;i++)
			{
				int sum=N;
				//cout<<"Before: "<<sum<<endl;
				//cout<<"mid :";
				for(int j=0;j<res;j++)
				{
					sum=sum-(100+i);
					//cout<<sum<<" "<<endl;
				}
				//cout<<endl;
				if(sum<=0)
				{
					chk=true;
				}
			}
			if(chk)
	     	{
			    cout<<'1'<<endl;
		    }
		    else
	    	{
		    	cout<<'0'<<endl;
	     	}
		}
	}
	return 0;
}

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

int main() {
	int i;
	long long a,b,c[10000],sum=0,dd=0;
	while(1){
		cin >> a ;
		if(a==0 ) break;
		for(i=0;i<a;i++){
			cin >> c[i];
		}
		sort(c,c+a);
		for(i=0;i<a;i++){
			sum+=dd;
			dd+=c[i];
		}
		cout << sum << endl;
		sum=0;
		dd=0;
	}
	return 0;
}

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

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        int n=fsc.nextInt();
        long sum=0;
        long min=Long.MAX_VALUE;
        long l;
        int neg=0;
        boolean ex0=false;
        for(int i=0;i<n;i++){
            l=fsc.nextLong();
            if(l<0) neg++;
            else if(l==0) ex0=true;
            l=Math.abs(l);
            if(l<min){
                if(min<Long.MAX_VALUE) sum+=min;
                min=l;
            }
            else sum+=l;
        }
        if(neg%2==0||ex0) sum+=min;
        else sum-=min;
        System.out.println(sum);
        fsc.close();
        
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}

Measured memory_bytes: 22452
#include<iostream>

using namespace std;

int main(){
	
	int a[9999] = { 0 };

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

		cin >> a[i];

		if (a[i] == 0){

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

				if (a[i] == 0){
					return 0;
				}
				cout <<"Case "<<i+1<<": "<< a[i] << endl;

				

			}


		}

	}
	return 0;
}

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

int main() {

    int N;
    cin >> N;

    int X[N];
    for(int i = 0; i < N; i++) {
        cin >> X[i];
        X[i]--;
    }

    int ans = 1000000007;
    for(int p = 0; p < 100; p++) {
        int cost = 0;
        for(int j = 0; j < N; j++) {
            cost = cost + (p-X[j])*(p-X[j]);
        }

        ans = min(ans, cost);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
long long int S[200010];
long long int U[200010];




int main(void){
    // Your code here!
    long long int N,H,W,A,B,K,i,j,k,ans,count,cost,tmp;
    
    
    string T;
    bool flag;
    count=0;
    ans=0;
    flag=false;
    cin >>N>>K;
    
    for (i=0;i<N;i++){
    cin>>S[i];
    }
    
    for (i=0;i<N-K;i++){
        //cout << S[i]<<S[K+i]<< endl;
        if (S[i]<S[K+i]){
            cout<< "Yes" <<endl;
        }
        else{
            cout<< "No" <<endl;
        }
    }
 

    
    

    return 0;
    
}



Measured memory_bytes: 5192
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  int N; cin >> N;
  vector<int64_t> answer(N+1);
  answer.at(0) = 2; answer.at(1) = 1;
  
  for(int i = 2; i <= N; i++){
    answer.at(i) = answer.at(i-1) + answer.at(i-2);
  }
  
  cout << answer.at(N) << endl;

}

Measured memory_bytes: 256
def gcd(a, b) : 
    while a : 
        a, b = b % a, a
    return b

N = int(raw_input())

arr = map(int, raw_input().strip().split(' '))

result = arr[0]
for i in xrange(1, len(arr)) : 
    result = gcd(result, arr[i])


print result



Measured memory_bytes: 11296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fori(n) for ( int i = 0; i < (n);i++)
#define forj(n) for ( int j = 0; j < (n);j++)
#define fork(n) for ( int k = 0; k < (n);k++)
#define forghj(n) for ( int ghj = 0; ghj < (n);ghj++)
#define fori1(n) for ( int i = (n)-1; i >= 0;i--)
#define all(vector) (vector).begin(),(vector).end()
#define pii pair < int, int >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define INF 1e9+7
#define _FORTIFY_SOURCE 0
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
#pragma GCC optimize "-O3"

int main() {
    int n;
    cin >> n;
    vector < int > a;
    a.resize(n);
    fori(n) cin >> a[i];
    int ans = 0;
    int kek = 1;
    fori(n-1) {
        if (a[i] == a[i+1]) {
            kek++;
            if (i == n-2) {
                ans+=(kek/2);
            }
        } else  {
            ans+=(kek/2);
            kek = 1;
        }
    }
    cout << ans;
}


Measured memory_bytes: 256
from math import factorial
n,m=map(int,input().split())
if n>m+1 or n+1<m:
  print(0)
  exit()

if n == m:
  print(2*((factorial(n)%1000000007)*(factorial(m)%1000000007))%1000000007)
if n != m:
  print(((factorial(n)%1000000007)*(factorial(m)%1000000007))%1000000007)

Measured memory_bytes: 4112
#include <iostream>
#include <chrono>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

using namespace std;

int main() {
	int N = 1000000;
	int a, b, c;
	cin >> a >> b >> c;
	for (int i = 0; i <= N; i++) {
		if (((i*a) - c) % b == 0) {
			cout << "YES" << endl;
			break;
		}
		if (i == N)
			cout << "NO" << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int n,a;

int main()
{
    cin >> n;
    for (int i(1); i<=n; i++)
    {
        cin >> a;
        if (a%2==0)
        {
            if (a%3==0 or a%5==0) continue;
            else
            {
                cout << "DENIED";
                return 0;
            }
        }
    }
    cout << "APPROVED";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  string s; cin >> s;

  for(int i = 0; i < s.size()-1; i++){
    string t = s.substr(i,3);
    if(t[0] == t[1]){
      cout << i+1 << " " << i+2 << endl;
      return 0;
    }
    if(t.size() >= 3 && t[0] == t[2]){
      cout << i+1 << " " << i+3 << endl;
      return 0;
    }
  }
  cout << "-1 -1" << endl;

  return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main()
{
    int p,q,r;
    scanf("%d%d%d",&p,&q,&r);
    int minn=205;
    if(p+q<minn)
        minn=p+q;
    if(q+r<minn)
        minn=q+r;
    if(r+p<minn)
        minn=r+p;
    printf("%d\n",minn);

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int main()
{
  string x, y;
  cin >> x >> y;
  if(x == y){
    cout << "=" << endl;
  }else{
    cout << ((x<y)?"<":">") << endl;
  }

}


Measured memory_bytes: 256
//凸だけ考える
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#define int long long
using namespace std;

int n, a, b, c, d;

bool check(int x) {
	int ge = max(a + c * x, b + c * (n - 1 - x));
	int jo = min(a + d * x, b + d * (n - 1 - x));
	return ge <= jo;
}

signed main() {
	int i;
	
	cin >> n >> a >> b >> c >> d;
	
	for (i = 1; i < n - 1; i++) {
		if (check(i)) {
			cout << "YES" << endl;
			return 0;
		}
	}
	
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type node struct {
	v          int
	prev, next *node
}
type list struct {
	head, tail node
}

func newList() *list {
	ll := new(list)
	ll.head.v = -1
	ll.tail.v = -2
	ll.head.prev = nil
	ll.head.next = &ll.tail
	ll.tail.prev = &ll.head
	ll.tail.next = nil
	return ll
}
func (ll *list) splice(lp *list) {
	// llの末尾にlpを接合する。
	ll.tail.prev.next = lp.head.next
	lp.head.prev = ll.tail.prev
	lp.tail.prev.next = &ll.tail
	ll.tail.prev = lp.tail.prev
}

func (ll *list) pushBack(v int) {
	nn := new(node)
	nn.v = v
	ll.tail.prev.next = nn
	nn.prev = ll.tail.prev
	nn.next = &ll.tail
	ll.tail.prev = nn
}
func (ll *list) pushFront(v int) {

}
func (ll *list) popBack(v *int) bool {
	return true
}
func (ll *list) popFront(v *int) bool {
	return true
}
func (ll *list) show(w *bufio.Writer) {
	cnt := 0
	for lp := ll.head.next; lp != nil && lp != &ll.tail; lp = lp.next {
		if cnt > 0 {
			fmt.Fprint(w, " ")
		}
		fmt.Fprint(w, lp.v)
		cnt++
	}
	fmt.Fprintln(w)
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt(sc)
	lists := make([]*list, n)
	q := nextInt(sc)
	wtr := bufio.NewWriter(os.Stdout)
	for i := 0; i < q; i++ {
		op := nextInt(sc)
		v := nextInt(sc)
		if op == 0 {
			x := nextInt(sc)
			// fmt.Fprintf(wtr, "debug q[%d] - appending %d to lists[%d]\n", i, v, x)
			if lists[v] == nil {
				lists[v] = newList()
			}
			lists[v].pushBack(x)
		} else if op == 1 {
			// fmt.Fprintf(wtr, "debug q[%d] - printing lists[%d]\n", i, v)
			if lists[v] == nil {
				fmt.Fprintln(wtr)
			} else {
				lists[v].show(wtr)
			}
		} else { // op == 2
			t := nextInt(sc)
			// fmt.Fprintf(wtr, "debug q[%d] - appending lists[%d] at the end of lists[%d]\n", i, t, v)
			if lists[t] == nil {
				lists[t] = newList()
			}
			if lists[v] == nil {
				lists[v] = newList()
			}
			lists[t].splice(lists[v])
			lists[v] = lists[t]
			lists[v] = nil
		}
		// wtr.Flush()
	}
	wtr.Flush()
}
func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}



Measured memory_bytes: 25580
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int m,f,r;
    
    while (1) {
        
        scanf("%d %d %d",&m,&f,&r);
        
        if (m == -1 && f == -1 && r == -1) {
            break;
        }
        
        if (m == -1 || f == -1) {
            printf("F\n");
            continue;
        }
        
        if (m+f >= 80) {
            printf("A\n");
        } else if (m+f >= 65 && m+f < 80) {
            printf("B\n");
        } else if (m+f >= 50 && m+f < 65) {
            printf("C\n");
        } else if (m+f >= 30 && m+f < 50) {
            if (r >= 50) {
                printf("C\n");
            } else {
                printf("D\n");
            }
        } else {
            printf("F\n");
        }
        
    }
    
    return 0;

}

Measured memory_bytes: 584
#include<cstdio>
using namespace std;
int book[5]={0};//M,A,R,C,H
long long c[100001][4];
long long c0;//总方案数 
void C(int n,int m)
{
	//for(int i=0;i<=n;i++)
//	c[i][0]=1;
//	for(int j=1;j<=m;j++)
//	c[0][j]=0;
	for(int i=0;i<=n;i++)
		for(int j=0;j<=m;j++)
		if(j==0)
			c[i][j]=1;
		else if(i==0&&j>=1)
			c[i][j]=0;
		else
			c[i][j]=c[i-1][j]+c[i-1][j-1];
}
int main()
{
	int N,num=0;//可选的总人数 
	char a[100001][11];
	scanf("%d",&N);
	for(int i=0;i<N;i++)
	{
		scanf("%s",&a[i]);
		switch (a[i][0]){
		case 'M':book[0]++;num++;break;
		case 'A':book[1]++;num++;break;
		case 'R':book[2]++;num++;break;
		case 'C':book[3]++;num++;break;
		case 'H':book[4]++;num++;break;
		defaut:break;
		}
	}
	C(num,3);
	c0=c[num][3];
	for(int i=0;i<5;i++)
	{
		if(book[i]==2)
			c0=c0-c[num-2][1];
		if(book[i]>=3)
			c0=c0-c[book[i]][3]-c[book[i]][2]*c[num-book[i]][1];
	} 
	//for(int i=0;i<5;i++)
//	printf("%d",book[i]);
//	printf("%d",num);
	printf("%lli",c0);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define INF 1 << 30
#define LLINF 1LL << 60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll fact(ll a){ll b=1;FOR(i,1,a)b*=i;return b;}

int solve(string s, string t)
{
  int sn = s.size();
  int tn = t.size();
  vector<vector<int>> dp(sn+1,vector<int>(tn+1,0));
  REP(i,sn+1) dp[i][0] = i;
  REP(i,tn+1) dp[0][i] = i;
  FOR(i,1,sn) FOR(j,1,tn)
    dp[i][j] = min({dp[i-1][j]+1,dp[i][j-1]+1,dp[i-1][j-1]+(s[i-1]!=t[j-1])});
  return dp[sn][tn];
}

int main()
{
  string s, t; cin >> s >> t;
  cout << solve(s,t) << endl;
  return 0;
}

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

int main(){
    int N;
    cin >> N;
    if(N%2==0)N--;
    int count1=0;
    while(N>=105){
        int count0=0;
        for(int i=1;i<=N/2;i++)count0+=(N%i==0);
        count1+=(count0==7);
        N-=2;
    }
    cout << count1 << endl;
}


Measured memory_bytes: 3608