akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#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)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;
 
 
 
int main() {
    int n;
    cin >> n;
	string s;
	cin >> s;

    int countW = 0;    
    int countE = 0;
    int w[n+1] = {}; // iより左で左向いてる人数
    int e[n+1] = {}; // iより右で右向いてる人数

    rep(i,n){
        w[i+1] = countW;
        if(s[i] == 'W'){
            countW++;
        }
    }

    drep(i,n){
        e[i+1] = countE;
        if(s[i] == 'E'){
            countE++;
        }
    }

    int min = n;
    srep(i,1,n+1){
        if(min>e[i]+w[i]){
            min = e[i] + w[i];
        }
    }

    int ans = 0;
    ans = min;

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

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s,c;
    cin>>s>>c;
    for(int i=0;i<s.size();i++)
    {
        cout<<s[i];
        if(i<c.size())cout<<c[i];
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

int main()
{
    int t, ans = 0;
    REP(4){ cin >> t; ans += t;}

    cout << ans /60 << endl;
    cout << ans % 60 << endl;
    return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <bitset>
#include <numeric>
#include <array>
#include <cstring>
#include <random>
#include <chrono>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {

  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  int k = 0;

  cin >> k;

  if(k % 2 == 0) { cout << -1; return 0; }

  int cur = 7 % k, ans = 1;

  while(cur != 0) {
    cur = (cur * 10 + 7) % k;
    ans++;
    if(ans > 1e7) { cout << -1; return 0; }
  }

  cout << ans;

  return 0;
}
/*

*/


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

using namespace __gnu_pbds; 
using namespace __gnu_cxx;
using namespace std;
using ll = long long;

#define eb emplace_back
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(v) ((int)v.size())
#define all(v) v.begin(), v.end()
#define precision(n) fixed<<setprecision(n)

#ifdef LOCAL
    #include "debug.h"
#else
    #define debug(...) 42
#endif

void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);    
    #ifdef LOCAL
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
}

template<typename T> using oset = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update >;
template<typename T> using MinPriorityQueue = priority_queue <T, vector <T>, greater <T> >;
template<typename T> void done(T ans) {cout << ans << "\n"; exit(0);}


template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
  for(auto& i:x)
    input>>i;
  return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
  for(auto& i:x)
    output<<i<<' ';
  return output;
}

 

const int mod = 1e9;
const int N = 3e5 + 5;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937_64 mt(seed);

template <typename T>
long long myrand(T m) {
    long long mod = m;
    long long x = mt()%mod;

    return x;
}
void check(int n, int m) {

}
int main() {
    io();
    int n, m;
    cin >> n >> m;
    check(n, m);
    if(n % 2) {
        int l = 1, r = n;
        while(m--) {
            cout << l << " " << r << "\n";
            l++;
            r--;
        }
    }
    else {
        int l = 1;
        int r = l + m;
        int l2 = r + 1;
        int r2 = r + m;
        while(l < r and m > 0) {
            cout << l << " "  << r << '\n';
            l++;
            r--;
            m--;
        }
        while(l2 < r2 and m > 0) {
            cout << l2 << " "  << r2 << '\n';
            l2++;
            r2--;
            m--;
        }

        

    }

}




Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    ll N;
    cin >> N;
    N--;
    ll pw[13];
    pw[0] = 1;
    rep(i, 12) pw[i+1] = pw[i]*26;
    int n = 1;
    rep2(i, 1, 12){
        if(N < pw[i]) break;
        else N -= pw[i];
        n++;
    }
    string ans;
    rep(i, n){
        char x = 'a'+(N%26);
        ans = x + ans;
        N /= 26;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define REP(i, a, b) for(int i(a); i <= (b); ++i)

#define gc getchar()
struct Reader {
	template <class T> inline operator T() {
		T w; char c, p = 0;
		for(; !isdigit(c = gc); c == '-' && (p = 1));
		for(w = c & 15; isdigit(c = gc); w = w * 10 + (c & 15));
		return p ? -w : w;
	}
} rd;

template <class T> inline bool smin(T&x, const T&y) { return y < x ? x = y, 1 : 0; }
template <class T> inline bool smax(T&x, const T&y) { return x < y ? x = y, 1 : 0; }

typedef long long ll;

const int N(1e5 + 5);
int n, a[N], f[N];

int main() {
	n = rd;
	REP(i, 1, n) a[i] = rd;
	REP(i, 2, n){
		f[i] = f[i - 1] + abs(a[i] - a[i - 1]);
		if (i ^ 2) smin(f[i], f[i - 2] + abs(a[i] - a[i - 2]));
	}
	std::cout << f[n];
	return 0;
}


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

int main(){
    //input
    int N,M;
    cin >> N >> M;

    int city[N] = {0};
    for(int i=0;i<M;i++){
        int a,b;
        cin >> a >> b;
        city[a-1]++;
        city[b-1]++;
    }

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

    return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::io::*;
use std::ops::*;
use std::*;

// -----------------------------------------------
// Framework
// -----------------------------------------------

#[allow(unused)]
fn rl() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused)]
fn rw<T>() -> Vec<T>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|word| T::from_str(word).unwrap())
        .collect()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

#[allow(unused)]
macro_rules! debug {
    ($($arg:expr),*) => {
        #[cfg(debug_assertions)]
        {
            let entries = &[
                $((
                    &stringify!($arg).to_string() as &fmt::Debug,
                    &($arg) as &fmt::Debug,
                )),*
            ];
            eprintln!("{:?}", DebugMap(entries));
        }
    };
}

#[allow(unused)]
struct DebugMap<'a>(&'a [(&'a fmt::Debug, &'a fmt::Debug)]);

impl<'a> std::fmt::Debug for DebugMap<'a> {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        let mut m = fmt.debug_map();
        for &(key, value) in self.0.iter() {
            m.entry(key, value);
        }
        m.finish()
    }
}

// -----------------------------------------------
// Polyfill
// -----------------------------------------------

#[derive(PartialEq, Eq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

#[allow(unused)]
macro_rules! eprintln {
    ($($arg:expr),*) => { _eprintln(format_args!($($arg),*)) }
}

fn _eprintln(args: fmt::Arguments) {
    let err = std::io::stderr();
    let mut err = err.lock();
    err.write_fmt(args).unwrap();
    err.write(b"\n").unwrap();
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

pub fn main() {
    let S = rl().chars().collect::<Vec<char>>();
    let N = S.len();
    let k = if N == 1 {
        0
    } else {
        let mut l = 0;
        let mut r = N - 1;
        let mut k = 0;

        while l < r {
            if S[l] == S[r] {
                l += 1;
                r -= 1;
            } else if S[l] == 'x' {
                l += 1;
                k += 1;
            } else if S[r] == 'x' {
                r -= 1;
                k += 1;
            } else {
                k = -1;
                break;
            }
        }

        k
    };

    println!("{}", k);
    return;
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_ok() {
        assert_eq!(7, 1 + 2 * 3);
    }
}


Measured memory_bytes: 4352
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
using namespace std;
int main(){
  int a,b;
  while(cin>>a>>b,a!=0){
    int c=0;
    if(b==a){
     cout<<a<<" "<<1<<endl;
     goto at;
   }
   int x,y;
   if(a>b){
     x=a,y=b;
   }else{
     x=b,y=a;
   }
   while(y>0){
     x=x%y;
     int s=x;
     x=y;
     y=s;
     c++;
   }
   cout<<x<<" "<<c<<endl;
 at:;
 }
 return 0;   
}
  

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

int main() {
  long double a, b;
  cin >> a >> b;
  
  if (a / b > 1)
    cout << "GREATER" << endl;
  if (a / b < 1)
    cout << "LESS" << endl;
  if (a / b == 1)
    cout << "EQUAL" << endl;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**7)
n,u,v = map(int,input().split())
u-=1
v-=1
ki = [[]for i in range(n)]
distt = [0]*n
dista = [0]*n
for i in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    ki[a].append(b)
    ki[b].append(a)
def dfst(now,last = -1):
    for next in ki[now]:
        if next == last:continue
        distt[next] = distt[now]+1
        dfst(next,now)
def dfsa(now,last = -1):
    for next in ki[now]:
        if next == last:continue
        dista[next] = dista[now]+1
        dfsa(next,now)
    
dfst(u)
dfsa(v)
ans = 0
for i in range(n):
    if dista[i]<=distt[i]:continue
    ans = max(ans,dista[i]-1)
print(ans)
    

Measured memory_bytes: 117040
# 146 B

n = int(input())
s = input()
ans = ""

for i in s:
    val = ord(i)
    if val + n > 90:
        ex = (val + n) - 90
        new = 64 + ex
        ans += chr(new)
    else:
        ans += chr(val + n)

print(ans)

Measured memory_bytes: 9116
n, x, y = map(int,input().split())
x-=1
y-=1
answer=[0]*(n)

for i in range(n):
    for j in range(i):
        swit=0
        if (i<=x and j<=x) or (i>=y and j>=y):
            answer[abs(i-j)]+=1
        elif j<=x and y<=i:
            answer[i-y+1+x-j]+=1
        elif x<=j and j<=y and x<=i and i<=y:
            answer[min(i-j, j-x+1+y-i)]+=1
        elif j<=x and x<=i and i<=y:
            answer[min(i-j, x-j+1+y-i)]+=1
        elif x<=j and j<=y and y<=i:
            answer[min(i-j, j-x+1+i-y)]+=1
            swit=5
        #print(i, j, answer, swit)

for an in range(len(answer)):
    if an!=0:
        print(answer[an])

Measured memory_bytes: 48220
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1000000000
#define mod 1000000007

struct UnionFind{
	VI par;
	UnionFind(int N):par(N){
		REP(i,N)par[i]=i;
	}
	int root(int x){
		if(par[x]==x)return x;
		return par[x]=root(par[x]);
	}
	void unite(int x,int y){
		int rx=root(x);
		int ry=root(y);
		if(rx==ry)return;
		par[rx]=ry;
	}
	bool same(int x,int y){
		int rx=root(x);
		int ry=root(y);
		return rx==ry;
	}
};
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

	ll N,M;
	cin>>N>>M;
	VI P(N);
	REP(i,N) cin>>P[i];
	
	UnionFind tree(N);
	REP(i,M){
		int x,y;
		cin>>x>>y;
		tree.unite(x-1,y-1);
	}
	int cnt=0;
	REP(i,N){
		if(tree.same(i,P[i]-1))cnt++;
	}
	cout<<cnt<<endl;
	
	return 0;
}

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

const int N = 100100;

int n;
set<int> g[N];
int p[N];

int get(int x) {
    if (p[x] == -1) {
        return x;
    }
    return p[x] = get(p[x]);
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        a--; b--;
        g[a].insert(b);
        g[b].insert(a);
    }

    vector<pair<int, int>> cand;   
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        a--; b--;
        if (g[a].count(b)) {
            cand.emplace_back(a, b);
        }
        g[a].insert(b);
        g[b].insert(a);
    }

    fill_n(p, n, -1);
    int cnt = 0;
    while (!cand.empty()) {
        int a, b;
        tie(a, b) = cand.back();
        cand.pop_back();
        a = get(a);
        b = get(b);
        if (a == b) {
            continue;
        }

        cnt++;

        if (g[a].size() > g[b].size()) {
            swap(a, b);
        }

        p[a] = b;

        g[a].erase(b);
        g[b].erase(a);
        for (int x: g[a]) {
            g[x].erase(a);
            if (g[x].count(b)) {
                cand.emplace_back(x, b);
            }
            g[x].insert(b);
            g[b].insert(x);
        }
        set<int>().swap(g[a]);
    }
    
    if (cnt == n - 1) {
        puts("YES");
    } else {
        puts("NO");
    }
}


Measured memory_bytes: 24064
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;


int main(){
  int a, b;
  cin >> a >> b;
  int c = a + b;
  int ans;
  if (c % 2) ans = c/2 + 1;
  else ans = c/2;
  cout << ans << endl;
}

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

const int mod = 998244353;

int L[20], R[20];
long long dp[200010];
long long sum[200010];

int main () {
	int n, k; cin >> n >> k;
	for (int i = 0; i < k; i++) {
		cin >> L[i] >> R[i];
	}
	dp[1] = sum[1] = 1;
	for (int i = 2; i <= n; i++) {
		for (int j = 0; j < k; j++) {
			if (i - L[j] <= 0) continue;
			int r = i - L[j], l = i - R[j];
			if (l < 0) l = 1;
			dp[i] = (dp[i] + sum[r] - sum[l - 1] + mod) % mod;
		}
		sum[i] = (sum[i - 1] + dp[i]) % mod;
	}
	cout << dp[n] << endl;
	return 0;
}


Measured memory_bytes: 6716
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
#include<cmath>
#include<complex>
using namespace std;

typedef complex<double> P;

#define X real()
#define Y imag()
typedef int kz;

kz gcd(kz a,kz b) { if(b==0) return a; else gcd(b,a%b); }

int main(){
    int mod=1000000007;
    int x,y,tmp=0;
    int ans[2]={0,0};
    while (scanf("%d,%d",&x,&y)!=EOF) {
        tmp++;
        ans[0]+=x*y;
        ans[1]+=y;
    }
    ans[1]=ans[1]*10/tmp;
    if (ans[1]%10>4) {
        ans[1]=ans[1]/10+1;
    } else {
        ans[1]/=10;
    }

    printf("%d\n%d\n",ans[0],ans[1]);
    return 0;
}

Measured memory_bytes: 3180
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
int main() {
  int N, M;
  float A[110];
  float sum = 0;
  int c = 0;
  cin >> N >> M;
  for(int i = 0; i < N; i++) {
    cin >> A[i];
    sum += A[i];
  }
  sort(A, A+N, greater<int>());
  for(int i = 0; i < N; i++){
    if(A[i] >= (float)sum/(4*M)) c++;
  }
  if(c >= M) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


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

using namespace std;

int main() {
	int N;
	string S;
	cin >> N;
	cin >> S;
	
	for (int i = 0; i < S.size(); i++) {
		S[i] += N;
		if (S[i] > 'Z') {
			S[i] -= 26;
		}
	}

	cout << S;
	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int x,n,soma=0;
	scanf("%d", &x);
	n=x;
	while(n>0){
		soma+=n%10;
		n/=10;
	}
	if(x%soma==0)printf("Yes\n");
	else printf("No\n");
	return 0;}

Measured memory_bytes: 128
#include <stdio.h>
 
int main(void)
{
  int x;
 
  for(int i=1;;i++)
    {
      scanf("%d",&x);
 
      if(x == 0)
    {
      break;
    }
 
      printf("Case %d: %d\n",i ,x);
 
       
    }
 
  return 0;
}

Measured memory_bytes: 1708
import java.util.Scanner;

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

        int x, y;

        x = sc.nextInt();
        y = sc.nextInt();

        if(x == 0 && y == 0)
            return;

        while(!(x == 0 && y == 0)) {
            if(x < y)
                System.out.println(x + " " + y);
            else
                System.out.println(y + " " + x);
            x = sc.nextInt();
            y = sc.nextInt();
        }
    }
}



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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

const int INF=1e9;
const int MOD=1e9+7;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

int main()
{
	for(int n;cin>>n && n;){
		vi bs(n),es(n),ws(n);
		rep(i,n) cin>>bs[i]>>es[i]>>ws[i],bs[i]--;
		
		vi is(n); iota(all(is),0);
		sort(all(is),[&](int i,int j){return es[i]<es[j];});
		
		const int N=365;
		vvi dp1(N+1,vi(N+1)),dp2;
		for(int k:is){
			dp2=dp1;
			rep(i,N+1) repi(j,es[k],N+1) dp2[i][j]=max(dp2[i][j],dp1[i][bs[k]]+ws[k]);
			rep(i,N+1) repi(j,es[k],N+1) dp2[j][i]=max(dp2[j][i],dp1[bs[k]][i]+ws[k]);
			swap(dp1,dp2);
		}
		cout<<dp1[N][N]<<endl;
	}
}

Measured memory_bytes: 2128
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <vector>

using namespace std;

int a, b;
int main() {
    cin >> a >> b;
    cout << a * b << " " << (a + b) * 2 << endl;
    return 0;
}

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

int main () {
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;

	if (0 <= (x - r) && (x + r) <= W && 0 <= (y - r) && (y + r) <= H) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3096
import numpy as np
n,k = map(int,input().split())
h = np.array(list(map(int,input().split())))
ans = np.zeros(n, dtype=int)
for i in range(1, n):
    s = max(i-k, 0)
    ans[i] = np.min(ans[s:i]+np.abs(h[s:i]-h[i]))
print(ans[-1])
#copy code

Measured memory_bytes: 22904
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

bool used[26];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S, T;
    cin >> S >> T;
    rep(i, 26) {
        set<char> st;
        rep(j, S.length()) {
            if (S[j] == ('a' + i)) st.insert(T[j]);
        }
        if(st.size() > 1) {
            cout << "No" << endl;
            return 0;
        }
        if (st.size() == 0) continue;
        char c = *st.begin();
        //cout << c << endl;
        rep(j, S.length()) {
            if (S[j] != ('a' + i) && T[j] == c) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;

    return 0;
}
// aa
// ab


Measured memory_bytes: 916
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;
typedef vector<long long int> vll;

int main() {
	int n;
	cin >> n;
	vi a(n);
	rep(i, 0, n) {
		cin >> a[i];
	}
	int ans = INF;
	rep2(i, -100, 100) {
		int cou = 0;
		rep(j, 0, n) {
			cou += pow(a[j] - i, 2);
		}
		ans = min(ans, cou);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mn(a, b) (a < b ? a : b)
#define mx(a, b) (a > b ? a : b)
#define f first
#define s second
#define all(v) (v).begin(), (v).end()
#define base 331

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int const MOD = 1e9 + 7;

ll dp[(1 << 21) + 2];

int main(){

    //freopen(".in","r",stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector < int > tip[22];
    for(int i = 1; i < (1 << n); i++)
        tip[__builtin_popcount(i)].push_back(i);
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < n; j++){
            int x;
            cin>>x;
            if(i == 1){
                if(x) dp[1 << j] = 1;
                continue;
            }
            if(x){
                for(auto to: tip[i - 1]){
                    bool yes = to & (1 << j);
                    if(yes) continue;
                    dp[to ^ (1 << j)] = (dp[to ^ (1 << j)] + dp[to]) % MOD;
                }
            }
        }
    }
    cout<<dp[(1 << n) - 1];
    return 0;
}


Measured memory_bytes: 26044
import java.util.*;

class Main {
	  static long mod=1_000_000_007;
  public static void main(String[] args) {
	  int flg = 0;
	  Scanner sc = new Scanner(System.in);
      long N = sc.nextLong();
      long K = sc.nextLong();
      long Q = sc.nextLong();
      long[] a = new long[(int)N];
      int tmp;
      
      for(int i=0;i<Q;i++) {
    	  tmp = sc.nextInt()-1;
    	  a[tmp] = a[tmp] +1;
      }

      for(int i=0;i<N;i++) {
    	  if(a[i]>Q-K) {
    		  System.out.println("Yes");
    	  } else {
    		  System.out.println("No");
    	  }
      }
      
  }
  
 
}

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

using ll = int64_t;
#define int ll

#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)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  int h, w;
  std::cin >> h >> w;
  char pic[h * w];
  rep(i, h) rep(j, w) cin >> pic[i * w + j];
  rep(i, h * 2) {
    rep(j, w) {
      int idx = i / 2;
      cout << pic[idx * w + j];
    }
    cout << "\n";
  }
}


Measured memory_bytes: 256
#include <cstdio> 
#include <cstdlib> 
#include <cmath> 
#include <cstring> 
#include <climits> 
#include <cfloat> 
#include <map> 
#include <utility> 
#include <set> 
#include <iostream> 
#include <memory> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <functional> 
#include <sstream> 
#include <complex> 
#include <stack> 
#include <queue> 
#include <numeric>
#include <cassert>

#define FOR(i, min, max) for (int i = (min); i < (max); ++i) 
#define FORE(i, min, max) for (int i = (min); i <= (max); ++i) 
#define REP(i, n) for (int i = 0; i < (n); ++i) 
#define REPV(vec, i) for (int i = 0; i < (int)(vec.size()); ++i) 
#define FOR_EACH(vec, it) for (typeof((vec).begin()) it = (vec).begin(); it != (vec).end(); ++it)

using namespace std; 
static const double EPS = 1e-12; 
typedef long long ll; 

int main(void)
{
    int K;
    cin >> K;
    int A, B;
    cin >> A >> B;

    FORE(i, A, B) {
        if (i % K == 0) {
            cout << "OK" << endl; return 0;
        }
    }
    cout << "NG" << endl;
    
    return 0;
}


Measured memory_bytes: 3544
#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::io::*;
use std::ops::*;
use std::*;

// -----------------------------------------------
// Framework
// -----------------------------------------------

#[allow(unused)]
fn rl() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused)]
fn rw<T>() -> Vec<T>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|word| T::from_str(word).unwrap())
        .collect()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

#[allow(unused)]
macro_rules! debug {
    ($($arg:expr),*) => {
        #[cfg(debug_assertions)]
        {
            let entries = &[
                $((
                    &stringify!($arg).to_string() as &fmt::Debug,
                    &($arg) as &fmt::Debug,
                )),*
            ];
            eprintln!("{:?}", DebugMap(entries));
        }
    };
}

#[allow(unused)]
struct DebugMap<'a>(&'a [(&'a fmt::Debug, &'a fmt::Debug)]);

impl<'a> std::fmt::Debug for DebugMap<'a> {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        let mut m = fmt.debug_map();
        for &(key, value) in self.0.iter() {
            m.entry(key, value);
        }
        m.finish()
    }
}

// -----------------------------------------------
// Polyfill
// -----------------------------------------------

#[derive(PartialEq, Eq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

#[allow(unused)]
macro_rules! eprintln {
    ($($arg:expr),*) => { _eprintln(format_args!($($arg),*)) }
}

fn _eprintln(args: fmt::Arguments) {
    let err = std::io::stderr();
    let mut err = err.lock();
    err.write_fmt(args).unwrap();
    err.write(b"\n").unwrap();
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

pub fn main() {
    let S = rl();

    let mut score = 0;
    for i in 0..S.len() {
        let g = S.as_bytes()[i] == b'g';

        score += if i % 2 == 0 && !g {
            -1
        } else if i % 2 == 1 && g {
            1
        } else {
            0
        };
    }

    println!("{}", score);
    return;
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_ok() {
        assert_eq!(7, 1 + 2 * 3);
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

#define REP(var,n) for(int var=0;var<(n);var++)
#define REPP(var,n) for(int var=1;var<(n);var++)

using namespace std;

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

    while(1){
        if(n<=0){
            cout << ans << endl;
            return 0;
        }
        if(ans == 0){
            ans++;
            n -= k;
        }
        else{
            ans++;
            n -= (k-1);
        }
    }
}


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

int main(){
  int i,n;
  int pm,pe,pj;
  char ans;

  while(1){
    cin >> n;
    if(!n)break;

    for(i=0;i<n;i++){
      cin >> pm >> pe >> pj;
      if(pm==100 || pe==100 || pj==100)ans = 'A';
      else if( (pm+pe)/2 >= 90 )ans = 'A';
      else if( (pm+pe+pj)/3 >= 80 )ans = 'A';
      else if( (pm+pe+pj)/3 >= 70 )ans = 'B';
      else if( (pm+pe+pj)/3 >= 50 && (pm>=80 || pe>=80) )ans = 'B';
      else ans = 'C';
      cout << ans << endl;
    }
  }
}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sx = sc.nextInt();
		int sy = sc.nextInt();
		int tx = sc.nextInt();
		int ty = sc.nextInt();
		StringBuilder ans = new StringBuilder();
		for(int i = 0; i < (tx-sx); i++)
			ans.append("R");
		for(int i = 0; i < (ty-sy); i++)
			ans.append("U");
		for(int i = 0; i < (tx-sx); i++)
			ans.append("L");
		for(int i = 0; i < (ty-sy); i++)
			ans.append("D");
		ans.append("L");
		for(int i = 0; i < (ty-sy+1); i++)
			ans.append("U");
		for(int i = 0; i < (tx-sx+1); i++)
			ans.append("R");
		ans.append("DR");
		for(int i = 0; i < (ty-sy+1); i++)
			ans.append("D");
		for(int i = 0; i < (tx-sx+1); i++)
			ans.append("L");
		ans.append("U");
		System.out.println(ans);
		
	}

}

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

int main(){
	int a , b , c;
	char arr[10000]={0};
	int i,j;
	cin >> a >> b >> c;
	for(i=a ; i<=b ; i++ ){
		if(c%i==0) arr[j++]='o';
	}
	cout << strlen(arr) << endl;
	return 0;
}

Measured memory_bytes: 1172
# AtCoder Beginner Contest 133
# B - Good Distance

def f(a,b,d):
    X=0
    for i in range (d):
        X+=(a[i]-b[i])**2
    return X**0.5


from itertools import combinations

ans =0

N,D=map(int,input().split())
ls=[]
for _ in range(N):
    p=list(map(int,input().split()))
    ls.append(p)

c=list(combinations(ls,2))
# print(c)

for i in range (len(c)):
    a=f(c[i][0],c[i][1],D)
    if a==a//1:
        ans+=1
    

print(ans)


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

vll G[100100];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,m; cin>>n>>m;
  rep(i,m){
    ll a,b; cin>>a>>b; a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  vll ans(n,-1);
  queue<ll> q;
  q.push(0);
  vb visited(n);
  visited[0]=1;
  while(!q.empty()){
    ll v=q.front(); q.pop();
    for(auto nv: G[v]){
      if(visited[nv]) continue;
      visited[nv]=true;
      ans[nv]=v;
      q.push(nv);
    }
  }
  
  irep(i,1,n){
    if(ans[i]==-1){
      cout<<"No"<<endl;
      return 0;
    }
  }
  
  
  cout<<"Yes"<<endl;
  irep(i,1,n){
    cout<<ans[i]+1<<endl;
  }
  
}

Measured memory_bytes: 13124
using System;

class Program
{
    static void Main()
    {
        int i = 0;
        while (i == 0)
        {
            string[] HW = Console.ReadLine().Split();
            int H = int.Parse(HW[0]);
            int W = int.Parse(HW[1]);

            if (H == 0 && W == 0)
                break;

            for (int j = 0; j < H; j++)
            {
                for (int k = 0; k < W; k++)
                {
                    Console.Write("#");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
}

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

unordered_map <int,int> cnt;

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

	int n;
	long long int t;
	int res = 0;
	vector <long long int> v;
	vector <long long int> two;
	long long int val = 1;

	while(val < 1e10)
	{
		two.push_back(val);
		val*=2;
	}

	sort(two.rbegin(),two.rend());

	cin >> n;

	for(int i=0;i<n;i++)
	{
		cin >> t;
		v.push_back(t);
		cnt[t]++;
	}

	sort(v.begin(),v.end());

	for(int i=0;i<two.size();i++)
	{
		for(int j=0;j<n;j++)
		{
			if(cnt[v[j]]==0)
			{
				continue;
			}
			long long int val = two[i] - v[j];
			if(val<=0)
			{
				continue;
			}
			if(cnt[val] > 0)
			{
				if(val==v[j] && cnt[v[j]]==1)
				{
					continue;
				}
				//cout << val << ' ' << v[j] << '\n';
				cnt[val]-=1;
				cnt[v[j]]-=1;
				res++;
			}
		}
	}

	cout << res << '\n';

	return 0;	
}


Measured memory_bytes: 43780
#include <stdio.h>

int main (void){
    int n, i, j, temp;
    
    scanf("%d", &n);
    
    int r[n];
    
    for(i = 0; i < n; i++){
        scanf("%d", &r[i]);
    }
    
    for(i = 0; i < n; i++){
        for(j = i; j > 0; j--){
            if(r[j] < r[j-1]){
            temp = r[j];
            r[j] = r[j-1];
            r[j-1] = temp;
            }
        }
        for(j = 0; j < n; j++){
            printf("%d", r[j]);
            if(n - j != 1) printf(" ");
        }
        puts("");
    }
    return 0;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
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;
}
int main(){
ll a,b,c,d,e;
cin >> a >> b >> c >> d >> e;
cout << (15 - a - b - c - d - e) << endl;

}

Measured memory_bytes: 3616
W,H,x,y,r=list(map(int,input().split()))
if (x-r<0 or x+r>W) or (y-r<0 or y+r>H):
    print("No")
elif (x-r>=0 and x+r<=W) or (y-r<=0 and y+r>=H):
    print("Yes")


Measured memory_bytes: 5596
import sys

sys.setrecursionlimit(10**5)

def solve():
    while 1:
        w, h = map(int, sys.stdin.readline().split())

        if w == h == 0:
            return

        room = [[int(j) for j in sys.stdin.readline().split()] for i in range(h)]

        cnt = 0

        for i in range(h):
            for j in range(w):
                if room[i][j]:
                    cnt += 1
                    dfs(w, h, room, i, j)

        print(cnt)

def dfs(w, h, room, i, j):
    if i < 0 or i >= h or j < 0 or j >= w or (not room[i][j]):
        return

    room[i][j] = 0

    dfs(w, h, room, i + 1, j)
    dfs(w, h, room, i - 1, j)
    dfs(w, h, room, i, j + 1)
    dfs(w, h, room, i, j - 1)
    dfs(w, h, room, i + 1, j + 1)
    dfs(w, h, room, i + 1, j - 1)
    dfs(w, h, room, i - 1, j + 1)
    dfs(w, h, room, i - 1, j - 1)

if __name__ == '__main__':
    solve()

Measured memory_bytes: 9440
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
#include<cmath>
#include<complex>
using namespace std;

typedef complex<double> P;

#define X real()
#define Y imag()
typedef int kz;

kz gcd(kz a,kz b) { if(b==0) return a; else gcd(b,a%b); }

int main(){
    double s;
    while (scanf("%lf",&s)!=EOF){
        if (s<=48.0) {
            printf("light fly\n");
        } else if (s<=51.0) {
            printf("fly\n");
        } else if (s<=54.0) {
            printf("bantam\n");
        } else if (s<=57.0) {
            printf("feather\n");
        } else if (s<=60.0) {
            printf("light\n");
        } else if (s<=64.0) {
            printf("light welter\n");
        } else if (s<=69.0) {
            printf("welter\n");
        } else if (s<=75.0) {
            printf("light middle\n");
        } else if (s<=81.0) {
            printf("middle\n");
        } else if (s<=91.0) {
            printf("light heavy\n");
        } else {
            printf("heavy\n");
        }
        /**
        if ((s-91.0)>1e-10) {
            printf("heavy\n");
        } else if ((s-81.0)>1e-10) {
            printf("light heavy\n");
        } else if ((s-75.0)>1e-10) {
            printf("middle\n");
        } else if ((s-69.0)>1e-10) {
            printf("light middle\n");
        } else if ((s-64.0)>1e-10) {
            printf("welter\n");
        } else if ((s-60.0)>1e-10) {
            printf("light welter\n");
        } else if ((s-57.0)>1e-10) {
            printf("light\n");
        } else if ((s-54.0)>1e-10) {
            printf("feather\n");
        } else if ((s-51.0)>1e-10) {
            printf("bantam\n");
        } else if ((s-48.0)>1e-10) {
            printf("fly\n");
        } else {
            printf("light fly\n");
        }
        **/
    }
    return 0;
}

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

int main() {
  int K;
  cin >> K;
  vector<int> A(K, 0);
  A.at(0) = 7 % K;
  for(int i = 0; i < K - 1; i++) {
    A.at(i + 1) = (A.at(i) * 10 + 7) % K;
  }
  bool N = true;
  for(int i = 0; i < K; i++) {
    if (A.at(i) == 0) {
      cout << i + 1 <<endl;
      N = false;
      break;
    }
  }
  if (N) cout << "-1" << endl;
}

Measured memory_bytes: 7200
#include <bits/stdc++.h>
using namespace std;
 
#define MOD 1000000007
#define INF  2000000000
//#define int ll
#define ll long long
#define ld long double
#define vi vector<int>
#define pa pair<int, int>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC(type, c, n) vector<type> c(n);for(auto& i:c)cin>>i;
#define MAT(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
 
#define BR cout << "\n";
#define SP cout << " ";
#define ENDL cout<<endl;
#define OUT(d) cout<<(d);
#define OUTL(d) cout<<(d); BR;
#define YES OUTL("YES")
#define Yes OUTL("Yes")
#define NO OUTL("NO")
#define No OUTL("No")
#define RET return 0;
#define SUM(a, n) accumulate(a, a+n, 0)
#define VSUM(v) accumulate(ALL(v), 0);
 
#define REP(i, n) for(int i=0;i<(n);i++)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define FOR(i, m, n) for(int i = m;i < n; i++)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define AREP(a, n) for(auto (a):(n))
#define ALL(a) (a).begin(),(a).end()
#define IN(n, a, b) ((a)<=(n)&&(n)<(b))

int fn(ll a){
    int sum = 0;
    while(a){
        sum += a %10;
        a /= 10;
    }
    return sum;
}

signed main(){ INIT;
    VAR(int, n);
    if(n % fn(n) == 0){
        Yes;
    }else{
        No;
    }
RET;}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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




int main() {
    int a, b;
    cin >> a >> b;
    if(a <= 8 && b <= 8){
        cout << "Yay!" << endl;
    }
    else{
        cout << ":(" << endl;
    }
}


Measured memory_bytes: 256
cards = {}
cards['a']=gets.chomp.chars.to_a
cards['b']=gets.chomp.chars.to_a
cards['c']=gets.chomp.chars.to_a

turn = 'a'
loop do
  break if cards[turn].empty?
  turn = cards[turn].shift
end
puts turn.to_s.upcase

Measured memory_bytes: 3836
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <cassert>
//#include <unordered_map>
#include <unordered_set>
using namespace std;

typedef long long ll;
#define eps 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define DE(val) cout<<#val<<": "<<val<<endl;

const int dx4[5] = { 0,-1,0,1,0 };
const int dy4[5] = { 0,0,1,0,-1 };
const int dx8[9] = { 0,-1,0,1,0,1,1,-1,-1 };
const int dy8[9] = { 0,0,1,0,-1,1,-1,1,-1 };
const int maxn = 1e5 + 5;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
ll po(ll a, ll b, ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a, ll b) { if (a == 0) { return b; } else { return gcd(b%a, a); } }
void YES() { puts("YES"); exit(0); }
void Yes() { puts("Yes");}// exit(0); }
void NO() { puts("NO"); exit(0); }
void No() { puts("No");}// exit(0); }
void one() { puts("-1"); exit(0); }

ll n,a,b;
ll h[maxn];
ll val[maxn];
vector<int>v;

bool check(ll x)
{
	v.clear();
	repp(i,1,n)
	{
		val[i]=h[i]-x*b;
		if(val[i]>0)
			v.push_back(val[i]);
	}
	if(v.size()==0)return true;
	//sort(v.begin(),v.end());

	ll cnt=0;
	for(int i=0;i<v.size();i++)
	{
		cnt+= (v[i]+a-b-1)/(a-b);
	}
	return cnt<=x;
}

void solve()
{
	scanf("%lld%lld%lld",&n,&a,&b);
	repp(i,1,n)
	{
		scanf("%lld",&h[i]);
	}
	ll le=0,ri=1e9+5;
	while(le<ri)
	{
		ll mid=(le+ri)/2;
		if(check(mid))
		{
			ri=mid;
		}
		else
		{
			le=mid+1;
		}
	}
	printf("%lld\n",le);
}

int main()
{

	solve();
	//system("pause");
	return 0;
}







Measured memory_bytes: 2428
# -*- coding: utf-8 -*-
import itertools
# 整数の入力
total = 0
last_l = 0
s = [c for c in input()]
for k,g in itertools.groupby(s):
    l = len(list(g))
    # print(k, l, (l+1)*l//2)
    total += (l+1)*l//2
    if(k=='>'):
        if(last_l <= l):
            total -= last_l
            # print(-last_l)
        else:
            total -= l
            # print(-l)
    last_l = l
print(total)
# 出力
# print("{} {}".format(a+b+c, s))


Measured memory_bytes: 11868