akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int maxPossible(vector<vector<int>> a){

    int n=a.size();

    int dp[n][3];


    for(int i=0;i<3;i++){
        dp[0][i]=a[0][i];

    }

    for(int i=1;i<n;i++){
        
        dp[i][0]= a[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]= a[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]= a[i][2]+max(dp[i-1][0],dp[i-1][1]);

    }

    // for(int i=0;i<n;i++){
    //     for(int j=0;j<3;j++){
    //         cout<<dp[i][j]<<" ";

    //     }
    //     cout<<endl;

    // }

    return max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));

}

int main() {
    int n;
    cin>>n;
    vector<vector<int>> a(n,vector<int>(3,0));

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

        }
    }

    cout<<maxPossible(a);

}


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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    int n;
    cin >> n;
    string ans = "No";
    int cnt = 0;
    REP(i, n)
    {
        int a, b;
        cin >> a >> b;
        if (a == b)
            cnt++;
        else
            cnt = 0;
        if (cnt == 3) {
            ans = "Yes";
        }
    }
    cout<<ans<<endl;
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main(){
    gearup;
    deque<char> a,b,c;
    string s,s1,s2;cin>>s>>s1>>s2;
    rep(i,s.size()){
        a.push_back(s[i]);
    }
     rep(i,s1.size()){
        b.push_back(s1[i]);
    }
     rep(i,s2.size()){
        c.push_back(s2[i]);
    }
    char d = a.front();a.pop_front();
    while(1){
        if(d == 'a'){
            if(a.empty()){
            out('A');
            return 0;
            }
            d = a.front();a.pop_front();
        }
        else if(d == 'b'){
            if(b.empty()){
            out('B');
            return 0;
            }
            d = b.front();b.pop_front();
        }
        else {
            if(c.empty()){
            out('C');
            return 0;
            }
            d = c.front();c.pop_front();
        }
    }
}



Measured memory_bytes: 256
#include <stdio.h>

int is_prime(int n)
{
    int i;

    if (n == 2){
        return (1);
    }
    else if (n < 2 || n % 2 == 0){
        return (0);
    }
    for (i = 3; i * i <= n; i += 2){
        if (n % i == 0){
            return (0);
        }
    }
    return (1);
}

int main()
{
    int n;
    int num;
    int cnt;

    scanf("%d", &n);
    cnt = 0;
    while (n--){
        scanf("%d", &num);
        if (is_prime(num) == 1){
            cnt++;
        }
    }
    printf("%d\n", cnt);

    return (0);
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map>
#include <map>
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
using namespace std;

int main() {
	int ol, el;
	string o, e, p;
	cin >> o;
	cin >> e;
	ol = o.length();
	el = e.length();
	for (int i = 0; i < el;i++) {
		p += o[i];
		p += e[i];
	}
	if (ol > el) p += o[ol-1];
	cout << p << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <cstdio>
using namespace std;
int a,b;
int main()
{
	cin>>a>>b;
	if (a==b)
		cout<<a;
	else
 	{
  		if (a>b)
  			cout<<a-1;
 			else
				cout<<a;
	}
    return 0;
}

Measured memory_bytes: 256
fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter).map(|e| e.parse().ok().unwrap()).collect::<Vec<T>>()
}

fn main() {
    let s = readn::<String>(",");
    println!("{} {} {}", s[0], s[1], s[2]);
}

Measured memory_bytes: 4352
import java.util.*;
import static java.lang.System.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	void run() {
		int q = sc.nextInt();
		for (int i = 0; i < q; i++) {
			String n = sc.next();
			int count = 0;
			while (n.length() > 1) {
				int max = -1;
				for (int j = 0; j < n.length()-1; j++) {
					max = Math.max(max, Integer.parseInt(n.substring(0, j+1))*Integer.parseInt(n.substring(j+1)));
				}
				n = String.valueOf(max);
				count++;
			}
			out.println(count);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 23136
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let m: usize = input();
    let s: Vec<i32> = (0..n).map(|_| input()).collect();
    let t: Vec<i32> = (0..m).map(|_| input()).collect();
    const MOD: i64 = 1000000007;

    let mut dp = vec![vec![0; m + 1]; n + 1];
    let mut sum = vec![vec![0; m + 1]; n + 1];
    for i in 1..n + 1 {
        for j in 1..m + 1 {
            if s[i - 1] == t[j - 1] {
                dp[i][j] = (sum[i - 1][j - 1] + 1) % MOD;
            }
            sum[i][j] = (((sum[i][j - 1] + sum[i - 1][j]) % MOD + MOD - sum[i - 1][j - 1]) % MOD
                + dp[i][j])
                % MOD;
        }
    }

    println!("{}", (sum[n][m] + 1) % MOD);
}


Measured memory_bytes: 86268
import sys
input = sys.stdin.readline
from collections import deque

def main():
    N, D, A = map(int, input().split())
    monsters = sorted([list(map(int, input().split())) for _ in range(N)])
    
    for i in range(N):
        monsters[i][1] = (monsters[i][1] + A - 1) // A
    
    attacks = deque([]) # [(有効範囲, 攻撃回数)]
    ans = 0
    atk = 0
    for i in range(N):
        atk_this = monsters[i][1]
        while attacks and monsters[i][0] > attacks[0][0]:
            _, atk_ = attacks.popleft()
            atk -= atk_
        if atk_this - atk > 0:
            ans += atk_this - atk
            attacks.append((monsters[i][0]+2*D, atk_this-atk))
            atk += atk_this - atk
    print(ans)
    
if __name__ == '__main__':
    main()


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

int main(){
  int N,P;
  cin >> N >> P;
  bool flag=false;
  for(int i=0;i<N;i++){
    int A;
    cin >> A;
    if(A%2!=0){
      flag=true;
    }
  }
  if(flag){
    cout << (int64_t)pow(2,N-1) << endl;
  }else{
    if(P%2==0){
      cout << (int64_t)pow(2,N) << endl;
    }else{
      cout << 0 << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

struct Scanner<'a> {
    cin : StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin : StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

fn main(){
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    loop {
        let n: usize = sc.read();
        if n == 0 { break; };
        let mut a: Vec<usize> = Vec::new();
        for _ in 0..n {
            a.push(sc.read());
        }
        let med = a.iter().sum::<usize>() / n;
        let ans = a.iter().fold(0, |sum, x| sum + ((x <= &med) as usize));
        println!("{}", ans);
    }
}



Measured memory_bytes: 5048
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1LL<<62;
const int MAX = 1e5;

//最大公約数と最小公倍数
ll gcd(ll a, ll b) {return(b?gcd(b,a%b):a);}
ll lcm(ll a, ll b) {return(a/gcd(a,b)*b);}

int main() {
    int n; cin >> n;
    ll ans = 1;
    rep(i,n) {
        ll t; cin >> t;
        ans = lcm(ans,t);
    }
    cout << ans << endl;
}

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

#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPR(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 999999999

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    cin.tie(0); //cinとcoutの同期切り
    ios::sync_with_stdio(false); //iostreamとstdioの同期切り

    int N, Y;
    cin >> N >> Y;

    REP(i, N+1){
        REP(j, N+1 - i){
            if(10000*i + 5000*j + 1000*(N - i - j) == Y){
                cout << i << " " << j << " " << N - i - j << endl;
                return 0;
            }
        }
    }

    cout << -1 << " " << -1 << " " << -1 << endl;

    return 0;
}

/*****************************************************************************/
/*****                                                                   *****/
/*****   std::cout << std::setprecision(2) << 3.0; // "3"                *****/
/*****   std::cout << std::fixed;                                        *****/
/*****   std::cout << std::setprecision(2) << 3.0; // "3.00"             *****/
/*****                                                                   *****/
/*****************************************************************************/

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<functional>
using namespace std;
#define ll long long int
#define ld long double
using namespace __gnu_pbds;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,
tree_order_statistics_node_update> in_set;
#define rep(n) for(ll i=0;i<(n);i++)
#define jrep(n) for(ll j=0;j<(n);j++)
#define all(a) (a).begin(), (a).end()
#define dpp(a) cout<<(a).first<<" "<<(a).second<<endl;
#define append push_back
#define mod 1000000007
#define ff first
#define ss second
#define ffast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fast ios::sync_with_stdio(0);
ll pw(ll x,ll y,ll p=mod){ll r=1; x=x%p;while(y>0){ if(y&1)r=(r*x)%p;
y=y>>1;x=(x*x)%p;} return r; } vector<ll> uniq(vector<ll> arr)
{vector<ll>brr;sort(all(arr));brr.append(arr[0]);
for(auto i:arr)if(brr.back()!=i)brr.append(i);return brr;}
 
void solve(){
    ll a,b; cin>>a>>b;
    for(ll i=0;i<10005;i++){
        if((i*8)/100 == a && i/10 == b){
            cout<<i<<endl; return;
        }
    }
    cout<<"-1\n"; return;
}
 
int main(){
    ffast
    ll t=1;
    //cin>>t;
    rep(t) solve();
}
 
 
// *p.find_by_order(n) : nth value (0 indexed)
// p.order_of_key(7): index of 7 (0 indexed)


Measured memory_bytes: 256
def actual(N, D, X, A):
    count = 0

    for a_i in A:
        for i in range(100+1):
            eating_day = 1 + (a_i * i)

            if eating_day <= D:
                count += 1

    return X + count

N = int(input())
D, X = map(int, input().split())
A = [int(input()) for _ in range(N)]

print(actual(N, D, X, A))


Measured memory_bytes: 9096
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// using namespace __gnu_pbds;
// #include<boost/multiprecision/cpp_int.hpp>
// namespace multiprecisioninteger = boost::multiprecision;
// using cint=multiprecisioninteger::cpp_int;
using namespace std;
using ll=long long;
#define double long double
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
// using llset=tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>;
#define For(i,a,b) for(i=a;i<(ll)b;++i)
#define bFor(i,b,a) for(i=b,--i;i>=(ll)a;--i)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N,0)
#define brep1(i,N) bFor(i,N,1)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define eb emplace_back
#define print(v) cout<<v<<endl
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define printYES cout<<"YES"<<endl
#define printNO cout<<"NO"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
#define matoutput(v) do{for(auto outimat:v)output(outimat);}while(0)
const ll mod=1000000007;
// const ll mod=998244353;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas x,ddatas y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  if(n<r)return 0;
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n>0){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

int main(){
  // startupcpp();
  // int codeforces;cin>>codeforces;while(codeforces--){
  ll i,j,N,S,H,W,ans;
  string s;
  cin>>S>>W;
  if(W>=S)print("unsafe");
  else print("safe");
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};

int main() {
  ll a,b,c;
  cin>>a>>b>>c;
  if(a+b>=c-1){
    cout<<b+c<<endl;
    return 0;
  }else{
    ll mi=min(c,a+b+1);
    cout<<b+mi<<endl;
  }
}

Measured memory_bytes: 3636
import java.io.IOException;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws IOException{

		Scanner sc = new Scanner(System.in);

		String x = sc.nextLine();
		char[] line = x.toCharArray();

		for(int i=0;i<x.length();i++) {
			if(Character.isUpperCase(line[i])) {
				line[i] = Character.toLowerCase(line[i]);
			}else if(Character.isLowerCase(line[i])) {
				line[i] = Character.toUpperCase(line[i]);
			}
			System.out.print(line[i]);
		}
		System.out.println();
		sc.close();
	}
}


Measured memory_bytes: 27084
#include<bits/stdc++.h>
using namespace std;
#define RI register int
typedef long long LL;
LL read() {
	LL q=0;char ch=' ';
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') q=q*10LL+(LL)(ch-'0'),ch=getchar();
	return q;
}
const int mod=1e9+7,N=100005;
const LL inf=2e18;
int n,Log[N],bin[17],f[N][2],sum[N][2];
LL X[2],a[N],mi[17][N];
int qm(int x) {return x>=mod?x-mod:x;}
void prework() {
	bin[0]=1;for(RI i=1;i<=16;++i) bin[i]=bin[i-1]<<1;
	Log[0]=-1;for(RI i=1;i<=n;++i) Log[i]=Log[i>>1]+1;
	for(RI j=1;j<=16;++j)
		for(RI i=1;i+bin[j]-1<=n;++i)
			mi[j][i]=min(mi[j-1][i],mi[j-1][i+bin[j-1]]);
}
LL getmi(int l,int r) {
	if(l>r) return inf;
	int t=Log[r-l+1];
	return min(mi[t][l],mi[t][r-bin[t]+1]);
}
int findl(int x,int o) {
	int l=0,r=x-1,mid,re=0;
	while(l<=r) {
		mid=(l+r)>>1;
		if(getmi(mid+2,x)>=X[o]) re=mid,r=mid-1;
		else l=mid+1;
	}
	return re;
}
int main()
{
	n=read(),X[0]=read(),X[1]=read();
	for(RI i=1;i<=n;++i) a[i]=read(),mi[0][i]=a[i]-a[i-1];
	prework();
	f[0][0]=f[0][1]=sum[0][0]=sum[0][1]=1;
	a[n+1]=inf;
	for(RI i=1;i<=n;++i) {
		int l=findl(i,0);
		int r=upper_bound(a+1,a+i,a[i+1]-X[1])-a-1;
		if(l<=r) f[i][0]=qm(sum[r][1]-(l?sum[l-1][1]:0)+mod);
		l=findl(i,1);
		r=upper_bound(a+1,a+i,a[i+1]-X[0])-a-1;
		if(l<=r) f[i][1]=qm(sum[r][0]-(l?sum[l-1][0]:0)+mod);
		sum[i][0]=qm(sum[i-1][0]+f[i][0]);
		sum[i][1]=qm(sum[i-1][1]+f[i][1]);
	}
	printf("%d\n",qm(f[n][0]+f[n][1]));
	return 0;
}

Measured memory_bytes: 16256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    if(a%1000==0){

      System.out.println(0);
      return;
    }
    System.out.println(1000 -a%1000);
  }
  
}



Measured memory_bytes: 35884
import java.util.*;

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

    int n=sc.nextInt();
    int k=sc.nextInt();
    int q=sc.nextInt();
    int count[]=new int[n];
    for(int i=0;i<n;i++){
      count[i]=0;
    }
    int a[]=new int[q];
    for(int i=0;i<q;i++){
      a[i]=sc.nextInt();
    }

    for(int i=0;i<q;i++){
      count[a[i]-1]++;
    }

    for(int i=0;i<n;i++){
      if(q-count[i]<k){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }



	}
}


Measured memory_bytes: 64588
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define MAX_NK 100000
#define MOD 1000000007

using namespace std;
typedef pair<int, int> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }

llong N, K;
int root;
vector<int> adj_list[MAX_NK];
int visited[MAX_NK];

llong solve(int node) {
    llong mx, res = 1;
    visited[node] = 1;
    
    int j = 0;
    for(int i = 0; i < adj_list[node].size(); ++i) {
        int next = adj_list[node][i];
        if(visited[next]) continue;
        

        if(node == root)
            mx = K - 1;
        else
            mx = K - 2;

        res = modulo(res * (mx - j), MOD);
        res = modulo(res * solve(next), MOD);
        ++j;
    }

    return res;
}

int main(int argc, char **argv) {
    cin >> N >> K;
    for(int i = 0; i < N - 1; ++i) {
        int a, b;
        cin >> a >> b;
        adj_list[a - 1].push_back(b - 1);
        adj_list[b - 1].push_back(a - 1);
    }

    root = 0;
    llong res = modulo(K * solve(root), MOD);
    cout << res << endl;
    
}

Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < (int)(n) ; i++)
typedef long long ll;
typedef long double Double;
ll l[100010], r[100010];
void solve(ll K, vector<ll> A){
	reverse(A.begin(),A.end());
	if( A[0] != 2 ){
		cout << -1 << endl;
		return;
	}

	l[0] = 2, r[0] = 3;
	for(int i = 1 ; i < K ; i++){
		ll lb = ((l[i-1]+A[i]-1) / A[i]) * A[i];
		ll rb = (r[i-1] / A[i]) * A[i];
		if( lb <= rb ){
			l[i] = lb;
			r[i] = rb + A[i]-1;
		}else{
			cout << -1 << endl;
			return;
		}
	}
	cout << l[K-1] << " " << r[K-1] << endl;
}

int main(){	
	ll K;
	scanf("%lld",&K);
	vector<ll> A(K-1+1);
	for(int i = 0 ; i <= K-1 ; i++){
		scanf("%lld",&A[i]);
	}
	solve(K, A);
	return 0;
}



Measured memory_bytes: 3328
from math import factorial as fact
def comb(n, r):
  return fact(n) // (fact(n-r) * fact(r))

n,k = map(int, input().split(' '))
mod = 10**9 + 7

for i in range(1, k+1):
  if i <= n-k+1:
    ans = comb(n-k+1, i) * comb(k-1, i-1)
  else:
    ans = 0
  print(ans % mod)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define ll long long
#define MAX(A,B) (A)>(B)?(A):(B)
#define MIN(A,B) (A)<(B)?(A):(B)
#define gcd(A,B) __gcd(A,B)
#define lcm(A,B) A/(__gcd(A,B))*B
#define MP make_pair
#define PB push_back
#define EPS 1e-9
#define ld long double
#define mod 1000000007LL
#define all(x) x.begin(), x.end()
#define int long long
#define usecppio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

typedef pair<int,int> pii;

int N, M, L, Q;
int road[330][330];
int dp[330][330];

bool compare(pii &a, pii &b)
{
	if (a.first < b.first) return true;
	if (a.first > b.first) return false;
	if (a.second > b.second) return true;
	return false;
}
void try_visit(int s)
{
	pii visit[330];
	for (int i = 0; i<330; i++)
		visit[i] = {INT_MAX, INT_MAX};
	visit[s] = {0, L};
	queue <int> q;
	q.push(s);
	while(!q.empty())
	{
		int cur = q.front();
		q.pop();
		for (int i = 1; i<=N; i++)
		{
			if (road[cur][i] == -1) continue;
			if (road[cur][i] <= visit[cur].second)
			{
				pii newpair = {visit[cur].first,visit[cur].second-road[cur][i]};
				if (compare(newpair,visit[i]))
				{
					visit[i] = newpair;
					q.push(i);
				}
			}
			else
			{
				pii newpair = {visit[cur].first+1,L-road[cur][i]};
				if (compare(newpair,visit[i]))
				{
					visit[i] = newpair;
					q.push(i);
				}
			}
		}
	}
	for (int i = 1; i<=N; i++)
	{
		dp[s][i] = visit[i].first;
	}
}

int32_t main()
{
	usecppio
	memset(road,-1,sizeof(road));
	memset(dp,0x3f,sizeof(dp));
	cin >> N >> M >> L;
	for (int i = 0; i<M; i++)
	{
		int a, b, c;
		cin >> a >> b >> c;
		if (c <= L)
		{
			road[a][b] = c;
			road[b][a] = c;
		}
	}
	for (int i = 1; i<=N; i++)
	{
		try_visit(i);
	}
	cin >> Q;
	for (int i = 0; i<330; i++)
	{
		for (int j = 0; j<330; j++)
		{
			if (dp[i][j] < 0 || dp[i][j] >= N)
				dp[i][j] = -1;
		}
	}
	while(Q--)
	{
		int s, t;
		cin >> s >> t;
		cout << dp[s][t] << '\n';
	}
}

Measured memory_bytes: 2304
def main():
    N, A, B, C = [int(i) for i in input().split()]

    if A == B == C == 0:
        print("No")
        return

    S = [input() for _ in range(N)]
    d = {"A": A, "B": B, "C": C}
    order = []

    for i, s in enumerate(S):
        s1, s2 = s

        if d[s1] == d[s2] == 0:
            print("No")
            return
        elif d[s1] == 0:
            d[s1] += 1
            d[s2] -= 1
            order.append(s1)
        elif d[s2] == 0:
            d[s2] += 1
            d[s1] -= 1
            order.append(s2)
        elif d[s1] == d[s2] == 1:
            try:
                if s1 in S[i + 1]:
                    d[s1] += 1
                    d[s2] -= 1
                    order.append(s1)
                else:
                    d[s2] += 1
                    d[s1] -= 1
                    order.append(s2)
            except:
                order.append(s1)
        else:
            if d[s1] > d[s2]:
                d[s1] -= 1
                d[s2] += 1
                order.append(s2)
            else:
                d[s2] -= 1
                d[s1] += 1
                order.append(s1)
    
    print("Yes")
    for o in order:
        print(o)


main()


Measured memory_bytes: 16984
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_sz_desc(const void* a, const void* b) {
    return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}

int compare_f(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_f2(const void* a, const void* b) {
    return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
    size_t result = 1;

    for (size_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
    uint64_t result = 1;

    for (uint64_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t gcdU64(uint64_t m, uint64_t n)
{
    uint64_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static size_t gcdZu(size_t m, size_t n) {
    size_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

#define MOD_VAL (UINT64_C(1000000007))

static uint64_t dp[2000][2000];
static uint64_t sum[2000][2000];

int main(void) {
    size_t N, M;
    uint64_t S[2000], T[2000];

    scanf("%zu %zu\n", &N, &M);
    for (size_t i = 0; i < N; i++) {
        scanf("%"PRIu64, &(S[i]));
        scanf(i < N - 1 ? " " : "\n");
    }
    for (size_t i = 0; i < M; i++) {
        scanf("%"PRIu64, &(T[i]));
        if (i < M - 1) {
            scanf(" ");
        }
    }

    for (size_t sI = 0; sI < N; sI++) {
        for (size_t tI = 0; tI < M; tI++) {
            if (S[sI] == T[tI]) {
                if (0 < sI && 0 < tI) {
                    dp[sI][tI] = (sum[sI - 1][tI - 1] + 1) % MOD_VAL;
                }
                else {
                    dp[sI][tI] = 1;
                }
            }
            else {
                dp[sI][tI] = 0;
            }

            sum[sI][tI] = 0;

            if (0 < sI) {
                sum[sI][tI] += sum[sI - 1][tI];
            }
            if (0 < tI) {
                sum[sI][tI] += sum[sI][tI - 1];
            }
            if (0 < sI && 0 < tI) {
                sum[sI][tI] += MOD_VAL;
                sum[sI][tI] -= sum[sI - 1][tI - 1];
            }

            sum[sI][tI] += dp[sI][tI];
            sum[sI][tI] %= MOD_VAL;
        }
    }

    printf("%"PRIu64, (sum[N - 1][M - 1] + 1) % MOD_VAL);

    return 0;
}


Measured memory_bytes: 62720
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const double pi = acos(-1);

class UnionFind {
public:
    vl parent;  // 親ノード
    vl Siz;  // 集合の大きさ
    
    // コンストラクタ
    UnionFind(ll n): parent(n), Siz(n, 1) {
        rep(i, n) {
            parent[i] = i;
        }
    }

    // n要素で初期化
    void init(ll n) {
        parent.resize(n);
        Siz.assign(n, 1);
        rep(i, n) {
            parent[i] = i;
        }
    }

    // xの属する集合の根を求める
    ll root(ll x) {
        if(parent[x] == x) {
            return x;
        }
        else {
            return parent[x] = root(parent[x]);
        }
    }

    // xとyの属する集合を併合
    void unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if(x == y) {
            return;
        }
        if(Siz[x] < Siz[y]) {
            swap(x, y);
        }
        Siz[x] += Siz[y];
        parent[y] = x;
    }
    
    // xとyが同じ集合に属するかどうか
    bool same(ll x, ll y) {
        return root(x) == root(y);
    }

    // xの属する集合の要素数を求める
    ll size(ll x) {
        return Siz[root(x)];
    }
};

int main() {
    ll n, m;
    cin >> n >> m;

    UnionFind Uni(n);
    Uni.init(n);
    rep(i, m) {
        ll a, b;
        cin >> a >> b;
        a--;  b--;
        Uni.unite(a, b);
    }
    
    ll x = min(Uni.size(0), Uni.size(1));
    
    out(x*(x-1)/2 + (n-x)*(n-x-1)/2 - m);
    re0;
}

Measured memory_bytes: 1792
# include <bits/stdc++.h>
using namespace std;
long long nxt[27][1000005], cnt1[1000005][27],created[1000005],sz,cnt[1000005][27],ans,n;
long long ans1;
string s1[200005];
pair <int, string> s[200005];
void insert(string &s)
{
    int v=0;
    for(int i=0;i<s.size();i++)
    {
        int c=s[i]-'a';
        if(!created[nxt[c][v]])
        {
            nxt[c][v]=++sz;
            created[sz]=1;
        } 
   //     cout<<v<<" "<<s<<endl;
	   for (int j=0; j<26; j++)
        {
            cnt1[v][j]+=cnt[i][j];
        }
        v=nxt[c][v];
        //cout<<v<<endl;
      //  cout<<v<<endl;
       
       // cout<<cnt1[1][0]<<endl;
    }
}
int search(string &tmp)
{
//cout<<tmp<<endl;
    long long ans=0;
    int v=0;
    for(int i=0;i<tmp.size()-1;i++)
    {
        int ty=tmp[i]-'a';
        if(created[nxt[ty][v]])
        {
            v=nxt[ty][v];
        }
        else
        {
            ans=-1;
            return 0;
        }
    }
    
   // cout<<v<<" "<<cnt1[v][tmp[tmp.size()-1]-'a']<<endl;
   // cout<<cnt1[2][2]<<" "<<v<<"  "<<tmp[tmp.size()-1]-'a'<<endl;
    return cnt1[v][tmp[tmp.size()-1]-'a'];
}
int main()
{
    cin>>n;
    for (int i=1; i<=n; i++)
    {
        cin>>s[i].second;
        s[i].first=s[i].second.size();
    }
    sort(s+1, s+n+1);
    for (int i=1; i<=n; i++)
    {
        s1[i]=s[i].second;
        reverse(s1[i].begin(), s1[i].end());
    }
    reverse(s1+1, s1+n+1);
    for (int i=s1[1].size()-1; i>=0; i--)
    {
        for (int j=0; j<26; j++)
        {
            if (s1[1][i]-'a'==j && !cnt[i+1][j])
            cnt[i][j]=1;
            else cnt[i][j]=cnt[i+1][j];
        }
    }
    insert(s1[1]);
    for (int i=0; i<s1[1].size(); i++)
    {
        for (int j=0; j<26; j++)
        {
            cnt[i][j]=0;
        }
    }
    for (int i=2; i<=n; i++)
    {
        ans1+=search(s1[i]);
        //cout<<i<<" "<<ans1<<endl;
        for (int j=s1[i].size()-1; j>=0; j--)
        {
            for (int j1=0; j1<26; j1++)
            {
                if (s1[i][j]-'a'==j1 && !cnt[j+1][j1])
                cnt[j][j1]=1;
                else cnt[j][j1]=cnt[j+1][j1];
            }
        }
        insert(s1[i]);
        for (int j=0; j<s1[i].size(); j++)
        {
        for (int j1=0; j1<26; j1++)
        {
            cnt[j][j1]=0;
        }
        }
    }
    cout<<ans1<<endl;
}

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

typedef pair<int,int> P;

int dxy[4] = {-1, 1, 0, 0};
int W, H;
char a[60][60];
int temp[4][60][60];

void huga(int y, int x, int Z){//cout<<y<<" "<<x<<endl;
	int w = 0, b = 0, s = 0, ans=-3, t;
	queue <P> Q;
	
	Q.push(P(y,x));
	
	while(!Q.empty()){
		P p = Q.front();Q.pop();
		int yy = p.first, xx = p.second;//cout<<yy<<" "<<xx<<endl;
		for(int i = 0; i <= 3; i++){
			int nx = xx+dxy[i], ny = yy+dxy[3-i];//cout<<" "<<ny<<" "<<nx<<endl;
			if(a[ny][nx] == '.' && !temp[Z+2][ny][nx]) {
				temp[Z+2][ny][nx] = temp[Z][ny][nx] = 1;
				Q.push(P(ny,nx));
				//cout<<temp[2][ny][nx]<<" "<<temp[Z][ny][nx]<<" AA"<<endl;
			}
			//int fds; cin>>fds;
		}
	}
}

int main(){
	
	while(1){
		int cw=0, cb=0;
		cin>>W>>H;
		
		if(!W&&!H)break;
		
		for(int i = 0; i <= H+1; i++)
			for(int j = 0; j <= W+1; j++)
				temp[0][i][j] = temp[1][i][j] = temp[2][i][j] = temp[3][i][j] = 0;
				
		for(int i = 0; i < 60; i++){
			a[0][i] = a[H+1][i] = 0;
			a[i][0] = a[i][W+1] = 0;
		}
			
		for(int i = 1; i <= H; i++)
			for(int j = 1; j <= W; j++)
				cin>>a[i][j];
		
		for(int i = 1; i <= H; i++){
			for(int j = 1; j <= W; j++){
				//if(temp[2][i][j])continue;
				if(a[i][j] == 'B') huga(i,j,0);
				else if(a[i][j] == 'W') huga(i,j,1);
			}
		}
		
		for(int i = 1; i <= H; i++){
			for(int j = 1; j <= W; j++){
				if(a[i][j] == '.'){
					if(temp[0][i][j] && !temp[1][i][j])cb++;
					else if(!temp[0][i][j] && temp[1][i][j])cw++;
				}
			}
		}
		
		cout<<cb<<" "<<cw<<endl;
	}
	
	
	
	return 0;
}


Measured memory_bytes: 3148
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

int W[2000][2000], H[2000][2000];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    deque<int> V(n), v;
    FOR(i, 0, n)cin >> V[i];

    ll ans = 0;
    eFOR(i, 0, k) {
        eFOR(j, 0, k - i) {
            int e = k - i - j;
            v = V;
            deque<int> c;
            FOR(l, 0, i) {
                if (v.empty())break;
                c.push_back(v.front()), v.pop_front();
            }
            FOR(l, 0, j) {
                if (v.empty())break;
                c.push_back(v.back()), v.pop_back();
            }
            SORT(c);
            FOR(l, 0, e) {
                if (c.empty() || c.front() > 0)break;
                c.pop_front();
            }
            ll cnt = 0;
            for (int a : c)cnt += a;
            chmax(ans, cnt);
        }
    }
    cout << ans << "\n";
}

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k; cin >> n >> k;
    int cnt = 0;
    while (n) {
        cnt++; n /= k;
    }
    cout << cnt << "\n";
    return 0;
}

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

using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define mp make_pair
#define vi vector<int>
#define vip vector<pair<int,int> >
#define ff first
#define ss second
#define int long long
#define SIZE 200010
#define mod 1000000007
#define BIG 998244353
#define s(t) scanf("%d",&t)
#define p(t) printf("%d\n",t)
#define mii map<int,int>
#define MSET(table,i) memset(table, i, sizeof(table))
#define endl '\n'
#define tc int t;cin>>t;while(t--)
#define pi  3.1415926358
#define print(x) for(auto el: x) cout<<el<<" ";cout<<endl
#define bits(x) __builtin_popcount(x)
#define minimum(a,n) min_element(a,a+n)-a
#define maximum(a,n) max_element(a,a+n)-a
#define pqbig priority_queue<int>
#define pqsmall priority_queue<int,vector<int>,greater<int> >
#define all(v) v.begin(),v.end()
#define sitr set<int>:: iterator
#define mitr map<int,int>:: iterator

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl


int32_t main()
{
    fast;
    int n;cin>>n;
    cout<<n*n*n;
}

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

int main()
{
	int n;
	cin >> n;
	auto m = map<int, int>();
	for(auto i = 0; i < n; ++i){
		int a;
		cin >> a;
		++m[a];
	}
	int ans = 0;
	for(auto p : m){
		int v = p.first;
		int c = p.second;
		ans += (c < v ? c : c - v);
	}
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;
const int MAX_N = 100000;

template<typename T>
T GCD(T a, T b) {
  if(a > b) std::swap(a, b);
  if(a == 0) return b;
  else return GCD(b % a, a);
}

int main() {
  int N;
  ll A[MAX_N + 2] = {};

  std::cin >> N;
  for(int i = 0; i < N; ++i) {
    std::cin >> A[i + 1];
  }

  static ll L[MAX_N + 2] = {}, R[MAX_N + 2] = {};
  for(int i = 1; i <= N; ++i) {
    L[i] = GCD(L[i - 1], A[i]);
    R[N + 1 - i] = GCD(R[N + 2 - i], A[N + 1 - i]);
  }

  ll ans = 0;
  for(int i = 1; i <= N; ++i) {
    ans = std::max(ans, GCD(L[i - 1], R[i + 1]));
  }
  std::cout << ans << std::endl;
}

Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_map>
#define mod 1000000007
using namespace std;
typedef long long ll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define mad(a,b) a=(a+b)%mod
#define mul(a,b) a=a*b%mod

ll h,w;
string s[510];
int main(){
    cin>>h>>w;
    for(int i=0;i<h;i++)cin>>s[i];
    for(int i=0;i<h;i++){
	for(int j=0;j<w;j++){
	    if(i==0||(i!=h-1&&j%2==0)||s[i][j]=='#')cout<<"#";
	    else cout<<".";
	}
	cout<<endl;
    }
    cout<<endl;
    for(int i=0;i<h;i++){
	for(int j=0;j<w;j++){
	    if(i==h-1||(i!=0&&j%2==1)||s[i][j]=='#')cout<<"#";
	    else cout<<".";
	}
	cout<<endl;
    }
}




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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String[]pooeater = s.split("/");
		int[]n = new int[3];
		n[0] = Integer.parseInt(pooeater[0]);
		n[1] = Integer.parseInt(pooeater[1]);
		n[2] = Integer.parseInt(pooeater[2]);
		if(n[0]>2019) {
			System.out.println("TBD");
		}else if(n[1]>04) {
			System.out.println("TBD");
		}else {
			System.out.println("Heisei");
		}
	}

}


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

  int n, m, q;
  vector<int> a, b, c, d;
  int ans;
  void dfs(vector<int> A) {
    if(A.size()==n+1) {
      int now = 0;
      rep(i,q) {
        if(A[b[i]]-A[a[i]]==c[i]) now += d[i];
      }
      ans = max(ans,now);
      return;
    }

    A.push_back(A.back());
    while(A.back()<=m) {
      dfs(A);
      A.back()++;
    }
  }

int main() {
  cin >> n >> m >> q;
  a=b=c=d=vector<int> (q);
  rep(i,q) cin >> a[i] >> b[i] >>c[i] >>d[i];
  dfs(vector<int>(1,1));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3572
#include <stdio.h>

char d[ 8 ][ 16 ];

void dfs (
  int x,
  int y
  )
{
  int i;

  if ( x < 0 || y < 0 || x >= 8 || y >= 8 ) return ;

  if ( d[ y ][ x ] == '1' )
  {
    d[ y ][ x ] = '0';
    for ( i = -3; i <= 3; ++i )
    {
      if ( i == 0 ) continue ;
      dfs ( x + i, y );
      dfs ( x, y + i );
    }
  }
}

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int i, j;
  int n;

  scanf ( "%d", &n );

  for ( j = 1; j <= n; ++j )
  {
    int x, y;

    for ( i = 0; i < 8; ++i )
    {
      scanf ( " %s", d[ i ] );
    }
    scanf ( " %d %d", &x, &y );

    dfs ( x - 1, y - 1 );

    printf ( "Data %d:\n", j );
    for ( i = 0; i < 8; ++i )
    {
      puts ( d[ i ] );
    }
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include <bits/stdc++.h> 
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define REP(i,s,t) for(long long i=s;i<t;i++)
#define all(x) x.begin(),x.end()
#define sp(n) setprecision(n)
typedef long long ll;
using namespace std;
int main(){
  string s;
  cin>>s;
  s[3]='8';
  cout<<s<<endl;
}

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

int main()
{
	int N, A, B;
	int min, max;

	std::cin >> N;
	std::cin >> A;
	std::cin >> B;

	max = std::min(A, B);

	int non_read = N - A;
	if (non_read > B)
	{
		min = 0;
	}
	else
	{
		min = B - non_read;
	}

	std::cout << max << " " << min << std::endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <bitset>

using namespace std;

int n, p[5100], x[5100], dp[5100];
vector<int> graph[5100];
int ldp[15000];
int lodp[15000];

void dfs(int v)
{
    for (int i = 0; i < graph[v].size(); i++) dfs(graph[v][i]);
    for (int i = 0; i <= 5001; i++) ldp[i] = 5001;
    int smin = 0, s = 0;
    for (int i = 0; i < graph[v].size(); i++)
    {
        int u = graph[v][i];
        smin += min(dp[u], x[u]);
        s += abs(dp[u] - x[u]);
    }
    if (smin > x[v])
    {
        cout << "IMPOSSIBLE\n";
        exit(0);
    }
    bitset<5001> kek;
    kek[0] = 1;
    for (int i = 0; i < graph[v].size(); i++)
    {
        int u = graph[v][i];
        kek = kek | (kek << (int)abs(dp[u] - x[u]));
    }
    dp[v] = 5001;
    for (int i = 0; i <= x[v] - smin; i++)
    {
        if (kek[i]) dp[v] = min(dp[v], smin + s - i);
    }
}

int main()
{
    cin >> n;
    for (int i = 2; i <= n; i++)
    {
        cin >> p[i];
        graph[p[i]].push_back(i);
    }
    for (int i = 1; i <= n; i++) cin >> x[i];
    dfs(1);
    cout << "POSSIBLE";
}


Measured memory_bytes: 1536
import java.util.Scanner;
public class Main{
    
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        
        int a = scan.nextInt();
        int b = scan.nextInt();
        
        int result = a * b;
        int result_2 = 2 * (a + b);
        
        System.out.println(result + " " + result_2);
    }
}


Measured memory_bytes: 26040
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int taihi;
		if(c<b) {
			taihi =c;
			c=b;
			b=taihi;
		}
		if(b<a) {
			taihi =b;
			b=a;
			a=taihi;
		}
		if(c<b) {
			taihi =c;
			c=b;
			b=taihi;
		}
		System.out.println((a)+" "+(b)+" "+(c));
	}
}

Measured memory_bytes: 26244
#include<iostream>
using namespace std;
int main(){
int d[100],n,x=0;
   cin>>n;
 for(int a=0;n>a;a++){
 cin>>d[a];
 }
  for(int i=0;n-1>i;i++){
    for(int b=0;n-1>b;b++){
    
    if(b+i==n-1)break;
  x=x+d[i]*d[b+i+1];
      
    }
  }
  cout<<x<<endl;
}

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

int main() {
    int n,z=0;
   cin>>n;
   int a[n];
   vector<int> vec;
   map<int,int> m;
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
       m.insert({a[i],i});
   }
   sort(a,a+n);
   for(int i=0;i<n;i++)
   {
      // m1.insert({a[i],(i-m[a[i]])});
      if(i-m[a[i]]==0)
      {
          z++;
      }
      else
      {
          vec.push_back(i-m[a[i]]);
      }
   }
   if(z==n){
   cout<<"YES";
   return 0;
   }
   if(z==n-2&&vec.size()==2)
   {
       cout<<"YES";
       return 0;
   }
   else
   cout<< "NO";

       return 0;
   }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
struct Point{
  double x,y,z;
  Point(){}
  Point(double x,double y,double z):x(x),y(y),z(z){}
  Point operator+(Point a){return Point(x+a.x,y+a.y,z+a.z);}
  Point operator-(Point a){return Point(x-a.x,y-a.y,z-a.z);}
  Point operator*(double k){return Point(x*k,y*k,z*k);}
  Point operator/(double k){return Point(x/k,y/k,z/k);}
   
};
double norm(Point a){
  return a.x*a.x+a.y*a.y+a.z*a.z;
}
double abs(Point a){
  return sqrt(norm(a));
}
typedef Point Vector;
 
struct st{
  int p,q;
  double t;
  st(){}
  st(int p,int q,double t):p(p),q(q),t(t){}
  bool operator<(const st&a)const{
    return t>a.t;
  }
};
 
 
signed main(){
  int n;
  while(cin>>n,n){
    Point ps[n];
    Vector vs[n];
    double r[n],v[n];
    for(int i=0;i<n;i++){
      cin>>ps[i].x>>ps[i].y>>ps[i].z;
      cin>>vs[i].x>>vs[i].y>>vs[i].z;
      cin>>r[i]>>v[i];
    }
    priority_queue<st> q;
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
	double L=0,R=100;
	bool I=0;
	for(int k=0;k<200;k++){
	  double M1=L+(R-L)/3,M2=L+(R-L)*2/3;
	  if((r[i]-v[i]*M2)<=0||(r[j]-v[j]*M2)<=0){
	    R=M2;
	    continue;
	  }
	  Point a1=ps[i]+vs[i]*M1,b1=ps[j]+vs[j]*M1;
	  Point a2=ps[i]+vs[i]*M2,b2=ps[j]+vs[j]*M2;
	  double d1=abs(a1-b1)-((r[i]-v[i]*M1)+(r[j]-v[j]*M1));
	  double d2=abs(a2-b2)-((r[i]-v[i]*M2)+(r[j]-v[j]*M2));
	  if(d1<=0) I=1;
	  if(d1<d2) R=M2;
	  else L=M1;
	}
	if(!I) continue;
	R=L;L=0;
	for(int k=0;k<200;k++){
	  double M=(L+R)/2;
	  Point a1=ps[i]+vs[i]*M,b1=ps[j]+vs[j]*M;
	  double d1=abs(a1-b1)-((r[i]-v[i]*M)+(r[j]-v[j]*M));
	  if(d1<=0) R=M;
	  else L=M;
	}
	q.push(st(i,j,R));
      }
    }
    vector<double> ans(n,-1);
    while(!q.empty()){
      st p=q.top();q.pop();
      if(ans[p.p] >=0 || ans[p.q] >= 0) continue;
      ans[p.p]=ans[p.q]=p.t;
    }
    for(int i=0;i<n;i++){
      if(ans[i]<0) ans[i]=r[i]/v[i];
      printf("%.12f\n",ans[i]);
    }
  }
  return 0;
}

Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N,M;
  cin >> N >> M;
  cout << ((1900*M)+100*(N-M))*(pow(2,M)) << endl;
  return 0;
    

}


Measured memory_bytes: 256
#include<stdio.h>
const char *rank(double w)
{
	if (w <= 48) return "light fly";
	if (w <= 51) return "fly";
	if (w <= 54) return "bantam";
	if (w <= 57) return "feather";
	if (w <= 60) return "light";
	if (w <= 64) return "light welter";
	if (w <= 69) return "welter";
	if (w <= 75) return "light middle";
	if (w <= 81) return "middle";
	if (w <= 91) return "light heavy";
	return "heavy";
}
int main()
{
	double w;
	while (scanf("%lf", &w)>0) {
		puts(rank(w));
	}
	return 0;
}

Measured memory_bytes: 0