akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	static Scanner scanner;

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

	    int N=gi();
	    int P=gi();

	    int k=0;
	    int g=0;
	    for (int i=0; i<N;i++) {
	    	int a=gi();
	    	if(a%2==0) {
	    		g++;
	    	}else {
	    		k++;
	    	}
	    }
	    long c=0;
	    //System.out.println(Math.max(max-min+1,0));
        long gc=(long)Math.pow(2, g);
        long kc=0;
        int i=0;
        while(i<=k) {
        	if(i%2==P) {
        	    kc+=combi(k,i);
        	}
        	i++;
        }
        c=gc*kc;

        System.out.println(c);
	}
	// ｎ個の中からm個選ぶ組み合わせの数
	public static long combi(long n, long m) {
		if (n<m) return 0;
		long c=Math.min(m, n-m);
		long ckaijo=kaijo(c);
		long v=1;
		while(c!=0) {
			c--;
			v*=n;
			n--;
		}
		return v/ckaijo;
	}

	// ｎ個の中からm個選ぶ組み合わせの数
	public static long kaijo(long n) {
	    if(n<=1) return 1;

	    return n* kaijo(n-1);
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35492
N,T = map(int,input().split())
L = []
A = []
for i in range(N):
    L.append(list(map(int,input().split())))

for i in range(N):
    if L[i][1]<=T:
        A.append(L[i][0])
if A ==[]:
    print("TLE")
else:
    print(min(A))

Measured memory_bytes: 3060
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {
    String s;
    int N;
    private void solve() {
        s = next();
        N = s.length();

        int ans = 0;
        for(int i = 0;i < N;i++) {
            for(int j = i + 1;j <= N;j++) {
                String t = s.substring(i, j);
                int len = j - i;
                for(int k = 0;k < t.length();k++) {
                    if (t.charAt(k) != 'A' && t.charAt(k) != 'C' && t.charAt(k) != 'G' && t.charAt(k) != 'T') {
                        len = 0;
                        break;
                    }
                }
                ans = Math.max(ans, len);
            }
        }

        out.println(ans);
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 21332
#include<iostream>
#include<vector>

using namespace std;

int main() 
{
    int r,D,x2k;
    cin>>r>>D>>x2k;

    vector<ulong>xs;
    xs.push_back(x2k);
    for(int i=1;i<11;++i)
    {
        xs.push_back((r*xs[i-1])-D);
    }

    for(int i=1;i<11;++i)
    {
        cout<<xs[i]<<endl;
    }

    return 0;
    
}

Measured memory_bytes: 3556
#include <iostream>

int main () {

  int i, j, key, answer;
  int size_of_ary, num_of_keys;
  int ary[10010];

  answer = 0;

  std::cin >> size_of_ary;
  for (i = 0; i <= size_of_ary - 1; i++) std::cin >> ary[i];

  std::cin >> num_of_keys;
  for (i = 0; i <= num_of_keys - 1; i++) {

    std::cin >> key;

    for (j = 0; j <= size_of_ary - 1; j++) {

      if (key == ary[j]) {

        answer ++;
        break;
      }
    }
  }

  std::cout << answer << std::endl;
  return 0;
}



Measured memory_bytes: 3136
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char data[10][6] = {
    "*",
    ".,!? ",
    "abc",
    "def",
    "ghi",
    "jkl",
    "mno",
    "pqrs",
    "tuv",
    "wxyz"
};

int data_len[10] = {1,5,3,3,3,3,3,4,3,4};

char out[256][2048],answer[256][2048];

int main(void){
    int k,c;
    scanf("%d",&c);
    for(k=0;k<c;k++){
      int i,j=0,count=-1,length,num,flag=0;
      char input[2048],input_num[2];
      char now;
      scanf("%s",input);
      length = strlen(input);
      input_num[1]='\0';
      now = input[0];
      for(i=0;;i++){
        if(input[i]=='\0') break;
        if(now==input[i]) count++;
        else{
          input_num[0] = now;
          out[k][j] = data[atoi(input_num)][count%data_len[atoi(input_num)]];
          j++;
          count = -1;
          now = input[i];
          i--;
        }
      }
      j = 0;
      for(i=0;i<strlen(out[k]);i++){
        if(out[k][i]!='*'){
          answer[k][j] = out[k][i];
          j++;
      }
      }
    }
    for(k=0;k<c;k++){
        printf("%s\n",answer[k]);
    }
    return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int ans = 0;
  ans += 800 * N;
  ans -= (int)(N / 15) * 200;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
A = [int(x) for x in input().split()]
# 最初の所持金
money = 1000
# 所有株数
kabu_c = 0
# 予言で翌日上がるかどうかのリスト
l = list()
for i in range(n-1):
    if A[i+1] - A[i] > 0:
        l.append(1)
    else:
        l.append(0)
for idx, i in enumerate(l):
    # 翌日上がってかつその時の株価で買える所持金があるなら買う。
    if i == 1 and money - A[idx] >= 0:
        kabu_c = money // A[idx]
        money = money - (kabu_c * A[idx])
    # 翌日上がらないなら売っちゃう（その時点での利幅ゲット）
    if i == 0:
        money = money + (kabu_c * A[idx])
        kabu_c = 0
# 上がり調子だと最終日で売り切ってない可能性があるので所持している株は最終日で売り切る
if kabu_c > 0:
    money = money + (kabu_c * A[n-1])
print(money)

Measured memory_bytes: 9092
import java.io.{BufferedReader, InputStreamReader}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val _ = in.readLine()
    val as = in.readLine().split("\\s+").map(_.toInt)

    System.out.println(
      if(as.filter(_ % 2 == 0).forall(a => a % 3 == 0 || a % 5 == 0)) {
        "APPROVED"
      } else {
        "DENIED"
      }
    )
  }
}


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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;
vector<int> val(51), sz(51);

int solve(int l, int x) {
    if (l == 0) return 1;
    if (x <= 1)return 0;
    if (x <= sz[l] / 2)return solve(l - 1, x - 1);
    if (x == sz[l] / 2 + 1)return 1 + val[l - 1];
    if (x < sz[l])return val[l - 1] + 1 + solve(l - 1, x - 1 - sz[l] / 2);
    return val[l];
}

void solve() {
    int n, x;
    cin >> n >> x;

//    string init = "P";
//    for (int i = 0; i < n; i++) {
//        string nw = 'B' + init + 'P' + init + 'B';
//        cout << nw << endl;
//        init = nw;
//    }
    cout << solve(n, x) << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    val[0] = sz[0] = 1;
    for (int i = 1; i <= 50; i++)
        val[i] = 2 * val[i - 1] + 1, sz[i] = 3 + sz[i - 1] * 2;

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define pb push_back
#define fr first
#define sc second
#define all(x) x.begin(), x.end()
#define skip continue
#define NAME "code"
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
void faster(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
 
const int MAXN = 2e5 + 2;
const ll INF = 1e9 + 1;
const ld pi = acos(-1);
const int dx[4] = {-1, -1, 1, 1};
const int dy[4] = {-1, 1, -1, 1};

ll n, cnt, ans;
string s;

int main(){
 
    faster();

    cin >> s;
    n = s.size();

    for(int i = 0; i < n; ++i){
        if(s[i] == 'S')
            cnt++;
        else {
            if(cnt == 0)
                ans++;
            else
                cnt--;
        }
    }
    cout << ans + cnt;

    return 0;
}


Measured memory_bytes: 720
import java.util.Scanner;

public class Main {
	public static long ctz(long n) {
		long ret = 0;
		while ((n & 1) == 0) {
			ret++;
			n >>= 1;
		}
		return ret;
	}
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long ret = 0;
		for (int i = 0; i < n; i++) {
			long input = sc.nextLong();
			ret += ctz(input);
		}
		System.out.println(ret);
	}
}

Measured memory_bytes: 36088
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll BIG=1e15;

int main(){
    int A,B; cin>>A>>B;
    if(A>9 || B>9) cout<<-1<<endl;
    else cout<<A*B<<endl;


} 


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

using namespace std;


typedef pair <long long ,long long>	PII;
typedef vector <int>	VI;
typedef vector <PII>    VII;
typedef priority_queue<PII,vector<PII>,greater<PII>> pairMinHeap;
typedef priority_queue<PII> pairMaxHeap;
typedef priority_queue<long long ,vector<long long>,greater<long long>> minHeap;
typedef priority_queue<long long> maxHeap;

#define what_is(x) cerr <<#x<<" is "<<x<<endl;
#define wis(x,y) cerr <<#x<<" is "<<x<<" and "<<#y<<" is "<<y<<endl;
#define getarr(n,d) for(int i=0;i<n;i++)cin>>d[i];
#define getgraph(n,g) for(int i=1;i<n;i++){int a,b;cin>>a>>b;a--;b--;g[a].push_back(b);g[b].push_back(a);}
#define getpartree(n,tree) for(int i=1;i<n;i++){int a;cin>>a;tree[a-1].push_back(i);}

struct POS{
    int x=0,y=0;
    POS():x(0),y(0){}
    POS(int _x,int _y):x(_x),y(_y){}
};

struct triple{
    int f,s,t;
    triple():f(0),s(0),t(0){}
    triple(int _f,int _s,int _t):f(_f),s(_s),t(_t){}
};

const int INF = 1e9+9;
const long long LINF = 1e17+9;
const long long MD=998244353 ;

inline long long po(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1)ans = (ans*a)%MD;
        a = (a*a)%MD;
        b/=2;
    }
    return ans;
}


const int N=1e5+33;

long long n,m,k,t;
long long arr[N];
string s;


int main() {
	ios_base::sync_with_stdio(false);cout.tie(nullptr);cin.tie(nullptr);cout << fixed;cout << setprecision(10);
    for(int i=0;i<4;i++){
        int a;
        cin>>a;
        arr[a]=1;
    }

    if(arr[1]==1 &&arr[9]==1 &&arr[7]==1 &&arr[4]==1)cout<<"YES";
    else cout<<"NO";

    return 0;
}


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

ll gcd(int a,int b){
    ll r;
    while(b != 0){
        if(a < b)swap(a,b);
        r = a%b;
        a=b;
        b=r;
    }
    return a;
}
ll lcm(ll a, ll b){
    return (a/gcd(a,b)*b);
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  ll x,y;
  cin>>x>>y;
  ll ans;
  ans = lcm(x,y);
  cout << ans << endl;
}


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

const long mod = 1000000007;
int n;
vector<int> g[200000];
long sz[200000];
long dp[200000];
long ans[200000];

long f[200001];
void pre() {
  f[0] = 1;
  for (int i = 0; i < n; ++i) {
    f[i + 1] = f[i] * (i + 1) % mod;
  }
}

long mpow(long b, long e) {
  if (e == 0) return 1;
  if (e % 2 == 1) return mpow(b, e - 1) * b % mod;
  long t = mpow(b, e / 2);
  return t * t % mod;
}

long inv(long n) {
  return mpow(n, mod - 2);
}

void prerec(int from, int prev) {
  long cnt = 1;
  long ret = 1;
  for (int to : g[from]) {
    if (to == prev) continue;
    prerec(to, from);
    cnt += sz[to];
    ret = ret * dp[to] % mod;
  }
  sz[from] = cnt;
  dp[from] = ret * inv(sz[from]) % mod;
}

void rec(int from, int prev, long inher) {
  const int m = g[from].size();
  vector<long> dps;
  
  for (int i = 0; i < m; ++i) {
    int to = g[from][i];
    if (to == prev) {
      dps.push_back(inher);
    } else {
      dps.push_back(dp[to]);
    }
  }
  
  vector<long> l(m, 1);
  vector<long> r(m, 1);
  for (int i = 0; i < m - 1; ++i) l[i + 1] = l[i] * dps[i] % mod;
  for (int i = m - 1; i > 0; --i) r[i - 1] = r[i] * dps[i] % mod;
  
  for (int i = 0; i < m; ++i) {
    int to = g[from][i];
    if (to == prev) continue;
    long nsz = n - sz[to];
    long ndp = l[i] * r[i] % mod * inv(nsz) % mod;
    rec(to, from, ndp);
  }
  
  long ret = 1;
  for (int i = 0; i < m; ++i) ret = ret * dps[i] % mod;
  ans[from] = ret * f[n - 1] % mod;
}

int main() {
  cin >> n;
  pre();
  
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  
  prerec(0, -1);
  rec(0, -1, 1);
  
  for (int i = 0; i < n; ++i) {
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 23024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    string S;
    cin >> S;
    int i;
    for (i = 1; i < 3; i++) {
        if (S[i-1] != S[i]) {
            cout << "Yes";
            break;
        }
    }
    if (i == 3)
        cout << "No";
}

Measured memory_bytes: 256
n = int(input())
s = input()

def f(x, y):
  a = 0
  for i in range(97, 97+26):
    k = chr(i)
    if k in x and k in y:
      a += 1
  return a

a = 0
for i in range(1, n-1):
  a = max(a, f(s[:i], s[i:]))
print(a)

Measured memory_bytes: 3060
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N=gets.to_i
A=get_i
even_cnt=A.count{|x| x.even?}
odd_cnt=N-even_cnt
puts 3**N-2**even_cnt

Measured memory_bytes: 1788
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.range;
class EOFException : Throwable { this() { super("EOF"); } }
class Reader {string[] t;int p;
  void next() {++p;while(p>=t.length) {if(stdin.eof) throw new EOFException; t=readln.split;p=0;}}
  string String() { next; return t[p]; }
  int Int() { next; return to!int(t[p]); }
  long Long() { next; return to!long(t[p]); }
  real Real() { next; return to!real(t[p]); }
};
Reader reader;

void main() {
  reader = new Reader;
	try {
    while(1) {
      int N = reader.Int;
      if (!N) break;
      int[] b = readln.split.map!(to!int).array;
      int ans = -1;
      foreach(iter; 0..10001) {
        bool ok = 1;
        foreach(i; 0..b.length) {
          if (b[i] != i+1) {
            ok = 0;
            break;
          }
        }
        if (ok) {
          ans = iter;
          break;
        }
        int[] c;
        foreach(ref x; b) {
          x--;
          if (x) c ~= x;
        }
        c ~= cast(int)b.length;
        b = c;
      }
      writeln(ans);
    }
	} catch (EOFException) {}
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define debug(x) cerr << "\n" \
                      << #x << ": " << x << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define int long long
#define print(x) cout << (x) << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = (1LL << 30);
const ll MOD = 1000000007;
//=============================================================
//=============================================================

int N, M;
const int mmax = 1000000005;
const int nmax = 100005;


map<int, int> soinsubunkai(int x)
{

    map<int, int> res;
    for (int i = 2; i * i <= x; i++)
    {
        while (x % i == 0)
        {
            x /= i;
            res[i]++;
        }
    }
    if (x != 1)
        res[x]++;
    return res;
}

const int MAX = 222222;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit()
{ // O(N)
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; ++i)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int ans = 1;
void solve()
{
    map<int,int> cx = soinsubunkai(M);

    for (auto x : cx)
    {
        int tmp = COM(x.second + N - 1, x.second);
        ans = (ans * tmp) % MOD;
    }
}

signed main()
{
    COMinit();
    cin >> N >> M;
    solve();

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
void print() {
    cout << endl;
}
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail) != 0)
        cout << " ";
    print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
    for (auto &a : vec) {
        cout << a;
        if (&a != &vec.back())
            cout << " ";
    }
    cout << endl;
}
template <class T>
void print(vector<vector<T>> &df) {
    for (auto &vec : df) {
        print(vec);
    }
}
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define xrep(i, a, b) for (int i = int(a); i < int(b); ++i)
using ll = long long;
const int INF = 1001001001;

int main() {
    int N;
    cin >> N;
    double cnt = 0;
    xrep(n, 1,N+1) {
        if(n%2==1) ++cnt;
    }
    printf("%.10f\n", cnt/(double)N);
}

Measured memory_bytes: 3748
def dps_rec(no, fno, d, hen, D, MD, P):
    D[no] = d
    P[no] = fno
    maxd = d
    for h in hen[no]:
        if h == fno:
            continue
        maxd = max(maxd, dps_rec(h, no, d + 1, hen, D, MD, P))
    MD[no] = maxd
    return maxd

def dps_stc(no, fno, d, hen, D):
    stack = [(no, fno, d)]
    while not stack == []:
        t = stack.pop()
        D[t[0]] = t[2]
        for h in hen[t[0]]:
            if h == t[1]:
                continue
            stack.append((h, t[0], t[2] + 1))

def main():
    N, u, v = map(int, input().split())
    hen = {}
    for i in range(N - 1):
        A, B = map(int, input().split())
        if A in hen.keys():
            hen[A].append(B)
        else:
            hen[A] = [B]
        if B in hen.keys():
            hen[B].append(A)
        else:
            hen[B] = [A]
    DEPTH_A = [-1 for i in range(N + 1)]
    DEPTH_T = [-1 for i in range(N + 1)]
    dps_stc(v, -1, 0, hen, DEPTH_A)
    dps_stc(u, -1, 0, hen, DEPTH_T)
    ans = 0
    for a, t in zip(DEPTH_A, DEPTH_T):
        if a > t:
            ans = max(ans, a - 1)

    print(ans)


if __name__ == '__main__':
    main()


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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Console.ReadLine();
            string result = string.Empty;
            foreach (var item in N)
            {
                if (item == '1')
                {
                    result += "9";
                }
                else
                {
                    result += "1";
                }
            }
            Console.Write(result);
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string cad;
int ans = 0 , m = 0;
vector<int> v;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
    cin>> cad;
	for(int i=0 ; i<cad.size() ; i++){
		if(cad[i] == 'R'){
			ans++;
		}
		else{
	        v.push_back(ans);
            ans = 0;			
		}
		if(i == cad.size()-1){
			v.push_back(ans);
		}
	}
	for(int i=0 ; i<v.size()  ; i++){
		if(m < v[i]) m = v[i];
	}
	cout<< m << '\n';
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main()
{
    int n;cin>>n;
    long long int ele;
    int f=1;
    for(int i=0;i<n;i++)
    {
        cin>>ele;
        if(ele%2==0 && f)
        {
            if((ele%3) && (ele%5))
                f=0;
        }
    }
    if(f)
        cout<<"APPROVED";
    else
        cout<<"DENIED";
}


Measured memory_bytes: 256
/**
*   author:  akifpathan
*   created: Saturday 19.09.2020 06:08:29 PM
**/

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

#ifdef LOCAL
#include "debug.h"
#else
#include<bits/stdc++.h>
using namespace std;
#define debug(x...)
#endif
 
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> 
using ordered_set= tree<T, null_type, 
		less<T>, 
		rb_tree_tag, tree_order_statistics_node_update> ;
template<class T> 		
using ordered_mset= tree<T, null_type, 
		less_equal<T>, 
		rb_tree_tag, tree_order_statistics_node_update> ;
		
*/
 
/*
 
PBDS
-------------------------------------------------
			0 based indexing
-------------------------------------------------			 
1) insert(value)
2) erase(value)
3) order_of_key(value) // Number of items strictly smaller than value
4) *find_by_order(k) : K-th element in a set (counting from zero)
 
*/
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());	

void solve()
{
	int n;
	cin>>n;
	
	ll ans=0;
	
	auto f=[&](int x)
	{
		int tot=0;
		for(int i=1;i*i<=x;i++)
		{
			if(x%i==0) 
			{
				tot+=2;
				if(i*i==x) tot--;
			}
		}
		return tot;
	};
	
	for(int i=1;i<n;i++)
	{
		int x=n-i;
		ans+=f(x);
	}
	
	cout<<ans;
}		

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	int testcase=1;
	//cin>>testcase;
	
	for(int i=1;i<=testcase;i++)
	{
		//cout<<"Case "<<i<<": ";
		solve();
	}
	
	#ifdef LOCAL
	cerr<<"\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms\n";
	#endif
	
	
	return 0;
}



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

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

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


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


int dp[MAX];


void solve() {
    int n;
    cin>>n;
    int ba = 0 , bx = 0 , xa = 0 , sum = 0;
    for (int i = 0; i < n; ++i) {
        string x;
        cin>>x;
        for(int j = 0 ; j< x.size() - 1 ; j++){
            if(x[j] == 'A' && x[j+1] == 'B'){
                sum++;
            }
        }
        if(x[0] == 'B' && x[x.size() - 1] == 'A')
            ba++;
        else if(x[0] == 'B')
            bx++;
        else if(x[x.size() - 1] == 'A')
            xa++;
    }


    if(ba > 0){
        sum += ba -1;
        if(xa != 0 ){
            sum ++;
            xa--;
        }
        if(bx != 0){
            sum++;
            bx--;
        }
    }
    sum += min(bx , xa);
    cout<<sum<<endl;

}


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

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

int main(){
  int n;
  string s;
  cin >> s;
  cin >> n;
  string ss;
  int count=0;
  rep(i,n){
    cin >> ss;
    ss = ss+ss;
    rep(j,ss.size()){
      if(s.substr(0,s.size()) == ss.substr(j,s.size())) {
	count++;
	break;
      }
    }
  }
  cout << count << endl;
  return 0;
}



Measured memory_bytes: 3188
// بِسمِ اللہِ  الرَّحم?نِ  الرَّ حِیم
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1000000007
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define INF 1e18
#define N 100100
typedef pair<ll,ll> pll;
ll power(ll a,ll b)
{
    if(b==1)return a;
    if(b==0)return 1;
    ll temp=power(a,b/2);
    ll ans=temp*temp;
    if(b&1)
        ans*=a;
    return ans;
}
ll power(ll a,ll b,ll p)
{
    a=a%p;
    if(b==1)return a;
    if(b==0)return 1;

    ll temp=power(a,b/2,p);
    ll ans=(temp*temp)%p;
    if(b&1)
        ans=(a*ans)%p;
    return ans%p;
}
ll inv(ll a,ll m)
{
    return power(a,m-2,m);
}
//code begins
signed main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    ll a,b,c,k;cin>>a>>b>>c>>k;
    ll sum=0;
    if(k>=a)
    {
        sum+=a;
        k-=a;
    }
    else
    {
        sum+=k;
        k=0;
    }

    if(k>=b)
    {
        sum+=0;
        k-=b;
    }
    else
    {
        sum+=0;
        k=0;
    }

    if(k>=c)
    {
        sum+=(-1*c);
        k-=c;
    }
    else
    {
        sum+=(-1*k);
        k=0;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3612
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,d;
    cin>>n>>d;
    ll ans=0;
    ll a,b,c;
    d*=d;
    rep(i,n){
        cin>>a>>b;
        a*=a;
        b*=b;
        c=a+b;
        if(c<=d){
            ans++;
        }
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 3592
#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 << 18;
const ll 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

int cnt[26];
char in[100050];

int main() {
	scanf("%s", in);
	for (int i = 0; in[i] != 0; i++) cnt[in[i] - 'a']++;

	for (int i = 0; i < 26; i++) if (!cnt[i]) return !printf("%c\n", i + 'a');
	return !printf("None\n");
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    ll N;cin>>N;
    vl value(N*3);
    rep(i,N*3)cin>>value[i];
    sort(all(value),greater<ll>());
    ll ans=0;
    rep(i,N)ans+=value[i*2+1];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  vector<bool> a(26,false);
  int l=s.size(),ans=l;
  for(int i=0;i<l;i++){
    a[s[i]-'a']=true;
  }
  for(int i=0;i<26;i++){
    if(a[i]){
      int cnt=0;
      string t=s;
      while(1){
        bool f=true;
        for(int k=0;k<t.size();k++)if(t[k]!='a'+i)f=false;
        if(f)break;
        for(int j=0;j<t.size()-1;j++){
          if(t[j]=='a'+i||t[j+1]=='a'+i)t[j]='a'+i;
        }
        t.pop_back();
        cnt++;
      }
      //cout << cnt << " " << t.size() << endl;
      if(cnt<ans)ans=cnt;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long

struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout <<fixed<<setprecision(12);
        cerr <<fixed<<setprecision(12);
    }
}IoSetup;

typedef long long ll;
typedef pair < int , int >  pii;
static constexpr const signed int INF = 0x3f3f3f3f;
static constexpr const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static constexpr const signed int SMOD = 1000000007;
static constexpr const signed int NMOD = 998244353;
static constexpr const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static constexpr const signed int dy[]={0,-1,0,1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a=max(a,b))==b;}
template<class T>bool chmin(T &a, const T &b){return(a=min(a,b))==b;}
inline int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int n;
int t[100100], a[100100];
int p[100100], q[100100];


signed main() {

    cin >> n;

    for(int i = 1; i <= n; i++) cin >> t[i];
    for(int i = 1; i <= n; i++) cin >> a[i];
    
    ll ans = 1LL;

    if(n == 1 and t[1] != a[1]) ans = 0;
    
    for(int i = 2; i < n; i++) {
        if((t[i] != t[i-1] and a[i] != a[i+1] and t[i] != a[i]) or
           (t[i] == t[i-1] and a[i] != a[i+1] and t[i] < a[i])  or
           (t[i] != t[i-1] and a[i] == a[i+1] and t[i] > a[i]))
            ans = 0;
        
        if(t[i] == t[i-1] and a[i] == a[i+1]) { 
            ans *= min(t[i], a[i]);
            ans %= SMOD;
        }
    }
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>

using namespace std;

typedef long long ll;

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


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll MOD=1e9+7;
const int INF=1<<30;

ll dp[110][100100];

int main(){
  ll N,W;
  cin >> N >> W;
  vector<ll> w(N);
  vector<ll> v(N);
  rep(i,N){
    cin >> w[i] >> v[i];
  }
  rep(i,N){
    rep(j,W+1){
      if(j+w[i]<=W) chmax(dp[i+1][j+w[i]],dp[i][j]+v[i]);
      chmax(dp[i+1][j],dp[i][j]);
    }
  }
  ll ans=0;
  rep(j,W+1){
    if(dp[N][j]>ans) ans=dp[N][j];
  }
  cout << ans << endl;
}


Measured memory_bytes: 79360
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF (1e10)
typedef long long unsigned int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

template<typename T>
T gcd(T a,T b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a * b / g;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

int N,K;


int main()
{
  cin>>N;
  ll a[N];
  ll L;
  cin >> L;
  int ans[N - 1];
  REP(i, 0, N)
  {
    cin >> a[i];
  }
  int idx = 0;
  bool flag = false;
  REP(i, 0, N - 1)
  {
    if(a[i]+a[i+1]>=L){
      idx = i;
      flag = true;
    }
  }
  if(!flag){
    cout << "Impossible" << endl;
    return 0;
  }
  ans[N - 2] = idx + 1;
  int tmp = idx;
  if(N>=3){
    for (int i = N - 3; i >= 0; i--)
    {
      if(idx>0){
        idx--;
        ans[i] = idx + 1;
      }else{
        tmp++;
        ans[i] = tmp + 1;
      }
    }
  }
  cout << "Possible" << endl;
  REP(i,0,N-1){
    cout << ans[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 2048
#include<stdio.h>
#include<string.h>

int main(){
  int A, B;

  scanf("%d", &A);
  scanf("%d", &B);

  int cnt = 0;
  for (int i = A; i <= B; i++) {
    if (i / 10000 == i % 10) {
      if ((i % 10000) / 1000 == (i % 100) / 10) {
        cnt += 1;
      }
    }
  }

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


Measured memory_bytes: 128
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = Integer.parseInt(sc.next());
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        sc.close();
        if (b - a <= 1) {
            System.out.println(k + 1);
        } else {
            long n = a;
            n += (long) (k + 1 - a) / 2 * (b - a);
            n += (long) (k + 1 - a) % 2;
            System.out.println(n);
        }
    }
}

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

using namespace std;

int main(void)
{
    int x;
    cin >> x;
    int a, b;
    int ok = false;
    for(int i = 120; i >= 0 ; i--){
        for(int j = i - 1; j >= -120; j--){
            if(pow(i, 5) - pow(j, 5) == x){
                a = i, b = j;
                ok = true;
                break;
            }
            if(pow(i, 5) - pow(j, 5) > 1000000000)  break;
        }
        if(ok)  break;
    }
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 4064
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=10000000010;


struct Edge{
  int to;int cost;
};

vector<Edge> tree[100005];
int  dist[100005];

void dfs(int v,int par,int dis){
  dist[v]=dis;
  for(auto &e : tree[v]){
    if(e.to==par)continue;
    dfs(e.to,v,dis+e.cost);
  }
}

signed main(){
  int n;
  cin>>n;
  rep(i,n-1){
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    tree[a].pb({b,c});
    tree[b].pb({a,c});
  }
  int q,k;
  cin>>q>>k;k--;
  dfs(k,-1,0);
  rep(i,q){
    int x,y;
    cin>>x>>y;x--;y--;
    cout<<dist[x]+dist[y]<<endl;
  }
  return 0;
}


Measured memory_bytes: 14336
import sys
input = sys.stdin.readline
N = int(input())
T = []
A = []
for i in range(N) :
    p, q = map(int,input().split())
    T.append(p)
    A.append(q)

Tak = T[0]
Aok = A[0]
for i in range(1, N) :
    Tb = (Tak + T[i] - 1) // T[i]
    Ab = (Aok + A[i] - 1) // A[i]
    Tak = T[i] * max(Tb, Ab)
    Aok = A[i] * max(Tb, Ab)

print(Tak + Aok)


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void){
    
    int N;
    int ans = 1;
    int count_Max = 0;
    cin >> N;
    
    for(int i = 1; i <= N; i++){
        int count = 0;
        int num = i;
        while(!(num%2)){
            count++;
            num /= 2;
        }
        if(count_Max < count){
            count_Max = count;
            ans = i;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val map = mapOf("SUN" to 7, "MON" to 6, "TUE" to 5, "WED" to 4, "THU" to 3, "FRI" to 2, "SAT" to 1)
    val s = sc.nextLine()
    println(map[s]!!)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 29348
program main
  implicit none
  integer i,D,j,last(26),day, score(26)
  integer,allocatable :: c(:),s(:,:)
  read(*, *)D
  allocate(c(26))
  allocate(s(D,26))
  read(*, *) (c(i), i = 1,26)
  do i = 1,D
    read(*, *) (s(i,j), j = 1,26)
  end do
  last = 0
  do i = 1,D-3
    last = last + 1
    score = 0
    do j = 1,26
      score(j) = s(i,j) - s(i+1,j) - s(i+2,j) - s(i+3,j) + 30*last(j)*c(j)
    end do
    day = 1
    do j = 1,26
      if (score(j) > score(day)) then
        day = j
      end if
    end do
    write(*, *) day
    last(day) = 0
  end do
  do i = D-2,D
    last = last + 1
    score = 0
    do j = 1,26
      score(j) = s(i,j) + 30*last(j)*c(j)
    end do
    day = 1
    do j = 1,26
      if (score(j) > score(day)) then
        day = j
      end if
    end do
    write(*, *) day
    last(day) = 0
  end do
end program main

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}

ll a,b;

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

Measured memory_bytes: 256
#include <stdio.h>

int d[101], c;

int main()
{
  int t;
  scanf("%d", &t);
  d[t]=1;
  scanf("%d", &t);
  d[t]=1;
  scanf("%d", &t);
  d[t]=1;
  
  for(int i=1; i<=100; i++)
    if(d[i]==1)
      c++;
  
  printf("%d\n", c);
}

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

int main(){
    int x , y;
    cin >> x >> y;
    int res = 0;
    if(x == 3){
        res += 100000;
    } else if (x == 2){
        res += 200000;
    } else if (x == 1){
        res += 300000;
    }
    if(y == 3){
        res += 100000;
    } else if (y == 2){
        res += 200000;
    } else if (y == 1){
        res += 300000;
    }
    if(x == 1 && y == 1){
        res += 400000;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n,x,y,bx,by;
    int ans=0;
    cin>>n;
    priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>r;
    priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>b;
    set<int>rys;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        r.push(pair(x,y));
    }
    for(int i=0;i<n;i++){
        cin>>x>>y;
        b.push(pair(x,y));
    }
    while(b.size()>0){
        tie(bx,by)=b.top();
        b.pop();
        while(r.size()>0&&r.top().first<bx){           
            rys.insert(r.top().second);
            r.pop();                    
        }
        if(rys.size()==0)continue;
        auto itr=rys.upper_bound(by);
        if(itr==rys.begin())continue;
        ans++;
        rys.erase(prev(itr));

    }
    cout<<ans;
    


}

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {

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

		int cnt = sc.nextInt();
		int[] nums = new int[cnt];
		for (int i = 0; i < cnt; i++) {
			nums[i] = sc.nextInt();
		}

		int falseCnt = 0;

		for (int i = 0; i < cnt; i++) {
			if (nums[i] != i + 1) {
				falseCnt++;
			}
		}

		if (falseCnt == 0 || falseCnt == 2) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	}

}


Measured memory_bytes: 22740
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] h = new long[n];
        for(int i=0;i<n;i++){
            h[i] = sc.nextLong();
        }
        long prev = h[0];
        int res =0;
        int now = 0;
        for(int i=1;i<n;i++){
            if(prev>=h[i]){
                now++;
            }
            else{
                now = 0;
            }
            if(res<now){
                res=now;
            }
            prev=h[i];
        }
        System.out.println(res);

    }
}

Measured memory_bytes: 61256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;

int		main(void)
{
	int N;
	cin >> N;
	map<int, int> C;
	for (int i = 0; i < N; i++)
	{
		int a;
		cin >> a;
		if (C.count(a))
			C[a]++;
		else
			C[a] = 1;
	}
	ll ans = 0;
	for (pair<int, int> p : C)
	{
		if (p.first > p.second)
			ans += p.second;
		if (p.first < p.second)
			ans += p.second - p.first;
	}
	cout << ans << endl;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	string s;
	cin >> s;
	cout << (s == "AAA" || s == "BBB" ? "No" : "Yes") << endl;
    
    return 0;
}



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

int main() {
  int n; cin >> n;
  vector<int> w(n);
  int sum = 0;
  for (int i = 0; i < n; i ++) {
    cin >> w[i];
    sum += w[i];
  }

  int ans = sum;
  for (int i = 0; i <= n; i ++) {
    int x = 0;
    for (int j = 0; j < i; j ++) {
      if (j < i) x += w[j];
    }
    ans = min(ans, abs(sum - x * 2));
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int i,A[3];
    int n5=0,n7=0;

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

    i = 0;
    while(i<=3){
        if(A[i]==5) n5 += 1;
        else if(A[i]==7) n7 += 1;
        i += 1;
    }

    if(n5==2 && n7==1)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}

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

int main(){
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
  
  if ( s < t ) cout << "Yes" ;
  else cout << "No";
}

Measured memory_bytes: 256