akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

int main() {

  int n;
  int pm,pe,pj;


  while(1) {

    cin >> n;

    if(n==0) break;

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

      cin >> pm >> pe >> pj;

      if(pm==100 || pe==100 || pj==100) cout << "A" << endl;

      else if((pm+pe)/2>=90) cout << "A" << endl;

      else if((pm+pe+pj)/3>=80) cout << "A" << endl;

      else if((pm+pe+pj)/3>=70) cout << "B" << endl;

      else if((pm+pe+pj)/3>=50 && (pm>=80 || pe>=80)) cout << "B" << endl;

      else cout << "C" << endl;

    }

  }

  return 0;

}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    int N = sc.nextInt();
    int X = sc.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }
    long ans = 0;
    if (A[0] > X) {
      ans = A[0] - X;
      A[0] = X;
    }
    for (int i = 1; i < N; i++) {
      if (A[i - 1] + A[i] > X) {
        ans += A[i - 1] + A[i] - X;
        A[i] = X - A[i - 1];
      }
    }

    System.out.println(ans);
  }

}


Measured memory_bytes: 33236
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n) for(ll i=0;i<(n);i++)
#define For1(i,n) for(ll i=1;i<(n);i++)
#define MOD 1000000007
ll gcd(ll a,ll b){
    return b?gcd(b,a%b):a;
}
int main(){
    string s;cin>>s;
    ll n=s.size();
    ll ans=0;
    string si,dt;
    For(i,n){
        dt+=s.at(i);
        if(dt!=si){
            si=dt;dt="";
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=2e5+10;
map<int,int>mp;
int a[N];
int n;
int dp[N];
int go(int pos)
{
    if(pos==n)
    {
        return 1;
    }
    if(pos>n)
    {
        return 0;
    }
    if(mp[pos]==1)
    {
        return 0;
    }
    if(dp[pos]!=-1)
    {
        return dp[pos];
    }
    int ans=0;
    for(int i=1;i<=2;i++)
    {
        ans=(ans+go(pos+i))%MOD;
    }
    dp[pos]=ans;
    return ans;
}
int32_t main()
{
    int m;
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        cin>>a[i];
        mp[a[i]]=1;
    }
    memset(dp,-1,sizeof(dp));
    
        cout<<go(0)<<endl;
    

}

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

public class Main {	

	private static void solve(){
		//Implement solution here.
		long A = nl();
		long B = nl();
		long N = nl();
		long result = -1L;
		long x = Math.min(N, B - 1);
		result = (A * x / B) - A * (x / B);
		//result = Math.max(v ,result);
		
		System.out.println(result);
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		boolean hasNext = true;
		while(hasNext){
			solve();	
			try{
				br.mark(1);
				if(br.read() > 0){
					br.reset();			
					System.out.println("---");
				} else {
					hasNext = false;
				}
			}catch(Exception e){
				throw new RuntimeException(e);
			} 
		}
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 25376
/**
DufauX-XuafuD
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define reset(x) memset(x,-1,sizeof(x))
#define CheckBit(a,b) (a&(1ll<<b))
#define SetBit(a,b) a=(a|(1ll<<b))
#define UnSetBit(a,b) a=(a&(~(1ll<<b)))
#define maxx 10000006
#define PI 2*acos(0.0)
const long long INF = 2000000000000000000LL;	// 2e18
const int inf = 0x3f3f3f3f;	// 1061109567
const long double EPS = 1e-9;
//bitset<maxx/2>vis;
//bitset<maxx>pr;
//int mobi[maxx+10];
//vector<ll>prime;
//void sieve(){
//    ll x=maxx/2, y=sqrt(maxx)/2;
//    for(ll i=1;i<=y;i++){
//        if(vis[i]==0){
//            for(ll j=(i*(i+1)*2);j<x;j+=(2*i)+1)
//                vis[j]=1;
//        }
//    }
//    prime.push_back(2);
//    for(ll i=3;i<maxx;i+=2)
//        if(vis[i/2]==0)
//        prime.push_back(i);
//}
//void generate_mobius()
//{
//    for(int i=0;i<maxx;i++)mobi[i]=1;
//    for(int i=2;i<maxx;i++){
//        if(!pr[i]){
//            mobi[i]*=-1;
//            for(int j=i+i;j<maxx;j+=i){
//                pr[j]=1;
//                mobi[j]*=(j%(i*i)?-1:0);
//            }
//        }
//    }
//}
//bool isprime(ll a)
//{
//    if(a==1)return false;
//    if(a==2)return true;
//    if(a%2==0)return false;
//    for(ll i=0;i<prime.size() && prime[i]*prime[i]<=a;i++)
//        if(a%prime[i]==0)return false;
//    return true;
//}
/* Calculate ( a*b ) %c */
inline ll mulmod(ll a, ll b, ll c) {
    ll ret = 0 , cur = a % c ;
    while(b) { if(b%2) ret=(ret+cur)%c; cur=(cur<<1)%c; b=b>>1; }
    return ret%c;
}
//Calculate (b^p)%m || modular inverse: b^-1 = bigmod(b, m-2, m)
inline ll bigmod(ll b, ll p, ll m){
    ll ret = 1, cur = b % m;
    while(p) { if(p&1) ret=(ret*cur)%m; cur=(cur*cur)%m; p=p>>1; }
    return ret;
}
inline ll modulo(ll a,ll b,ll c) { //Same as big mod, use for numbers over 1e10
    ll ret = 1 , cur = a%c ;
    while(b) { if(b%2) ret=mulmod(ret,cur,c); cur=mulmod(cur,cur,c); b=b>>1; }
    return ret%c ;
}
inline ll power(ll b, ll p){
    ll ret = 1, cur = b;
    while(p) { if(p&1) ret=(ret*cur); cur=(cur*cur); p=p>>1; }
    return ret;
}
ll lcm(ll a,ll b)
{
    return (a/__gcd(a,b))*b;
}
ll gcd(ll a,ll b)
{
    return __gcd(a,b);
}
ll n,k;
ll dp[1002][1002];
ll f(ll pos,ll colour)
{
    if(pos==n-1){
        return 1;
    }
    if(dp[pos][colour]!=-1){
        return dp[pos][colour];
    }
    ll ans=0;
    for(int i=0;i<k;i++){
        if(i!=colour)
            ans+=f(pos+1,i);
    }
    return dp[pos][colour]=ans;
}
void Dufaux()
{
    reset(dp);
    cin>>n>>k;
    ll ans=0;
    ans=f(0,0);
    cout<<ans*k<<endl;
}
int main()
{
    FastIO;
	///sieve();
	///generate_mobius();
	int test=1;
	while(test--){
        Dufaux();
	}
	return 0;
}






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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) 
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (ll i=(ll)(a);i<(ll)(b);++i)
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)
#define YES(cond) cond ? OUT("YES") : OUT("NO")
#define Yes(cond) cond ? OUT("Yes") : OUT("No")

template<class T> T gcd(const T x,const T y){if(!y){return x;}return gcd(y,x%y);}
template<class T> T lcm(const T x,const T y){return x/gcd(x,y)*y;};
template<class T> T modpow(const T x,const T n,const T mod) {
  T res=1;while(n>0){if(n%2)res=res*x%mod;x=x*x%mod;n/=2;};return res;
}
template<class T> bool alltrue(const T &a){return all_of(ALL(a),[](bool x){return x;});}
template<class T> bool anytrue(const T &a){return any_of(ALL(a),[](bool x){return x;});}
template<class T> bool contain(const T &a,const T &b){for(auto x:b){if (a.find(x)==a.end()){return false;}}return true;}
template<class T> bool mmax(T &m,const T q){ if (m < q) {m = q; return true;} else return false; }
template<class T> bool mmin(T &m,const T q){ if (m > q) {m = q; return true;} else return false; }
template<class T> int siz(const T &a) {return (int)a.size();}
template<class T> set<T> devisers(T n) {
  set<T> res;for(T i=1;i<(T)sqrt(n)+1;i++){if(n%i==0){res.insert(i);res.insert(n/i);}}return res;
}
template<class T> void concat(T &a, const T &b){a.insert(a.end(),b.begin(),b.end());}
template<class T> void getand(const T &a,const T &b,T &c) {
  set_intersection(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}
template<class T> void getor(const T &a,const T &b,T &c) {
  set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.end()));
}

typedef long long ll;
typedef pair<ll, ll> P;

const int MOD=1e9+7;

int main() {
  // 部分文字列にtが含まれるs'の最短長
  // 存在しない場合とは、tの全ての文字がsに含まれていない時
  string s,t;cin>>s>>t;

  for (char c:t) {
    if (s.find(c)==string::npos) {
      OUT(-1);
      return 0;
    }
  }

  vector<vector<int>> pos(26);
  REP(i,siz(s)) {
    char c = s[i];
    pos[c-'a'].push_back(i);
  }

  ll ans = 0;
  int cur = 0;
  int tmp = 0;

  while (cur<siz(t)) {
    int tchar = t[cur]-'a';
    auto it = lower_bound(ALL(pos[tchar]),tmp);
    // 一周して戻ってくる
    if (it==pos[tchar].end()) {
      ans += (pos[tchar].front()+1)+(siz(s)-tmp);
      tmp = (pos[tchar].front()+1)%siz(s);
    } else {
      ans += *it-tmp+1;
      tmp = (*it+1)%siz(s);
    }
    cur++;
  }
  OUT(ans);

  return 0;
}

Measured memory_bytes: 1216
#include "bits/stdc++.h"

//region Template
#include "ext/pb_ds/assoc_container.hpp"

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(const string& USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }
/*
template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
 */
//endregion

/* Notes:
 * Farah </3
 */

const int MAXN = 1e5 + 5;
const int INF = 2e9;

int ans[MAXN];

int main() {
	//usaco("milkvisits");

#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
#endif

	string s;
	cin >> s;

	bool l = 0;
	s += 'R';
	int rcnt = 0, lcnt = 0;
	int ridx = 0, lidx = 0;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == 'R' && !l){
			ridx = i;
			rcnt++;
		}
		if(s[i] == 'L'){
			l = 1;
			if(lidx == 0)
				lidx = i;
			lcnt++;
		}

		if(s[i] == 'R' && l){
			int cnt = 0;

			while(rcnt > 0 && lcnt > 0){
				cnt++;
				ans[ridx]++;
				ans[lidx]++;
				rcnt--, lcnt--;
			}
			while(rcnt--){
				cnt++;
				swap(ans[lidx], ans[ridx]);
				ans[ridx]++;
			}
			while(lcnt--){
				cnt++;
				swap(ans[lidx], ans[ridx]);
				ans[lidx]++;
			}

			if(!(cnt & 1)){
				swap(ans[lidx], ans[ridx]);
			}
			l = 0;
			lidx = 0;
			ridx = i;
			rcnt = 1;
			lcnt = 0;
			cnt = 0;

			/*
			ans[ridx] = ans[lidx] = (rcnt + lcnt) / 2;

			if(rcnt > lcnt && ((rcnt + lcnt) & 1)){
				ans[ridx]++;
			}

			if(lcnt > rcnt && ((lcnt + rcnt) & 1)){
				ans[lidx]++;
			}
			if((rcnt + lcnt) % 2 != 0){
				//swap(ans[lidx], ans[ridx]);
			}
			l = 0;
			lidx = 0;
			ridx = i;
			rcnt = 1;
			lcnt = 0;
			 */
		}
	}
	for(int i = 0; i < s.size() - 1; i++){
		cout << ans[i] << " ";
	}
}

Measured memory_bytes: 1024
import heapq
N, M = map(int,input().split())
L = [[] for _ in range(M)]
for _ in range(N):
    A, B = map(int,input().split())
    try:
        L[A-1].append(-B)
    except:
        pass
Q = []
ans = 0
for i in range(M):
    for j in L[i]:
        heapq.heappush(Q, j)
    try:
        ans -= heapq.heappop(Q)
    except:
        pass
print(ans)

Measured memory_bytes: 17604
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = if n <= m then  List.range n `To m else []
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

module ModOp = struct
  let prime = 1_000_000_007
  let (-) a b = (a + prime - b) mod prime
  let (+) a b = (a + b) mod prime
  let ( * ) a b = (a * b) mod prime

  let rec pow x n =
    if n = 0 then 1
    else if n mod 2 = 0 then pow (x*x) (n/2)
    else x * pow (x*x) (n/2)
end

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let atoi c = Char.code c - Char.code '0'
let itoa n = Char.chr (n + Char.code '0')

let rec powerset = function
  | [] -> [[]]
  | hd::tl ->
    let pws =  powerset tl in
    pws @ ListL.map pws ~f:(fun pw -> hd::pw)

let permutations l =
  let rec interleave x = function
    | [] -> [[x]]
    | (hd::tl) as l ->
      (x::l) :: (interleave x tl |> ListL.map ~f:(fun l -> hd::l)) in
  let rec aux = function
    | [] -> [[]]
    | a::rest ->
      aux rest |> ListL.map ~f:(interleave a) |> List.concat in
  aux l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let zip l m =
  let n = min (List.length l) (List.length m) in
  List.combine (List.take n l) (List.take n m)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

let n = scan "%d" id

let () =
  let arr = Array.make 10_001 0 in
  ListL.iter (1++100) ~f:(fun x ->
      ListL.iter (1++100) ~f:(fun y ->
          ListL.iter (1++100) ~f:(fun z ->
              let n = x*x + y*y +z*z+ x * y + y*z + z*x  in
              if n <= 10_000 then arr.(n) <- succ arr.(n)
            )
        )
    );
  ListL.iter (1++n) ~f:(fun i ->
      Printf.printf "%d\n" arr.(i)
    )


Measured memory_bytes: 7720
#include <bits/stdc++.h>
#define gc getchar()
#define pc(x) putchar(x)
template<typename T> void scan(T &x){x = 0;register bool _=0;register T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){register bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;
const int MM = 5e5+5;

char s[MM];
int cnt = 0, low = 0, id = 0, a[MM];
long long ans;

vector<int> v;

int main(){
    
    scanf("%s", s);
    int n = strlen(s);
    
    for(int i = 1; i <= n; i++){
        if(i < n && s[i-1] == '>' && s[i] == '<')
            a[i] = 0;
        else if(s[i-1] == '<')
            a[i] = a[i-1]+1;
        //printf("%d ", a[i]);
    }
    //pc(10);
    
    for(int i = n-1; i >= 0; i--){
        if(s[i] == '>'){
            a[i] = max(a[i], a[i+1]+1);
        }
    }
    
    for(int i = 0; i <= n; i++){
        ans += a[i];
        //printf("%d ", a[i]);
    }
    //pc(10);
    print(ans);
    
    return 0;
}

Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
int main()
{
    #ifdef TarekHasan
        freopen("input.txt","r",stdin);
    #endif // TarekHasan

    int n; cin >> n;
    if(n>=30)
        cout << "Yes\n";
    else 
        cout << "No\n";
    return 0;
}


Measured memory_bytes: 3588
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ull B = 100000007;
int mod = 1000000007;

class Solution {
public:
    ll d(int n) {
        ll res = 0;
        res += (ll)n * (n + 1) / 2;
        for(int i = 2; i <= n; ++i) {
            int t = n / i;
            //cout << t * (i + i + (t - 1) * i) / 2 << endl;
            res += (ll)t * (i + i + (ll)(t - 1) * i) / 2;
        }
        return res;
    }
};

int main() {
    int n;
    cin >> n;
    Solution zhy;
    cout << zhy.d(n) << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n;
  cin >> n;
  cout << n*(n+1)/2 << endl;
}

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

using namespace std;

#define FOR(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define REP(i,n) FOR(i,0,n)

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
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; }
using ll = long long;

int main() {
  string s; cin >> s;
  int ans = 0;
  FOR(i,1,s.size()) {
    if (s[i] != s[i-1]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main() {
	int a, b, c,i=0,cnt=0;
	scanf("%d %d %d", &a, &b, &c);
	for (i = a;i <= b;i++) {
		if (c % i == 0) {
			cnt++;
		}
	}
	printf("%d\n", cnt);
	return 0;
}


Measured memory_bytes: 2112
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace Atcoder {
    class _81 {
        private int n;

        public _81(int n) {
            this.n = n;
        }

        public string Judge() {

            for(int i = 1; i <= 9; i++) {
                for(int j = 1; j <= 9; j++) {
                    if(i * j == n) {
                        return "Yes";
                    }
                }
            }

            return "No";
        }
    }

    class _81Main {
        static void Main() {
            int n = int.Parse(ReadLine());

            _81 Cal = new _81(n);

            WriteLine(Cal.Judge());
        }
    }
}


Measured memory_bytes: 13140
using System;

public class Test
{
	public static void Main()
	{
		// your code goes here
		string[] s = Console.ReadLine().Split(' ');
		int[] n = new int[s.Length];
		for(int i = 0; i < s.Length; i++) {
			n[i] = int.Parse(s[i]);
		}
		
		var W = n[0];
		var H = n[1];
		var x = n[2];
		var y = n[3];
		var r = n[4];
		
		if( ( (x-r) >= 0 ) && ( (y-r) >= 0 ) &&
			( (x+r) <= W ) && ( (y+r) <= H ) ){
			Console.WriteLine("Yes");
		} else {
			Console.WriteLine("No");
		}
	}
}

Measured memory_bytes: 9000
#include<map>
#include<iostream>
using namespace std;
int main(){
    int n,i;
    string S;
    char t[20];
    map<string,bool> mp;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>t;
        if(t[0]=='i'){
            cin>>S;
            mp[string(S)]=true;
        }
        else{
            cin>>S;
            if(mp[string(S)]) cout<<"yes"<<endl;
            else cout<<"no"<<endl;
        }
    }
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

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

int x,y,ans,min_res=0;

inline vector<pii> fill_cells(vector<vector<char>>& cells,char color){
    vector<pii> res;
    queue<pii> que;
    que.push(make_pair(0,0));
    char prev_color=cells[0][0];
    cells[0][0]=color;
    while(!que.empty()){
        pii p=que.front();
        que.pop();
        res.push_back(p);
        for(int i=0; i<4; ++i){
            int ny=p.first+dy[i],nx=p.second+dx[i];
            if(ny<0 or y<=ny or nx<0 or x<=nx) continue;
            if(cells[ny][nx]!=prev_color) continue;
            que.push(make_pair(ny,nx));
            cells[ny][nx]=color;
        }
    }

    return move(res);
}

inline void dfs(int num,vector<vector<char>>& cells){
    if(num>min_res) return;
    for(int i=0; i<3; ++i){
        if(num>=ans) return;
        if(cells[0][0]=="BGR"[i]) continue;

        char prev_color=cells[0][0];
        vector<pii> ps=fill_cells(cells,"BGR"[i]);

        if(ps.size()==x*y) ans=num;
        else dfs(num+1,cells);
        for(const pii& p:ps) cells[p.first][p.second]=prev_color;
    }
}

void solve(){
    while(true){
        cin >> x >> y;
        if(x==0 and y==0) break;

        vector<vector<char>> cells(y,vector<char>(x));
        rep(i,0,y) rep(j,0,x) cin >> cells[i][j];

        ans=inf;
        min_res=0;
        while(ans==inf){
            dfs(0,cells);
            ++min_res;
        }

        cout << ans << endl;
    }
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 3208
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;
int main() {
    int A, B;
    cin >> A >> B;
    if (A > 8 || B > 8) {
        cout << ":(" << endl;
    } else {
        cout << "Yay!" << endl;
    }
}

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

int main()
{
    long long n,m,j=0;
    cin>>n>>m;
    long long a[n],sum=0;
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    sort(a,a+n,greater<long long>());
    for(int i=n-1; i>=0 && j<m; i--)
    {
        double per = double(a[i])/double(sum);
        double lim = 1/(double(4)*double(m));
        if(per>=lim) j++;
    }
    if(j>=m) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<cmath>
typedef long long int lli;
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    vector<int> v;
    vector<string> v1;
    set<int> s;
    map<int, int> m;
    int a, b, c,  t, cnt=0;
    cin >> t;
    for(int i=0; i<t-1; ++i){
        cin >> a;
        m[a]++;
    }
 
    
    for(int i=1; i<=t; ++i){
        cout<<m[i]<<"\n";
    }
  
       
   
    return 0;
}



Measured memory_bytes: 12976
#include <stdio.h>
int main(){
	int A,B;
	char op;
	scanf("%d %c %d",&A,&op,&B);
	switch(op){
     case'+':
     printf("%d\n",A + B);
     break;
     case'-':
     printf("%d\n",A - B);
     break;
}
	return 0;
}

Measured memory_bytes: 128
//#include <bits/stdc++.h>
#include <stack>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	//入力
	long a[100001], b[100001], x[100001] = {};
	long N,K,M = 1000000000, ans = 0,l=0,r=0,sum=0;
	string S;
	cin >> S;
	/*for (int i = 0; i < N; i++) {
		cin >> a[i];
	}*/
	//処理
	//出力
	if (S[0] != S[1] && S[1] != S[2] && S[2] != S[3] && S[3] != S[4]) cout << "Good" << endl;
	else cout << "Bad" << endl;

	//cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <cstdio>
using namespace std;

int main()
{
    int m;
    
    cin >> m;
    
    for(int i=0; i<m; i++){
        int A, y, n, e=0, d=0;
        double c=0;
        priority_queue<int> maxpq;
        
        cin >> A;
        cin >> y;
        cin >> n;
        
        for(int j=0; j<n; j++){
            int ans=A;
            int B=0, S=0;
            scanf("%d %lf %d", &e, &c, &d);
            
            if(e==0){
                for(int k=0; k<y; k++){
                    B = ans*c;
                    ans -= d;
                    S += B;
                }
                maxpq.push(ans+S);
            }
            if(e==1){
                for(int k=0; k<y; k++){
                    B = ans*c;
                    ans = ans+B-d;
                }
                maxpq.push(ans);
            }
        }
        
        cout<<maxpq.top()<<endl;
        //maxpq.pop();
       // cout<<maxpq.top()<<endl;
        
    }

    return 0;
}

Measured memory_bytes: 1296
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>

using namespace std;
using ll = long long;

const int MN = 3003;

int n,t;
struct S{
	int d;//deliciousness
	int t;//time
	bool operator<(const S& o)const{
		return t<o.t;
	}
} a[MN];

int memo[MN][MN];
int f(int i, int rt){
	if(rt<=0||i>=n)return 0;
	if(memo[i][rt])return memo[i][rt];
	return memo[i][rt]=max( a[i].d+f(i+1,rt-a[i].t), f(i+1,rt) );
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cin>>n>>t;
	for(int i=0; i<n; ++i)cin>>a[i].t>>a[i].d;
	sort(a,a+n);
	cout<<f(0,t)<<endl;
	return 0;
}



Measured memory_bytes: 34944
#include <iostream>
#include <vector>
#include <numeric>
#include <cmath>
#include <algorithm>
#include<string>
#define myfor(i,N) for(i=0;i<N;i++)
#define myforFL(i,f,l) for(i=f;i<l;i++)

using namespace std;

int main(void){
	int N,X,Y,d[2001],i,j;
	cin >> N >> X >> Y;
	myforFL(i,1,N)d[i] = 0;
	myforFL(i,1,N)myforFL(j,i+1,N+1){
		d[min(j-i,abs(j-Y) +abs(X-i) + 1)]++;
	}
	myforFL(i,1,N)cout << d[i] << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    static Tuple[] data;
    static int xt;
    static int yt;
    static int N;

    static class Tuple implements Comparable<Tuple> {
        long x;
        long y;
        long r;
        int index;
        double cost;

        @Override
        public int compareTo(Tuple o) {
            return Double.compare(cost, o.cost);
        }
    }

    static double dist(Tuple a, Tuple b) {
        double p = Math.hypot((a.x - b.x), (a.y - b.y));
        p -= a.r + b.r;
        if (p < 0) {
            p = 0;
        }
        p += a.cost;

        return p;
    }

    public static void setNext(PriorityQueue<Tuple> queue, Tuple a, double[] dp) {
        for (int i = 0; i < data.length; i++) {
            Tuple t = new Tuple();
            t.x = data[i].x;
            t.y = data[i].y;
            t.index = i;
            t.r = data[i].r;
            t.cost = dist(a, data[i]);
            if (dp[i] > t.cost) {
                queue.add(t);
            }
        }
        Tuple end = new Tuple();
        end.x = xt;
        end.y = yt;
        end.r = 0;
        end.cost = dist(a, end);

        end.index = N;
        if (dp[N] > end.cost) {
            queue.add(end);
        }
    }

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


        xt = sc.nextInt();
        yt = sc.nextInt();
        N = sc.nextInt();
        data = new Tuple[N];
        for (int i = 0; i < N; i++) {
            Tuple t = new Tuple();
            t.x = sc.nextInt();
            t.y = sc.nextInt();
            t.r = sc.nextInt();
            t.index = i;
            data[i] = t;
        }

        Tuple start = new Tuple();
        start.x = xs;
        start.y = ys;

        PriorityQueue<Tuple> queue = new PriorityQueue<>();
        double[] dp = new double[N + 1];

        Arrays.fill(dp, Double.MAX_VALUE);

        setNext(queue, start, dp);

        while (queue.size() > 0) {
            final Tuple poll = queue.poll();
            if (dp[poll.index] > poll.cost) {
                dp[poll.index] = poll.cost;
                setNext(queue, poll, dp);
            }
        }
        System.out.println(dp[N]);
    }
}


Measured memory_bytes: 57524
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int INF=1<<29,MOD=1e9+7;

int main(){
	int n,c,k; cin>>n>>c>>k;
	int t[n+1]; rep(i,n) cin>>t[i];
	sort(t,t+n); t[n]=INF;
	int i=0,ans=0;
	while(i<n){
		int cnt=0;
		for(int j=i;;j++){
			if(t[j]<=t[i]+k) cnt++;
			else{i=j;break;}
			if(cnt==c){i=j+1;break;}
		}
		ans+=(cnt+c-1)/c;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
from collections import deque
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    a,b=map(int,input().split())
    if a<b:print("a < b")
    if a>b:print("a > b")
    if a==b:print("a == b")

main()



Measured memory_bytes: 5996
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
  long long N,M,X;
  cin >> N >> M >> X;
  
  vector<vector<long long>>a(N,vector<long long>(M+1));
  for(int i=0;i<N;i++){
    for(int j=0;j<M+1;j++){
      cin >> a[i][j];
    }
  }
  
  long long ans = 9999999999;
  
  for (int bit = 0; bit < (1<<N); ++bit) {
      vector<long long>b(M+1,0);
      for(int i=0;i<N;i++){
          if(bit & (1 << i)){
              for(int j=0;j<M+1;j++){
                  b[j] += a[i][j];
              }
          }
      }
          bool clear = true;
          for(int i=1;i<M+1;i++){
              if(b[i] < X) clear = false;
          }
          if(clear) ans = min(ans,b[0]);
    }
    if(ans != 9999999999) cout << ans << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 3632
//Heaplax
//别让自己后悔
#include<bits/stdc++.h>
#define N 100001
#define int long long
#define LOG(x) cerr<<#x<<" = "<<x<<endl
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;
}
using namespace std;
int n,a[N];
main()
{
	re(n);
	for(int i=1;i<=n;++i)re(a[i]);
	if(n%2==0)
	{
		int sum=0;
		for(int i=1;i<=n;++i)
			sum+=a[i]-1;
		puts(sum&1?"First":"Second");
	}
	else
	{
		int sum=0;
		for(int i=1;i<=n;++i)
			sum+=a[i]-1;
		if(sum&1)
		{
			puts("First");
			return 0;
		}
		int now=0;
		while(1)
		{
			int cnt=0;
			for(int i=1;i<=n;++i)
				if(a[i]&1)
				{
					if(cnt || a[i]==1)
					{
						puts(now?"First":"Second");
						return 0;
					}
					++cnt;
					--a[i];
				}
			sum=0;
			int gcd=a[1];
			for(int i=2;i<=n;++i)
				gcd=__gcd(gcd,a[i]);
			for(int i=1;i<=n;++i)
				a[i]/=gcd,sum+=a[i]-1;
			if(sum&1)
			{
				puts(now?"First":"Second");
				return 0;
			}
			now^=1;
		}
	}
}
//3 4 4 4 4
/*
n%2==0
n
xyn - > yn
xyn-n -> yn-n

n%2==1

xyn - > yn
xyn-n -> yn-n
(xy-1)n -> (y-1)n

x%2==0 && y%2==1

(xy-1)n+1%2=0

*/


Measured memory_bytes: 1024
#include <iostream>
#include <string>

using namespace std;

void ChangeAtoa(string& inputStr) {

   string outputStr;

   int max = inputStr.length();

   for (int i = 0; i < max; ++i) {
   
      char inChar = inputStr[i];
      
      if ('A' <= inChar && inChar <= 'Z') {
         inChar += 'a' - 'A';
      }

      outputStr += inChar;
      
   }

   inputStr = outputStr;

}

int main() {

   long count = 0;
   string word, line;

   cin >> word >> line;
   ChangeAtoa(word);

   while (line.compare("END_OF_TEXT") != 0) {

      ChangeAtoa(line);

      if (line.compare(word) == 0) {
         ++count;
      }

      cin >> line;

   }

   cout << count << endl;

   return 0;

}

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

using namespace std;
typedef long long ll;
const ll MOD = 998244353;

int main() {
  int n, k;
  cin >> n >> k;
  vector<pair<int, int>> v(k);
  for (int i = 0; i < k; ++i)
    cin >> v[i].first >> v[i].second;
  vector<ll> sum(n + 1);
  sum[1] = 1;
  for (int i = 2; i <= n; ++i) {
    ll curr = 0;
    for (int j = 0; j < k; ++j) {
      if (v[j].first >= i)
        continue;
      int l = max(1, i - v[j].second);
      int r = i - v[j].first;
      curr += sum[r] - sum[l - 1];
    }
    curr %= MOD;
    if (curr < 0)
      curr += MOD;
    sum[i] = (sum[i - 1] + curr) % MOD;
  }
  ll ans = sum[n] - sum[n - 1];
  if (ans < 0)
    ans += MOD;
  cout << ans;
}


Measured memory_bytes: 4792
#include <iostream>
#include <string>
using namespace std;
int main(){
  string a, b; cin >> a >> b;
  int n = 1;
  while (true) {
    string s = to_string(n * n);
    if (s == a + b) {
      cout << "Yes" << endl;
      return 0;
    }
    if (s.size() > 6) break;
    n++;
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
S = list(input())

ans = 0
c = 0

pre = ''
for s in S:
    if s == 'L':
        if pre == 'L':
            ans += 1
        else:
            pre = s
            c += 1
    else:
        if pre == 'R':
            ans += 1
        else:
            pre = s

cc = 0
if S[0] == 'L':
    cc += 1
if S[-1] == 'R':
    cc += 1

if c <= K:
    ans += 2 * c
    K -= c
    c = 0
else:
    ans += 2 * K
    c -= K
    K = 0

print(min(ans, N - 1))


Measured memory_bytes: 4084
#include <iostream>

int main()
{
    int x, a, b;
    std::cin >> x >> a >> b;
    if(std::abs(x-a) < std::abs(x-b)){
        std::cout << 'A' << std::endl;
    }else{
        std::cout << 'B' << std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);


int main(){
    IOS;
    ll a;cin>>a;
    cout<<a+a*a+a*a*a;
    return 0;  
} 





Measured memory_bytes: 3636
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&... args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

int N, K[SIZE], L[SIZE], R[SIZE];

ll solve2(const vector<pair<int, int>> vec) {
  ll res = 0;
  int M = vec.size();
  set<int> ss;
  for (int i = 1; i <= M; i++) ss.insert(i);

  for (auto p : vec) {
    auto it = ss.upper_bound(p.second);
    if (it == ss.begin()) continue;
    it--;
    ss.erase(it);
    res += p.first;
  }

  return res;
}

void solve() {
  ll ans = 0;
  vector<pair<int, int>> pos, neg;

  scanf("%d", &N);

  for (int i = 0; i < N; i++) {
    scanf("%d%d%d", K + i, L + i, R + i);
    if (L[i] >= R[i]) {
      pos.push_back({L[i] - R[i], K[i]});
    } else {
      neg.push_back({R[i] - L[i], N - K[i]});
    }
    ans += min(L[i], R[i]);
  }

  sort(pos.rbegin(), pos.rend());
  sort(neg.rbegin(), neg.rend());

  ans += solve2(pos);
  ans += solve2(neg);

  printf("%lld\n", ans);
}

int main() {
  int T;

  cin >> T;

  while (T--) {
    solve();
  }

  return 0;
}

Measured memory_bytes: 12796
var
	c,w,f,p:array[0..100000]of longint;
	a:array[0..1000,0..100010]of longint; 
	g,v,x,y,d,n,i,j,k,t:longint;
begin
	readln(d,g);
	v:=g div 100;
	n:=0;
	fillchar(a,sizeof(a),0);
	fillchar(f,sizeof(f),0);
	for i:=1 to d do
    begin
		readln(x,y);
		y:=y div 100;
		for j:=1 to x do
	    begin
			inc(n);
			if j<>x then w[n]:=i*j else w[n]:=i*j+y;
			c[n]:=j; p[n]:=i;
		end;
	end;
	for i:=1 to n do
    begin
		inc(a[p[i],0]);
		a[p[i],a[p[i],0]]:=i;
	end;
	for i:=1 to n do
		for j:=v downto 0 do
			for k:=1 to a[i,0] do
				if j>=c[a[i,k]] then
					if f[j]<f[j-c[a[i,k]]]+w[a[i,k]] then
						f[j]:=f[j-c[a[i,k]]]+w[a[i,k]]; //分组背包
	for i:=1 to n do
		if f[i]>=v then break;
	writeln(i);
end.

Measured memory_bytes: 391552
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin>>N;int i,j;
  string s;
  cin>>s;
  int ans=0;
  for(i=0,j=0;j<N;i=j)
  {
    while(j<N&&s[i]==s[j])
    {
      j++;
    }
    ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <algorithm>
using namespace std;

int n,p[55];
int main()
{
scanf ("%d",&n);
  for (int i=0;i<n;i++) scanf ("%d",&p[i]);
  
  if (is_sorted(p,p+n)){
puts("YES");
    return 0;
  }
  for (int i=0;i<n;i++) for (int j=i+1;j<n;j++){
swap(p[i],p[j]);
  if (is_sorted(p,p+n)){
puts("YES");
    return 0;
  }
swap(p[i],p[j]);
  }
  puts("NO");
  return 0;
}

Measured memory_bytes: 3184
x,n=map(int,input().split())
p=set([int(i) for i in input().split()])
low=x
high=x
if not x in p:
  print(x)
  exit()
while True:
  low-=1
  if not low in p:
    print(low)
    exit()
  high+=1
  if not high in p:
    print(high)
    exit()

Measured memory_bytes: 9128
import java.util.*;

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

        int[] coordinates = new int[5];

        for (int i=0; i<5; i++) {
            coordinates[i] = sc.nextInt();
        }

        int k = sc.nextInt();

        if (coordinates[4] - coordinates[0] <= k) {
            System.out.println("Yay!");
        } else {
            System.out.println(":(");
        }
    }
}


Measured memory_bytes: 23252
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i <= (int)(n); i++) 
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<int> num(n);
    int res = 0;
    rep(i,n){
        cin >> num[i];
        if((num[i]%2 == 0)&&(num[i]%3 != 0 && num[i]%5 != 0)){
            dunk("DENIED");
            return 0;
        }
    }
    dunk("APPROVED");
    return 0;

}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        for (int i=1;i<100000;i++) {
            if (i*(i+1)/2==N) {
                System.out.println("Yes");
                System.out.println(i+1);
                int[] arr = new int[i];
                for (int j=0;j<i;j++) arr[j] = j+1;
                for (int j=0;j<i+1;j++) {
                    StringBuilder sb = new StringBuilder();
                    sb.append(i);
                    sb.append(" ");
                    if (j!=0) {
                        for (int k=0;k<j-1;k++) arr[k] = arr[k]+1;
                        for (int k=j;k<i;k++) arr[k] = arr[k]+i-j;
                    }
                    for (int k=0;k<i;k++) {
                        sb.append(arr[k]);
                        if (k!=i) sb.append(" ");
                    }
                    System.out.println(sb);
                }
                break;
            }
            if (i*(i+1)/2>N) {
                System.out.println("No");
                break;
            }
        }
    }
}

Measured memory_bytes: 34884
import queue

K = int(input())

q=queue.Queue()
for i in range(1,10):
    q.put(i)

for _ in range(K):
    x = q.get(0)
    #print(x)
    if x % 10 != 0:
        q.put(x*10 + x%10 - 1)
    q.put(x*10 + x%10)
    if x % 10 != 9:
        q.put(x*10 + x%10 + 1)
print(x)



Measured memory_bytes: 57428
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    static class Task {

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            char[] arr = in.next().toCharArray();
            int[] countArr = new int[26];
            for (char c : arr) {
                countArr[c - 'a']++;
            }

            for (int i = 0; i < 26; i++) {
                if (countArr[i] % 2 == 1) {
                    out.println("No");
                    return;
                }
            }
            out.println("Yes");
        }
    }

    private static void sort(double[] arr) {
        Double[] objArr = Arrays.stream(arr).boxed().toArray(Double[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(int[] arr) {
        Integer[] objArr = Arrays.stream(arr).boxed().toArray(Integer[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(long[] arr) {
        Long[] objArr = Arrays.stream(arr).boxed().toArray(Long[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task task = new Task();
        task.solve(1, in, out);
        out.close();
    }

    public static void main(String[] args) {
        new Thread(null, () -> solve(), "1", 1 << 26).start();
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

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

    }

}

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

int main(){
    int N;
    string S;
    cin >> N >> S;

    int count = 0;

    for (int i = 0; i < N - 2; i++){
        if(S.at(i) == 'A' && S.at(i+1) == 'B' && S.at(i+2) == 'C'){
            count++;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N, L[2010], cnt[2010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N) cin >> L[i];

	rep(i, 0, N) cnt[L[i]]++;
	rep(i, 1, 2010) cnt[i] += cnt[i - 1];

	ll ans = 0;
	rep(a, 0, N) rep(b, 0, N) if (a != b) {
		int mi = max(L[a] - L[b], L[b] - L[a]);
		int ma = L[a] + L[b];

		int cn = 0;
		if (0 <= ma - 1) cn = cnt[ma - 1];
		cn -= cnt[mi];

		if (mi < L[a] and L[a] < ma) cn--;
		if (mi < L[b] and L[b] < ma) cn--;

		ans += cn;
	}
	ans /= 6;
	cout << ans << endl;
}







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

int main() {
    int h;
    cin >> h;
    int w;
    cin >> w;
    vector<string> a(h);
    for (int i = 0; i < h; i++) {
        cin >> a.at(i);
    }
    
    vector<bool> row(h, false);
    vector<bool> col(w, false);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (a.at(i).at(j) == '#') {
                row.at(i) = true;
                col.at(j) = true;
            }
        }
    }
    
    for (int i = 0; i < h; i++) {
        if (row.at(i)) {
            for (int j = 0; j < w; j++) {
                if (col.at(j)) {
                    cout << a.at(i).at(j);
                }
            }
            cout << endl;
        }
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long int lli;
const long long int MaxN=300005;
const lli mod=1e9+7;
#define fst first
#define snd second
#define mp make_pair
const float pi=3.1415926535897932384626433832795028;
	lli mcd(lli a,lli b){
		if(a==0)return b;
		return mcd(b%a,a);
	}
	lli arr[MaxN];
	void solve(){
		lli N,K,i,j,p,q,res=0;
		cin>>N;
		for(i=0;i<N;i++){
			cin>>arr[i];
		}
		i=1;
		while(i<N){
			if(arr[i]==arr[i-1]){
				res+=1;
				i+=2;
			}
			else i+=1;
		}
		cout<<res;
	}
int main(){
	//cin.tie(0),ios_base::sync_with_stdio(0);
	lli i,t;
	t=1;
	for(i=1;i<=t;i++){
		solve();
	}
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1

const int maxn = 2e5 + 7;

int a[maxn];

int main() {
    int n,k;
    while(~scanf("%d%d",&n,&k)) {
        for(int i = 1 ; i <= n ; i++) {
            scanf("%d",&a[i]);
        }
        sort(a+1,a+n+1);
        LL sum = 0;
        for(int i = 1 ; i <= n - k ; i++) {
            sum += 1LL * a[i];
        }
        printf("%lld\n",sum);
    }
    return 0;
}


Measured memory_bytes: 1024