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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)
#define SUM(v) accumulate((v).begin(),(v).end(),0ll)
#define range(i,left,right) (left<=i && i<right)

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;
typedef priority_queue<int> PQi;

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;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vout(Vs &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());} //vectorの同じ要素消す
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
int leng(int n){string s=to_string(n); return s.size();} //intの桁数
int digitsum(int n){int ret=0; while(n>0){ret+=n%10;n/=10;}return ret;} //桁和
int lesscount(int x,Vi &a){return lower_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx未満の数の個数
int orlesscount(int x,Vi &a){return upper_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx以下の数の個数
int morecount(int x,Vi &a){return a.size()-orlesscount(x,a);} //vector aにおけるxより大きい数の個数
int ormorecount(int x,Vi &a){return a.size()-lesscount(x,a);} //vector aにおけるx以上の数の個数
int iscount(int x,Vi &a) {return upper_bound(ALL(a),x)-lower_bound(ALL(a),x);} //vector aにおけるxの個数
Vi accum(Vi &v){Vi ret((v).size()+1);REP(i,0,(v).size()) ret[i+1]=ret[i]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);
    int n;
    cin>>n;
    Vi ans(n);
    REP(i,0,n-1){
        int t;
        cin>>t;
        t--;
        ans[t]++;
    }
    vout(ans);
    return 0;
}


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

int main() {
	int i, j;
	int H=0, W=0;
	char s[51][51];

	cin >> H >> W;

	for (i = 0; i < H; i++) {
			cin >> s[i];
	}


	for (i = 0; i < H; i++) {
		for (j = 0; j < W; j++) {
			if (s[i][j] != '#') {
				int count = 0;
				for (int k = -1; k <= 1; k++) {
					for (int l = -1; l <= 1; l++) {
						if ((i + k >= 0) && (j + l >= 0)) {
							if (s[i + k][j + l] == '#') {
								count++;
							}
						}
						s[i][j] = char(count + '0');
					}
				}
			}
		}
	}

	for (i = 0; i < H; i++) {
		for (j = 0; j < W; j++) {
			cout << s[i][j];
		}
		cout << endl;
	}

	return 0;
}

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

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

    vector<string> S(N);
    for(int i = 0; i < N; i++) cin >> S.at(i);

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

    for(int i = 0; i < N; i++) cout << S.at(i);
    cout << endl;    
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repa(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define COUT(x) cout << (x) << endl
#define VIEW(x) do{cout << "--" << #x << "--" << endl; view(x);}while(0)
template<typename T> void view(T e){COUT(e);}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
#define _GLIBCXX_DEBUG

int main(){
  
  string s;
  cin >> s;
  sort(ALL(s));
  if(s == "abc")
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;


vector<string> split(const string &s, char delim) {
    vector<string> elems;
    string item;
    for (char ch: s) {
        if (ch == delim) {
            if (!item.empty())
                elems.push_back(item);
            item.clear();
        }
        else {
            item += ch;
        }
    }
    if (!item.empty())
        elems.push_back(item);
    return elems;
}


int ng[500];
int dp[500];

int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll n,m;
    cin >> n >> m;
    vector<ll> a(n);
    vector<ll> s(n + 1);
    map<ll, ll> mp;
    rep(i, n) {
        cin >> a[i];
        s[i + 1] = s[i] + a[i];
    }
    rep(i, n + 1) mp[s[i] % m]++;
    ll ans = 0;
    for(auto num : mp){
        ans += num.sc * (num.sc - 1) / 2;
    }
    print(ans);


    

}



Measured memory_bytes: 8724
use std::io;
use std::cmp;

macro_rules! read {
    () => {
        {
            let mut line = String::new();
            io::stdin().read_line(&mut line).unwrap();
            line
        }
    };
}

fn split(s: &String) -> std::str::SplitWhitespace {
    s.trim().split_whitespace()
}

fn main() {
    let mut line = read!();
    let mut line = split(&mut line);
    let n: usize = line.next().unwrap().parse().unwrap();
    let m: i64 = line.next().unwrap().parse().unwrap();
    let mut v: Vec<(i64, i64)> = Vec::new();
    for i in 0..n {
        let mut line = read!();
        let mut line = split(&mut line);
        let a: i64 = line.next().unwrap().parse().unwrap();
        let b: i64 = line.next().unwrap().parse().unwrap();
        v.push((a, b));
    }
    v.sort_by_key(|k| k.0);
    let (mut ans, mut cur) = (0, 0);
    for &(a, b) in &v {
        let c = cmp::min(b, m - cur);
        ans += a*c;
        cur += b;
        if cur >= m { break; }
    }
    println!("{}", &ans);
}


Measured memory_bytes: 6396
alpha='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N=int(input())
S=str(input())
alpha_lst=[]
for i in range(len(S)):
    alpha_lst.append(int(alpha.index(S[i]))+1)
    alpha_lst[i]=(alpha_lst[i]+N-1)%26
for i in range(len(S)):
    print(alpha[alpha_lst[i]],end='')

Measured memory_bytes: 4596
import collections

N = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


c = collections.Counter(prime_factorize(N-1))
ans = 1
lis = make_divisors(N)

for i in c.values():
    ans *= i+1
ans -=1

for i in lis:
    if i==1:continue
    tmp = N
    while tmp%i==0:
        tmp //= i
    if tmp%i==1:
        ans+=1

print(ans)


Measured memory_bytes: 67660
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int k,a,b;
    cin >> k >> a >> b;
    reps(i,a,b+1){
        if(i % k == 0){
            cout << "OK" << endl;
            return 0;
        }
    }

    cout << "NG" << endl;

    return 0;
}

Measured memory_bytes: 3624
N,L = list(input().split())
N = int(N)
L = int(L)
m = []
for i in range(1,N+1):
  m.append(i+L-1)

#print(m)  
#inn =m.index(min(m))
z = (list(map(abs,m)))
inn = z.index(min(z))
     
#print(z)
del m[inn]
print(sum(m))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
int decode(string s){
    string str = "ixcm";
    int digit[] = {1,10,100,1000};
    int res = 0;
    rep(j,0,4){
        rep(i, 0, s.size()){
            if(s[i] == str[j]){
                int t = 1 * digit[j];
                if(i && s[i-1] >= '2' && s[i-1] <= '9'){
                    t *= s[i-1] - '0';
                }
                res += t;
            }
        }
    }
    return res;
}
string encode(int n){
    string res;
    string str = "mcxi";
    string ss = to_string(n);
    ss = string(4 - ss.size(), '0') + ss;
    //cout << ss << endl;
    rep(i,0,ss.size()){
        string sub;
        if(ss[i] == '0')continue;
        if(ss[i] != '1')sub.push_back(ss[i]);
        sub.push_back(str[i]);
        res += sub;
    }
    return res;
}
main(){
    int N;
    cin >> N;
    rep(i,0,N){
        string s,t;
        cin >> s >> t;
        int a = decode(s), b = decode(t);
        //cout << a << " " << b << endl;
        cout << encode(a + b) << endl;
    }
}


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

using namespace std;

int main() 
{
    int n, x, z, i;
    string y;
    cin >> n;
    
    map<string, int> m;
    
    for(i = 0; i < n; i++)
    {
        cin >> x >> y;
        
        if(x == 0)
        {
            cin >> z;
            m[y] = z;
        }
        else if(x == 1)
        {
            printf("%d\n", m[y]);
        }
        else if(x == 2)
        {
            m[y] = 0;
        }
    }
    
    return 0;
}


Measured memory_bytes: 27828
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int h[n];
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
	}
	int c[n]={0};
	c[1]=abs(h[1]-h[0]);
	for(int i=2;i<n;i++)
	{
		c[i]=INT_MAX;
	}
	for(int i=2;i<n;i++)
	{
		for(int j=1;j<=k;j++)
		{
			if(i-j>=0)
			c[i]=min(c[i],c[i-j]+abs(h[i]-h[i-j]));
			else
			break;	
		}		
	}
	cout<<c[n-1]<<endl;
	
	return 0;
}

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() int {
	sc.Scan()
	val, err := strconv.Atoi(sc.Text())

	if err != nil {
		fmt.Println(err)
	}
	return val
}

func scanSlice(val int) (arr []int) {

	for i := 0; i < val; i++ {
		arr = append(arr, next())
	}
	return
}

func main() {
	sc.Split(bufio.ScanWords)

	N := next()
	An := scanSlice(N)

	count := 0
	for i, v := range An {
		if (i+1)%2 == 1 && v%2 == 1 {
			count++
		}
	}
	fmt.Println(count)

}

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

int main()
{
    int a, b;
    int ans[4] = {0};

    for (int i = 0; i < 3; i++)
    {
        cin >> a >> b;
        ans[a - 1]++;
        ans[b - 1]++;
    }

    int c1 = 0;
    int c2 = 0;
    for (int i = 0; i < 4; i++)
    {
        if (ans[i] == 1)
        {
            c1++;
        }
        else if (ans[i] == 2)
        {
            c2++;
        }
    }

    if (c1 == 2 && c2 == 2)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define mod 10000000007
#define mod2 998244353
#define pb push_back
#define ru(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define vi vector<int>
#define mp make_pair
#define inp(a,n) ru(i,n){cin>>a[i];}
#define sv(v) sort(v.begin(),v.end())
#define sa(a) sort(a,a+size(a)/size(a[0]))
using namespace std;

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

const int mw=1e5+10;
ll dp[110][mw];

ll n,w,a[110],b[110];

ll po(ll a,ll b,ll m)
{	a%=m;
	ll res=1;
	while(b>0)
	{if(b&1)
	res=(res*a)%m;
	a=(a*a)%m;
	b>>=1;}
	return res;
}
ll inv(ll a,ll m)
{
	return po(a,m-2,m)%m;
}

ll solve(ll i,ll j)
{
	if(i>n||j==0)
	return 0;
	if(dp[i][j]!=-1)
	return dp[i][j];
	if(b[i]<=j)
	dp[i][j]=max(a[i]+solve(i+1,j-b[i]),solve(i+1,j));
	else
	dp[i][j]=solve(i+1,j);
	return dp[i][j];
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--)
	{
		memset(dp,-1,sizeof(dp));
		cin>>n>>w;
		ru(i,n)
		cin>>b[i+1]>>a[i+1];
		cout<<solve(1,w);
	}
return 0;
}


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

#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair

using namespace std;

typedef long long ll;

const int mod = (int)1e9 + 7;
const int N = (int)2e6 + 7;

int n,m;

int dp[301][301][301];
int ans;

 main () {
        cin >> n >> m;

        dp[0][1][1] = 1;

        for (int i = 0; i < m; i ++) {
                for (int j = 1; j <= n; j ++) {
                        for (int k = 1; k <= n; k ++) {
                                int cur = dp[i][j][k];
                                if (cur == 0)
                                        continue;

                                if (i < m - 1) {
                                        dp[i + 1][j + 1][k] += (cur * 1ll *(n - j)) % mod;
                                        dp[i + 1][j + 1][k] %= mod;

                                        dp[i + 1][j][k] += (cur * 1ll * (j - k)) % mod;
                                        dp[i + 1][j][k] %= mod;

                                        dp[i + 1][j][j] += (cur * 1ll * k) % mod;
                                        dp[i + 1][j][j] %= mod;
                                }
                                else {
                                        if (j == n)
                                                ans += (cur * 1ll * k) % mod,ans %= mod;
                                }
                        }
                }
        }
        cout << ans << endl;
}


Measured memory_bytes: 104704
N,K,Q = map(int,input().split())
seikaiList = [int(input()) for _ in range(Q)]
seikaiList2 = [0]*N
pointList = [K]*N
for seikai in seikaiList:
    seikaiList2[seikai-1] += 1

for i in range(N):
    if Q-seikaiList2[i]<K:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 9420
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
cnt = 0
for i, j in zip(a,b):
    if i > j:
        print(0)
        break
    if i < j:
        print(1)
        break
    cnt += 1
if cnt == len(b):
    print(0)
elif cnt == len(a):
    print(1)


Measured memory_bytes: 5624
#include <bits/stdc++.h>
 
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
 
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int maxn = 1e5+15;
const int mod = 1e9+7;
struct edge{
    int to,nxt;
}e[maxn<<1];
int n,k,u,v,cnt,head[maxn];
inline void add(int u,int v){
    e[++cnt] = (edge){v,head[u]};
    head[u] = cnt;
}
int num[maxn];
void dfs(int x,int fa){
    for(int i = head[x]; i;i = e[i].nxt){
        int v = e[i].to;
        if(v == fa) continue;
        num[x]++;
        dfs(v,x);
    }
}
void dfs2(int x,int fa,ll &res){
    ll t;
    if(x == 1) t = k-1;
    else t = k-2;
    for(int i = 1;i<=num[x]&&k;++i,--t)
            res = res*t%mod;
    for(int i = head[x];i;i=e[i].nxt){
        int v = e[i].to;
        if(v == fa) continue;
        dfs2(v,x,res);
    }
}
int main(){
    cin >> n>> k;
    for(int i = 1;i < n; ++i) {
        cin >> u >> v;
        add(u,v);
        add(v,u);
    }
    dfs(1,0);
    ll res = k;
    dfs2(1,0,res);
    cout << res << endl;
    return 0;
}

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

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

#[allow(dead_code)]
fn with_stdout_lock<F: FnOnce(std::io::BufWriter<std::io::StdoutLock>)>(f: F) {
    let out = std::io::stdout();
    let w = std::io::BufWriter::new(out.lock());
    f(w);
}

#[allow(unused_macros)]
macro_rules! debug {
    ($var:expr) => {
        match &$var { v => eprintln!(concat!(stringify!($var), "={:?}"), v) }
    };
    ($var:expr, $($vars:expr),*) => {
        match &$var { v => eprint!(concat!(stringify!($var), "={:?} "), v) }
        debug!($($vars),*);
    };
}

fn main() {
    let s: Vec<char> = input::<String>().chars().collect();
    let k: usize = input();

    for i in 0..std::cmp::min(k, s.len()) {
        if s[i] != '1' {
            println!("{}", s[i]);
            return;
        }
    }
    println!("1");
}


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

#define MOD 1000000007
#define MAX 100005
#define ll long long
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define vpii vector<pii >
#define vll vector<ll>
#define clr(x) memset(x,0,sizeof(x))

using namespace std;

int main(){
	int n;sd(n);
	vi v((n<<1));
	for(int i=1;i<=(n<<1);i++) sd(v[i-1]);
	sort(v.begin(),v.end());
	int ans=0;
	for(int i=0;i<v.size();i+=2) ans+=v[i];
	pd(ans);
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int k, x;
	cin >> k >> x;

	for (int i = 1; i <= 2 * k - 2; i++) {
		cout << x - k + i << " ";
	}
	cout << x + k - 1 << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long ll;


int main()
{
    int a[3][3],f[3][3];
    for(int i=0;i<3;i++)
    {
        scanf("%d %d %d",&a[i][0],&a[i][1],&a[i][2]);
        for(int j=0;j<3;j++)
        {
            f[i][j]=0;
        }
    }
    int n;
    scanf("%d",&n);
    int b;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&b);

        for(int i=0;i<3;i++)
        {
            for(int j=0;j<3;j++)
            {
                if(b==a[i][j])
                {
                    f[i][j]=1;
                }
            }
        }
    }

    int flag=0;

    for(int i=0;i<3;i++)
    {
        if(f[i][0]+f[i][1]+f[i][2]==3)
        {
            flag=1;
        }
        if(f[0][i]+f[1][i]+f[2][i]==3)
        {
            flag=1;
        }
    }
    if(f[0][0]+f[1][1]+f[2][2]==3)
    {
        flag=1;
    }
    if(f[0][2]+f[1][1]+f[2][0]==3)
    {
        flag=1;
    }
        

    if(flag==1)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
        
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mypair;
// c a b
typedef pair<ll,mypair> pa;
ll gcd(ll a,ll b){
if(b==0)return a;
else return gcd(b,a%b);
}

int main(){
ll n,ma,mb;
cin>>n>>ma>>mb;
vector<ll> a(n+1),b(n+1),c(n+1);
ll maxcost =0,maxa=0,maxb=0;
for(ll i=1;i<=n;i++){
cin>>a[i]>>b[i]>>c[i];
maxcost+=c[i];
maxa+=a[i];
maxb+=b[i];
}
vector<vector<vector<ll> > > make(maxa+1,vector<vector<ll> > (  maxb+1,vector<ll>(n+1,maxcost+1)));
//vector<ll> mincost(maxcost+1,maxcost+1);
vector<vector<bool> > used(maxa+1,vector<bool>(maxb+1,false));
used[0][0]=true;
make[0][0][0]=0;
for(ll i=1;i<=n;i++){
	for(ll j = 0;j<maxa;j++){
		for(ll k=0;k<maxb;k++){
			if(used[j][k]){
				make[j][k][i]=make[j][k][i-1];
			}
			if(j>=a[i]&&k>=b[i]&&make[j-a[i]][k-b[i]][i-1]!=maxcost){
				make[j][k][i]=min(make[j][k][i],make[j-a[i]][k-b[i]][i-1]+c[i]);
				used[j][k] = true;
			}
		}
	}
}
	
	ll ans =maxcost;
	ll nowa=ma,nowb=mb;
	while(nowa<=maxa&&nowb<=maxb){
	ans =	min(ans,make[nowa][nowb][n]);
	nowa+=ma;
	nowb+=mb;
//	cout<<nowa<<' '<<nowb<<' '<<make[nowa][nowb][n]<<endl;
	}
/*
cout<<endl;
	for(int i=0;i<maxa;i++){
		for(int j=0;j<maxb;j++){
			cout<< make[i][j][n]<<' ';
		}
	cout<<endl;
	}
	*/
	if(ans==maxcost)cout<<-1<<endl;
	else cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 20480
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;
int ans1 = 0 , ans2 = 0;
const int MAX = 100005;
vector<pair<int , pair<int , int> > > v;

int p[MAX];
int sz[MAX];
int n;
void addEdges(vector<pair<pair<int , int> , int> > &t)
{
	for(int i = 1; i < n; i++)
	{
		v.PB({min(abs(t[i].X.X - t[i - 1].X.X) , abs(t[i].X.Y - t[i - 1].X.Y)) , {t[i].Y , t[i - 1].Y} });
	}
}
int find(int u)
{
	if(p[u] == u)
		return u;
	return p[u] = find(p[u]);
}
void unite(int u , int v)
{
	if(find(u) == find(v))
		return;
	u = find(u);
	v = find(v);
	if(sz[u] > sz[v])
	{
		swap(u , v);
	}
	sz[v] += sz[u];
	p[u] = v;
}
		
int main()
{
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		p[i] = i;
		sz[i] = 1;
	}
	vector<pair<pair<int , int> , int> > t(n);
	for(int i = 0; i < n; i++)
	{
		cin >> t[i].X.X >> t[i].X.Y;
		t[i].Y = i;
	}
	sort(t.begin() , t.end());
	addEdges(t);
	reverse(t.begin() , t.end());
	addEdges(t);
	
	for(auto &x : t)
	{
		swap(x.X.X , x.X.Y);
	}
	sort(t.begin() , t.end());
	addEdges(t);
	reverse(t.begin() , t.end());
	addEdges(t);
	
	sort(ALL(v));
	int ans = 0;
	for(auto x : v)
	{
		if(find(x.Y.X) != find(x.Y.Y))
		{
			ans += x.X;
			unite(x.Y.X , x.Y.Y);
		}
	}
	cout << ans;
}


Measured memory_bytes: 10480
#include "bits/stdc++.h"
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i, n) for (int i = (int)(n) - 1; i >= 0; i--)
#define REPS(i, n) for (int i = 1; i <= (int)(n); i++)
#define RREPS(i, n) for (int i = (int)(n); i > 0; i--)
#define mp make_pair
#define pb(a) push_back(a)
typedef long long ll;
#define MAX_N 200000
int parent[MAX_N], r[MAX_N];

void Makeset(int n) {
  REP(i, n) {
    parent[i] = i;
    r[i] = 0;
  }
}

int Find(int x) {
  if (parent[x] == x) return x;
  else {
    return parent[x] = Find(parent[x]);
  }
}

void Union(int x, int y) {
  int xroot = Find(x);
  int yroot = Find(y);
  if (xroot == yroot) return;
  if (r[x] < r[y]) {
    parent[xroot] = yroot;
  } else {
    parent[yroot] = xroot;
    if (r[xroot] == r[yroot]) r[xroot]++;
  }
}

bool isUnion(int x, int y) {
  if (Find(x) == Find(y)) return true;
  else return false;
}

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> p(N + 1);
  REPS(i, N) cin >> p[i];
  Makeset(2 * N + 1);
  REPS(i, N) Union(i, N + p[i]);
  REP(i, M) {
    int x, y;
    cin >> x >> y;
    Union(N + p[x], N + p[y]);
  }
  int ans = 0;
  REPS(i, N) {
    if (isUnion(i, N + i)) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2176
#include<stdio.h>
#include<math.h>

double wau(double a,int n){
	a=a*pow(10,n-1);
	if(a>=0)a=(double)(int)(a+0.5);
	else a=(double)(int)(a-0.5);
	a=a*pow(10,-n+1);
	return a;
}

int main(){
  int a,b,c,d,e,f;
  double x,y;
  while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF){
	  y=(double)((f-(double)c*d/a)/(e-(double)b*d/a));
	  x=(double)((c-b*y)/a);
	  x=wau(x,4);
	  y=wau(y,4);
	  printf("%5.3f %5.3f\n",x,y);}
  return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()
#define dump(v) (cerr << #v << ": " << v << endl)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

vi E[1000100];

void dfs(int from, int to, int d, int distance[]) {
  distance[to] = d;
  for (int e : E[to]) {
    if (from != e)
      dfs(to, e, d + 1, distance);
  }
}

void solve(long long N, vector<long long> a, vector<long long> b) {

  REP(i, N - 1) {
    E[a[i]].push_back(b[i]);
    E[b[i]].push_back(a[i]);
  }

  int f[1000100] = {};
  fill(f, f + N, 1 << 25);
  int s[1000100] = {};
  fill(s, s + N, 1 << 25);

  dfs(-1, 0, 0, f);
  dfs(-1, N - 1, 0, s);

  ll ans = 0;
  REP(i, N) {
    ans += (f[i] <= s[i]) ? 1 : -1;

    cerr << i << "  " << f[i] << ":" << s[i] << endl;
  }

  cout << ((ans > 0) ? "Fennec" : "Snuke") << endl;
}

int main() {
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  vector<long long> a((N - 1) - 1 + 1);
  vector<long long> b((N - 1) - 1 + 1);
  for (int i = 0; i <= (N - 1) - 1; i++) {
    cin >> a[i];
    a[i]--;
    cin >> b[i];
    b[i]--;
  }
  solve(N, a, b);
  return 0;
}


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

void solve() {
	int n, m, ans = 0;
	cin >> n >> m;
	vector<vector<int> >s(m);
	vector<int>k(m), p(m);
	for (int i = 0; i < m; i++) {
		cin >> k[i];
		for (int j = 0; j < k[i]; j++) {
			int t;
			cin >> t;
			s[i].emplace_back(t - 1);
		}
	}
	for (int i = 0; i < m; i++)cin >> p[i];
	for (int i = 0; i < (1 << n); i++) {
		bool lightable = true;
		for (int j = 0; j < m; j++) {
			int cnt = 0;
			for (int l = 0; l < k[j]; l++) {
				if ((i >> s[j][l]) & 1) {
					cnt++;
				}
			}
			if (cnt % 2 != p[j])lightable = false;
		}
		if (lightable)ans++;
	}
	cout << ans << endl;
}

int main() {
	solve();
}

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

using ll = long long;

using namespace std;

using P = pair<int, int>;
#define fi first
#define se second

#define INF 10000000

int main() {
    int n;
    cin >> n;
    map<P, char> dir;
    map<int, vector<int>> x, y, xPy, xSy;
    for (int i=0; i<n; i++) {
        P p;
        char u; cin >> p.fi >> p.se >> u;
        dir[p] = u;
        x[p.fi].push_back(p.se);
        y[p.se].push_back(p.fi);
        xPy[p.fi+p.se].push_back(p.fi);
        xSy[p.fi-p.se].push_back(p.fi);
    }
    int ans = INF;
    for (auto &[xi, vi]:x) {
        sort(vi.begin(), vi.end());
        int umax = -INF;
        for (auto &yi:vi) {
            if (dir[P{xi, yi}] == 'U') umax = yi;
            if (dir[P{xi, yi}] == 'D' && umax > -INF) {
                ans = min(ans, (yi - umax) * 10 / 2);
            }
        }
    }
    for (auto &[yi, vi]:y) {
        sort(vi.begin(), vi.end());
        int rmax = -INF;
        for (auto &xi:vi) {
            if (dir[P{xi, yi}] == 'R') rmax = xi;
            if (dir[P{xi, yi}] == 'L' && rmax > -INF) {
                ans = min(ans, (xi - rmax) * 10 / 2);
            }
        }
    }
    for (auto &[xpy, vi]:xPy) {
        sort(vi.begin(), vi.end());
        int dmax = -INF, rmax = -INF;
        for (auto &xi:vi) {
            int yi = xpy - xi;
            if (dir[P{xi, yi}] == 'U' && rmax > -INF) {
                ans = min(ans, (xi - rmax) * 10);
            }
            if (dir[P{xi, yi}] == 'R') rmax = xi;
            if (dir[P{xi, yi}] == 'D') dmax = xi;
            if (dir[P{xi, yi}] == 'L' && dmax > -INF) {
                ans = min(ans, (xi - dmax) * 10);
            }
        }
    }
    for (auto &[xsy, vi]:xSy) {
        sort(vi.begin(), vi.end());
        int umax = -INF, rmax = -INF;
        for (auto &xi:vi) {
            int yi = xi - xsy;
            if (dir[P{xi, yi}] == 'U') umax = xi;
            if (dir[P{xi, yi}] == 'R') rmax = xi;
            if (dir[P{xi, yi}] == 'D' && rmax > -INF) {
                ans = min(ans, (xi - rmax) * 10);
            }
            if (dir[P{xi, yi}] == 'L' && umax > -INF) {
                ans = min(ans, (xi - umax) * 10);
            }
        }
    }
    if (ans < INF) cout << ans << '\n';
    else cout << "SAFE" << '\n';
    return 0;
}

Measured memory_bytes: 81308
#include <cstdio>
#include <iostream>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int a, b;

int main() {
	while(1) {
		cin >> a >> b;
		if(a == 0 &&  b == 0) break;
		rep(i,a) {
			rep(j,b) {
				if((i + j) % 2 == 0) cout << "#";
				else cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
days = {
  "SUN" : 0,
	"MON" : 1,
  "TUE" : 2,
  "WED" : 3,
  "THU" : 4,
  "FRI" : 5,
  "SAT" : 6
}

input_day = input()
for d in days:
  if input_day == d:
    print(7 - days.get(d))
    break

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

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define sz(x) int(x.size())
const ll mod = 1000000007;
const int INF = 100100100;

int main() {
    int n,q; cin >> n >> q;
    fenwick_tree<ll> fw(n);
    rep(i,n) {
        int a; cin >> a;
        fw.add(i,a);
    }

    rep(i,q) {
        int t; cin >> t;
        if (!t) {
            int p,x; cin >> p >> x;
            fw.add(p,x);
        } else {
            int l,r; cin >> l >> r;
            printf("%lld\n", fw.sum(l,r));
        }
    }
    return 0;
}

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

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

int main(){
    int n,x;cin>>n>>x;
    int l[n];
    REP(i,n){
        cin>>l[i];
    }
    int count=1,d=0;
    REP(i,n)
    {
        d+=l[i];
        if (d<=x)
        {
            /* code */
            count++;
        }
        else
        {
            break;
        }
        
        
    }
    cout<<count<<endl;
    }

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

using namespace std;

void Main() {
    string s;
    cin >> s;

    if (s[s.size() - 1] == 's') {
        cout << s + "es" << endl;
    }
    else{
        cout << s + "s" << endl;
    }
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

using namespace std;
int main(){
    int N;

    cin>>N;
    
    if(N%10 == 2 || N%10 == 4 || N%10 == 5 || N%10 == 7 || N%10 == 9){
        cout<<"hon\n";
    }
    else if(N%10 == 0 || N%10 == 1 || N%10 == 6 || N%10 == 8){
        cout<<"pon\n";
    }
    else{
        cout<<"bon\n";
    }
    

    return 0;
}



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

int main() {
	int n;cin >> n;
	vector<int> d(n);
	for(int i=0; i<n; i++){
		cin >> d[i];
	}

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

	int m = n/2;
	int ans = d[m]-d[m-1];

	if(n%2 != 0){
		cout << 0 << endl;
	}

	else{
		cout << ans << endl;
	}

	
}

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

int seki[30];

int main(){
	int buf;
	int ans[2];
	for (int a = 0; a < 28; a++){
		scanf("%d", &buf);
		seki[buf - 1] = 1;
	}
	for (int a = 0; a < 30; a++){
		if (seki[a] == 0){
			ans[0] = a + 1;
			break;
		}
	}
	for (int a = ans[0]; a < 30; a++){
		if (seki[a] == 0){
			ans[1] = a + 1;
			break;
		}
	}
	printf("%d\n%d\n", ans[0], ans[1]);
	return 0;
}

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

using namespace std;
using ll = long long;

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

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

  const ll mod = 1e9 + 7;
  vector<ll> dp(n + 1, 0);
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    if (find(a.begin(), a.end(), i) != a.end())
      continue;
    dp[i] += dp[i - 1];
    dp[i] %= mod;
    if (i > 1) {
      dp[i] += dp[i - 2];
      dp[i] %= mod;
    }
  }

  cout << dp[n] << endl;

  return 0;
}


Measured memory_bytes: 4436
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

#define N 100

using namespace std;

int main() {
    int a,b;
    scanf("%d%d", &a, &b);
    if(a>0) printf("Positive\n");
    else if (b>=0) printf("Zero\n");
    else if (a==b) printf("Positive\n");
    else if ((b-a+1)%2) printf("Negative\n");
    else printf("Positive\n");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}



int main() {
  ll N;
  cin >> N;
  ll l[2222];
  ll i, j;
  
  for(i=0; i<N; i++) {
    cin >> l[i];
  }
  sort(l, l+N);
  
  ll ans=0;
  for(i=0; i<N-1; i++) {
    for(j=i+1; j<N; j++) {
      ll a=l[i];
      ll b=l[j];
      
      ll p=lower_bound(l+j+1, l+N, a+b)-(l+j+1);
      ans+=p;
    }
  }
  
  pt(ans);
}

















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//約数列挙(√N)
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
//素因数分解(√N)
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
//素数テーブル(NloglogN)
vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}
//二項係数(K)
template< typename T >
T binomial(int64_t N, int64_t K) {
  if(K < 0 || N < K) return 0;
  T ret = 1;
  for(T i = 1; i <= K; ++i) {
    ret *= N--;
    ret /= i;
  }
  return ret;
}
//二項係数テーブル(N^2)
template< typename T >
vector< vector< T > > binomial_table(int N) {
  vector< vector< T > > mat(N + 1, vector< T >(N + 1));
  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= i; j++) {
      if(j == 0 || j == i) mat[i][j] = 1;
      else mat[i][j] = mat[i - 1][j - 1] + mat[i - 1][j];
    }
  }
  return mat;
}
int main(){
  int x ,y;
  cin >> x >> y;
  if(y%2!=0){
    cout << "No" << endl;
    return 0;
  }
  if(2*x-y/2>=0&&-x+y/2>=0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
  

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
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(){
    bool iftrue = false;
    vector<vector<ll>> c(3, vector<ll>(3));
    rep(i, 3){
        rep(j, 3){
            cin>>c[i][j];
        }
    }
    if(c[1][0] - c[0][0] == c[1][1] - c[0][1] && c[1][1] - c[0][1] == c[1][2] - c[0][2]){
        if(c[2][0] - c[1][0] == c[2][1] - c[1][1] && c[2][1] - c[1][1] == c[2][2] - c[1][2]){
            iftrue = true;
        }
    }
    if(iftrue) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
typedef long long ll;
using namespace std;

const int MAXN = 2e5+5;
const int MOD = 1e9+7;

int main()
{
    int n, k;
    int h[MAXN];
    ll ans = 0;
    scanf("%d%d", &n, &k);
    rep(i, 0, n-1)
        scanf("%d", &h[i]);
    if (n > k)
    {
        sort(h, h+n);
        rep(i, 0, n-k-1)
            ans += h[i];
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long k = sc.nextInt();
        long x = sc.nextInt();

        long min = x - (k - 1);
        long max = x + (k - 1);
        long judge = -1000000;
        if(min < judge){
        
            for(long i = judge; i< judge + k; i++){
                System.out.println(i);
            }
        }else{
             for(long i = min;i <= x;i++){
                System.out.println(i);
            }           
        }

        if(max > 1000000){
            for(long i = 1000000 -k ;i <= 1000000 ;i++){
                System.out.println(i);
            }
        }else{
            for(long i = x+1;i <= max;i++){
                System.out.println(i);
            }           
        }
    }
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x;
map<ll,ll> pos;
int main()
{
	scanf("%d",&x);
	for(ll i=1;i<=6200;++i) pos[i*i*i*i*i]=i;
	ll i;
	for(i=0;i*i*i*i*i<=x;++i) {
		ll f=pos[x-i*i*i*i*i];
		if(f!=0) {
			printf("%d ",i);
			printf("%d",-f);
			return 0;
		}
	}
	while(!pos[i*i*i*i*i-x]) ++i;
	printf("%lld %lld",i,pos[i*i*i*i*i-x]);
	return 0;
}

Measured memory_bytes: 4220
#include<stdio.h>
#include<string.h>
#define LEN 1000050

typedef struct pp{
  char name[100];
  int t;
}P;

void enqueue(P);
P dequeue(void);
int min(int,int);

P Q[LEN];
int head, tail, n;

void enqueue(P x){
  Q[tail] = x;
  tail = tail + 1;
}

P dequeue(){
  P x;
  x = Q[head];
  head = head + 1;
  return x;
}

int min(int a,int b){
  if(a < b) return a;
  else return b;
    }

int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d%d",&n,&q);

  for (i = 1; i <= n; i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);
  }

  head = 1;
    tail = n+1;
  
  while(head != tail){
    u = dequeue();
    c = min(q,u.t);
    u.t -= c;
    elaps +=c;

    if(u.t > 0){
      enqueue(u);
    }

    else printf("%s %d\n",u.name,elaps);
  }
  
  return 0;
}

Measured memory_bytes: 21076
N=int(input())
s=input()
S=[]
for i in s:
  S.append(int(i))

A=set()
B={S[-2]*10+S[-1]}
C={S[-1]}
C.add(S[-2])
for j in range(N-2):
  i=N-3-j
  for b in B:
    A.add(S[i]*100 + b)
  for c in C:
    B.add(S[i]*10 + c)
  C.add(S[i])
print(len(A))

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

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

    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++) ans += A[i]*A[j];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
S = input()
if S[K-1] == "A":
  S = S[:K-1] + "a" + S[K:] 
elif S[K-1] == "B":
  S = S[:K-1] + "b" + S[K:]
elif S[K-1] == "C":
  S = S[:K-1] + "c" + S[K:]


print(S)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, x;
  cin >> N >> K;
  x = 1;  
  for (int i = 0; i < N; i++) {
    if (x * 2 < x + K)
      x *= 2;
    else {
      x += K;
    }
  }
  cout << x << endl;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    int k, x;
    cin >> k >> x;
    for(int i=x-k+1; i<=x+k-1; i++){
        if(i<-1000000 || 1000000<i){
            continue;
        }
        else cout << i << " ";
    }
    cout << endl;

}

Measured memory_bytes: 3600
// Copyright lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef std::pair<int, int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef std::pair<long long, long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i, j, k)  for (register int i = (int)(j); i <= (int)(k); i++)
#define rrep(i, j, k) for (register int i = (int)(j); i >= (int)(k); i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

inline ll read() {
  ll x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = 10 * x + ch - '0';
    ch = getchar();
  }
  return x * f;
}

const int mod = 1e9 + 7;
const int mxst = (1 << 22) + 10;
const int maxn = 25;
int n;
int a[maxn][maxn];
int f[maxn][mxst];

void work() {
  n = read();
  rep(i, 1, n) rep(j, 1, n) a[i][j] = read();
  f[0][0] = 1;
  rep(i, 1, n) {
    rep(j, 0, (1 << n) - 1) {
      if (f[i - 1][j] == 0) continue;
      rep(k, 1, n) {
        if (j & (1 << (k - 1))) continue;
        if (!a[i][k]) continue;
        (f[i][j + (1 << (k - 1))] += f[i - 1][j]) %= mod;
      }
    }
  }
  printf("%d\n", f[n][(1 << n) - 1]);
}

int main() {
  #ifdef LZT
    freopen("in", "r", stdin);
  #endif

  work();

  #ifdef LZT
    Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
  #endif
}


Measured memory_bytes: 178432
#include<iostream>
#include<cctype>
#include<stdio.h>
using namespace std;
int main(){
    char ch;
    while(1){
        scanf("%c", &ch);
        if(islower(ch)){
            ch = toupper(ch);
        }else if(isupper(ch)){
            ch = tolower(ch);
        }
        cout << ch;
        if (ch == '\n') break;
    }
    return 0;
}



Measured memory_bytes: 3148
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <set>
#include <unordered_set>
#include <vector>
#include<valarray>
#include<map>
#include <bits/stdc++.h>
#include <utility>
#include<bits/stdc++.h>
using namespace std;

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

for(int i=1;i<=n;i++)
{
   if(a[i]%2!=0&&i%2!=0)
   {
       sum ++;
     
   }


}
cout<<sum;
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>

template <class T>
inline void read(T &x) {
    x = 0;
    int f = 0;
    char ch = getchar();
    while (!isdigit(ch))    { f |= ch == '-'; ch = getchar(); }
    while (isdigit(ch))     { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    x = f ? -x : x;
    return;
}

int a[200010];
int n, x;

int main() {
    read(n);
    for (int i = 1; i < n; ++i) {
        read(x);
        ++a[x];
    }
    for (int i = 1; i <= n; ++i)    printf("%d\n", a[i]);
    return 0;
}

Measured memory_bytes: 4536
def main():
    n = iread()
    h = aread()
    cnt = 0
    i = 0
    while i < n:
        tmpcnt = 0
        while i + 1 < n and h[i + 1] <= h[i]:
            tmpcnt += 1
            i += 1
        i += 1
        cnt = max(tmpcnt, cnt)
    print(cnt)


def iread():
    return int(input())


def sread():
    return input()


def aread(t="int"):
    if t == "int":
        ret = [int(i) for i in input().split()]
    elif t == "str":
        ret = list(input())
    return ret


def scan():
    return list(map(int, input().split()))


if __name__ == '__main__':
    main()


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

int main () {
	
	int n=0, l=0, i=0, v=0, x=0, chico = INT_MAX, signo=0;

	cin >> n >> l;

	for (i=1; i<=n; i++) {
		v = l+i-1;
		x += v;
		v = abs(v);
		chico = min(chico, v);

		if (chico == v) {
			v = l+i-1;
			if (v>=0) signo = 1;
			else signo = -1;
		}
	}

	//if (n >= l) x-=chico;
	//else x += chico;

	x -= (chico*signo);
	cout << x << endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
#define f2(i,j,k) for(int i=j;i>k;i--)
using namespace std;
int main(){
    long long n,ans=0;
    cin>>n;
    vector <long long> a(n+1,0);
    f(i,1,n+1){
        cin>>a[i];
    }
    f(i,1,n+1){
        if(a[a[i]]==i){
            ans++;
        }
    }
    cout<<ans/2<<endl;
    return 0;
}


Measured memory_bytes: 4048