akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
#define SHOWA(x,n) for( int yui = 0; yui < n; yui++ ){ cout << x[yui] << " "; } cout << endl

#define pb emplace_back
#define fi first
#define se second

using namespace std;

typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
     
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-12;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }

ll in(){ long long int x; scanf( "%lld" , &x ); return x; }
char yuyushiki[1000010]; string stin(){ scanf( "%s" , yuyushiki ); return yuyushiki; }

// head

int main(){

  int n = in();
  int m = in();
  int k = in();

  REP( i , n+1 ){
    REP( j , m+1 ){
      if( i * m + j * n - 2 * i * j == k ){
        puts( "Yes" );
        return 0;
      }
    }
  }

  puts( "No" );
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream> 
#include <stdlib.h> 
#include <string.h> 
#include <string> 
#include <sstream>
#include <cstring> 
#include<cmath>
using namespace std;
int main()
{
	int x, y, z;
	cin >> x >> y >> z;
	if (z < x)
		cout << "NO";
	else if (z>x&&x+y<z)
		cout << "NO";
	else 
		cout << "YES";
}

Measured memory_bytes: 3604
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T b,T a){if(a<b){a^=b;b^=a;a^=b;return 1;}return 0;}

ll r;
void input(){
    cin>>r;
}
void src(){
    cout<<3*r*r;
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
/* ITP1_1_D: Watch */

/* 20181118 AOJ */

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

int main(void){
	int time, h, m, s;

	scanf("%d", &time);
	h = time / 3600;
	m = (time / 60) % 60;
	s = (time % 3600) % 60;
	printf("%d:%d:%d\n", h, m, s);

	return 0;
}


Measured memory_bytes: 1968
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int result = -1;

        for(int i = 0;i<1010;i++) {
            if( (int)(i*0.1) == B && (int)(i*0.08) == A){
                result = i;
                break;
            }
        }
        System.out.println(result);
    }
}

Measured memory_bytes: 23124
#include<stdio.h>
#define NUMBER 100
int main(void){
    int i,n,a[NUMBER];
    scanf("%d",&n);
    for(i=0;i<n;i++){
       scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++){
       printf("%d",a[n-1-i]);
       if(i<(n-1))
         putchar(' ');
    }
    putchar('\n');
    return 0;
}


Measured memory_bytes: 2132
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,a[100];
  cin >> n; 
  for(int i=0; i<n; i++) {
    cin >> a[i];
  }
  sort(a,a+n);
  cout << a[n-1]-a[0] << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
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; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;

lint N;
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N;
	FOR(h, 1, 3501) {
		FOR(w, 1, 3501) {
			if ((4 * h * w - N * h - N * w) <= 0) continue;
			if ((N * h * w) % (4 * h * w - N * h - N * w) == 0) {
				cout << h << " " << w << " " << (N * h * w) / (4 * h * w - N * h - N * w) << endl;
				return 0;
			}
		}
	}
}


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

// using i32 = std::int_fast32_t;
// using i64 = std::int_fast64_t;
using i32 = int;
using i64 = long long;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)
#define RREP(i, n) for (int i = n; i-- > 0;)
#define ALL(v) (v).begin(), (v).end()

template<typename T> istream& operator>>(istream& is, vector<T>& a) { for (T& x : a) is >> x; return is; }

// struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); } } initCpp;

signed main() {
  i32 x, y, z, k;
  scanf("%d%d%d%d", &x, &y, &z, &k);
//  cin >> x >> y >> z >> k;
  vector<i64> A(x), B(y), C(z);
  REP(i, x) scanf("%lld", &A[i]);
  REP(i, x) scanf("%lld", &B[i]);
  REP(i, x) scanf("%lld", &C[i]);
//  cin >> A >> B >> C;
  sort(ALL(A), greater<i64>());
  sort(ALL(B), greater<i64>());
  sort(ALL(C), greater<i64>());
  using T = tuple<i32, i32, i32>;
  using P = pair<i64, T>;
  priority_queue<P> Q;
  Q.push({A[0] + B[0] + C[0], make_tuple(0, 0, 0)});
  set<T> S;
  S.insert(make_tuple(0, 0, 0));
  REP(_, k) {
    i64 p = Q.top().first;
    i32 u, v, w;
    tie(u, v, w) = Q.top().second;
    Q.pop();
    cout << p << endl;
    auto u1 = make_tuple(u + 1, v, w);
    auto v1 = make_tuple(u, v + 1, w);
    auto w1 = make_tuple(u, v, w + 1);
    if (u + 1 < x && !S.count(u1)) { S.insert(u1); Q.push({A[u + 1] + B[v] + C[w], u1}); }
    if (v + 1 < y && !S.count(v1)) { S.insert(v1); Q.push({A[u] + B[v + 1] + C[w], v1}); }
    if (w + 1 < z && !S.count(w1)) { S.insert(w1); Q.push({A[u] + B[v] + C[w + 1], w1}); }
  }
}

Measured memory_bytes: 896
import sys
h=['light ','']
for e in sys.stdin:
 e=float(e)
 for i in range(7):
  if[81,69,60,57,54,51,0][i]<e:print([h[e>91]+'heavy',h[e>75]+'middle',h[e>64]+'welter',h[0][:-1],'feather','bantam',h[e>48]+'fly'][i]);break


Measured memory_bytes: 5584
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
vector<vector<ll> >ans(2001,vector<ll>(2001,INT_MAX));

int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n,x,y;
    cin>>n>>x>>y;
    vector<vector<ll> >arr(n+1);
    for(ll i = n; i>1 ;i--){
        arr[i].pb(i-1);
        arr[i-1].pb(i);
    }
    arr[y].pb(x);
    arr[x].pb(y);
    /*for(ll i=0;i<=n;i++)
    {
        for(ll j=0;j<arr[i].size();j++)
            cout<<arr[i][j]<< " ";
        cout<<endl;
    }*/
    for(ll i=1;i<=n;i++)
    {
        queue<pair<ll,ll> >q;
        q.push(mp(i,1));
        vector<ll>vis(n+1);
        vis[i] = 1;
        while(!q.empty())
        {
            ll fi = q.front().first;
            ll se = q.front().second;
            q.pop();
            for(ll k=0;k<arr[fi].size();k++)
            {
                if(vis[arr[fi][k]] == 1)
                    continue;
                ans[i][arr[fi][k]] = min(se,ans[i][arr[fi][k]]);
                q.push(mp(arr[fi][k],se+1));
                vis[arr[fi][k]] = 1;
            }
        }
    }
    vector<ll>output(n+1);
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i+1;j<=n;j++)
            output[ans[i][j]]++;
    }
    for(ll i=1;i<n;i++)
        cout<<output[i]<<endl;
}


Measured memory_bytes: 31744
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

int main(){
	ll a,b,c,d;
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	ll ans=-INF;
	ans=max(ans,a*c);
	ans=max(ans,a*d);
	ans=max(ans,b*c);
	ans=max(ans,b*d);
	if(a<=0&&0<=b||c<=0&&0<=d)ans=max(ans,0);
	printf("%lld",ans);
}

Measured memory_bytes: 1672
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;

#define F(i , a , b) for(int (i) = (a) ; (i) <= (b) ; (i)++)
#define pb push_back
#define ll long long
#define E(a) cerr << #a << " = " << a << '\n'
#define X first
#define Y second
#define INF 10000000000000
#define int long long
const int MAX_N = 100000 + 10 , mod = 1000000007;


int n,ans=1;

bool p(int x){
	if(x == 1) return false;
	for(int i =2; i<=sqrt(x) ; i++){
		if(x% i ==0 )return false;
	}
	return true;
}
int num(int x){
	int d =0 ,k=x;
	while(k<=n){
		d+=n/k;
		k*=x;
	}
	return d;
}
int32_t main(){
    
    //    freopen("input.txt" , "r" , stdin);
    //    freopen("output.txt" , "w" , stdout);
    //    cout << setprecision(10) << fixed;
    ios::sync_with_stdio(0); cin.tie() ; cout.tie(); 
    

    cin >> n;
    for(int i = 2 ;i<=n ; i++){
    	if(p(i)){
    		ans *= (num(i)+1);
    		ans%=mod;
    	}
    }
    cout << ans;



    
    
    
    
    
    
    return 0;
}


Measured memory_bytes: 256
import sys


def solv(matrix):
    for row in matrix:
        s = sum(row)
        row.append(s)
    r = []
    l = len(matrix[0])
    for c in range(l):
        column = map(lambda x: x[c], matrix)
        sc = sum(column)
        r.append(sc)
    matrix.append(r)
    return matrix


while True:
    n = int(sys.stdin.readline())
    if n == 0:
        exit()
    matrix = []
    for i in range(n):
        line = sys.stdin.readline()
        row = map(int, line.split(' '))
        matrix.append(row)
    matrix2 = solv(matrix)
    for row in matrix2:
        print ''.join(map(lambda x: str(x).rjust(5), row))

Measured memory_bytes: 4260
#include <stdio.h>
#include <stdlib.h>
#include<math.h>

int main(void) {
	int a,b,c,k,aa,ba,ca;
	scanf("%d%d%d",&a,&b,&c);
	scanf("%d",&k);
	for(int i=0;i<=k;i++){//a
		for(int j=0;j<=k-i;j++){//b
			for(int ij=0;ij<=k-i-j;ij++){//c
				if(i==0)aa=a;
				else aa=a*pow(2,i);
				if(j==0)ba=b;
				else ba=b*pow(2,j);
				if(ij==0)ca=c;
				else ca=c*pow(2,ij);
				//printf("i:%d,j:%d,ij:%d,aa:%d,ba:%d,ca:%d\n",i,j,ij,aa,ba,ca);
				if(ba>aa && ca>ba){
					printf("Yes");
					return 0;
				}
			}
		}
	}
	printf("No");
	return 0;
}


Measured memory_bytes: 2540
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> v;
    int num1 = 0,num2 = 0,count = 0;
    for(int i = 0;i < n;i++)
    {
        int x;
        cin >> x;
        v.push_back(x);
        if(x >= num1)
        {
            if(num1 == x)
            {
                count++;
            }
            else
            {
                count = 0;
            }
            num2 = num1;
            num1 = x;
        }
        else if(x > num2)
        {
            num2 = x;
        }
    }
    for(int i = 0;i < n;i++)
    {
        if(count || v.at(i) < num1)
        {
            cout << num1 << "\n";
        }
        else
        {
            cout << num2 << "\n";
        }
    }
    
    return 0;
}

Measured memory_bytes: 2548
import java.util.*;

class Main{
	public static void main(String[] $){
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();

		int[] a=new int[n];
		Arrays.setAll(a,i->Integer.parseInt(s.next()));
		Arrays.sort(a);
		int b=a[0],c=a[n-1];

		int l=1,r=n-2;

		long v=c-b;

		while(l<=r){
			int w=0;
			w=Math.max(w,Math.abs(b-a[l]));
			w=Math.max(w,Math.abs(b-a[r]));
			w=Math.max(w,Math.abs(c-a[l]));
			w=Math.max(w,Math.abs(c-a[r]));
			v+=w;
			//System.err.println(w);
			if(w==Math.abs(b-a[l])){
				b=a[l++];
				continue;
			}
			if(w==Math.abs(b-a[r])){
				b=a[r--];
				continue;
			}
			if(w==Math.abs(c-a[l])){
				c=a[l++];
				continue;
			}
			if(w==Math.abs(c-a[r])){
				c=a[r--];
				continue;
			}
		}
		System.out.println(v);
	}
}


Measured memory_bytes: 50896
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

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

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

ll myPow(ll x, ll n, ll 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;
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;
 
	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}
 
	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}
 
	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい]
	}
 
	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}
 
		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);
 
		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;
 
		return true;
	}
};




long long fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {
  // 前処理
  //COMinit();

  ll N;
  cin>>N;
  ll ans=0;
  ll made =sqrt(N+1);

 made--;

  FOR(i,1,made){

    if(N%i==0){
      ans= ans + (N/i)-1;
    }

  }

  cout<<ans<<endl;

  return 0;
 
}


Measured memory_bytes: 256
line = input().split()
N = int(line[0])
A = int(line[1])
B = int(line[2])
S = input()

ab = 0
bb = 0
for c in S:
    b = False
    if c == 'a' and ab < A + B:
        b = True
        ab += 1
    elif c == 'b' and ab < A + B and bb < B:
        b = True
        ab += 1
        bb += 1
    print("Yes" if b else "No")


Measured memory_bytes: 58072
#include <stdio.h>
#define MAX 1000000

int binarySearch(int);
int A[MAX];
int n;

int main(){
  int i,q;
  int key,result = 0;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for( i = 0; i < q; i++){
    scanf("%d",&key);
    if(binarySearch(key)){ /**/
      result++;
    }
  }
  printf("%d\n",result);
  //printf("\n");
  return 0;
}

int binarySearch(int key){
  int left = 0, right = n;
  int mid;
  while(left < right){
    mid = (left + right)/2;
    if(key == A[mid]){
      return 1;
    }
    if(key > A[mid]){
      left = mid + 1;
    }
    else if(key < A[mid]){
      right = mid;
    }
  }
  return 0;
}

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

#define endl "\n"
#define sz(x) (int)(x).size()

const int MOD = 1e9 + 7;

#define int long long
using namespace std;

string k;
int d;
int dp[10010][110][2];

void add(int &a, int b) {
    a = a + b;
    if (a >= MOD)
        a -= MOD;
}

int digitdp(int pos, int sum, bool flag) {
    if (pos == sz(k)) {
        return (sum == 0);
    }
    int &res = dp[pos][sum][flag];

    if (res != -1)
        return res;

    res = 0;
    int limit = 9;

    if (!flag) limit = (int) (k[pos] - '0');

    for (int i = 0; i <= limit; i++) {
        bool current_flag = flag;

        if (!current_flag && i < limit) current_flag = true;

        add(res, digitdp(pos + 1, (sum + i) % d, current_flag));
    }
    return res ;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin >> k >> d;
    memset(dp, -1, sizeof(dp));

    int z = digitdp(0, 0, false) - 1;
    z = (z + MOD) % MOD;
    cout << z << endl;
    return 0;
}

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

using namespace std;
using ll = long long int;
constexpr ll M = 1e9 + 7;
inline ll sum_1(const ll n) { return ((n * (n + 1)) / 2) % M; }
inline ll sum_2(const ll n) { return ((n * (n + 1) * (2 * n + 1)) / 6) % M; }
inline ll sum_3(const ll n) { return (((n * (n + 1)) / 2) % M * ((n * (n + 1)) / 2) % M) % M; }
inline ll sum_1(const ll i, const ll j) { return (sum_1(j) - sum_1(i - 1) + M) % M; }
inline ll sum_2(const ll i, const ll j) { return (sum_2(j) - sum_2(i - 1) + M) % M; }
inline ll sum_3(const ll i, const ll j) { return (sum_3(j) - sum_3(i - 1) + M) % M; }

void solve() {
    int n, k, c;
    string s;
    cin >> n >> k >> c >> s;

    /**
     * 
     * Find the least time if he need to work
     * Find the highest time if he need to work
     * If they coincide he needs to work
     * 
     * 
     * 
     */

    vector<int> isLowerBound(n, -1);
    vector<int> isUpperBound(n, -1);

    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'o' && cnt < k) {
            isLowerBound[i] = cnt;
            i += c;
            ++cnt;
        }
    }
    assert(cnt==k);
    cnt = k-1;
    for (int i = n-1; i >= 0; --i) {
        if (s[i] == 'o' && cnt >= 0) {
            isUpperBound[i] = cnt;
            i -= c;
            --cnt;
        }
    }
    assert(cnt==-1);

    for (int i = 0; i < n; ++i) {
        if (isLowerBound[i] == isUpperBound[i] && isLowerBound[i] != -1) {
            cout << i+1 << endl;
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef D_LOCAL
        freopen("in.in", "r", stdin);
        freopen("out.out", "w", stdout);
    #endif

    solve();

    return 0;
}

Measured memory_bytes: 3348
import sys
from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, *A = map(int, read().split())

memo = defaultdict(int)  # 0で初期化する
answer = 0
for idx, x in enumerate(A, 1):  # indexを1から始める
    # i<jを満たしながらansを計算
    # idx = 1の時はansが増えることはない
    # idx = 2の時は、idx = 1の時の結果がmemoに記録されている
    # idx = 3の時は、idx=1,2の結果が記録されている
    # 以下同様
    answer += memo[idx - x]
    memo[idx + x] += 1

print(answer)


Measured memory_bytes: 61560
import java.sql.SQLOutput;
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true) {
            int n = sc.nextInt();
            int[] x = new int[n];
            int sum=0;
            double bun=0.0;
            if(n==0){
                break;
            }else{
                for(int i=0 ; i<n ; i++){
                    x[i] = sc.nextInt();
                    sum += x[i];
                }
                double ave = sum/(double)n;
                for(int i=0 ; i<n ; i++){
                    bun += (x[i]-ave)*(x[i]-ave);
                }
                System.out.println(Math.sqrt(bun/(double)n));
            }
        }
    }
}



Measured memory_bytes: 32132
s=int(input())
def calc(n):
  if n % 2 == 0:
    return n / 2
  else:
    return 3*n +1
ans = []
ans.append(s)
for i in range(1000001):
  if calc(ans[i]) in ans:
    print(len(ans) +1)
    exit()
  else:
    ans.append(int(calc(ans[i])))

Measured memory_bytes: 9184
import std.stdio;
import std.string;
import std.conv;
import std.math;

void main() {
	string[] inputs = split(readln());
	int a = to!int(inputs[0]);
	int b = to!int(inputs[1]);
	
	real m = (a + b) / 2.;
	writeln(format("%s", ceil(m)));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 3e5 + 5;
unordered_map<int,int> Qx , Qy;
vector<int> X [maxn];
int main()
{
    ios::sync_with_stdio(false);
    int h , w, n ; cin >> h >> w >> n;
    pair<int,int> res;
    for (int i = 1 ; i <= n ; i++){
        int x , y; cin >> x >> y;
        Qx[x]++;
        res.first = max (res.first , Qx[x]);
        Qy[y]++;
        res.second = max (res.second , Qy[y]);
        X[x].push_back(y);
    }
    int ans = res.first + res.second - 1;
    unordered_set<int> goodY;
    for (auto g : Qy) {
        if (g.second == res.second){
            goodY.insert(g.first);
        }
    }
    unordered_set<int>temp;
    for (auto g : Qx){

        if (g.second == res.first){
            temp.clear();
            // 看最优解的这条线上是否有点不在最优解Y上
            for (auto k : X[g.first]){
                temp.insert(k);
            }
            bool all = false;
            for (auto k : goodY){
                if (temp.find(k) == temp.end()){
                    all = true;
                    break;
                }
            }
            if (all){
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 60580
x, y, a, b, c = map(int, input().split())
red = [int(x) for x in input().split()]
green = [int(x) for x in input().split()]
red.sort(reverse=True)
green.sort(reverse=True)
candidates = [int(x) for x in input().split()] + red[:x] + green[:y]
candidates.sort(reverse=True)
print(sum(candidates[:x+y]))

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

using namespace std;

int main() {

	long long  r, D,x ;
	cin >> r >> D >>x;
	long long hozon;

	for (int i = 0; i < 10; i++)
	{


		x = r * x - D;
		cout << x << endl;

	}
	
	
	
	return 0;
}

Measured memory_bytes: 256
from collections import deque

n = int(input())
adj = [[]]
for i in range(n):
    adj.append(list(map(int, input().split()))[2:])

ans = [-1]*(n+1)
ans[1] = 0

q = deque([1])
visited = [False] * (n+1)
visited[1] = True

while q:
    x = q.popleft()
    for y in adj[x]:
        if visited[y] == False:
            q.append(y)
            ans[y] = ans[x]+1
            visited[y] = True

for j in range(1, n+1):
    print(j, ans[j])


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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

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

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

char BigAlphaToSmall(char a){
    if (a >= 65 && a <= 90){
        return a + 32;
    }
    return a;
}

char SmallAlphaToBig(char a){
    if (a >= 97 && a <= 122){
        return a - 32;
    }
    return a;
}

double Distance(double x1, double y1, double x2, double y2){
    return pow(pow(x1 - x2, 2.0) + pow(y1 - y2, 2.0), 0.5);
}

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

    while(true){
        cin >> n;
        if(n == 0) break;
        vector<int> hoge(n);

        rep_i(i, n){
            cin >> hoge[i];
        }
        
        double s = sum_vi(hoge);
        double m = s/double(n);

        double e = 0;
        for (int i = 0; i < n; i++){
            e += pow(double(hoge[i]) - m, 2.0);
        }

        cout << fixed << setprecision(10);
        cout << pow(e/n, 0.5) << endl;
    }
}


Measured memory_bytes: 3488
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll inf=-9e18;
struct node
{
	ll sum,maxn,tag;
};
struct node1
{
	ll l,a;
};
node t[800080];
ll n,m,sum;
vector <node1> q[200020];
void build(ll l1,ll r1,ll p)
{
	t[p].tag=0;
	if(l1==r1)
	{
		t[p].sum=0;
		t[p].maxn=0;
		return ;
	}
	ll mid=(l1+r1)>>1;
	build(l1,mid,p<<1);
	build(mid+1,r1,p<<1|1);
}
void pushdown(ll l1,ll r1,ll p)
{
	ll mid=(r1+l1)>>1;
	t[p<<1].sum+=(mid-l1+1)*t[p].tag;
	t[p<<1].maxn+=t[p].tag;
	t[p<<1].tag+=t[p].tag;
	t[p<<1|1].sum+=(r1-mid)*t[p].tag;
	t[p<<1|1].maxn+=t[p].tag;
	t[p<<1|1].tag+=t[p].tag;
	t[p].tag=0;
}
void plu(ll l1,ll r1,ll p,ll l2,ll r2,ll k)
{
	if(l1>r2 || r1<l2)
		return ;
	if(l1>=l2 && r1<=r2)
	{
		t[p].maxn+=k;
		t[p].sum+=(r1-l1+1)*k;
		t[p].tag+=k;
		return ;
	}
	ll mid=(l1+r1)>>1;
	pushdown(l1,r1,p);
	plu(l1,mid,p<<1,l2,r2,k);
	plu(mid+1,r1,p<<1|1,l2,r2,k);
	t[p].sum=t[p<<1].sum+t[p<<1|1].sum;
	t[p].maxn=max(t[p<<1].maxn,t[p<<1|1].maxn);
}
void insert(ll l1,ll r1,ll p,ll p1,ll k)
{
	if(l1>p1 || r1<p1)
		return ;
	if(l1==r1)
	{
		t[p].sum=t[p].maxn=k;
		return ;
	}
	ll mid=(l1+r1)>>1;
	insert(l1,mid,p<<1,p1,k);
	insert(mid+1,r1,p<<1|1,p1,k);
	t[p].sum=t[p<<1].sum+t[p<<1|1].sum;
	t[p].maxn=max(t[p<<1].maxn,t[p<<1|1].maxn);
}
ll quary(ll l1,ll r1,ll p,ll l2,ll r2)
{
	if(l1>r2 || r1<l2)
		return inf;
	if(l1>=l2 && r1<=r2)
		return t[p].maxn;
	ll mid=(l1+r1)>>1,res;
	pushdown(l1,r1,p);
	res=max(quary(l1,mid,p<<1,l2,r2),quary(mid+1,r1,p<<1|1,l2,r2));
	return res;
}
void search(ll l1,ll r1,ll p,ll l2,ll r2)
{
	if(l1==r1)
	{
		cout<<l1<<' '<<t[p].sum<<endl;
		return ;
	}
	cout<<l1<<' '<<r1<<' '<<t[p].sum<<' '<<t[p].maxn<<' '<<t[p].tag<<endl;
	ll mid=(l1+r1)>>1;
	pushdown(l1,r1,p);
	search(l1,mid,p<<1,l2,r2);
	search(mid+1,r1,p<<1|1,l2,r2);
}
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		node1 x;
		ll r1;
		cin>>x.l>>r1>>x.a;
		q[r1].push_back(x);
		sum+=x.a;
	}
	build(0,n+1,1);
	for(int i=1;i<=n+1;i++)
	{
		for(int j=0;j<q[i-1].size();j++)
		{
		//	cout<<q[i][j].a<<endl;
			plu(0,n+1,1,0,q[i-1][j].l-1,-q[i-1][j].a);
		}
		insert(0,n+1,1,i,quary(0,n,1,0,i-1));
	//	search(0,n+1,1,0,n+1);
	}
	cout<<sum+quary(0,n+1,1,0,n+1)<<endl;
//	search(0,n+1,1,0,n+1);
	return 0;
}


Measured memory_bytes: 24960
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define PI 3.14159265359

int N,W;
int w[100], v[100];
LL dp[100][1000*100+1]; //i日目までに価値の合計をjにしたときの重さの最小値

int main(){
	cin >> N >> W;
	for(int i=0; i<N; i++){
		cin >> w[i] >> v[i];
		for(int j=0; j<=1000*N; j++) dp[i][j] = INT_MAX;
	}
	
	dp[0][0] = 0;
	dp[0][v[0]] = w[0];
	for(int i=1; i<N; i++){
		for(int j=0; j<=1000*N; j++){
			dp[i][j] = min(dp[i-1][j], (j-v[i]>=0 ? dp[i-1][j-v[i]] + w[i] : INT_MAX));
		}
	}

	int ans = 0;
	for(int i=0; i<=1000*N; i++){
		if(dp[N-1][i] <= W) ans = max(ans, i);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 78336
import std.stdio;

int main(){
	int a, b;
	readf("%d %d", &a, &b);
	if((a>=1) && (b<=10000)){
		if(a * b % 2 == 0){
			"Even".writeln;
		}else{
			"Odd".writeln;
		}
	}
	return 0;
}

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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007

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

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

string s;

int main(){
	cin >> s;
	int a[6];
	a[0] = int(s[0]-'0');
	a[1] = int(s[1]-'0');
	a[2] = int(s[2]-'0');
	a[3] = int(s[3]-'0');
	for(int i=0;i<=7;i++){
		int sum;
		sum = a[0];
		string l;
		for(int j=0;j<=2;j++){
			if(i>>j & 1){
				l[j] = '-';
			}else{
				l[j] = '+';
			}
		}
		for(int j=0;j<=2;j++){
			if(i>>j & 1){
				sum -= a[j+1];
			}else{
				sum += a[j+1];
			}
		}
		if(sum==7){
			cout << a[0] << l[0] << a[1] << l[1] << a[2] << l[2] << a[3] << "=7" << endl;		
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n, t;
    cin >> n >> t;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    sort(v.begin(),v.end());
    ll ans = 1;
    for (int i = 0; i < n; ++i) {
        (ans *= (v.begin()+i+1-lower_bound(v.begin(),v.end(), v[i]-t))) %= MOD;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3456
sx, sy, gx, gy = list(map(int,input().split()))

x = gx-sx
y = gy-sy

ans = ""
ans += "U"*y
ans += "R"*x
ans += "D"*y
ans += "L"*x
ans += "L" + "U"*(y+1)
ans += "R"*(x+1) + "D"
ans += "R" + "D"*(y+1)
ans += "L"*(x+1) + "U"

print(ans)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 100001
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define REP(i, n) for(int i=0; i<n; i++)
#define RER(i, n) for(int i=n-1; i>=0; i--)
#define ALL(v) v.begin() v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int a, b, c, d;

signed main(){
    cin >> a >> b >> c >> d;
    cout << max(min(b, d) - max(a, c), 0) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {


        int x = sc.nextInt();

        long ans = 0;

        long tmp500 = x/500 * 1000;
        long diff = x - 500 * (x/500);
        long tmp5 = diff/5 * 5;


        out.print(tmp500+tmp5);
        out.flush();



    }

}


Measured memory_bytes: 21844
#include<iostream>
using namespace std;
int tree[26][2000001]={0};
void build_tree(string &str,int start,int end,int index)
{
	if(start==end)
	{
		tree[str[start]-97][index]=1;
		return ;
	}
	else
	{
		int mid=(start+end)/2;
		build_tree(str,start,mid,2*index);
		build_tree(str,mid+1,end,2*index+1);
		int i;
		for(i=0;i<26;i++)
		{
			tree[i][index]=tree[i][2*index]+tree[i][2*index+1];
		}
	}
}
void update(int start,int end,int index,int point,int val1,int val2)
{
	if(point>end||point<start)
	  return ;
	if(start==end)
	{
		tree[val1][index]++;
		tree[val2][index]--;
	}
	else
	{
		int mid=(start+end)/2;
		update(start,mid,2*index,point,val1,val2);
		update(mid+1,end,2*index+1,point,val1,val2);
		tree[val1][index]=tree[val1][2*index]+tree[val1][2*index+1];
		tree[val2][index]=tree[val2][2*index]+tree[val2][2*index+1];
	}
}
int get_query(int start,int end,int left,int right,int index,int val)
{
	if(left>end||start>right)
	  return 0;
	else if(start>=left&&end<=right)
	  return tree[val][index];
	else
	{
		int mid=(start+end)/2;
		int x=get_query(start,mid,left,right,2*index,val);
		int y=get_query(mid+1,end,left,right,2*index+1,val);
		return x+y;
	}
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,q;
	string str;
	cin>>n;
	cin>>str;
	cin>>q;
	build_tree(str,0,n-1,1);
	while(q--)
	{
		int query;
		cin>>query;
		if(query==1)
		{
			int point;
			cin>>point;
			point--;
			char x;
			cin>>x;
			int val2=str[point]-97;
			int val1=x-97;
			str[point]=x;
			update(0,n-1,1,point,val1,val2);
		}
		else
		{
			int left,right;
			cin>>left>>right;
			left--;
			right--;
			int answer=0;
			int i;
			for(i=0;i<26;i++)
			{
				int count=get_query(0,n-1,left,right,1,i);
				if(count>0)
				  answer++;
			}
			cout<<answer<<endl;
		}
	}
}


Measured memory_bytes: 160668
string = list(input())
times = int(input())
for i in range(times):
    order = input().split()
    if order[0] == "replace":
        replace_string = order[3]
        count = 0
        for j in range(int(order[1]), int(order[2]) + 1):
            string[j] = replace_string[count]
            count += 1
    elif order[0] == "reverse":
        reverse_string = string[int(order[1]):int(order[2]) + 1]
        reverse_string.reverse()
        string = string[:int(order[1])] + reverse_string + string[int(order[2])+1:]
    elif order[0] == "print":
        print("".join(string[int(order[1]):int(order[2]) + 1]))

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    set<int> s;
    rep(i, n) s.insert(a[i]);

    int ans = 0;
    vector<int> ck(200000, 0);
    rep(i, n) ck[a[i]]++;
    sort(all(ck));

    if (s.size() > k)
    {
        int num = s.size() - k;
        int i = 0;
        while (num)
        {
            if (ck[i] > 0)
            {
                num--;
                ans += ck[i];
            }
            i++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 13932
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int lu;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> v;
typedef vector<v> vv;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
typedef vector<set<ll>> vsll;
typedef set<pair<ll, ll>> spll;
typedef vector<spll> vspll;
typedef vector<pll> vpll;
const ll MOD = 1e9 + 7;
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define yesno(f) \
    if (f)       \
        yes else no;
#define noo \
    { no return; }
#define round(x, y) ((2 * x + y) / (2 * y))
#define ce(x, y) ((x + y - 1) / y)
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define sz(x) (ll) x.size()
#define sq(x) ((x) * (x))
 
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
 
template <typename T = ll>
vector<T> ga(ll n, bool oneIndexed = false) {
    vector<T> a = vector<T>(n + oneIndexed);
 
    for (ll i = 0; i < n; i++) {
        T p;
        cin >> p;
        a[i + oneIndexed] = p;
    }
 
    return move(a);
}
 
template <typename T, typename A>
void pa(vector<T, A> const &a, ll begin = 0, ll end = -1) {
    if (end == -1)
        end = sz(a) - 1;
    for (ll i = begin; i <= end; i++) {
        cout << a[i] << " ";
    }
    cout << endl;
}
 
void solve() {
 ll h;
 cin >>h;
 ll sum=0;
 ll power=1;
 while(h>0)
 {
     sum+=power;
     power*=2;
     h/=2;
 }
 cout << sum<<"\n";
}
 
int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    // freopen("file", "r", stdin);
    // freopen("file", "w", stdout);

    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <math.h>
#include <time.h>
using namespace std;
int main() {
	long long int a, b, k;
	cin >> a >> b >> k;
	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			if (b*i + a*j - 2 *i*j == k) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
/*ID:PROG:LANG:*/
#include<bits/stdc++.h>
#define LL long long
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 5005
using namespace std;
struct Edge{
	int to,nex;Edge(int _=0,int __=0){to=_,nex=__;}
}e[MAXN<<1];
int n,ans,cnt,rt,S,hd[MAXN],sz[MAXN],dp[2][MAXN];
LL jc[MAXN],njc[MAXN];
int rd(){
	int x=0,tp=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')tp=-1;c=getchar();}
	while(c>='0' && c<='9'){x=(x*10+c-'0');c=getchar();}
	return x*tp;
}
void adde(int x,int y){e[++cnt]=Edge(y,hd[x]);hd[x]=cnt;}
LL quick_mod(LL a,LL x){LL res=1;while(x){if(x&1)(res*=a)%=MOD;(a*=a)%=MOD,x>>=1;}return res;}
LL C(int n,int m){if(n<m)return 0;return jc[n]*njc[m]%MOD*njc[n-m]%MOD;}
LL C2(int n,int m){LL t=C(n,m);return t*t%MOD;}
void dfs(int now,int fa){
	sz[now]=1;int mx=0;
	for(int i=hd[now];i;i=e[i].nex)
		if(e[i].to!=fa)
			dfs(e[i].to,now),sz[now]+=sz[e[i].to],mx=max(mx,sz[e[i].to]);
	mx=max(mx,n-sz[now]);
	if(mx*2<=n)rt=now;
}
int main(){
	// freopen("testdata.in","r",stdin);
	// freopen("1.out","w",stdout);
	int x,y;
	n=rd();
	jc[0]=njc[0]=1;
	for(int i=1;i<=n;i++)jc[i]=jc[i-1]*i%MOD;
	njc[n]=quick_mod(jc[n],MOD-2);
	for(int i=n-1;i;i--)njc[i]=njc[i+1]*(i+1)%MOD;
	for(int i=1;i<n;i++){
		x=rd(),y=rd();
		adde(x,y),adde(y,x);
	}
	dfs(1,0),dfs(rt,0);
	dp[0][0]=1;
	bool now=1,las=0;
	for(int i=hd[rt];i;i=e[i].nex){
		for(int j=0;j<=S;j++)
			if(dp[las][j])
				for(int k=0;k<=sz[e[i].to];k++)
					(dp[now][j+k]+=1ll*dp[las][j]*C2(sz[e[i].to],k)%MOD*jc[k]%MOD)%=MOD;
		S+=sz[e[i].to];
		memset(dp[las],0,sizeof(dp[las]));
		now^=1,las^=1;
	}
	for(int i=0;i<=n;i++){
		if(i&1)(ans-=dp[las][i]*jc[n-i]%MOD)%=MOD;
		else (ans+=dp[las][i]*jc[n-i]%MOD)%=MOD;
	}
	printf("%d\n",(ans+MOD)%MOD);
	// printf("%.2lf\n",(double)clock()/CLOCKS_PER_SEC);
	return 0;
}

Measured memory_bytes: 640
#include<cstdio>
int a,b,t;
int main(){
	scanf("%d%d",&a,&b);
	if(a>b){
		t=a;
		a=b;
		b=t;
	}
	for(int i=a;i<=b;i++){
		if((a*b*i)%2==1){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
}

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

int main(){
  int n, y, flag = false;
  int a = -1, b = -1, c = -1;
  cin >> n >> y;

  for(int i = 0; i <= n; i++){
    for(int j = 0; j <= n-i; j++){
      int result = 10000*i + 5000*j + 1000*(n-i-j);
      if(result == y && (n-i-j) >= 0){
        flag = true;
        a = i; b = j, c = n-i-j;
      }
    }
    if(flag) break;
  }
    cout << a << " " << b << " " << c << endl;
}


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

int main(void){
  int n;
  vector<int> bricks;
  int ans=0;
  
  cin >> n;
  for (int i=0; i<n; i++){
    int t; cin >> t;
    bricks.push_back(t);
  }
  for (int i=0; i<n; i++){
    if (bricks[i]==ans+1) ans++;
//    cout << "(" << i << "," << ans << ") ";
  }
  if (ans==0) cout << -1 << endl;
  else cout << (n-ans) << endl;
  return 0;
}


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

int n;
bool vis[20];

int ans;
int a[20];
int x[20][20];
int y[20][20];

void dfs(int cur) {
    if(cur>n) {
        int cnt = 0;
        for(int i=1; i<=n; i++) {
            if(!vis[i])
                continue;
            cnt++;
            for(int j=1; j<=a[i]; j++) {
                if((y[i][j] && !vis[x[i][j]]) || (!y[i][j] && vis[x[i][j]])) {
                    cnt = -1;
                    break;
                }
            }
            if(cnt<0)
                break;
        }
        if(cnt>0)
            ans = max(ans, cnt);
        return;
    }
    vis[cur] = true;
    dfs(cur+1);
    vis[cur] = false;
    dfs(cur+1);
}

int main() {
    scanf("%d", &n);
    for(int i=1; i<=n; i++) {
        scanf("%d", &a[i]);
        for(int j=1; j<=a[i]; j++)
            scanf("%d%d", &x[i][j], &y[i][j]);
    }
    dfs(1);
    printf("%d\n", ans);
    return 0;
}


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

using namespace std;

int main() {
    string s1, s2;
    cin >> s1 >> s2;

    for (auto i = 0; i < s1.size(); ++i) {
        int j = i + s2.size() - 1;
        if (j >= s1.size())
            break;
        int k = s2.size() - 1;
        while (j >= i && k >= 0) {
            if (s1[j] != s2[k]) {
                break;
            }
            --j; --k;
        }
        if (k < 0)
            cout << i << endl;
    }

    return 0;
}

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

using namespace std;

void rotate(int xs[], int s, int t){
    int v = xs[t];
    for(int i = t; i > s; i--){
        xs[i] = xs[i-1];
    }
    xs[s] = v;
    return;
}

void insert(int xs[], int idx){
    for(int i = 0; i < idx; i++){
        if(xs[i] > xs[idx]){
            rotate(xs, i, idx);

        }
    }
}

void printArr(int xs[], int arr_len){
    for(int j = 0; j < arr_len-1; j++){
        cout << xs[j] << ' ';
    }
    cout << xs[arr_len-1] << '\n';
}

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

    for(int i = 0; i < n; i++){
        insert(arr, i);
        printArr(arr, n);
    }
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <climits>

int main(){
    long A;
    std::cin >> A;
    std::string B;
    std::cin >> B;
    long Bs = (B[0]-'0')*100+(B[2]-'0')*10+B[3]-'0';
    std::cout << A*Bs/100 << std::endl;
    return 0;
}


Measured memory_bytes: 3572
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (PrintWriter out = new PrintWriter(System.out); Scanner sc = new Scanner(System.in);) {

			int n = sc.nextInt();
			int m = sc.nextInt();
			int q = sc.nextInt();
			List<int[]> listlr = new ArrayList<>();
			List<int[]> listpq = new ArrayList<>();
			for (int i = 0; i < m; i++) {
				int[] lr = new int[2];
				lr[0] = sc.nextInt() - 1;
				lr[1] = sc.nextInt() - 1;
				listlr.add(lr);
			}
			for (int i = 0; i < q; i++) {
				int[] pq = new int[2];
				pq[0] = sc.nextInt() - 1;
				pq[1] = sc.nextInt() - 1;
				listpq.add(pq);
			}

			int[][] t = new int[n][n];

			for (int[] lr : listlr) {
				t[lr[0]][lr[1]]++;
			}

			for (int i = 1; i < n; i++) {
				for (int j = i - 1; j >= 0; j--) {
					t[j][i] = t[j][i] + t[j + 1][i];
				}
			}

			for (int i = 0; i < n; i++) {
				for (int j = i + 1; j < n; j++) {
					t[i][j] = t[i][j] + t[i][j - 1];
				}
			}

			for (int[] pq : listpq) {
				out.println(t[pq[0]][pq[1]]);
			}

		}
	}

}


Measured memory_bytes: 160968
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin). unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	() => (get().parse::<i64>().unwrap());
    	($t:ty) => (get().parse::<$t>().unwrap());
    }
    let n = get!(usize);
    let h = get!();
    let mut xs = vec![0; n];
    let mut ys = vec![0; n];
    for i in 0..n {
    	xs[i] = get!();
        ys[i] = get!();
    }
    xs.sort();
    ys.sort();
    let &max_x = xs.last().unwrap();
    let mut ans = 0;
    let mut damage = 0;
    for i in 0..n {
    	let j = (n - 1) - i;
        if ys[j] < max_x {
        	break;
        }
        damage += ys[j];
        ans += 1;
        if damage >= h {
        	println!("{}", ans);
            return;
        }
    }
    if damage < h {
    	let rem = h - damage;
    	ans += (rem + (max_x-1)) / max_x;
	}
    println!("{}", ans);
}

Measured memory_bytes: 10232
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 100005;
const int mod = 1000000007;

int a[maxn];
int n,m;

ll gcd(ll x,ll y){
  if(!y)return x;
  return gcd(y, x%y);
}

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  cin>>n>>m;
  for(int i=0;i<n;i++){
    cin>>a[i];
    a[i]>>=1;
  }
  int cnt = 0;
  bool sign = 0;
  while(!sign){
    int cnt0 = 0, cnt1 = 0;
    for(int i=0;i<n;i++){
      if(a[i]&1)cnt1++;
      else {
        a[i]>>=1;
        cnt0++;
      }
    }
    if(cnt0&&cnt1){
      sign=1;
      break;
    } else if(cnt0){
      cnt++;
    } else break;
  }
  m>>=cnt;
  if(sign)cout<<0<<endl;
  else {
    ll p = a[0];
    for(int i=1;i<n;i++){
      p= p/gcd(p, a[i]) * a[i];
      if(p>m)break;
    }
    if(p<=m) {
      //bug(p)
      ll ret = m / p;
      cout << (ret + 1) / 2 << endl;
    } else cout<<0<<endl;
  }
  return 0;
}

Measured memory_bytes: 640