akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    vector<int> a(n), f(n);
    rep(i, n) {
        cin >> a[i];
    }
    rep(i, n) {
        cin >> f[i];
    }
    sort(a.begin(), a.end());
    sort(f.rbegin(), f.rend());

    ll left = -1LL, right = 1e12;
    while(left+1 < right) {

        ll mid = (left+right)/2LL;

        bool ok = [&]{

            ll cnt = 0;
            rep(i, n) {
                cnt += max(0LL, a[i] - mid/f[i]);
            }

            return cnt <= k;
        }();

        if(ok) {
            right = mid;
        }
        else {
            left = mid;
        }
    }
    
    cout << right << endl;
    return 0;
}

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

using namespace std;

int n,i,j,a[100005];

int main(){
	scanf("%d", &n);
	
	for(i = 0; i < n; i++)
	scanf("%d", &a[i]);
	
	int res = 1;
	int pre = a[0];
	int st = 0;
	//1 = increse 2 = decrese
	for(i = 0; i < n; i++){
		if(st == 0){
			if(a[i] > pre)
			st = 1;
			if(a[i] < pre)
			st = 2;
		}
		else{
			if(st == 1 && a[i] < pre){
				res++;
				st = 0;
			}
			else if(st == 2 && a[i] > pre){
				res++;
				st = 0;
			}
		}
		
		pre = a[i];
	}
	
	printf("%d\n", res);
}


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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h,w,n;
    cin >> h >> w >> n;
    int sum = 0;
    int cnt=0;
    if(h > w){
        while(sum < n){
            sum+=h;
            cnt++;
        }
    }
    else{
        while(sum < n){
            sum+=w;
            cnt++;
        }
    }
    cout << cnt << endl;

}

Measured memory_bytes: 256
from sys import stdin
import numpy as np

H, W = map(int,input().split())
board = [[str(c) for c in l.strip()] for l in stdin]
np_board = np.array(board)
np_board = np_board[:, np.any(np_board == "#", axis=0)]
np_board = np_board[np.any(np_board == "#", axis=1), :]

for i in range(np_board.shape[0]):
  for j in range(np_board.shape[1]):
    print(np_board[i][j], end="")
  print("")
    



Measured memory_bytes: 18740
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
using namespace std;
 
// ??¶??\???????????°????????????
#define MAX_N 100000 + 16
int parent[MAX_N];
int height[MAX_N];
 
void init(const int& n)
{
	for (int i = 0; i < n; ++i)
	{
		parent[i] = i;
		height[i] = 0;
	}
}
 
int find(const int& x)
{
	if (parent[x] == x)
	{
		return x;
	}
	else
	{
		return parent[x] = find(parent[x]);
	}
}
 
void unite(int x, int y)
{
	x = find(x);
	y = find(y);
	if (x == y)
	{
		return;
	}
 
	if (height[x] < height[y])
	{
		parent[x] = y;
	}
	else
	{
		parent[y] = x;
		if (height[x] == height[y])
		{
			++height[x];
		}
	}
}
 
bool same(const int& x, const int& y)
{
	return find(x) == find(y);
}
// End Of ??¶??\???
 
// ????§?????????¨?????\?????°
vector<int> children[MAX_N];
int parent_tree[MAX_N];
bool marked[MAX_N];
int ancestor[MAX_N];
// ?????????????¢?????????? ?????? + ??????
stack<char> operation;
stack<int>  target;
 
void bfs(int index, int the_ancestor)
{
	queue<int> q_index;
	queue<int> q_ancestor;
	q_index.push(index);
	q_ancestor.push(the_ancestor);
	while (!q_index.empty())
	{
		the_ancestor = q_ancestor.front(); q_ancestor.pop();
		index = q_index.front(); q_index.pop();
		if (marked[index] == true)
		{
			the_ancestor = index;
		}
		ancestor[index] = the_ancestor;
		for (vector<int>::iterator it = children[index].begin(); it != children[index].end(); ++it)
		{
			q_index.push(*it);
			q_ancestor.push(the_ancestor);
		}
	}
}
 
///////////////////////////SubMain//////////////////////////////////
int main(int argc, char *argv[])
{
 
	int N, Q;
	while (cin >> N, cin >> Q, N)
	{
		for (int i = 0; i < N; ++i)
		{
			children[i].clear();
			marked[i] = false;
		}
		marked[0] = true;
		int p;
		for (int i = 1; i < N; ++i)
		{
			cin >> p; --p;
			parent_tree[i] = p;
			children[p].push_back(i);
		}
		for (int i = 0; i < Q; ++i)
		{
			char o;
			int t;
			cin >> o >> t; --t;
			if (o == 'M')
			{
				if (marked[t])
				{
					continue;
				}
				else
				{
					marked[t] = true;
				}
			}
			operation.push(o);
			target.push(t);
		}
		bfs(0, 0);
		init(N);
		for (int i = 0; i < N; ++i)
		{
			unite(i, ancestor[i]);
		}
		unsigned long long result = 0;
		while (!operation.empty())
		{
			char o = operation.top(); operation.pop();
			int t = target.top(); target.pop();
			if (o == 'Q')
			{
				result += ancestor[find(t)] + 1;	// ?¢????index???1????§?
			}
			else
			{
				// ??§?????????????????????????????????????????????????\????????????¶??¶??????????\????
				int p = ancestor[find(parent_tree[t])];
				unite(t, parent_tree[t]);
				ancestor[find(t)] = p;
			}
		}
		cout << result << endl;
	}
	
 
	return 0;
}

Measured memory_bytes: 9852
#include <iostream>
#include<algorithm>
#define maxn 2000050
using namespace std;
int num[maxn],sum[maxn];
int a,b,k;
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>num[i];
        sum[i]=num[i];
    }
    if(is_sorted(num+1,num+1+n)) {cout<<"Yes";return 0;}
    else{
        sort(num+1,num+1+n);
        for(int i=1;i<=n;i++)
        {
            if(abs(num[i]-sum[i])>1) {cout<<"No";return 0;}
            else continue;
        }
        cout<<"Yes";
    }
}


Measured memory_bytes: 4736
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

    rep(i, n)
    {
        if (a[i] > i) {
            cout << -1 << endl;
            return 0;
        }
    }

    rep(i, n - 1)
    {
        if (a[i + 1] - a[i] > 1) {
            cout << -1 << endl;
            return 0;
        }
    }

    int64_t result = 0;
    rrep(i, n)
    {
        if (i == n - 1) {
            result += a[i];
        } else {
            if (a[i] >= a[i + 1]) {
                result += a[i];
            }
        }
    }
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 1024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.nextString();
            String wa = "WA";

            if (s.charAt(0) != 'A') {
                out.println(wa);
                return;
            }

            if (Character.isUpperCase(s.charAt(1))) {
                out.println(wa);
                return;
            }

            boolean flg = false;
            for (int i = 2; i < s.length(); i++) {
                if (s.charAt(i) == 'C') {
                    if (flg) {
                        out.println(wa);
                        return;
                    }
                    flg = true;
                } else if (Character.isUpperCase(s.charAt(i))) {
                    out.println(wa);
                    return;
                }
            }

            out.println(flg && s.charAt(s.length() - 1) != 'C' ? "AC" : wa);
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

    }
}



Measured memory_bytes: 21460
<?php

fscanf(STDIN, "%d", $N);
$S = str_split(trim(fgets(STDIN)));
fscanf(STDIN, "%d", $K);

for ( $i = 0; $i < $N; $i++ ) {
    if ( $S[$i] != $S[$K - 1] ) {
        $S[$i] = '*';
    }

}

for ( $i = 0; $i < $N; $i++ ) {
    echo $S[$i];
}


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

const ll MOD = 1000000007;

// nのcnt乗
ll pow2( ll n, ll cnt ){
  if( cnt == 0 ) return 1;
  if( cnt == 1 ) return n;
  ll tmp = pow2(n,cnt/2);
  if( cnt%2 == 0 )
    return tmp*tmp%MOD;
  else
    return tmp*n%MOD*tmp%MOD;
}

// nから(n-cnt+1)までの積
ll factorial( ll n, ll cnt ){
  if( cnt == 0 ) return 1;
  return n%MOD*factorial(n-1,cnt-1)%MOD;
}


int main(){
  ll n,a,b;cin >> n >> a >> b;
  ll ans = pow2(2,n) - 1;

  // nCa mod MOD
  ll a_denominator = factorial(a,a);
  ll nca = factorial(n,a)%MOD * pow2(a_denominator,MOD-2);
  nca %= MOD;

  // nCb mod MOD
  ll b_denominator = factorial(b,b);
  ll ncb = factorial(n,b)%MOD * pow2(b_denominator,MOD-2);
  ncb %= MOD;

  ans -= nca + ncb;

  while( ans < 0 )
    ans += MOD;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6640
n, m = map(int, input().split())
price = [0] * m
treasure = [0] * m
for i in range(m):
  price[i], _ = map(int, input().split())
  for c in map(int, input().split()):
    treasure[i] += 1 << c-1
dp = [10 ** 8 + 1] * (1 << n)
dp[0] = 0
for bit in range((1 << n) - 1):
  cost = dp[bit]
  for i in range(m):
    next_bit = treasure[i] | bit
    next_cost = price[i] + cost
    dp[next_bit] = min(dp[next_bit], next_cost)
if dp[-1] > 10 ** 8:
  print(-1)
else:
  print(dp[-1])

Measured memory_bytes: 45400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9+7;
#define REP(i,j,n) for(int i=j;i<n;i++)
#define rep(i,n) REP(i,0,n)


// 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(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    ll ary[n];
    rep(i,n) cin>> ary[i];

    ll wa=0;
    rep(i,n) 
    {
        wa += ary[i];
        wa %= MOD;
    }
    ll ans = 0;
    rep(i,n)
    {
        wa -= ary[i];
        wa = (wa + MOD) % MOD;
        ans += ary[i] * wa;
        ans %= MOD;
    }

    cout << ans << endl;


}


Measured memory_bytes: 5252
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static final int MAX = 16;
	
	public static final int DIRS  = 4;
	public static final int LEFT  = 0;
	public static final int DOWN  = 1;
	public static final int UP    = 2;
	public static final int RIGHT = 3;
	
	public static final int[][] move_dir = new int[][]{{-1, 0}, {0, 1}, {0, -1}, {1, 0}};
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int h = sc.nextInt();
		final int w = sc.nextInt();
		
		boolean[][][][] is_visited = new boolean[h][w][DIRS][MAX];
		
		char[][] map = new char[h][];
		for(int i = 0; i < h; i++){
			map[i] = sc.next().toCharArray();
		}
		
		LinkedList<Integer> x_queue = new LinkedList<Integer>();
		LinkedList<Integer> y_queue = new LinkedList<Integer>();
		LinkedList<Integer> memory_queue = new LinkedList<Integer>();
		LinkedList<Integer> dir_queue = new LinkedList<Integer>();
		
		is_visited[0][0][0][RIGHT] = true;
		x_queue.add(0);
		y_queue.add(0);
		memory_queue.add(0);
		dir_queue.add(RIGHT);
		
		boolean flag = false;
		while(!dir_queue.isEmpty()){
			int x = x_queue.poll();
			int y = y_queue.poll();
			int memory = memory_queue.poll();
			int dir = dir_queue.poll();
			
			//System.out.println(x + " " + y + " " + memory  +"  " + dir);
			
			if(map[y][x] == '@'){
				flag = true;
				break;
			}
			
			if(map[y][x] == '^'){
				dir = UP;
			}else if(map[y][x] == 'v'){
				dir = DOWN;
			}else if(map[y][x] == '<'){
				dir = LEFT;
			}else if(map[y][x] == '>'){
				dir = RIGHT;
			}else if(map[y][x] == '_'){
				dir = memory == 0 ? RIGHT : LEFT;
			}else if(map[y][x] == '|'){
				dir = memory == 0 ? DOWN : UP;
			}else if('0' <= map[y][x] && map[y][x] <= '9'){
				memory = map[y][x] -  '0';
			}else if(map[y][x] == '+'){
				memory = (memory + 1) % MAX;
			}else if(map[y][x] == '-'){
				memory = (memory + MAX - 1) % MAX;
			}
			
			
			if(map[y][x] == '?'){
				for(int i = 0; i < DIRS; i++){
					final int nx = (x + move_dir[i][0] + w) % w;
					final int ny = (y + move_dir[i][1] + h) % h;
			
					if(!is_visited[ny][nx][i][memory]){
						is_visited[ny][nx][i][memory] = true;
						x_queue.add(nx);
						y_queue.add(ny);
						memory_queue.add(memory);
						dir_queue.add(i);
					}
				}
			}else{
				final int nx = (x + move_dir[dir][0] + w) % w;
				final int ny = (y + move_dir[dir][1] + h) % h;
			
				if(!is_visited[ny][nx][dir][memory]){
					is_visited[ny][nx][dir][memory] = true;
					x_queue.add(nx);
					y_queue.add(ny);
					memory_queue.add(memory);
					dir_queue.add(dir);
				}
			}
		}
		
		System.out.println(flag ? "YES" : "NO");

	}

}

Measured memory_bytes: 44208
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <math.h>
#include <queue>
typedef long long ll;
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; }
using namespace std;

int main(){
	int C[3][3];
	for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) cin >> C[i][j];
	int B[3];
	for (int i = 0; i < 3; i++) B[i] = C[0][i];
	int A[3];
	for (int i = 0; i < 3; i++) A[i] = C[i][0] - B[0];
	string ans = "Yes";
	for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) if(A[i] + B[j] != C[i][j]) ans = "No";
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#define pritnf printf
#define scnaf scanf
#define retrun return
#define sizoef sizeof
#define inl inline
#define br break
#define con continue
#define mst(a,b) memset(a,b,sizeof(a))
#define fora(x,a,b) for(re nti (x)=(a);(x)<=(b);++(x))
#define forb(x,a,b) for(re nit (x)=(a);(x)>=(b);--(x))
#define foral(x,a,b) for(re ll (x)=(a);(x)<=(b);++(x))
#define forbl(x,a,b) for(re ll (x)=(a);(x)>=(b);--(x))
#define re register
#define stt struct
#define infa (0x3f3f3f3f)
#define infb (0x7fffffff)
#define infd (0x7f)
#define abss(x) ((x)>(0)?(x):(-1)*(x))
#define maxx(a,b) ((a)>(b)?(a):(b))
#define minn(a,b) ((a)<(b)?(a):(b))
#define in(a) freopen("D:/""/in"a".in","r",stdin)
#define out(a) freopen("D:/""/out"a".out","w",stdout)
typedef long long ll;
typedef int itn,nti,tin,tni,nit;
using namespace std;
const nit maxa=104;
const nit maxb=1e2;
const nit maxc=5;

ll f,t,m,ans=0;

tni main()
{
	scanf("%lld%lld%lld",&f,&t,&m);
	//
	if(f%m==0)
	{
		f=f/m;
	}
	else
	{
		f=f/m+1;
	}
	t=t/m;
	//
	printf("%lld\n",t-f+1);
	return 0;
}

Measured memory_bytes: 128
let get_figure a =
  let rec loop = function
      (x,y) when x = 7 && y = 7 -> "not found1"
    | (x, y) ->
       if a.(x).(y) = 1 then
         if a.(x).( (y + 1) mod 8) = 1 then
           if a.(x).( (y+2) mod 8 ) = 1 then "C"
           else if a.((x+1) mod 8).(y) = 1 then
             if a.( (x+1) mod 8 ).( (y+1) mod 8 ) = 1 then "A" else "G"
           else "E"
         else
           if a.((x+2) mod 8).(y) = 1 then "B"
           else if a.( (x+1) mod 8 ).( (y+7) mod 8) = 1 then "D" else "F"
       else
         if y = 7 then loop (x+1,0) else loop (x, y+1)
  in loop (0,0)
;;

let to_array s =
  Array.init 8 (fun x -> String.make 1 s.[x] |> int_of_string)
;;

let () =
  let rec read () =
    try let a = Array.init 8 (fun x -> read_line () |> to_array) in
        print_endline (get_figure a);
        let _ = read_line () in
        read ()
    with End_of_file -> ()
  in read ()
;;

Measured memory_bytes: 2128
//    .------------------------------------------------------------.
//    |   _  __   ___    ___    ___   _  _    ___     _     _  _   |
//    |  | |/ /  / _ \  |   \  |_ _| | \| |  / __|   /_\   | \| |  |
//    |  | ' <  | (_) | | |) |  | |  | .` | | (_ |  / _ \  | .` |  |
//    |  |_|\_\  \___/  |___/  |___| |_|\_|  \___| /_/ \_\ |_|\_|  |
//    |             ___    ___     _     _  _    ___               |
//    |            / _ \  | _ \   /_\   | \| |  / __|              |
//    |           | (_) | |   /  / _ \  | .` | | (_ |              |
//    |            \___/  |_|_\ /_/ \_\ |_|\_|  \___|              |
//    |                 ___   ___    ___    ___                    |
//    |                | _ ) | __|  / __|  / _ \                   |
//    |                | _ \ | _|  | (_ | | (_) |                  |
//    |                |___/ |___|  \___|  \___/                   |
//    |                                                            |
//    |------------------------------------------------------------|
//    |                      .------------.                        |
//    |                      | KerakTelor |                        |
//    |                      |------------|                        |
//    |                      | 2019-10-08 |                        |
//    |                      '------------'                        |
//    '------------------------------------------------------------'

#include <bits/stdc++.h>

#pragma GCC optimize("O2,unroll-loops")
#pragma GCC target("tune=native")

#define vec vector
#define prq priority_queue
#define fi first
#define se second

using namespace std;

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

//    .-----------------------------------------.
//    |        ___   _   _    ___   ___         | 
//    |       | _ ) | | | |  / __| / __|        | 
//    |       | _ \ | |_| | | (_ | \__ \        | 
//    |       |___/  \___/   \___| |___/        | 
//    |  ___   ___    ___    ___    _  _   ___  | 
//    | | _ ) | __|  / __|  / _ \  | \| | | __| |
//    | | _ \ | _|  | (_ | | (_) | | .` | | _|  | 
//    | |___/ |___|  \___|  \___/  |_|\_| |___| |
//    |                                         | 
//    '-----------------------------------------'

vec<vec<int>> gr;
vec<int> dp;

int solve(int n)
{
    if(dp[n]>=0)
        return dp[n];
    int res=0;
    for(auto &i:gr[n])
        res=max(res,solve(i)+1);
    return dp[n]=res;
}

int main()
{
    int v,e;
    scanf("%d%d",&v,&e);
    gr.assign(v,{});
    dp.assign(v,-1);
    while(e--)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        gr[a-1].push_back(b-1);
    }
    int res=0;
    for(int i=0;i<v;++i)
        res=max(res,solve(i));
    printf("%d\n",res);
}



Measured memory_bytes: 8192
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProgrammingContest_CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var e = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long n = e[0], m = e[1];
            long ans = Solve(n, m);
            Console.WriteLine(ans);
        }

        private static long Solve(long n, long m)
        {
            long begin = 0, end = n + m;

            while (begin < end)
            {
                //Console.WriteLine($"{begin} {end}");
                long middle = (begin + end) / 2 + 1;

                if (CanCreate(middle, n, m))
                {
                    begin = middle;
                }
                else
                {
                    end = middle - 1;
                }
            }

            return begin;
        }

        private static bool CanCreate(long count, long n, long m)
        {
            long lack = Math.Max(count - n, 0);
            return m - lack * 2 >= count * 2;
        }
    }
}


Measured memory_bytes: 13396
n,k=map(int,input().split())
TD=[list(map(int,input().split())) for _ in range(n)]
TD=sorted(TD,key=lambda x:-x[1])
#print(TD)
q=[]
ans=0
v=set()
cnt=0
for t,d in TD[:k]:
    ans+=d
    if t in v:
        q.append(d)
    else:
        v.add(t)

ans+=len(v)**2
cnt=ans
for t,d in TD[k:]:
    if t not in v and len(q)!=0:
        x=q.pop()
        ans+=d+2*len(v)+1-x
        v.add(t)
        cnt=max(ans,cnt)

print(cnt)

Measured memory_bytes: 33036
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());
		String str[] = br.readLine().split(" ");

		int a[] = new int[n];

		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(str[i]);
			if (a[i] % 2 == 0) {
				if (a[i] % 3 != 0 && a[i] % 5 != 0) {
					System.out.println("DENIED");
					return;
				}
			}
		}
		System.out.println("APPROVED");
	}
}


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

int main(){

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

    long long X, Y, Z, K; cin >> X >> Y >> Z >> K;

    vector<long long> A, B, C;
    long long a, b, c;
    for( int i = 0; i < X; i++ ){
        cin >> a;
        A.push_back(a);
    } 
    for( int i = 0; i < Y; i++ ){
        cin >> b;
        B.push_back(b);
    } 
    for( int i = 0; i < Z; i++ ){
        cin >> c;
        C.push_back(c);
    } 

    vector<long long> D;
    for( int i = 0; i < X; i++ ){
        for( int j = 0; j < Y; j++ ){
            D.push_back(A[i]+B[j]);
        }
    }

    sort(D.begin(),D.end());
    reverse(D.begin(), D.end());

    int d = D.size();
    int n = min(d,3000);
    vector<long long> E;
    for( int i = 0; i < n; i++ ){
        for( int j = 0; j < Z; j++ ){
            E.push_back(D[i]+C[j]);
        }
    }

    sort(E.begin(), E.end());
    reverse(E.begin(), E.end());

    for( int i = 0; i < K ; i++ ){
        cout << E[i] << endl;
    } 
}

Measured memory_bytes: 43384
#include <iostream>
#include <algorithm>
#include <vector>
#include <limits>

using lint = long long;
constexpr lint INF = std::numeric_limits<lint>::max();

int main() {
    int n;
    lint m;
    std::cin >> n >> m;

    std::vector<lint> as(n);
    for (auto& a : as) std::cin >> a;
    std::sort(as.begin(), as.end());

    lint ok = INF, ng = 0;
    while (ok - ng > 1) {
        lint mid = (ok + ng) / 2;
        lint added = 0;
        for (int i = 0; i < n; ++i) {
            int r = as.end() - std::lower_bound(as.begin(), as.end(), mid - as[i]);
            added += r;
        }
        (added < m ? ok : ng) = mid;
    }

    std::vector<lint> ss(n + 1, 0);
    for (int i = 0; i < n; ++i) {
        ss[i + 1] = ss[i] + as[i];
    }

    lint ans = 0;
    lint nextmax = 0;
    for (int i = 0; i < n; ++i) {
        int r = as.end() - std::lower_bound(as.begin(), as.end(), ok - as[i]);
        m -= r;
        ans += ss[n] - ss[n - r] + as[i] * r;

        if (r < n) {
            nextmax = std::max(nextmax, as[i] + as[n - r - 1]);
        }
    }
    ans += nextmax * m;

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


Measured memory_bytes: 1920
import collections
MAXN = 10**6+10
sieve = [i for i in range(MAXN+1)]
p = 2
while p*p <= MAXN:
    if sieve[p] == p:
        for q in range(2*p,MAXN+1,p):
            if sieve[q] == q:
                sieve[q] = p
    p += 1
    
def prime(a):
    tmp = []
    while a > 1:
        tmp.append(sieve[a])
        a //= sieve[a]
    return collections.Counter(tmp)
 
def main():
    N = int(input())
    ans = 0
    for c in range(1, N):
        p = prime(N - c)
        tmp = 1
        for v in p.values():
            tmp *= (v + 1)
        ans += tmp
    return ans
 
if __name__ == '__main__':
    print(main())

Measured memory_bytes: 144068
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
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; }

int main(){
  double a,b,x; cin >> a >> b >> x;
  double s = x/a;
  if(s < a*b/2){
    double w = 2*s/b;
    cout << setprecision(10) << atan2(b,w)/(2*M_PI)*360.0;
  }else{
    double h = 2*(a*b-s)/a;
    cout << setprecision(10) << atan2(h,a)/(2*M_PI)*360.0;
  }
  cout << "\n";
  return 0;
}


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


int main() {
  int N;
  cin >> N;
  string s[N];
  for(int i=0; i<N; i++){
    cin >> s[i];
  }
  int NB =0;
  int NA = 0;
  int ans=0;
  int same_flag=0;
  for(int i=0; i<N; i++){
    int j=0;
    //    if(s[i].back() == "A") NA++;
    if(s[i].back() == 'A') NA++;  
    if(s[i].front() == 'B' && s[i].back() == 'A') same_flag+=1;
    int flag=0;
    for (auto x: s[i]) {      
      if (j ==0 && x == 'B'){
	NB++;
      }
      if(flag ==0 && x == 'A') flag=1;
      if(flag==1 && x == 'B'){
	ans++;
      }
      if(x != 'A') flag=0;
      j++;      
    }
  }

  if(N==1){
    cout << ans << endl;
    return 0;
  }
  if(NA == same_flag && NB ==same_flag && same_flag>=1){
    cout << ans+same_flag-1 << endl;
    return 0;
  }
  if(min(NA,NB) != N){
    ans += min(NA,NB);
  }
  else if(N!=1) ans += N-1;
  cout << ans << endl;


}


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

template <int N>
void printQueen(vector<int> queen)
{
    for (int i = 0; i < N; i++)
    {
        if (queen[i] == -1)
        {
            for (int j = 0; j < N; j++)
            {
                cout << ".";
            }
            cout << endl;
        }
        else
        {
            for (int j = 0; j < queen[i]; j++)
            {
                cout << ".";
            }
            cout << "Q";
            for (int j = queen[i] + 1; j < N; j++)
            {
                cout << ".";
            }
            cout << endl;
        }

        // cout << ":" << queen[i] << endl;
    }
}

template <int N>
void changeBoard(vector<vector<int>> &board, int i, int j, int d)
{

    for (int k = 0; k < N; k++)
    {
        board[i][k] += d;
        board[k][j] += d;
    }

    if (i > j)
    {
        for (int k = 0; k < N - (i - j); k++)
        {
            board[k + (i - j)][k] += d;
        }
    }
    else
    {
        for (int k = 0; k < N - (j - i); k++)
        {
            board[k][k + (j - i)] += d;
        }
    }

    if (i + j < N)
    {
        for (int k = 0; k <= i + j; k++)
        {
            board[i + j - k][k] += d;
        }
    }
    else
    {
        for (int k = i + j - N + 1; k < N; k++)
        {
            board[i + j - k][k] += d;
        }
    }
}

template <int N>
void setQueen(vector<int> &queen, vector<vector<int>> &board, vector<int> vr, int i)
{
    // cout << i << endl;
    if (i == N)
    {
        printQueen<8>(queen);
        // cout << "---" << endl;
        return;
    }

    for (int j = 0; j < N; j++)
    {
        if (board[vr[i]][j] == 0)
        {
            queen[vr[i]] = j;
            changeBoard<N>(board, vr[i], j, +1);
            setQueen<N>(queen, board, vr, (i + 1));
            changeBoard<N>(board, vr[i], j, -1);
        }
    }
}

int main()
{
    set<int> sr;
    for (size_t i = 0; i < 8; i++)
    {
        sr.insert(i);
    }

    int k = 0;
    cin >> k;

    vector<int> queen(8, -1);
    vector<vector<int>> board(8, vector<int>(8, 0));
    vector<int> vr;
    for (size_t i = 0; i < k; i++)
    {
        int r = 0, c = 0;
        cin >> r >> c;
        queen[r] = c;
        changeBoard<8>(board, r, c, +1);
        sr.erase(r);
        vr.push_back(r);
    }

    // printQueen<8>(queen);
    // return 0;

    for (auto &e : sr)
    {
        vr.push_back(e);
    }

    setQueen<8>(queen, board, vr, k);

    // cout << "terminate" << endl;

    return 0;
}


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

using namespace std;

int gcd(int a, int b){
    if(a < b) swap(a, b);
    while(b){
        a %= b;
        swap(a, b);
    }
    return a;
}

int main(){
    int N, tmp;
    int X;
    int ans;
    cin >> N >> X;
    cin >> ans;
    ans = abs(ans - X);
    for(int i = 1; i < N; ++i){
        cin >> tmp;
        ans = gcd(ans, abs(tmp - X));
        
    }
    

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main()
{
  int n;
  cin>>n;
  long long int sum=0;
  vector<int> d(n);
  for(unsigned int i=0;i<n;i++)
  {
    cin>>d[i];
  }
  for(unsigned int i=0;i<n-1;i++)
  {
    for(unsigned int j=i+1;j<n;j++)
    {
      sum+=d[i]*d[j];
    }
  }
  cout<<sum;
}
    

Measured memory_bytes: 3624
n = int(input())
p = list(map(int,input().split()))
ans = 0

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

print(ans)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template <class _T> static _T tp_abs(const _T& a) {
	//	usage:  tp_abs<type name>(a);
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}

static void B_task();

int main()
{
	B_task();
	fflush(stdout);
	return 0;
}

template <class _Ty> class PermComb
{
protected:

	_Ty _maxNum = 0;
	_Ty _use_mod = 0;
	_Ty* _fact = 0;
	_Ty* _inv = 0;
	_Ty* _finv = 0;

	PermComb() {}

public:
	PermComb(_Ty maxNum, _Ty use_mod = 0) {
		_maxNum = maxNum;
		_use_mod = use_mod;
		_fact = new _Ty[(unsigned int)maxNum + 1];
		_fact[0] = _fact[1] = 1;

		if (_use_mod) {
			_inv = new _Ty[(unsigned int)maxNum + 1];
			_finv = new _Ty[(unsigned int)maxNum + 1];
			_inv[0] = _inv[1] = 1;
			_finv[0] = _finv[1] = 1;
		}

		for (_Ty i = 2; i <= maxNum; i++) {
			_fact[i] = _fact[i - 1] * i;
			if (_use_mod) {
				_fact[i] %= _use_mod;
				_inv[i] = _use_mod - _inv[_use_mod % i] * (_use_mod / i) % _use_mod;
				_finv[i] = _finv[i - 1] * _inv[i] % _use_mod;
			}
		}
	}

	//	get permutation value
	virtual _Ty nPk(int n, int k) {
		if ((k > _maxNum) || (n > _maxNum) || (k > n) || (k < 0) || (n < 0)) {
			return 0;
		}
		return(_fact[n] / _fact[n - k]);
	}

	//	get combination value
	virtual _Ty nCk(int n, int k) {
		_Ty ans = 0;
		if ((k > _maxNum) || (n > _maxNum) || (k > n) || (k < 0) || (n < 0)) {
			ans = 0;
		}
		else if (_use_mod == 0) {
			ans = nPk(n, k);
			ans /= _fact[k];
		}
		else {
			ans = _fact[n] * (_finv[k] * _finv[n - k] % _use_mod) % _use_mod;
		}
		return ans;
	}

	//	destructor
	~PermComb() {
		delete[] _fact;
		delete[] _inv;
		delete[] _finv;
	}
};

static void B_task()
{
	LLONG N, K;
	get2int<LLONG>(N, K);

	auto seqa = new int[N];
	for (int i = 0; i < N; i++) {
		get1int(seqa[i]);
	}

	PermComb<LLONG> cmb(2000, MOD_NUM);

	LLONG ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			if (seqa[i] > seqa[j]) {
				ans += ((K * (K + 1)) / 2) % MOD_NUM;
				ans %= MOD_NUM;
			}
			else if (seqa[i] < seqa[j]) {
				ans += ((K * (K - 1)) / 2) % MOD_NUM;
				ans %= MOD_NUM;
			}
		}
	}

	printf("%lld\n", ans);
	delete[] seqa;
}


Measured memory_bytes: 256
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict
from fractions import gcd

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	K = int(input())
	ans = 0
	D = defaultdict(int)
	for i in range(1, K + 1):
		for j in range(1, K + 1):
			s = gcd(i, j)
			D[s] += 1

	for i in range(1, K + 1):
		for j in range(1, K + 1):
			ans += gcd(i, j) * D[j]

	print(ans)

if __name__ == '__main__':
	main()

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

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

    ll left = 4 * a * b;
    ll right = c - a - b;
    cout << (right > 0 && left < right * right ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <functional>

using namespace std;
using ll = long long;
using ld = long double;

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VL vector<ll>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) ((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) ((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;


int main() {
	int N;
	cin >> N;
	VD t(N+1), v(N+1);
	REP(i, N) {
		cin >> t[i];
		if(i != 0) t[i] += t[i - 1];
	}
	t[N] = t[N - 1];
	REP(i, N) cin >> v[i];
	v[N] = 0;
	int tempx = 0;
	double tempv = 0, prev = 0, S = 0;

	for (double tempt = 0.5; tempt <= t[N - 1]; tempt += 0.5) {
		tempv += 0.5;
		if (t[tempx] < tempt) tempx++;
		FOR(i, tempx, N) tempv = min(tempv, v[i + 1] + t[i] - tempt);
		tempv = min(tempv, v[tempx]);
		S += 0.25*(prev + tempv);
		prev = tempv;
		//cout << tempt << " " << tempv << endl;
	}

	printf("%.6lf\n", S);
	//cin >> N;
	return 0;
}




Measured memory_bytes: 256
#include <queue>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <assert.h>
#include <algorithm>
using namespace std;
#define debug printf("%s %d\n", __FUNCTION__, __LINE__)

int main(int argc, char **argv) {
    int cur = 0, a;
    int n, k;
    int best = 0;
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a);
        cur = __gcd(cur, a);
        best = max(best, a);
    }
    if (k % cur == 0 && k <= best) printf("POSSIBLE\n");
    else printf("IMPOSSIBLE\n");
    return 0;
}

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

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

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    vector<ll> left(N), right(N);
    left[0] = A[0];
    right[N - 1] = A[N - 1];
    rep(i, N - 1) {
        left[i + 1] = gcd(left[i], A[i + 1]);
        right[N - i - 2] = gcd(right[N - i - 1], A[N - i - 2]);
    }

    ll ans = max(left[N - 2], right[1]);
    rep(i, N - 2) ans = max(ans, gcd(left[i], right[i + 2]));
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2560
from collections import defaultdict

N,K=map(int,input().split())
A=list(map(int,input().split()))
C=defaultdict(int)
B=[]
for a in A:
    C[a]+=1
ans=0
for i,v in C.items():
    B.append(v)
B.sort(reverse=True)
p=0
for i in range(len(B)):
    if i<K:
        continue
    ans+=B[i]
print(ans)


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

using namespace std;

int main(){
        int  d ,i;
        int a[1000] = {0};
        int b[1000] = {0};
        int c[1000] = {0};
        bool ans[1000];
        scanf("%d", &d);
        for(i = 0; i < d; i++){
                scanf("%d%d%d", &a[i], &b[i], &c[i]);
                ans[i] = false; 
                if(a[i] * a[i] + b[i] * b[i] == c[i] * c[i])
                        ans[i] = true;
                if(b[i] * b[i] + c[i] * c[i] == a[i] * a[i])
                        ans[i] = true;
                if(c[i] * c[i] + a[i] * a[i] == b[i] * b[i])
                        ans[i] = true;
                printf("%s\n", ans[i] ? "YES" : "NO");
        }
        return 0;
}
 

Measured memory_bytes: 1020
// https://atcoder.jp/contests/abc114/tasks/abc114_c

#include <algorithm>
#include <cmath>
#include <iostream>
#include <set>
#include <string>
using namespace std;
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))

int len = 0, n;
set<string> st;

void rege(string s) {
    // 3, 5, 7が含まれている
    if (s.find("3") != std::string::npos && s.find("5") != std::string::npos &&
        s.find("7") != std::string::npos && stoi(s) <= n) {
        st.insert(s);
    }
    if (s.size() < len) {
        rege(s + "3");
        rege(s + "5");
        rege(s + "7");
    }

    return;
}

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

    s = to_string(n);
    len = s.size();
    rege("");

    cout << st.size() << endl;
    return 0;
}


Measured memory_bytes: 3072
n,k=map(int,input().split())
x=0
for b in range(k+1,n+1):
  r=n%b
  if r==0:
    x+=(n//b)*(b-k)
  else:  
    x+=(n//b+1)*max(0,(r-k+1))
    x+=(n//b)*max(0,(b-max(k,r+1)))
    if k==0:
      x-=1
print(x)

Measured memory_bytes: 39408
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
 

#define int             long long

 
void anmol()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
 
const int N = 1e6 + 5 ;
 int a[N], nums2[N] , freq[N];


int32_t main(){

  anmol();
    
 int n ;
 cin>>n;

 int count =0;

 for(int i =1; i<=n; i++){

    cin>>a[i];

    if(a[i]%2 == i%2 && i%2==1){

      count++;
    }

 }

 cout<<count<<endl;

}










  
 






   

  
  

   
   





  










 
 





  



 
 
    

  
 
 
 
 
 


 

   

 
 



  
  












 
 





  



 
 
    

  































 
 



  
  












 
 





  



 
 
    

  
 
 
 
 
 


 

   

 
 



  
  












 
 





  



 
 
    

  


Measured memory_bytes: 3584
L, R = map(int, input().split())

if R - L >= 2050:
    print(0)
else:
    ans = 20000000
    for i in range(L, R):
        for j in range(i+1, R+1):
            x = (i*j)%2019
            if ans > x:
                ans = x
    print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<ll> L(N);
    rep(i,N){
        cin >> L[i];
    }
    int ans = 0;
    for (ll i = 0; i < N; i++){
        for (ll j = i + 1; j < N; j++){
            for (ll k = j + 1; k < N; k++){
                bool ok = true;
                if (L[i] + L[j] <= L[k] || L[j] + L[k] <= L[i] || L[k] + L[i] <= L[j]) ok = false;
                if (L[i] == L[j] || L[j] == L[k] || L[k] == L[i]) ok = false;
                if (ok) ans++;
            }
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3632
#include <cstdio>
#include <set>
#include <string>

int main() {
	int n = 0;
	scanf("%d", &n);
	std::string cmd, str;
	char buff[100];
	std::set<std::string> dict;
	for (int i = 0; i < n; i++) {
		scanf("%s",buff);
		cmd = buff;
		scanf("%s",buff);
		str = buff;
		if (cmd[0] == 'i') {
			dict.insert(str);
		}
		else {
			if (dict.find(str) != dict.end()) {
				printf("yes\n");
			}
			else {
				printf("no\n");
			}
		}
	}

	return 0;
}

Measured memory_bytes: 29652
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 k=gi();
	    int b=gi();
	    
        //System.out.println(n-k+1);
        if (k*b % 2==0) {
        	System.out.print("No");
        }else {
        	System.out.print("Yes");
        }


	}

	// 文字列として入力を取得
	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: 35280
#include<bits/stdc++.h>

using namespace std;

int main() {

    int A[3][3]; 
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> A[i][j];
        }
    }

    int N;
    cin >> N;

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

    bool bingo[3][3];

    for(int i = 0; i < 3; i++) {
        for(int j = 0; j < 3; j++) {
            bingo[i][j] = false;

            for (int k = 0; k < N; k++) {

                if (A[i][j] == b[k]) {

                    bingo[i][j] = true;
                }    
            }
        }
    }


    for (int i = 0; i < 3; i++) {
        if(bingo[i][0] and bingo[i][1] and bingo[i][2] == true) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    for (int i = 0; i < 3; i++) {
        if(bingo[0][i] and bingo[1][i] and bingo[2][i] == true) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    if(bingo[0][0] and bingo[1][1] and bingo[2][2] == true) {
        cout << "Yes" << endl;
        return 0;
    }

    if(bingo[0][2] and bingo[1][1] and bingo[2][0] == true) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int i;
    int n;
    scanf("%d", &n);
    int R[n];
    for( i = 0; i < n; ++i )
        scanf("%d", &R[i]);
    int min = R[0], max = R[1] - R[0];
    for( i = 1; i < n; ++i ){
        max = max < R[i] - min ? R[i] - min : max;
        min = min > R[i] ? R[i] : min;
    }
    printf("%d\n", max);
}


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

int main() {
  int n; cin >>n;
  int kotae=0;
  int kazu=0;
  if(n==1){
    cout<<1<<endl;
    return 0;
  }
  for(int i=2;i<=n;i++){
    int x=i;
    int count=0;
    while(x%2==0){
      count++;
      x/=2;
    }
    if(kotae<count){
      kotae=count;
      kazu=i;
    }
  }
  cout<<kazu<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
typedef struct a{
  double x;
  double y;
}Point;
void kohho(Point,Point,int);
Point start,end;
int main(){
  int n;
  start.x=0;
  start.y=0;
  end.x=100;
  end.y=0;
  scanf("%d",&n);
  printf("%f %f\n",start.x,start.y);
  kohho(start,end,n);
  printf("%f %f\n",end.x,end.y);
  return 0;
}
void kohho(Point p1,Point p2,int dipth){
  if(dipth==0)return;
  Point s,t,u;
  s.x=(2*p1.x+p2.x)/3;
  s.y=(2*p1.y+p2.y)/3;
  t.x=(p1.x+2*p2.x)/3;
  t.y=(p1.y+2*p2.y)/3;
  u.x=(t.x-s.x)*cos(M_PI*60.0/180.0)-(t.y-s.y)*sin(M_PI*60.0/180.0)+s.x;
  u.y=(t.x-s.x)*sin(M_PI*60.0/180.0)+(t.y-s.y)*cos(M_PI*60.0/180.0)+s.y;
  kohho(p1,s,dipth-1);
  printf("%f %f\n",s.x,s.y);
  kohho(s,u,dipth-1);
  printf("%f %f\n",u.x,u.y);
  kohho(u,t,dipth-1);
  printf("%f %f\n",t.x,t.y);
  kohho(t,p2,dipth-1);
}



Measured memory_bytes: 2104
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
typedef long long ll;
using namespace std;

int main() 
{
	int N, i, count = 0;
	string s;
	cin >> N;
	cin >> s;
	for (i = 0; i < N; i++)
	{
		if (s[i] == 'R')
			count++;
	}
	if (count > N/2)
		cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int x = i;
		if (x % 3 == 0) {
			cout << " " << i;
		}
		else {
			while (x) {
				if (x % 10 == 3) {
					cout << " " << i;
					break;
				}
				x /= 10;
			}
		}
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3096
from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    N,Q=map(int,input().split())
    S=list(input())
    res=[0]*N

    temp=False
    for i in range(N):
        if S[i]=='A':
            temp=True
        elif temp==True and S[i]=='C':
            res[i-1]=1
            temp=False
        else: temp=False


    B = [0] + res
    # 累積和を格納したリスト．A[l:r]の総和はB[r] - B[l]
    B = list(accumulate(B))

    for i in range(Q):
        l,r=map(int,input().split())
        print(B[r-1]-B[l-1])



resolve()

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

ll dp[200010][2][2];

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

    for (int i = 0; i < 200010; ++i) {
        for (int j = 0; j < 2; ++j) {
            for (int k = 0; k < 2; ++k) {
                dp[i][j][k] = -LINF;
            }
        }
    }
    dp[0][0][0] = 0;
    dp[0][1][0] = 0;

    for (int i = 1; i <= n; ++i) {
        if (i%2){
            dp[i][0][0] = max(dp[i-1][1][1], dp[i-1][1][0]);
            if (i > 1) dp[i][0][1] = dp[i-1][0][0] + a[i-1];
            dp[i][1][1] = dp[i-1][1][0] + a[i-1];
        } else{
            dp[i][0][0] = max(dp[i-1][0][0], dp[i-1][0][1]);
            dp[i][1][0] = max(dp[i-1][1][0], dp[i-1][1][1]);
            dp[i][1][1] = dp[i-1][0][0] + a[i-1];
        }
    }
    if (n%2){
        cout << max(dp[n][0][0], dp[n][0][1]) << endl;
    } else{
        cout << max(dp[n][1][0], dp[n][1][1]) << endl;
    }
}


Measured memory_bytes: 10380