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

using namespace std;
#define ll long long

#define rep(i, a) for (int (i) = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int (i) = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int (i) = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int (i) = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__ "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x


int N, M;

struct pre {
	vector<pair<int, int> > v;
	// Y C
};

vector<pre> p;
vector<pair<int, pair<int, int> > > c;
// C P J

signed main()
{
	cin >> N >> M;
	p.resize(N);
	rep(i, M) {
		int a, b;
		cin >> a >> b;
		p[a-1].v.PB(MP(b, i));
	}
	rep(i, N) {
		sort(all(p[i].v));
		for (int j = 0; j < (int) p[i].v.size(); j++) {
			c.PB(MP(p[i].v[j].second, MP(i, j)));
		}
	}
	sort(all(c));
	for (auto x : c) {
		auto y = x.second;
		cout << setfill('0') << setw(6) << y.first + 1;
		cout << setfill('0') << setw(6) << y.second + 1 << endl;
	}
}


Measured memory_bytes: 8308
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
 
int main(void)
{
	long a=0;
	long b=0;
	long c=0;
	long res = numeric_limits<long>::max();
	cin >> a >> b >> c;
	bool has_one_even = a%2 == 0 || b % 2 == 0 || c % 2 == 0;
	if(has_one_even)
	{
		res = 0;
	}else
	{
		res =  min ( min(a * b, a * c ), b * c);
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;


int main()
{
    int n,m;
    cin>>n >> m;
    vector<vector<int>> g(n+1);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    rep(i,g[1].size()){
        int dex=g[1][i];
        rep(k,g[dex].size()){
            if(g[dex][k]==n){
                cout<<"POSSIBLE"<<endl;
                return 0;
            }
        }
    }
    cout<<"IMPOSSIBLE"<<endl;
    return 0;
}


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

#define ll long long

#define mod 1000009

vector<long long> prime;
vector<long long> num(mod,1);

void sive(){
	long long n = (long long)sqrt(mod);

	for(long long i=2;i<=n;i++){
		if(num[i]==1){
			for(long long j=i*i;j<mod;j+=i){
				num[j]=0;
			}
		}
	}

	for(long long i=2;i<mod;i++){
		if(num[i]==1){
			prime.push_back(i);
		}
	}
}

long long findAns(ll n){

	long long ind=0,pf=prime[ind];
	long long ans = 0;
	while(pf*pf<=n){
		if(n%pf==0)
			ans++;

		while(n%pf==0)
			n=n/pf;

		ind++;
		pf=prime[ind];
	}	

	if(n!=1)
		ans++;

	return ans;




}


int main(){

	ll a,b;
	sive();

	// for(long long i=0;i<100;i++){
	// 	cout << i << " " << prime[i] << "\n";
	// }

	cin >> a >> b;
	a = __gcd(a,b);

	cout  << findAns(a)+1 << "\n";






}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int N;
  cin >> N;
  vector<P> xy(N);
  REP(i, N) {
    ll x, y;
    cin >> x >> y;
    xy[i].first = x;
    xy[i].second = y;
  }
  if (N == 1) {
    cout << 1 << endl;
    return 0;
  }
  int res = N;
  REP(i, N) REP(j, N) {
    if (i == j) continue;
    ll p = xy[j].first - xy[i].first;
    ll q = xy[j].second - xy[i].second;
    int sub = 0;
    REP(k, N) REP(l, N) {
      if (k == l) continue;
      if (p == xy[l].first - xy[k].first && q == xy[l].second - xy[k].second)
        sub++;
    }
    res = min(res, N - sub);
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
t;i;K;char s[100001];main(){gets(s);scanf("%d",&K);
	for(;i<strlen(s)&&K;++i){
		if(s[i]>'a'&&('z'+1-s[i])<=K){
			K-='z'+1-s[i];
			s[i]='a';
		}
	}
	if(K){
		t=s[strlen(s)-1];
		s[strlen(s)-1]='a'+(t-'a'+K)%26;
	}
	K=!puts(s);
}

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



int main() {
    while(true){
        int h,w;
        cin>>h>>w;
        if(h==0) break;
        for(int i=0; i<h; i++){
            for(int j=0;j<w; j++){
              if(i==0||i==h-1) cout<<'#';
              else{
                if(j==0||j==w-1) cout<<"#";
                else cout<<".";
              }
            }
            cout<<endl;
            
        }
        cout<<endl;
    }
    



  
}


Measured memory_bytes: 3080
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <array>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;

typedef  pair<int,int> P;
typedef long long LL;

const LL  INF=1<<31;



int main(){
     int n;
     cin>>n;
     int h[100001];
     for(int i=0;i<n;++i){
          cin>>h[i];
     }
     int dp[100001];
     dp[0]=0;
     dp[1]=abs(h[1]-h[0]);
     for(int i=0;i<n;++i){
          dp[i+2]=min(dp[i+1]+abs(h[i+1]-h[i+2]),dp[i]+abs(h[i]-h[i+2]));
     }     

     cout<<dp[n-1]<<endl;


}

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

typedef long long ll;
 
using tpl = tuple<int, int, int>;
typedef pair<int,int> pii;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}


int N;
int A[200010];
int mlpos[21][200010];

int main(){

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

    for(int i = 0; i < N; i++){
        for(int j = 0; j < 20; j++){
            if((A[i] >> j) & 1){
                mlpos[j][i]++;
            }
        }
    }
    for(int j = 0; j < 20; j++){
        for(int i = 0; i < N; i++){
            mlpos[j][i+1] += mlpos[j][i];
            // cout << j << " " << i <<" " << mlpos[j][i] << endl;
        }
    }
    
    ll ans = 0;
    for(int i = 0; i < N; i++){
        int l = 0;
        for(int j = 0; j < 20; j++){
            int ub = i;
            int lb = -1;
            while(ub - lb > 1){
                int mid = (ub + lb) / 2;
                int t = 0;
                if(mid - 1 >= 0)
                    t = mlpos[j][i] - mlpos[j][mid-1];
                else{
                    t = mlpos[j][i];
                }
                if(t <= 1){
                    ub = mid;
                }
                else{
                    lb = mid;
                }
            }
            // cout << i << " " << j << " " << ub << endl;
            l = max(l, ub);
        }
        // cout << l << " " << i << endl;
        ans += i - l + 1;
    }

    // cout <<mlpos[0][2]<<endl;
    // cout <<mlpos[0][0]<<endl;
    
    cout << ans << endl;


}


Measured memory_bytes: 17408
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: usize,
      aa: [usize; n],
    }
    let mut acm = vec![0; n+1];
    for i in 0..n {
        acm[i+1] = acm[i] ^ aa[i];
    }

    const SZ: usize = 1 << 20;
    let mut dp0 = vec![1; SZ];
    let mut dp1 = vec![0; SZ];
    let mut cnt = vec![0; SZ];

    const MOD: usize = 1e9 as usize + 7;

    let mut z = 0;
    for i in 1..n+1 {
        let a = acm[i];
        if a == 0 {
            z += 1;
        } else {
            let p0 = dp0[a];
            let p1 = dp1[a];
            dp0[a] = (p0 + (p1 * ((z - cnt[a]) % MOD))) % MOD;
            dp1[a] = (dp0[a] + p1) % MOD;
            cnt[a] = z;
        }
    }

    if acm[n] == 0 {
        let mut ans = 1;
        for _ in 0..z-1  {
            ans *= 2;
            ans %= MOD;
        }
        for i in 0..dp1.len() {
            ans += dp1[i];
            ans %= MOD;
        }
        println!("{}", ans);
    } else {
        println!("{}", dp0[acm[n]]);
    }
}


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

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

//動的計画法で役に立つ関数
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; }

//最大公約数と最小公倍数
ll gcd(ll a, ll b) {
    if(b==0)return a;
    return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a/g*b;
}

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int H, W; cin >> H >> W;
    VS C(H);
    
    REP(i,H)
    {
        cin >> C.at(i);
    }

    REP(i,H)
    {
        cout << C.at(i) << endl;
        cout << C.at(i) << endl;
    }

    return 0;
}



Measured memory_bytes: 256
//author:satwik_bhv1
#include<bits/stdc++.h>
//datatypes
#define ll long long 
#define ld long double
//loops
#define fr(i,z,n) for(ll i=z;i<n;i++)
#define br(i,z,n) for(ll i=z;i>n;i--)
//operations
#define mp  make_pair
#define ff  first
#define ss  second
#define pub push_back
#define all(v) v.begin(),v.end()
//map
#define mi map<ll,ll>
//vectors
#define vi vector<ll>
#define vpi vector<pair<ll,ll> >
//constants
#define pi 3.1415926535897932384626
#define mod 1000000007 
#define MAXN 100001
/*notes
    Don't use inbuilt fun for power
    Range of longlong=(-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 )
    INT_MAX = 2147483647(aprox 2*10^10)
    INT_MIN = -2147483648
    LLONG_MAX = 9223372036854775807 
    LLONG_MIN = -9223372036854775808
    __gcd is the function in built for hcf
    priority queue is max heap by default
    topological sort -> khan's algo use bfs and indegree of node  
    sssp(positive weighted edges) -> Dijkstras
    apsp -> Floydwarshall
    MST -> kruskal(DSU)
*/
using namespace std;
//functions
ll power(ll x,ll y){ll res=1;while(y){if(y%2){res*=x;}y/=2;x*=x;} return res;}
ll power(ll x,ll y,ll z){ll res=1;while(y){if(y%2){res=(res*x)%z;}y/=2;x=(x*x)%z;} return res;}
void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }
bool sortbysec(const pair<ll, ll>& a, const pair<ll, ll>& b) { return (a.second > b.second); }
ll ceil(ll x,ll y){return (x/y)+(x%y!=0);}
ll n,w;
ll v[101][2];
ll dp[101][100001];
ll fun(ll pos,ll limit)
{
    if(pos==n)
    {
        return 0;
    }
    ll ans=0;
    if(dp[pos+1][limit]==-1)
    {
        ans=max(ans,fun(pos+1,limit));
    }
    else
    {
        ans=max(ans,dp[pos+1][limit]);
    }
    if(limit>=v[pos][0])
    {
        if(dp[pos+1][limit-v[pos][0]]==-1)
        {
            ans=max(ans,fun(pos+1,limit-v[pos][0])+v[pos][1]);
        }
        else
        {
            ans=max(ans,dp[pos+1][limit-v[pos][0]]+v[pos][1]);
        }
    }
    return dp[pos][limit]=ans;
}
void solve()
{
    cin>>n>>w;
    fr(i,0,n)
    {
        fr(j,0,2)
        {
            cin>>v[i][j];
        }
    }
    fr(i,0,n)
    {
        fr(j,0,w+1)
        {
            dp[i][j]=-1;
        }
    }
    cout<<fun(0,w);
}
int main()
{
    fast();
    ll t;
    t=1;
    //cin>>t;
    fr(i,0,t)
    {
        solve();
    }
}
/*





























*/

Measured memory_bytes: 81648
import decimal

A = input().split()
a = decimal.Decimal(A[0])
b = decimal.Decimal(A[1])

an = a*b

#print(a)
#print(b)

#print(a*b)

ans = "" 
for i in str(an):
    if i == ".":
        break
    ans += i

print(ans)

Measured memory_bytes: 9936
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 998244353
using namespace std;
typedef pair<llint, llint> P;

llint n;
llint a[1<<18];
P p[1<<18];
llint cum[1<<18];

P merge(P &p, P &q)
{
	vector<llint> vec;
	vec.push_back(p.first);
	vec.push_back(p.second);
	vec.push_back(q.first);
	vec.push_back(q.second);
	sort(vec.rbegin(), vec.rend());
	return P(vec[0], vec[1]);
}

P zeta_transform(P a[], int n)
{
	int S = 1<<n;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < S; j++){
			if((j&(1<<i))) a[j] = merge(a[j], a[j^(1<<i)]);
		}
	}
}

int main(void)
{
	cin >> n;
	llint N = 1<<n;
	for(int i = 0; i < N; i++) cin >> a[i];
	for(int i = 0; i < N; i++) p[i] = P(a[i], -inf);
	
	zeta_transform(p, n);
	
	for(int i = 1; i < N; i++){
		cum[i] = max(cum[i-1], p[i].first + p[i].second);
		cout << cum[i] << endl;
	}
	
	return 0;
}


Measured memory_bytes: 11264
class Problem
  attr_accessor :a, :b, :n, :m, :h, :w

  def initialize
    @n = gets.to_s.to_i
    @a = gets.to_s.split.map{ |v| v.to_i }
  end

  def solve
    cnt = a.map{_1 / 400}.tally
    mini = 0
    gold = 0
    cnt.each do |k,v|
      if k >= 8 
        gold += v
      else
        mini += 1
      end
    end
    if mini == 0
      [1, gold]
    else
      [mini, mini + gold]
    end
  end
  
  def rates(a)
  end

  def show(ans)
    puts ans.join(" ")
  end
end

Problem.new.instance_eval do
  show(solve)
end


Measured memory_bytes: 14212
from collections import defaultdict

import sys
sys.setrecursionlimit(10**6)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    x=ii()
    ttl=100
    cnt=0
    while ttl<x:
        ttl+=ttl//100
        cnt+=1
    print(cnt)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9412
r,c=map(int,input().split())
sheet=[list(map(int,input().split()))for i in range(r)]

#for i in range(r):
#    a[i] = list(map(int, input().split()))

for i in range(r):
    sum=0
    for j in range(c):
        sum=sum+sheet[i][j]   
    sheet[i].append(sum)

sum_list=[]
for i in range(c+1):
    sum=0
    for j in range(r):
        sum=sum+sheet[j][i]
    sum_list.append(sum)

sheet.append(sum_list)

for i in range(r+1):
    for j in range(c+1):
        if j != c:
            print(sheet[i][j],end=' ')
        else:
            print(sheet[i][j],end="")
    print()


Measured memory_bytes: 6232
#include "bits/stdc++.h"
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair <ll, ll > pll;

bool comp(const pll &a, const pll &b) {
	return a.first < b.first;
}
std::vector<int> enum_div(int n)//nの約数を列挙
{
	std::vector<int> ret;
	for (int i = 1; i*i <= n; ++i)
	{
		if (n%i == 0)
		{
			ret.push_back(i);
			if (i != 1 && i*i != n)
			{
				ret.push_back(n / i);
			}
		}
	}
	return ret;
}


template<int N>
int factorial() {
	return factorial<N - 1>() * N;
}

template<>  /// 特殊化：factorial<N=”1”>だったら，値を返す
int factorial<1>() {
	return 1;
}
int main()
{
	priority_queue<int> q;
	string s = {};
	string s1 = {};
	ll h = 0, w = 0, k = 0, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, ans = 0;
	ll x[300005] = {};
	ll y[300005] = {};
	ll z[300005] = {};
	cin >> a;
	cin >> b;
	for (int i = 0; i < b; i++)
	{
		cin >> x[i];
		cin >> y[i];
	}
	for (int i = 1; i <= 10000; i++)
	{
		z[i] = 9999999999;
	}
	for (ll i = 0; i < b; i++)
	{

			//for (ll k = 0; k <= a-x[i]; k++)
		for (ll k = 0; k <= 10000; k++)
		{
			z[k + x[i]] = min(z[k] + y[i], z[k + x[i]]);
		}
	}
	//for (int i = 0; i <= a; i++)
	//{
	//	cout << z[i] << endl;

	//}
	ans = 99999999999;
	
	for (int i = a; i <= 10000; i++)
	{
		//cout << z[i] << endl;
		ans = min(ans, z[i]);
	}
	cout << ans << endl;



	//return 0;

	/*cout << c << endl;
	cout << b << endl;*/
	//cout << fixed << setprecision(10) <<tmp << endl;
	//cout<<factorial<10><<endl;
	return 0;
}
//2つの組の数をソートしたりするやつ
//vector<pair<ll, ll> > hoges(a);
//for (int i = 1; i <= a; i++)
//{
//	cin >> h;
//	hoges[i - 1] = make_pair(h, i);
//}
//sort(hoges.begin(), hoges.end(), comp);
//for (int i = 0; i < a; i++)
//{
//	cout << hoges[i].second << endl;
//}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;



int main() {
    li a, b;
    cin >> a >> b;
    if (a * b == 15) {
        puts("*");
        return 0;
    } else if (a + b == 15) {
        puts("+");
        return 0;
    }
    puts("x");

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

string s;

int main(void) {
	cin >> s;
	int d = s.size();
	cout << s.substr(0, d - 8) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAX = 64;
ll com[MAX][MAX];
void COMinit() {
  for(int i=0;i<MAX;i++){
    com[i][0]=1;
    com[i][i]=1;
  }
  for(int i=1;i<MAX;i++){
    for(int j=0;j<=i;j++){
      com[i][j]=com[i-1][j-1]+com[i-1][j];
    }
  }
}
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return com[n][k];
}
int main(){
  COMinit();
  int n,a,b;
  cin >> n >> a >> b;
  vector<ll> x(n);
  for(int i=0;i<n;i++) cin >> x[i];
  sort(x.rbegin(),x.rend());
  double ave=0;
  ll num=0;
  for(int i=0;i<a;i++) ave+=double(x[i]);
  ave/=a;
  int l=100,r=0;
  for(int i=0;i<n;i++){
    if(x[i]==x[a-1]){
      l=min(l,i);
      r=max(r,i);
    }
  }
  int m=r-l+1;
  if(r == a-1) num=1;
  else if(l == 0){
    for(int i=a;i<=b;i++){
      num+=COM(m,i);
    }
  }
  else{
    num+=COM(m,a-l);
  }
  cout << fixed << setprecision(8) << ave << endl << num << endl;
}

Measured memory_bytes: 256
from sys import stdin

n = int(stdin.readline().rstrip())
h = [int(x) for x in stdin.readline().rstrip().split()]

nowstep = 0
maxstep = 0

for i in range(n-1, 0, -1):
    if h[i] <= h[i-1]:
        nowstep += 1
    else:
        nowstep = 0
    maxstep = max(maxstep, nowstep)

print(maxstep)

Measured memory_bytes: 20104
#include <iostream>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n;i++)
int main(void) {
	int a, b,sum = 1,ans = 0;cin >> a >> b;
	while (sum < b) {
		sum += (a - 1);
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
template <char d = ' ', class T>
ostream& operator << (ostream& out, vector<T>& v){ for(auto& e : v){ out << e << d; } return out; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<vector<char>> ss(h, vector<char>(w)); cin >> ss;
    vector<vector<int>> lens(h, vector<int>(w, M));
    lens[0][0] = 1;
    pair<int, int> dyxs[4] = {{1, 0}, {0, 1}, {0, -1}, {-1, 0}};
    for(int _ = 0; _ < h * w; _++){
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                if(ss[i][j] == '#'){ continue; }
                for(auto& dyx : dyxs){
                    if(i + dyx.first < 0 || h <= i + dyx.first || j + dyx.second < 0 || w <= j + dyx.second){ continue; }
                    lens[i][j] = min(lens[i][j], lens[i + dyx.first][j + dyx.second] + 1);
                }
            }
        }
    }
    int ns = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            ns += ss[i][j] == '#';
        }
    }
    prints(lens);
    cout << (lens[h - 1][w - 1] == M ? -1 : h * w - ns - lens[h - 1][w - 1]) << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535;

int main()
{
    int k;
    string s;
    cin >> k >> s;
    if (s.size() <= k) {
        cout << s << endl;
        return 0;
    }
    else {
        cout << s.substr(0, k) << "..." << endl;
    }
}

Measured memory_bytes: 3644
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

int a, b, c;

int main(){
  cin >> a >> b >> c;
  if(b-a == c-b) puts("YES");
  else puts("NO");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main(){
    ll k,s;
    cin>>k>>s;
    ll ans=0;

    for(int i=0;i<=k;++i){
        for(int j=0;j<=k;++j){
            ll t=s-i-j;
            if(0<=t and t<=k){
                ans+=1;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 384
import java.io.*;

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
double height;
double max=Double.parseDouble(br.readLine());
double min=max;
while((line=br.readLine())!=null){
height=Double.parseDouble(line);
max=Math.max(max,height);
min=Math.min(min,height);
}
System.out.println(max-min);
}
}

Measured memory_bytes: 16912
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // fixed, setprecision 
#include <math.h> // double sqrt
#define rep(i,n) for(int i=0;i<(n);++i)
#define ll long long
using namespace std;
int main(){
    ll n,k;
    cin>>n>>k;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
     for(int i=0;i<n;i++){
        if(i+k>=n)break;
        if(a[i+k]<=a[i]){cout<<"No"<<endl;continue;}
        cout<<"Yes"<<endl;
    }

    return 0;
}

Measured memory_bytes: 4456
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 

long long int N,K,A[200200];
vector<long long int>pl,mi;

int main()
{
    cout << fixed << setprecision(18);
    cin>>N;
    cout<<(N-2)*180<<endl;
    
}

Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    int n;
    cin >> n;
    
    vector<int> A(n);
    vector<int> B(n);
    vector<int> C(n);
    
    vector<int> CA(n);
    vector<int> CB(n);
    vector<int> CC(n);
    
    for(int i = 0; i < n; i++)
    {
        cin >> A[i] >> B[i] >> C[i];
    }
    
    CA[0] = A[0];
    CB[0] = B[0];
    CC[0] = C[0];
    
    for(int i = 1; i < n; i++)
    {
        CA[i] = max(CB[i-1],CC[i-1])+A[i];
        CB[i] = max(CA[i-1],CC[i-1])+B[i];
        CC[i] = max(CB[i-1],CA[i-1])+C[i];
    }
    
    cout << max(CA[n-1],max(CB[n-1],CC[n-1])) << '\n';
    
    return 0;
}


Measured memory_bytes: 2560
str = gets.split
N,K,Q = str[0].to_i, str[1].to_i, str[2].to_i
need = 1-(K-Q)
a = Array.new(N+1,0)

for i in 0...Q do
    b = gets.chomp.to_i
    a[b] += 1
end

for i in 1..N do
    if a[i] >= need
        puts "Yes"
    else
        puts "No"
    end
end

Measured memory_bytes: 2940
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int top, S[1000];
void push(int x) {
    S[++top] = x;
}

int pop() {
    top--;
    return S[top + 1];
}

int main() {
    int a, b;
    top = 0;
    char s[100];
    while(scanf("%s", s) != EOF) {
        if (s[0] == '+') {
            a = pop();
            b = pop();
            push(a + b);
        } else if (s[0] == '-') {
            b = pop();
            a = pop();
            push(a - b);
        } else if (s[0] == '*') {
            a = pop();
            b = pop();
            push(a * b);
        } else {
            push(atoi(s));
        }
    }

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




Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target ("avx2,avx,fma")
#define ll long long int
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
    io;
    string s;
    int c=0;
    cin>>s;
    for(int i=0;i<s.length();i++)
        if(s[i]=='o')
        c++;
        if(15-s.length()+c>=8)
            cout<<"YES";
        else
            cout<<"NO";
    return 0;
}


Measured memory_bytes: 256
import itertools
import numpy as np

N = int(input())
arr = np.empty((0, 3), int)
for i in range(N):
    for _ in range(int(input())):
        x, y = map(int,input().split())
        arr = np.vstack((arr, [i, x, y]))

bl = list(itertools.product([0,1], repeat=N))

ans = 0
for n in bl:
    flg = True
    for i,x,y in arr:
        if (n[i] != 1) or (n[x-1]==y):
            continue
        else:
            flg = False
            break

    if flg == True:
        ans = max(ans, sum(n))

print(ans)
     

Measured memory_bytes: 18000
#include <bits/stdc++.h>
using namespace std;
     
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
  void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << " |";
    __f(comma + 1, args...);
}
     
#define int  long long
using ii = pair<int, int>;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
   

void solve(){
  int r;
  cin >> r;
  cout << r * r << endl; 
}

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

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	cin >> H >> W;
	vector<string>s(H);
	vector<vector<int>>dis(H, vector<int>(W, 10000));
	dis[0][0] = 0;
	int ans = 0;
	for (int i = 0; i < H; i++) {
		cin >> s[i];
		for (auto j : s[i]) {
			if (j == '.') {
				ans++;
			}
		}
	}
	ans -= 2;
	deque<pair<int,int>>Q;
	int dir[] = { 1,0,-1,0,1 };
	Q.push_back({ 0,0 });
	while (!Q.empty()) {
		int cx = Q.front().second;
		int cy = Q.front().first;
		Q.pop_front();
		for (int i = 0; i < 4; i++) {
			int ny = cy + dir[i];
			int nx = cx + dir[i + 1];
			if (ny < 0 || ny >= H || nx < 0 || nx >= W) {
				continue;
			}
			int add = 0;
			if (s[ny][nx] == '#') {
				continue;
			}
			if (s[ny][nx] == '.') {
				add++;
			}
			if (ny == H - 1 && nx == W - 1) {
				add = 0;
			}
			if (add) {
				if (dis[ny][nx] > dis[cy][cx] + add) {
					dis[ny][nx] = dis[cy][cx] + add;
					Q.push_back({ ny,nx });
				}
			}
			else {
				if (dis[ny][nx] > dis[cy][cx] + add) {
					dis[ny][nx] = dis[cy][cx] + add;
					Q.push_front({ ny,nx });
				}
			}
		}
	}
	if (dis[H - 1][W - 1] == 10000) {
		cout << -1 << endl;
		return 0;
	}
	cout << ans - dis[H - 1][W - 1] << endl;
	return 0;
}

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

int main(){
    int n,k;cin >> n >> k;
    int h[n];
    int ans = 0;
    for(int i=0;i<n;i++){
        cin >> h[i];
        if(h[i] >= k){
            ans ++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vii = vector<ii>;
const int oo = 1e9+7;


int main() {
    
    int n;
    scanf("%d", &n);
    
    vector<ll> nums(n);
    vector<vector<ll>> dp(n, vector<ll>(n, 0));
    vector<vector<ll>> st(n, vector<ll>(n, 0));
    
    for(ll& i : nums) {
        scanf("%lld", &i);
    }
    
    for(int s = 0; s < n; ++s) {
        ll run = 0;
        for(int e = s; e < n; ++e) {
            run += nums[e];
            st[s][e] = run;
        }
    }
    
    // dp[s][e] - lo maximo que puedo conseguir si me toca
    // a mi y en la queue queda el intervalo [s, e)
    
    for(int s = n-1; s >= 0; s--) {
        dp[s][s] = nums[s];
        for(int e = s+1; e < n; ++e) {
            dp[s][e] = max(st[s][e] - dp[s+1][e], st[s][e] - dp[s][e-1]);
        }
    }
    
    printf("%lld\n", dp[0][n-1]-(st[0][n-1]-dp[0][n-1]));
    
    return 0;
}




Measured memory_bytes: 141184
import sys
s=input()
s=s[::-1]
l=list(["maerd","remaerd","esare","resare"])
i=0
while i < len(s):
  ok=0
  for j in l:
    if s[i:i+len(j)] == j:
      ok=1
      i += len(j)
      break
  if ok == 0:
    print("NO")
    sys.exit()
print("YES")



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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define vi vector<int>
typedef long long ll;

using namespace std;



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

	ll n , m , k;
	cin >> n >> m >> k;
	if(k == 0 || k == n * m)dier("Yes");
	if(k >= n && k % n == 0)dier("Yes");
	if(k >= m && k % m == 0)dier("Yes");

	
	
	rep(i , n + 1){
		rep(j , m + 1){
			if(1ll * i * m + 1ll * j * n - 2ll * i * j > n * m)continue;
			if(1ll * i * m + 1ll * j * n - 2ll * i * j == k
			 || 1ll * i * m + 1ll * j * n - 2ll * i * j == n * m - k)dier("Yes");
		}
	}
	
	
	dier("No");
	

	return 0;
}

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

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	int n;
	cin >> n;

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

	int ans = 0;
	rep(i, n) ans += a[i] - 1;

	cout << ans << endl;	
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cstdlib>
#include<sstream>
#include<queue>
#include<deque>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#define INF 2147483647
#define lli long long int
#define MOD 1000000007

using namespace std;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;

int dfs(int depth,vi a,int ponta,int gonta){
	if (depth == a.size()){
		return abs(ponta - gonta);	
	}

	return min(dfs(depth + 1,a,ponta + a[depth],gonta),dfs(depth + 1,a,ponta,gonta + a[depth]) );
}

int main() {

	while(1){
		int n; cin >> n;
		if (n == 0) break;

		vi a(n);
		for (int i = 0; i < n; i++){
			cin >> a[i];
		}
		int ponta = 0;
		int gonta = 0;
		cout << dfs(0,a,ponta,gonta) << endl;
	}
	return 0;
}

Measured memory_bytes: 3096
S = input()

# dream + eraser で dreamer ができるのに注意
c1 = S.count('dream')  # dream + dreamer
c2 = S.count('dreamer')  # dreamer + (dream + erase) + (dream + eraser)
c3 = S.count('erase')  # erase + eraser
c4 = S.count('eraser')  # eraser
# c5 = S.count('dreameraser')  # dream + eraser
c6 = S.count('dreamerase')  # (dream + erase) + (dream + eraser)

num_eraser = c4
num_erase = c3 - num_eraser
num_dreamer = c2 - c6
num_dream = c1 - num_dreamer

l = num_eraser * 6 + num_erase * 5 + num_dreamer * 7 + num_dream * 5
if l == len(S):
    print('YES')
else:
    print('NO')


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

// Shortening code
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;

// Macros
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = a; i >= b; i--)

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    // Your code
    int n, m;
    cin >> n >> m;
    vi height(n);
    REP(i, 0, n){
        cin >> height[i];
    }
    vector<vector<int>> adjList(n + 1);
    REP(i, 0, m){
        int a, b;
        cin >> a >> b;
        adjList[a].push_back(b);
        adjList[b].push_back(a);
    }
    int cnt = 0;
    REP(i, 1, n + 1){
        bool flag = true;
        REP(j, 0, adjList[i].size()){
            if(height[adjList[i][j] - 1] >= height[i - 1])
                flag = false;
        }
        if(flag)
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 8736
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
typedef long long ll;
 
#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define REPI(x,y)	for (i=(x);i<(y);i++)
#define REPJ(x,y)	for (j=(x);i<(y);i++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))
 
using namespace std;
 
ll X,Y;
 
int main() {
	ll x, n=1;
 
	cin >> X >> Y ;
	x = X;
	while( (x=2*x) <= Y ) n++;
	cout << n;
 
	return 0;
}

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


int main(){
	long long n;
	int a[200100];
	long long X = 0;
	long long sum = 0;
	long long res = 1000000000000000;

	cin>>n;

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


	for(int i = 0;i<n-1;i++){
		X += a[i];
		long long A = sum - X;
		res = min(res,abs(X-A));
	}

	cout<<res<<"\n";

}





Measured memory_bytes: 1024
import fractions

N, M = map(int, input().split())
S = input()
T = input()
gcd = fractions.gcd(N, M)
lcm = N*M // gcd
ans = lcm


for i in range(gcd):
    if S[i*N//gcd] != T[i*M//gcd]:
        ans = -1
        break 
    
print(ans)

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

using namespace std;

int main() {
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> cnt(N, 0);
    for (int i = 0; i < Q; i++) {
        int a;
        cin >> a;
        a--;
        cnt.at(a)++;
    }
    for (auto c : cnt) {
        if (Q - c < K) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}


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

const int MAX = 1000000007;
 
 


 
signed main(){
    int n,x0,y;
    cin>> n;
    pair<int,int> x[n];
    int ans[n*n]={};
    for(int i=1;i<=n;i++){
        cin>>x0;
        ans[x0-1]=i;
        x[i-1]=make_pair(x0-1,i);
    }
    sort(x,x+n);
    int t=0;
    for(int i=0;i<n;i++){
        y=x[i].second-1;
      // cerr<<y;
        while(y!=0&&t<x[i].first){
            if(ans[t]==0){
                 ans[t]=x[i].second;
                 y--;
              //   cerr<<t<<' '<<ans[t]<<endl;
            }
           
            t++;
         
        }
        if(y!=0){
            cout<<"No";
            return 0;
        }

    }
    t=n*n-1;
    for(int i=n-1;i>=0;i--){
        y=n-x[i].second;
       
        while(y!=0&&t>x[i].first){
            if(ans[t]==0){
                 ans[t]=x[i].second;
                 y--;
                 //cerr<<t<<' '<<ans[t]<<endl;
            }
           
            t--;
         
        }
        if(y!=0){
            cout<<"No";
            return 0;
        }

    }
    cout<<"Yes"<<endl;
    for(int i=0;i<n*n;i++)cout<<ans[i]<<' ';

   
    
    return 0;
}

Measured memory_bytes: 3072
n,A,B,C = map(int,input().split())
D = [A,B,C]
def nex(time):
  for i in range(n):
    if time[i] < 3:
      time[i] += 1
      break
    else:
      time[i] = 0
  else:
    time = 'over'
  return time
boo = []
for _ in range(n):
  boo.append(int(input()))
can = []
time = [0 for _ in range(n)]
while time != 'over':
  d = [0,0,0]
  tmp = (n-3) * 10
  for i in range(n):
    if time[i] < 3:
      d[time[i]] += boo[i]
    else:
      tmp -= 10
  for k in range(3):
    tmp += abs(D[k] - d[k])
  if d[0] * d[1] * d[2] != 0:
    can.append(tmp)
  time = nex(time)
print(min(can))

Measured memory_bytes: 45916
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a==b || b==c || c==a){
        if(b!=c || c!=a || a!=b){
            printf("Yes");
            return 0;
        }
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 1732