akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int n, A[50];


int solve(int i, int m){
  int res = 0;
  if (m == 0) return 1;
  if (i >= n) return 0;
  res = solve(i + 1, m) || solve(i + 1, m - A[i]);
  return res;
}

int main(){
  int q, M, i;
  
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &A[i]);
  }
  scanf("%d", &q);
  for( i = 0; i < q; i++){
    scanf("%d", &M);
    if (solve(0, M) == 1){
      printf("yes\n");
    } else {
      printf("no\n");
    }
  }

  return 0;
}

Measured memory_bytes: 1820
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

const int MAX = 300001;
bool data[MAX];
vector<int> MSPrime;


void make(){
  fill(data,data+MAX,false);
  for(int i = 0; i < MAX; i++){
    if(7*i+1 < MAX) data[7*i+1] = true;
    else break;
    if(7*i+6 < MAX) data[7*i+6] = true;
    else break;
  }

  for(int i = 5; i < MAX; i++)
    if(data[i]) 
      for(int j = 2*i; j < MAX; j+=i) data[j] = false;

  for(int i = 2; i < MAX; i++)
    if(data[i])MSPrime.push_back(i);
}

void solve(int in){
  for(int i = 0; i < MSPrime.size(); i++)
    if(!(in%MSPrime[i])) cout << " " << MSPrime[i];				 
}
int main(){
  make();
  int in;
  while(cin >> in){
    if(in == 1) break;
    
    cout << in << ":";
    solve(in);
    cout << endl;
  }
  return 0;
}

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

int main(){
  ll i,N,Y;
  cin>>N>>Y;
  Y/=1000;
  i=Y%5;
  while(i<=N){
    if(Y-i>=(N-i)*5&&Y-i<=(N-i)*10){
      Y=(Y-i)/5-N+i;
      printf("%lld %lld %lld\n",Y,N-i-Y,i);
      return 0;
    }
    i+=5;
  }
  cout<<"-1 -1 -1"<<endl;
  return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < static_cast<int>(b); i++)
#define FORR(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) FOR (i, 0, n)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
template <typename T>
void print(const vector<vector<T>> matrix);
template <typename T>
void print(const vector<T> vec);
template <typename Arg>
void print(const Arg arg);
template <typename Head, typename... Args>
void print(const Head head, const Args... args);
template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
using ll = long long;

typedef pair<int, int> P;

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

    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m);
    vector<bool> satisfied(m);
    pqr<P> q;

    rep (i, m) {
        cin >> a[i] >> b[i];
        q.push(P(b[i], i));
    }

    for (int t = 1; /*kierumade*/; t++) {
        int bridge;
        int num;
        while (true) {
            P p = q.top();
            bridge = p.first - 1;
            num = p.second;
            q.pop();

            if (not satisfied[num]) break;
        }

        bool clear = true;
        rep (i, m) {
            if (not satisfied[i]) {
                if (a[i] <= bridge and bridge < b[i])
                    satisfied[i] = true;
                else
                    clear = false;
            }
        }

        if (clear) {
            print(t);
            break;
        }
    }

    return 0;
}

//---------------------------------------------
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    repall (i, vec)
        cout << i << ' ';
    cout << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}


Measured memory_bytes: 2168
//https://atcoder.jp/contests/arc090/tasks/arc090_b
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class reverse_range {private:struct I {int x;int operator*() {return x-1;}bool operator!=(I& lhs) {return x>lhs.x;}void operator++() {--x;}};I i, n;public:reverse_range(int n) :i({ 0 }), n({ n }){}reverse_range(int i, int n) :i({ i }), n({ n }){}I& begin() {return n;}I& end() {return i;}};
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }reverse_range operator!(){return reverse_range(*i,*n);}};

int N,M;
LL pos[112345];
int a[212345];
int b[212345];
LL c[212345];
vector<int> g[112345];
void dfs(int v){
    for(int e:g[v]){
        int u = a[e];
        LL  d = c[e];
        if(v == u){
            u = b[e];
            d = -d;
        }

        if(pos[u]==-1){
            pos[u]=pos[v]+d;
            dfs(u);
        }
        else{
            if(pos[u]!=pos[v]+d){
                cout<<"No"<<endl;
                exit(0);
            }
        }
    }
}
int main(){
    cin >> N >> M;
    for(int i:range(M)){
        cin >>a[i]>>b[i]>>c[i];
        a[i]--;
        b[i]--;
        g[a[i]].push_back(i);
        g[b[i]].push_back(i);
    }
    for(int i:range(N))pos[i]=-1;
    for(int i:range(N)){
        if(pos[i]==-1){
            pos[i]=1e12;
            dfs(i);

        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 14592
#include<stdio.h>
int main(){
  int i,j,k,r,a,b,n,m,s[12000],d[100010],M=300010;
  char p[300010]={1,1};
  for(i=0;i*i<M;i++){
    if(p[i])continue;
    for(j=i*i;j<M;j+=i)p[j]=1;
  }
  for(i=r=0;i<M;i++){
    if(p[i]==0)d[r++]=i;
  }
  while(scanf("%d %d",&n,&m),n+1){
    for(b=r=0;d[b]<=n;b++);
    for(i=0;i<110;i++){
      for(j=i;i+j<110;j++){
	a=d[b+i]+d[b+j];
	for(k=r++;k&&s[k-1]>a;k--)s[k]=s[k-1];
	s[k]=a;
      }
    }
    printf("%d\n",s[m-1]);
  }
  return 0;
}

Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll grundy(ll a,ll k){
    while(1){
        if(a<k)return 0;
        if(a%k==0)return a/k;
        ll d = a/k;
        ll i = (a - d*(k-1))/(d+1);
        a=a - i*(d+1);
    }
}
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n,ans=0;cin>>n;
    for(ll i=0,a,k;i<n;i++)cin>>a>>k,ans^=grundy(a,k);
    cout<<(ans?"Takahashi":"Aoki");
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			n = scanner.nextInt();
			k = scanner.nextInt();
			if ((n | k) == 0)
				break;
			num = new int[n];
			for (int i = 0; i < n; i++)
				num[i] = scanner.nextInt();
			set = new HashSet<String>();
			dfs(0, "", 0);
			System.out.println(set.size());
		}
	}

	private void dfs(int x, String s, int bit) {
		if (x == k) {
			set.add(s);
			return;
		}
		for (int i = 0; i < num.length; i++) {
			if (((bit >> i) & 1) == 1)
				continue;
			dfs(x + 1, s + num[i], bit | 1 << i);
		}
	}

	int n, k;
	int[] num;
	Set<String> set;
}

Measured memory_bytes: 25964
#include<cstdio>
#include<cstring>
int change (char);
int main(void){

int i,j,k=-1;
char n[1024][2000];
int m[1024];
char str[]="0\n";
do{
	k++;
	fgets(n[k],sizeof(n[k]),stdin);
	for(i=0;n[k][i]!='\n';i++);
	m[k]=i;
}while(strcmp(n[k],str)!=0);

for(i=0;i<k;i++){
	int c=0;

	for(j=0;j<m[i];j++){
		
		c=c+change(n[i][j]);
	};
	printf("%d\n",c);
};	
return 0;
}
int change(char suuji){
int suuti;
suuti=suuji-'0';
return suuti;
}

Measured memory_bytes: 3000
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    int N; cin >> N;
    map<Int, Int> M;
    Int sum = 0;
    for (int i = 0; i < N; i++) {
        int a; cin >> a; M[a] += 1; sum += a;
    }
    int Q; cin >> Q;
    while (Q--) {
        int b, c; cin >> b >> c;
        auto it = M.find(b);
        if (it != M.end()) {
            sum -= b * it->second;
            M[c] += it->second;
            sum += c * it->second;
            M.erase(it);
        }
        cout << sum << '\n';
    }
    return 0;
}


Measured memory_bytes: 7544
#include<cstdio>

char s[200000];
char map[200000];

int main(void) {
    int n;
    scanf("%d",&n);
    scanf("%s",s);
    for(int i=0; i<n; i++)
        s[i] = s[i] == 'o' ? 0 : 1;

    for(int k=0; k<4; k++) {
        map[0] = k&1, map[1] = k>>1;
        for(int i=1; i<n-1; i++) {
            map[i+1] = (map[i] + map[i-1] + s[i])%2;
        }

        if(((map[0] + map[1] + map[n-1] + s[0] + 1)%2) && (map[n-1] + map[n-2] + map[0] + s[n-1] + 1)%2) {
            for(int i=0; i<n; i++)
                printf("%c", map[i] ? 'W' : 'S');
            return 0;
        }
    }
    puts("-1");
    return 0;
}


Measured memory_bytes: 512
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

#include<bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double d;
typedef long long ll;

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

int n;
vector<string>v;
void rec(int i,string s){
    int maxi=-1;
    bool ok[10]{0};
    for(char c:s){
        ok[c-'a']=1;
        maxi=max(maxi,int(c-'a'));
    }
    rep(j,0,maxi){
        if(!ok[j]) return;
    }
    if(i==n){
        v.pb(s);
        return;
    }
    rep(j,0,i){
        rec(i+1,s+char('a'+j));
    }
}
signed main(){
    FastIO;
    cin>>n;
    rec(0,"");
    sort(all(v));
//    cout<<v.size();
    for(string s:v) cout<<s<<'\n';
    return 0;
}


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

using namespace std;

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

int ans[555][555];
int main(){
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
	int n;cin >> n;
	REP(i, n){
		REP(j, n){
			if(i == j)continue;
			for(int k = 30;k >= 0;k--){
				if((i & (1 << k)) != (j & (1 << k))){
					ans[i][j] = (k + 1);
					break;
				}
			}
		}
	}
	REP(i, n-1){
		REP(j, n){
			if(i < j)cout << ans[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 1536
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
 
const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long
const double pi = acos(-1.0);

LL mod = 1e9 + 7;

int main() {
#ifdef LOCAL
  auto start_clock = clock();
  freopen("in", "r", stdin);
#endif

  int n;
  scanf("%d", &n);
  printf("%d\n", (1000 - n % 1000) % 1000);


#ifdef LOCAL
 auto end_clock = clock();
 cout << "Time:" << (end_clock - start_clock) / CLOCKS_PER_SEC << endl;
#endif
  return 0;
}

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

using namespace std;

int main(){
    int n[3];
    int i = 3;
    while(i != 0){ 
        cin >> n[3-i];
        i--;
    }   
    if(0 == (n[0]-n[1])) cout << n[2];
    else if (0 == (n[0]-n[2])) cout << n[1];
    else if (0 == (n[1]-n[2])) cout << n[0];
    return 0;
}


Measured memory_bytes: 256
let cnt = 0
const mergeSort = (xs, left, right) => {
  if (left + 1 < right) {
    const mid = Math.floor((left + right) / 2)
    mergeSort(xs, left, mid)
    mergeSort(xs, mid, right)
    merge(xs, left, mid, right)
  }
}
const merge = (xs, left, mid, right) => {
  const n1 = mid - left
  const n2 = right - mid
  var ls = new Array(n1)
  for (var i = 0; i < n1; i++) {
    ls[i] = xs[left + i]
  }
  ls[n1] = 1000000000
  var rs = new Array(n2)
  for (var i = 0; i < n2; i++) {
    rs[i] = xs[mid + i]
  }
  rs[n2] = 1000000000
  var i = 0
  var j = 0
  for (var k = left; k < right; k++) {
    cnt++
    if (ls[i] < rs[j]) {
      xs[k] = ls[i]
      i++
    } else {
      xs[k] = rs[j]
      j++
    }
  }
}

const solver = (n, xs) => {
  mergeSort(xs, 0, n)
  return xs
}

let rows = 0
let n = 0
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
})
reader.on("line", (line) => {
  rows++
  if (rows === 1) {
    n = Number(line.trim())
  } else {
    const xs = line.trim().split(" ").map(x => Number(x))
    const result = solver(n, xs)
    console.log(result.reduce((acc, x) => `${acc} ${x}`))
    console.log(cnt)
    process.exit(0)
  }
})



Measured memory_bytes: 167448
#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  int max_even = 0;
  int max_odd = 0;
  int second_max_even = 0;
  int second_max_odd = 0;
  int max_even_val, max_odd_val, second_max_even_val, second_max_odd_val;
  unordered_map<int, int> even_counts;
  unordered_map<int, int> odd_counts;
  for (int i = 0; i < n; i+=2) {
    even_counts[v[i]]++;
    int cur_count = even_counts[v[i]];
    if (cur_count > max_even) {
      if (max_even_val != v[i]) {
	second_max_even = max_even;
	second_max_even_val = max_even_val;
      }
      max_even_val = v[i];
      max_even = cur_count;
    }
    else if (even_counts[v[i]] > second_max_even) {
      second_max_even = even_counts[v[i]];
      second_max_even_val = v[i];
    }
  }
  for (int i = 1; i < n; i+=2) {
    odd_counts[v[i]]++;
    int cur_count = odd_counts[v[i]];
    if (cur_count > max_odd) {
      if (max_odd_val != v[i]) {
	second_max_odd = max_odd;
	second_max_odd_val = max_odd_val;
      }
      max_odd_val = v[i];
      max_odd = cur_count;
    }
    else if (odd_counts[v[i]] > second_max_odd) {
      second_max_odd = odd_counts[v[i]];
      second_max_odd_val = v[i];
    }
  }
  int fixed = max_even + max_odd;
  if (max_even_val == max_odd_val) {
    fixed = max(max_even + second_max_odd, max_odd + second_max_even);
  }
  cout << n - fixed;
  

}


Measured memory_bytes: 4748
fn solve(n: usize) -> bool {
    let a = n / 100;
    let r = n % 100;

    a * 5 >= r
}

#[test]
fn solve_test() {
    assert_eq!(solve(615), true);
    assert_eq!(solve(217), false);
    assert_eq!(solve(107), false);
}

#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        line.pop();
        line
    }};
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        let iter = line.split_whitespace();
        iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
    }};
}

fn main() {
    let n = parse_line!(usize);
    println!("{}", if solve(n) { "1" } else { "0" });
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define N 205

using namespace std;

int n;
int a[N];
int b[N], tot;

inline int read() {
	int x = 0; char ch = getchar();
	while(!isdigit(ch)) ch = getchar();
	while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
	return x;
}

bool vis[N];
int match[N];

bool isPrime(int x) { // except 2
	if(x == 1 || (~x & 1)) return false;
	for(int i = 3; i * i <= x; ++i)
		if(x % i == 0)
			return false;
	return true;
}

bool dfs(int u) {
	for(int i = 1; i <= tot; ++i) {
		if(u == i || vis[i] || !isPrime(abs(b[i] - b[u])))
			continue;
		vis[i] = true;
		if(!match[i] || dfs(match[i])) {
			match[i] = u;
			return true;
		}
	}
	return false;
}

int main() {
	n = read();
	for(int i = 1; i <= n; ++i) a[i] = read();
	sort(a + 1, a + n + 1);
	a[0] = a[1] - N, a[n + 1] = a[n] + N;
	for(int i = 1; i <= n; ++i) {
		if(a[i - 1] + 1 != a[i])
			b[++tot] = a[i];
		if(a[i] + 1 != a[i + 1])
			b[++tot] = a[i] + 1;
	}
	
	int ans(0);
	int even = 0, odd = 0;
	for(int i = 1; i <= tot; ++i) {
		if(~b[i] & 1) {
			++even;
			continue;
		}
		++odd;
		memset(vis, 0, sizeof vis);
		if(dfs(i)) {
			cerr << "ERR" << endl;
			++ans;
			--even;
			--odd;
		}
	}

	ans += (even) / 2 * 2;
	ans += (odd) / 2 * 2;
	ans += (even & 1) * 3;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;
  if(x-r>=0 && x+r<=W && y-r>=0 && y+r<=H) cout << "Yes"<<endl;
  else cout << "No" <<endl;
}

Measured memory_bytes: 3112
// =====================================================================================
//
//       Filename:  1092.cpp
//
//    Description:  
//
//        Version:  1.0
//        Created:  14/04/20 08:28:57 PM IST
//       Revision:  none
//       Compiler:  g++
//
//         Author:  Kiran Bhanushali (), kiranbhanushali143.kb143@gmail.com
//   Organization:  
//
// =====================================================================================

#include<bits/stdc++.h>


using namespace std;

#define int long long 
#define pb push_back
//#define _SHOW_TIME

void solve(){
    string s;
    cin>>s;
    int ans = INT_MAX;
    for(int i =0;i<=s.size()-3;i++){
        int n = (s[i]-'0')* 100 + (s[i+1]-'0')* 10+(s[i+2]-'0');
        ans = min (ans, abs(n-753));
    }
    cout<<ans<<endl;
}
int32_t main(){
 /////////////////////////////////////
    #ifdef _SHOW_TIME
	int tt = (int) clock();
    #endif
    /////////////////////////////////////
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /////////////////////////////////////
    solve();
    /////////////////////////////////////
    #ifdef _SHOW_TIME
        cerr << "TIME = " << (double)(clock() - tt) / CLOCKS_PER_SEC << endl;
    #endif
    /////////////////////////////////////
    return 0;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    int n;cin>>n;
    vstr s(n);rep(i,n)cin>>s[i];
    int ac=0;int wa=0;int tle=0;int re=0;
    rep(i,n){
        if(s[i]=="AC")ac++;
        else if(s[i]=="WA")wa++;
        else if(s[i]=="TLE")tle++;
        else re++;
    }
    cout<<"AC"<<" "<<'x'<<" "<<ac<<endl;
    cout<<"WA"<<" "<<'x'<<" "<<wa<<endl;
    cout<<"TLE"<<" "<<'x'<<" "<<tle<<endl;
    cout<<"RE"<<" "<<'x'<<" "<<re<<endl;
}

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

int main ()
{
    long long int n;
    int l, h;
    cin >> n;
    string s = "";
    char x, tmp;
    
    while(n)
    {
        if(n % 26 == 0)
        {
            s.push_back('z');
            n = (n / 26) - 1;
        }
        else
        {
            x = ((n % 26) + 96);
            s.push_back(x);
            n /= 26;
        }
        
    }

    l = 0;
    h = s.length() - 1;
    while(l < h)
    {
        tmp = s[l];
        s[l] = s[h];
        s[h] = tmp;
        l++;
        h--;
    }
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 3624
def numba_compile(numba_config):
    import os, sys
    if sys.argv[-1] == "ONLINE_JUDGE":
        from numba import njit
        from numba.pycc import CC
        cc = CC("my_module")
        for func, signature in numba_config:
            globals()[func.__name__] = njit(signature)(func)
            cc.export(func.__name__, signature)(func)
        cc.compile()
        exit()
    elif os.name == "posix":
        exec(f"from my_module import {','.join(func.__name__ for func, _ in numba_config)}")
        for func, _ in numba_config:
            globals()[func.__name__] = vars()[func.__name__]
    else:
        from numba import njit
        for func, signature in numba_config:
            globals()[func.__name__] = njit(signature, cache=True)(func)
        print("compiled!", file=sys.stderr)

import numpy as np

def solve(N, K, P, C):
    ans = -10**18
    for start in range(N):
        t = 1
        s = 0
        idx = start
        while P[idx] != start:
            idx = P[idx]
            s += C[idx]
            t += 1
        s += C[start]
        q = K // t
        #print(R)
        score = 0
        #print(ans, s)
        if s >= 0:
            x = max(0, (q-2)*t)
            score += s * (x//t)
            #print(f"score={score}")
            idx = start
            for _ in range(x, K):
                idx = P[idx]
                score += C[idx]
                ans = max(ans, score)
        else:
            idx = start
            for _ in range(1, min(N, K+1)):
                idx = P[idx]
                score += C[idx]
                ans = max(ans, score)
    return ans

numba_compile([
    [solve, "i8(i8,i8,i8[:],i8[:])"],
])


def main():
    N, K = map(int, input().split())
    P = np.array(input().split(), dtype=np.int64)-1
    C = np.array(input().split(), dtype=np.int64)
    ans = solve(N, K, P, C)
    print(ans)

main()


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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

struct union_find {
    vi P, R, S;

    union_find(int N) {
        P.resize(N), R.resize(N, 0), S.resize(N, 1);
        for (int i = 0; i < N; i++)
            P[i] = i;
    }

    int rep(int i) {
        if(P[i] != i) P[i] = rep(P[i]);
        return P[i];
    }

    bool unio(int a, int b) {
        a = rep(a), b = rep(b);
        if(a == b) return false;
        if(R[a] < R[b]) swap(a, b);
        P[b] = a;
        S[a] += S[b];
        if(R[a] == R[b]) R[a]++;
        return true;
    }
};

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    const int MAXV = 1e5 + 1;

    int N;
    cin >> N;

    vi x(N), y(N);
    vvi xe(MAXV), ye(MAXV);
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i];

        xe[x[i]].push_back(i);
        ye[y[i]].push_back(i);
    }

    union_find uf(N);
    for (int v = 1; v < MAXV; v++) {
        for (int i = 1; i < sz(xe[v]); i++)
            uf.unio(xe[v][i-1], xe[v][i]);
        for (int i = 1; i < sz(ye[v]); i++)
            uf.unio(ye[v][i-1], ye[v][i]);
    }

    unordered_map<int, vi> comps;
    for (int i = 0; i < N; i++)
        comps[uf.rep(i)].push_back(i);

    ll ans = 0;

    vi sx(MAXV, -1), sy(MAXV, -1);
    for (auto p : comps) {
        int px = 0, py = 0;

        for (int e : p.second) {
            if (sx[x[e]] != p.first) {
                px++;
                sx[x[e]] = p.first;
            }
            if (sy[y[e]] != p.first) {
                py++;
                sy[y[e]] = p.first;
            }
        }

        ans += ll(px) * py - sz(p.second);
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 11768
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N=200005;
int n;
ll x,a[N],p,ans,sum,now;
int main(){
  scanf("%d%lld",&n,&x);
  for (int i=1;i<=n;i++) scanf("%lld",&p),a[i]=a[i-1]+p;
  ans=1e18;
  for (int k=1;k<=n;k++){
  	sum=0;now=3;
  	for (int i=n;i>=1;i-=k){
  		sum+=(a[i]-a[max(0,i-k)])*max(now,5ll),now+=2;
  		if (sum>=ans) break;
	  }
	ans=min(ans,sum+1ll*x*(k+n));
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
using namespace std;

typedef long long ll;

int main() {
    ll n, ans = 1<<29;
    cin >> n;
    for (ll a = 1; a * a <= n; a++)
        if (n % a == 0) {
            ans = min(ans, (ll) (to_string(n / a).size()));
        }
    cout << ans << endl;
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
int A, B;

int main() {
	cin >> N >> A >> B;
	int t = 0;

	while (true) {
		if (t == 0) {
			if (A + 1 < B) {
				++A;
			} else {
				if (A == 1) {
					puts("Borys");
					return 0;
				}
				--A;
			}
		} else {
			if (B - 1 > A) {
				--B;
			} else {
				if (B == N) {
					puts("Alice");
					return 0;
				}
				++B;
			}
		}

		t ^= 1;
	}

	return 0;
}

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

using namespace std;

string s, t;
int a[200005], b[200005];
int cnta[26], cntb[26];

int main(void)
{
	cin >> s >> t;
	if(s.size() != t.size()){
		cout << "No" << endl;
		return 0;
	}
	
	for(int i = 0; i < s.size(); i++){
		cnta[s[i]-'a']++;
	}
	for(int i = 0; i < t.size(); i++){
		cntb[t[i]-'a']++;
	}
	
	for(int i = 0; i < s.size(); i++){
		if(cnta[s[i]-'a'] != cntb[t[i]-'a']){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	
	return 0;
}

Measured memory_bytes: 776
//ABC070A
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <numeric>
using namespace std;

int main() {
	string s;
	cin >> s;
	if(s.at(0) == s.at(2)){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a,b,c;
    int t;
    int N;
    int count=0;
    int end=0;
    int maxcount=0;
    int maxnum=0;
    int num=0;
    
    scanf("%d", &N);
    
    
    a=0;
    b=0;
    c=0;
   
    for(t=1;t<=N;t++){
        num=t;
         //printf("num %d\n",num);
       do{
           if(num%2==0){
               count++;
               num=num/2;
           }else end=1;
           
       }while(end==0);
       //printf("count %d\n",count);

        end=0;
   
    
        if(maxcount<=count){
               maxcount=count;
               maxnum=t;
           }
          
        count=0;
           
    }
           printf("%d",maxnum);
  
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 100
int main()
{
  int i,j,v,num;
  int A[N];
  scanf("%d",&num);
  for(i=0;i<num;i++)
    {  
      scanf("%d",&A[i]);
    }
 
  for(i=0;i<num;i++)
    {
      v=A[i];
      j=i-1;
      while(j>=0 && A[j]>v)
	{
	  A[j+1]=A[j];
	  j--;
	  A[j+1]=v;
	}
      for(j=0;j<num-1;j++)
	{
	  printf("%d ",A[j]);
	}
 printf("%d\n",A[j]);
    }
  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (ll)(x).size()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fill(a)  memset(a, 0, sizeof (a))
#define ff first
#define ss second
#define pb push_back
typedef long double ld;
typedef vector<ll> vll;
const ll INF = 1e18;
const ld PI = 4*atan((ld)1);
const ll mod = 1e9+7;

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll tt=1;
        // cin >> tt;
    while((tt)--){
        ll a,b,c,k; cin >> a >> b >> c >>k;
        ll ans =0;
        ans += min(a,k);
        k-= min(a,k);
        k-=min(b,k);
        ans -= min(c,k);
        k-= min(c,k);
        cout << ans << endl;
    }
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N, K, M;

int main()
{
    cin >> N >> K;
    vector<vector<int>> v(N);
    for (int i = 0; i + 1 < N; i++)
    {
        for (int j = i + 1; j + 1 < N; j++)
        {
            if (K > 0)
            {
                K--;
            }
            else
            {
                M++;
                v[i].push_back(j);
            }
        }
        M++;
        v[i].push_back(N - 1);
    }
    if (K > 0)
    {
        cout << -1 << endl;
        return 0;
    }
    cout << M << endl;
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < v[i].size(); j++)
        {
            cout << i + 1 << " " << v[i][j] + 1 << endl;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define F first
#define S second
using namespace std;
int n,m;
int a[510][510];
PII nxt[510][510];
int x,y,t;
vector<int> v;
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=0;i<n;i++)
	{
		for (int j=0;j<m;j++)
		    scanf("%d",&a[i][j]);
	}
	for (int i=0;i<n;i++)
	{
		for (int j=0;j<m;j++)
		{
			if ((i%2==0 && j==m-1) || (i%2 && !j)) nxt[i][j].F=i+1,nxt[i][j].S=j;
			else
			{
				if (i%2==0) nxt[i][j].F=i,nxt[i][j].S=j+1;
				else nxt[i][j].F=i,nxt[i][j].S=j-1;
			}
		}
	}
	x=y=t=0;
	while (t!=n*m-1)
	{
		int xi=nxt[x][y].F;
		int yi=nxt[x][y].S;
		//cout <<x<<" "<<y<<" "<<a[x][y]<<" ##\n";
		if (a[x][y]%2==0)
		{
			x=xi;
			y=yi;
			t++;
			continue;
		}
		else
		{
			a[xi][yi]++;
			a[x][y]--;
			v.push_back(x+1);
			v.push_back(y+1);
			v.push_back(xi+1);
			v.push_back(yi+1);
			x=xi;
			y=yi;
			t++;
			continue;
		}
	}
	printf("%d\n",(int)v.size()/4);
	for (int i=0;i<v.size();i++)
	{
		printf("%d",v[i]);
		if (i%4==3) cout <<"\n";
		else cout <<" ";
	}
	return 0;
}

Measured memory_bytes: 7152
import sys
import random
import time
my_input = sys.stdin.readline

start = time.time()
D = int(input())
C = list(map(int, my_input().split()))
S = [list(map(int, my_input().split())) for _ in range(D)]


def main():
    cnt = 0
    best_ans, best_score = generate_first_ans()
    while time.time() - start < 1.83:
        cnt += 1
        ans = best_ans[:]

        x = random.random()
        if x > 0.66:
            si, sj = random.randint(0, 364), random.randint(0, 364)
            if si == sj:
                continue
            ans[si], ans[sj] = ans[sj], ans[si]
        else:
            si = random.randint(0, 364)
            sx = random.randint(0, 25)
            if ans[si] == sx:
                continue
            ans[si] = sx

        score = calc_score(ans)
        if score > best_score:
            best_score = score
            best_ans = ans

    #print(best_score, cnt)
    for a in best_ans:
        print(a + 1)


def generate_first_ans():
    best_ans = []
    best_score = 0
    last_day = [-1] * 26
    for d in range(365):
        d_ans = -1
        d_score = -float('inf')
        d_last_day = [-1] * 26
        for t in range(26):
            d_tmp_score = 0
            d_tmp_score += S[d][t]
            d_tmp_last_day = last_day[:]
            d_tmp_last_day[t] = d
            for c, ld in zip(C, d_tmp_last_day):
                d_tmp_score -= c * (d - ld)

            if d_tmp_score > d_score:
                d_ans = t
                d_score = d_tmp_score
                d_last_day = d_tmp_last_day[:]

        best_ans.append(d_ans)
        best_score += d_score
        last_day = d_last_day[:]

    return best_ans, best_score


def calc_score(T):
    score = 0
    last_day = [-1] * 26
    for d, t in enumerate(T):
        score += S[d][t]
        last_day[t] = d
        for c, ld in zip(C, last_day):
            score -= c * (d - ld)
    return score


if __name__ == "__main__":
    main()


Measured memory_bytes: 83848
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const ll INF = 1e16;

void solver(int n, vector<ll> &a, vector<ll> &b){

    int cnt{}, left{}, right{};
    left = 0;
    right = (int)a.size()-1;
    
    for(int i = (int)a.size()-1; i != -1; --i){
        int buf;
        buf = a.at(i);

        if(cnt%2 == 0){
            b.at(left) = buf;
            ++left;
        }
        else{
            b.at(right) = buf;
            --right;
        }
        ++cnt;
    }
    return;
}

int main(){

    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i != n; ++i){
        cin >> a.at(i);
    }

    vector<ll> b(n, 0);
    solver(n, a, b);

    for(int i = 0; i != (int)b.size(); ++i){
        cout << b.at(i) << " "s;
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 6324
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

a, b = map(int, input().split())

if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")


Measured memory_bytes: 6880
N = int(input())
li = list(map(int,input().split()))
app = 0
for i in li:
    if i % 2 == 0 and (i % 6 == 0 or i % 10 == 0):
        pass
    elif i % 2 == 0:
        app += 1
        break
if app == 0:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//????????????????????????????????????
#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const ll inf = 4523372036854775807;
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//??£??\???????????¨???
	ll to, cost;
};
struct S {//???????????±?????\???????????°
	int from, to, cost;
};
struct H {
	int x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
ll gcm(ll i, ll j) {//?????§??¬?´???°
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(ld a, ld b, ld c, ld d) {
	return sqrt(pow(a - c, 2) + pow(b - d, 2));
}//rad?????§?¨???????2??????????????¢
int ari(int a, int b, int c) {
	return (a + b)*c / 2;
}//????????°?????????
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
int n, a[100000], b[200001], ans;
int solve(int s, int e) {
	int s2 = s, e2 = e, t;
	while (e - s > 1) {
		t = (s + e) / 2;
		if (b[t] - b[s2 - 1] > b[e2 - 1] - b[t])
			e = t;
		else
			s = t;
	}
	int sum = min(b[s] - b[s2 - 1], b[e2 - 1] - b[s]);
	if (s + 2 != e2)
		sum = max(sum, min(b[s + 1] - b[s2 - 1], b[e2 - 1] - b[s + 1]));
	return sum;
}
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	b[0] = a[0];
	for (int i = 1; i < n; i++)
		b[i] = b[i - 1] + a[i];
	for (int i = 0; i < n; i++)
		b[i + n] = b[i + n - 1] + a[i];
	for (int i = 0; i < n; i++) {
		int s = i, e = i + n, t;
		while (e - s > 1) {
			t = (s + e) / 2;
			if (solve(t + 1, i + n) < (i != 0 ? b[t] - b[i - 1] : b[t]))
				e = t;
			else
				s = t;
		}
		int sum = min(solve(s + 1, i + n), (i != 0 ? b[s] - b[i - 1] : b[s]));
		if (s + 3 != i + n)
			sum = max(sum, min(solve(s + 2, i + n), (i != 0 ? b[s + 1] - b[i - 1] : b[s + 1])));
		ans = max(ans, sum);
	}
	cout << ans << endl;
	getchar(); getchar();
}

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

int main(){
  int participant;
  int point[100000];
  int answer[100000];
  int numberofanswer;
  int initial;
  int i=0;

  scanf("%d %d %d",&participant,&initial,&numberofanswer);

  for(i=0;i<participant;i++)
  {
    point[i]=0;
  }

  for(i=0;i<numberofanswer;i++)
  {
    scanf("%d",&answer[i]);
    point[answer[i]-1]=point[answer[i]-1]+1;
  }

for(i=0;i<participant;i++)
{
  if(numberofanswer-point[i]<initial){printf("Yes\n");}
  else{printf("No\n");}
}
return 0;

}


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

final class Main {

    private Main() {
    }

    public static void main(final String[] argv) throws IOException {
        final BufferedReader inputReader =
                new BufferedReader(new InputStreamReader(System.in));
        while (true) {
            String input = inputReader.readLine();
            if (input == null || input.equals("0 0")) {
                break;
            }
            String[] inputs = input.split(" ");
            int n = Integer.parseInt(inputs[0]);
            int s = Integer.parseInt(inputs[1]);
            System.out.println(solv(n, s));
        }
    }

    private static int solv(final int n, final int s) {
        return solv(n, s, 0);
    }

    private static int solv(final int n, final int s, final int min) {
        if (n == 0) {
            return s == 0 ? 1 : 0;
        }
        int count = 0;
        for (int i = min; i < 10 && i <= s; i++) {
            count += solv(n - 1, s - i, i + 1);
        }
        return count;
    }
}

Measured memory_bytes: 9184
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public final class Main {

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final int n = fs.nextInt();
        System.out.println(canDo(n) ? "Yes" : "No");
    }

    private static boolean canDo(int target) {
        for (int i = 0; i < 30; i++) {
            for (int j = 0; j < 30; j++) {
                if ((i * 4 + j * 7) == target) {
                    return true;
                }
            }
        }
        return false;
    }

    static final class Util {
        public static void shuffleSort(int[] x) {
            shuffle(x);
            Arrays.sort(x);
        }

        public static void shuffleSort(long[] x) {
            shuffle(x);
            Arrays.sort(x);
        }

        public static void shuffle(int[] x) {
            final Random r = new Random();

            for (int i = 0; i <= x.length - 2; i++) {
                final int j = i + r.nextInt(x.length - i);
                swap(x, i, j);
            }
        }

        public static void shuffle(long[] x) {
            final Random r = new Random();

            for (int i = 0; i <= x.length - 2; i++) {
                final int j = i + r.nextInt(x.length - i);
                swap(x, i, j);
            }
        }

        public static void swap(int[] x, int i, int j) {
            final int t = x[i];
            x[i] = x[j];
            x[j] = t;
        }

        public static void swap(long[] x, int i, int j) {
            final long t = x[i];
            x[i] = x[j];
            x[j] = t;
        }

        private Util() {}
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        private String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        int[] nextIntArray(int n) {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++) { a[i] = nextInt(); }
            return a;
        }

        long[] nextLongArray(int n) {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++) { a[i] = nextLong(); }
            return a;
        }
    }
}


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

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

	int ans = 0;
	int max = N + 5;
	for (int i = 0; i < N; i++) {
		int p;
		cin >> p;
		if (p < max) {
			ans++;
			max = p;
		}
	}

	cout << ans;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
using namespace std;

template<class T>
void in(vector<T>& V) {
	for (auto itr = V.begin(); itr != V.end(); itr++)cin >> *itr;
	return;
}

template<class T>
void out(vector<T>& V) {
	for (T& itr : V)cout << itr << endl;
	return;
}

void goup(vector<pair<long double, int>>& V, int n) {
	if (n != 0) {
		if (V[2 * n].first < V[2 * n + 1].first)V[n] = V[2 * n + 1];
		else V[n] = V[2 * n];
		goup(V, n / 2);
	}
	return;
}

int main() {
	int N, M;
	vector<pair<long double, int>> A;
	cin >> N >> M;
	int RN = 1;
	while (RN < N)RN *= 2;
	A.resize(RN * 2);
	for (int n = 0; n < N; n++) {
		int a;
		cin >> a;
		A[RN + n] = pair<long double, int>(a, n);
	}
	for (int n = RN - 1; n >= 1; n--) {
		if (A[2 * n].first < A[2 * n + 1].first)A[n] = A[2 * n + 1];
		else A[n] = A[2 * n];
	}
	for (int m = 0; m < M; m++) {
		int minimum = A[1].second;
		A[RN + minimum].first /= 2;
		goup(A,(RN + minimum) / 2);
	}
	long long ans = 0;
	for (int i = RN; i < RN + N; i++) {
		ans += A[i].first;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8448
#include <iostream>
#include<math.h>
#include <vector>
#include <numeric>

using namespace std;

int main() {

    int N, K;
    cin >> N >> K;

    if (N % K != 0) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
a,b,c = gets.chomp.split(" ").map(&:to_i)
k = gets.to_i

k.times do
  if a >= b
    b = b * 2
  elsif b >= c
    c = c * 2
  end
end
if a < b && b < c
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 14376
import java.lang.Math;
import java.util.Scanner;

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

        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();

        System.out.println(Math.min(N * A, B));
    }
}


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

int n, k;
int dp[100100][4];
bool vis[100100][4];
vector<int> arr[100100];

int func( int pos, int k ) {
    if (pos > n) return 0;
    if (vis[pos][k]) return dp[pos][k];
    vis[pos][k] = 1;

    int mx = 0;
    for (int i = 0; i < 3; ++i) {
        if (k == i) continue;
        mx = max(mx, arr[pos][i] + func(pos + 1, i));
    }
    return dp[pos][k] = mx;
}

int main() {
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= 3; ++j) {
            cin >> k;
            arr[i].push_back(k);
        }
    }

    cout << func(1, -1) << endl;
    return 0;
}


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

const int MAXN = 100;
const int INF = 0x3f3f3f3f;

int N, M;
char S[MAXN + 5][MAXN + 5];

int Dp[MAXN + 5][MAXN + 5];
bool Vis[MAXN + 5][MAXN + 5];

int main() {
	scanf("%d%d", &N, &M);
	for (int i = 1; i <= N; i++)
		scanf("%s", S[i] + 1);
	Dp[N][M] = Vis[N][M] = S[N][M] == '#';
	for (int i = N; i >= 1; i--) {
		for (int j = M; j >= 1; j--) {
			if (i == N && j == M)
				continue;
			int dwn = i == N ? INF : Dp[i + 1][j];
			int rgt = j == M ? INF : Dp[i][j + 1];
			if (S[i][j] == '#') {
				Vis[i][j] = true;
				dwn += !Vis[i + 1][j];
				rgt += !Vis[i][j + 1];
			}
			Dp[i][j] = std::min(dwn, rgt);
		}
	}
	printf("%d", Dp[1][1]);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=10000000000000000;


int main(){
  int n,m;
  cin >> n >> m;
  vector<vector<pp>> e(n+1,vector<pp>(0));
  vector<int> b(n+1,-inf);
  rep(i,m){
    int f,g,h;
    cin >> f >> g >> h;
    e[f].push_back(mk(g,h));
    e[g].push_back(mk(f,-h));
  } 
  for(int k=1;k<=n;k++){
  if (b[k]!=-inf) continue;
  queue<int> q;
  q.push(k);
  b[k]=0;
  while(!q.empty()){
    int f=q.front();
    q.pop();
    rep(i,e[f].size()){
      int u=e[f][i].first,y=e[f][i].second;
      if (b[u]==-inf){
        b[u]=b[f]+y;
        q.push(u);
      }
      else{
        if (b[u]!=b[f]+y){
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 10240