akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
//DEFINE and TYPEDEF--------------------------------------------------------------
 
#define FORG(i,a,n) for(lld i=a;i<n;i++) //for - general
#define FORZ(i,n) for(lld i=0;i<n;i++) //for - zero
#define FORGI(i,a,n,inc) for(lld i=a;i<n;i+=inc) //for - general incremental
#define FORZI(i,n,inc) for(lld i=0;i<n;i+=inc) //for - zero incremental
#define DEBUG(x) cerr<<(#x)<<" is "<<(x)<<endl //to debug values of variables
#define ZINDA cerr<<"\nIdhar-ich hai apun!!\n"; //to debug if code reached that point
#define SPEEDUP ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
 
#define SORTall(m) sort(m.begin(),m.end());
 
#define st first
#define nd second
#define pb push_back
#define mod 1000000007
 
typedef long long int lld;
typedef unsigned long long int ulld;
 
lld power(lld b, lld e)
{
	if(e==0)
		return 1;
	if(e%2==1)
		return b*power(b*b,(e-1)/2);
	else
		return power(b*b,e/2);
}
 
int nDig(lld n)
{
	return floor(log10(n) + 1);
}

//--------------------------------------------------------------------------------
 
int main()
{
    SPEEDUP;
 	lld a,b,c;
 	cin>>a>>b>>c;

 	if((a==b && b!=c) || (a==c && a!=b) || (c==b && b!=a))
 		cout<<"Yes";
 	else
 		cout<<"No";
    return 0;
}

Measured memory_bytes: 256
a,b,k=map(int,input().split())
for i in range(k):
  if i%2==0:
    if a%2==1:
      a-=1
    b+=a//2
    a=a//2
  else:
    if b%2==1:
      b-=1
    a+=b//2
    b=b//2
print(a,b)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
    ll K;
    cin >> K;
    if(!K){
        cout << "4\n3 3 3 3\n";
        return 0;
    }else if(K == 1){
        cout << "3\n1 0 3\n";
        return 0;
    }
    ll size = min<ll>(K, 50);
    ll a[size];
    ll kaisu = K / size;
    for(ll i = 0; i < size; i++) a[i] = size + kaisu - 1;
    for(ll i = 0; i < K % size; i++) a[i] += 1;
    if(K % size){
        for(ll i = K % size; i < size; i++) a[i] -= K % size;
    }
    cout << size << endl;
    for(ll i = 0; i < size; i++) cout << a[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.nextLine();
		int a=0,z=0;
		for (int i = 0; i < s.length(); i++) {
			if(s.charAt(i)=='A'){
				a=i;
				break;
			}
		}
		for (int i = s.length()-1; i > 0; i--) {
			if(s.charAt(i)=='Z'){
				z=i;
				break;
			}
		}
		System.out.println(z-a+1);
	}
}

Measured memory_bytes: 15284
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};

template <typename T> 
struct SegmentTree {
  
  int n;
  vector<T> node;
  T e;
 
  T f(T a, T b) {return (a + b);}
  void g(T &a, T b) {a += b;}
 
  SegmentTree (int sz, T init = 0) {
    n = 1; e = init; while (n < sz) n <<= 1;
    node.assign(2*n, init);
    for (int i = n - 2; i >= 0; i--) node[i] = f(node[2*i+1], node[2*i+2]);
  }
 
  void update(int k, T x) {
    k += (n - 1);
    g(node[k], x);
    while (k > 0) {
      k = (k - 1) >> 1;
      node[k] = f(node[2*k+1], node[2*k+2]);
    } 
  }
 
  T query(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    if (r <= a || b <= l) return e;
    if (a <= l && r <= b) return node[k];
    T vl = query(a, b, 2*k+1, l, (l+r)/2);
    T vr = query(a, b, 2*k+2, (l+r)/2, r);
    return f(vl, vr);
  }
 
  T getvalue(int k) {
    return query(k,k+1);
  }
  
  template <typename F> 
  int find (int a, int b, T x, F &ok, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    if (!ok(node[k]) || r <= a || b <= l) return b;
    if (k >= n - 1) return k - n + 1;
    int vl = find(a, b, x, ok, 2*k+1, l, (l + r)/2);
    if (vl != b) return vl;
    return find(a, b, x, ok, 2*k+2, (l + r)/2, r);
  }
 
};
int main() {
  int n, k;
  cin >> n >> k;
  vector<P> p(k);
  rep(i,k) cin >> p[i].first >> p[i].second;
  sort(p.begin(), p.end());
  SegmentTree<mint> dp(n + 1, 0);
  dp.update(1, 1);
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j < k; j++) {
      int l = max(0, i - p[j].second), r = max(0, i - p[j].first);
      //cout << l << " " << r << endl;
      dp.update(i, dp.query(l, r + 1));
    }
  }
  cout << dp.query(n, n + 1).x << endl;
  return 0; 
}

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

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define int long long
#define endl '\n'

using namespace std;

const int N = 2e5 + 77;
int A[N];

int32_t main(){
    fast;
    int n , c = 0; cin >> n ;
    for(int i = 0 ; i < n ;++i){
        cin >> A[i] ;
        if(A[i] < 0){
            c++;
            A[i] = -A[i];
        }
    }
    sort(A,A+n);
    int ans = 0;
    if(c%2==1) A[0] = -A[0];
    for(int i = 0; i < n ; ++i) ans += A[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4416
#include <bits/stdc++.h>
using namespace std;
 
int main(){
int i, N, T, A; cin >> N; long m, c, d, a=1, t=1, ans=2;
for(i=0; i<N; i++){
  cin >> T >> A; c=a/A; d=t/T; m=max(c, d);
  if((c>=d && a%A) || (d>=c && t%T)){ m++; }
  a=m*A; t=m*T; ans=a+t;
}
cout << ans << "\n";
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>
#include <stack>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll x,y;
  cin >> x >> y;

  bool found = false;
  rep(i,x+1) {
    // Here, try i as 2
    ll c = 0;
    c += 2*i;
    c += 4*(x-i);
    if (c == y) {
      found = true;
    }
  }
  if (found) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().run();
	}
	
	public void run () throws IOException {
		
//		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//		int n = Integer.parseInt(reader.readLine());
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int k = Integer.MIN_VALUE;
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			k = Math.max(k, a[i]);
		}
		countingSort(a, b, k);
		StringBuilder sb = new StringBuilder();
		sb.append(b[0]);
		for (int i = 1; i < n; i++) {
			sb.append(' ').append(b[i]);
		}
		System.out.println(sb.toString());
	}

	private static void countingSort(int[] a, int[] b, int k) {
		int[] c = new int[k + 1];
		for (int i = 0; i < a.length; i++) {
			c[a[i]]++;
		}
		for (int i = 1; i <= k; i++) {
			c[i] += c[i - 1];
		}
		for (int i = a.length - 1; i >= 0; i--) {
			c[a[i]]--;
			b[c[a[i]]] = a[i];
		}		
	}
}


Measured memory_bytes: 518116
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))
import math
N = ii()

print(math.pi*2*N)

Measured memory_bytes: 9160
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  ll m,k;
  cin>>m>>k;
  ll a=1;
  rep(i,m) a*=(ll)2;
  if(m==0){
    if(k!=0) cout<<-1<<endl;
    else cout<<"0 0"<<endl;
  }
  else if(m==1){
    if(k!=0) cout<<-1<<endl;
    else cout<<"0 0 1 1"<<endl;
  }else{
    if(k<a){
      if(k==0){
	rep(i,a){
	  cout<<i<<" ";
	}
	repn(i,a-1){
	  if(i==0) cout<<i;
	  else cout<<i<<" ";
	}
	cout<<endl;
	return 0;
      }else{
	cout<<0<<" ";
	for(ll j=a-1;j>0;j--){
	  if(j!=k) cout<<j<<" ";
	}
	cout<<0<<" "<<k<<" ";
	for(ll j=1;j<a;j++){
	  if(j!=k){
	    cout<<j<<" ";
	  }
	}
	cout<<k<<endl;;
      }
    }
      else cout<<-1<<endl;
    
  }
  
  return 0;
}
















Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		sc.close();

		if (a + b + 1 >= c) {
			System.out.println(b + c);
		} else {
			System.out.println(b + a + b + 1);
		}
	}
}


Measured memory_bytes: 23764
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <memory.h>
 

using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int

int C[51][51];

void comb_table(int N) {
    rep(i, N+1) {
        for (int j = 0; j <= i; j++){
            if(j == 0 || j == i) C[i][j] = 1;
            else C[i][j] = C[i-1][j-1] + C[i-1][j];
        }
    }
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, A, B;
    cin >> N >> A >> B;
    comb_table(N);
    int v[55];
    rep(i, N) cin >> v[i];
    sort(v, v+N, greater<int>());
    double ans = 0;
    rep(i, A) {
        ans += v[i];
    }
    ans /= A;

    int cnt = 0;
    int X = 0, Y = 0;
    rep(i, N) {
        if (v[i] == v[A-1]) {
            X++;
            if(i < A) Y++;
        } 
    }

    if (Y == A) {
        for (int i = A; i <= min(B,X); i++) cnt += C[X][i];
    } else {
        cnt += C[X][Y];
    }

    cout.precision(7);
    cout << fixed << ans << endl;
    cout << cnt << endl;

    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
ll mod=998244353;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll powmod(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res%mod;}
long modInverse(long a) {return powmod(a, mod-2);}
ll my_rand(){ll a=rand();ll b=rand();return (a*RAND_MAX+1)+b;}
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()


int main(){
    ios::sync_with_stdio(false);
    srand(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin>>n>>m;
    vector<ll>v(n);
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>v[i];
        sum+=v[i];
    }
    sort(v.rbegin(),v.rend());
    if(4*m*v[m-1]>=sum)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int K;
	cin >> K;
	int sum = 0;
	for(int i=1;i<=K;i++) for(int j=1;j<=K;j++) for(int k=1;k<=K;k++) sum += __gcd(i,__gcd(j,k));
	cout << sum << '\n';
	return 0;
}

Measured memory_bytes: 3640
/************************Code by Hardik Aggarwal!!!!***********************************/

#include<bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =998244353;
int main()
{
       

    IOS
    string s;
    cin>>s;
    ll ans=0;
    for(ll i=0;i<s.size();i++)
    {
        if(i%2==0)
        {
            ans+=(s[i]=='0');
        }
        else
        {
            ans+=(s[i]=='1');   
        }
    }

    ll mini=ans;
    ans=0;
    for(ll i=0;i<s.size();i++)
    {
        if(i%2==0)
        {
            ans+=(s[i]=='1');
        }
        else
        {
            ans+=(s[i]=='0');   
        }
    }    
    mini=min(ans,mini);
    cout<<mini<<endl;



    

    
}
    
 
    
    



Measured memory_bytes: 512
#include <iostream>
#include <string>
using namespace std;
int main()
{
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i]=='1') ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3564
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++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;}
using ll = long long;
constexpr long long INF = 1LL << 62;
constexpr int MOD = 1e9 + 7;
constexpr double EPS = 1e-10;

ll dp[1010][1010];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N, K; cin >> N >> K;
    
    dp[0][0] = 1;
    for(int i=1; i <= K; ++i) {
        for(int j=0; j <= N; ++j) {
            if(j >= i) dp[i][j] = (dp[i-1][j] + dp[i][j-i])%MOD;
            else dp[i][j] = dp[i-1][j];
        }
    }
    cout << dp[K][N] << '\n';
    return 0;
}


Measured memory_bytes: 11012
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n,m;
  cin >> n >> m;
  vector<string> a(n),b(m);
  rep(i,n) cin >> a.at(i);
  rep(i,m) cin >> b.at(i);
  for(int i = 0; i+m-1<n; i++){
    for(int j = 0; j+m-1<n; j++){
      vector<string> c(m);
      rep(k,m){
        c.at(k)=a.at(i+k).substr(j,m);
      }
      bool x=true;
      rep(k,m){
        if(b.at(k)!=c.at(k))x=false;
      }
      if(x){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


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

signed main(){
	int T1, T2, A1, A2, B1, B2;
	scanf("%lld%lld", &T1, &T2);
	scanf("%lld%lld", &A1, &A2);
	scanf("%lld%lld", &B1, &B2);
	if(T1 * A1 + T2 * A2 == T1 * B1 + T2 * B2){
		printf("infinity\n");
		return 0;
	}
	if(T1 * A1 + T2 * A2 < T1 * B1 + T2 * B2){
		swap(A1, B1);
		swap(A2, B2);
	}
	if(A1 > B1){
		printf("0\n");
		return 0;
	}
	int C1 = T1 * A1 + T2 * A2;
	int C2 = T1 * B1 + T2 * B2;
	int k = (T1 * (B1 - A1)) / (C1 - C2) + 1;
//	printf("(C1, C2, k) = (%lld, %lld, %lld)\n", C1, C2, k);
	int ans = 2 * k - 1;
	if((T1 * (B1 - A1)) % (C1 - C2) == 0){
		ans--;
	}
	printf("%lld\n", ans);
	return 0;
}

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

#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 >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { cout << p.first << ' ' << p.second; return os; }

void solve() {
  i64 a, b, c, d; cin >> a >> b >> c >> d;
  a--;
  i64 ans = b - a;
  {
    ans -= (b / c) - (a / c);
    ans -= (b / d) - (a / d);
    ans += (b / lcm(c, d)) - (a / lcm(c, d));
  }
  cout << ans << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

//試してて御免

const int cm = 1 << 17;
char ci[cm];
int cn;
inline char getcha() { 
	if (!cn) { fread(ci, 1, cm, stdin); cn = cm; }
	cn--;
	return ci[cm - cn - 1];
}
inline char getcha2() {
	cn--;
	return ci[cm - cn - 1];
}

inline int getint() {
	if (cn < 20) {
		char C = getcha();
		int A = C - '0';
		while (isdigit(C = getcha())) A = A * 10 + C - '0';
		return A;
	}
	else {
		char C = getcha2();
		int A = C - '0';
		while (isdigit(C = getcha2())) A = A * 10 + C - '0';
		return A;
	}
}

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


	int N, X;
	N = getint();
	X = getint();

	int A = 0;
	ll kotae = 0;
	rep(i, N) {
		int B = getint();
		if (A + B > X) {
			kotae += A + B - X;
			B = X - A;
		}
		A = B;
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <list>
using namespace std;
int main() {
	int a;
	cin >> a;
	a = a % 10;
	if (a == 3) {
		cout << "bon" << endl;
	}
	else if(a==2 ||a==4||a==5||a==7||a==9){
		cout << "hon" << endl;
	}
	else {
		cout << "pon"<< endl;
	}
}

Measured memory_bytes: 3632
import java.io.File;
import java.util.Properties;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static Properties pps = System.getProperties();
	static boolean dbg = true;

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int[] a = ni(3);

		System.out.println(Solve(a));

	}

	private static int Solve(int[] a) {
		// TODO Auto-generated method stub
		int k = Math.min(a[0], a[1]);
		while (true) {

			if (a[1] % k == 0 && a[0] % k == 0) {
				if (--a[2] == 0) {
					return k;
				}

			}
			--k;

		}

	}

	public static void out(String str) {

		if (dbg)
			System.out.println(str);
	}

	public static void out(int str) {

		if (dbg)
			System.out.println(str);
	}

	public static int ni() {
		sc.nextLine();
		return sc.nextInt();

	}

	public static String ns() {

		return sc.nextLine();
	}

	public static int[] ni(int k) {
		int[] res = new int[k];
		for (int i = 0; i < k; i++)
			res[i] = sc.nextInt();
		sc.nextLine();
		return res;
	}

	public static String[] ns(int k) {
		String[] res = new String[k];
		for (int i = 0; i < k; i++)
			res[i] = sc.nextLine();
		return res;
	}

	public static int[][] ni(int a, int b) {
		int[][] res = new int[a][b];
		for (int i = 0; i < a; i++)
			for (int j = 0; j < b; j++)
				res[i][j] = sc.nextInt();
		sc.nextLine();
		return res;
	}
}


Measured memory_bytes: 21716
n = int(input())
q = lambda i:input('%d\n'%i)
i, j = 0, n - 1
a, b = q(i), q(j)
while True:
  k = (j - i + 1) // 2 + i
  c = q(k)
  if (k - i)%2 == (a==c):
    j = k
  else:
    a = c
    i = k

Measured memory_bytes: 3660
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>

#define INT long long int
using namespace std;
INT n, k, cnt[200020], ans;
int main()
{
    cin>>n>>k;
    for(int i = 1 ; i <= n ; i++ )
        cnt[i%k]++;
    ans += cnt[0]*cnt[0]*cnt[0];
    for(int i = 1 ; i <= k-i ; i++ )
    {
        if( i == k-i ) ans += cnt[i]*cnt[i]*cnt[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
n, q = map(int, input().split())
s = input()
ls = [list(map(int, input().split())) for i in range(q)]
d = [0]
pre = 0
c = 0

for i in range(len(s)-1):
    if s[i:i+2] == 'AC':
        d.append(d[i]+1)
    else:
        d.append(d[i])



for start, end in ls:
    print(d[end-1]-d[start-1])


Measured memory_bytes: 29588
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main(){
    string s;
    int min=200010;
    int max=1;
    cin >> s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='A' && i<min){
            min=i;
        }
        if(s[i]=='Z'){
            max=i;
        }
    }
    cout << max-min+1 << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
using namespace std;

string next(string& str) {
  if (str.size() == 26) {
    string n(str);
    if (!next_permutation(n.begin(), n.end()))
      return "-1";
    for (int i = 0; i < 26; ++i) {
      if (str[i] != n[i]) {
        return n.substr(0, i + 1);
      }
    }
  }
  set<char> s;
  for (char c = 'a'; c <= 'z'; ++c) {
    s.insert(c);
  }
  for (char c : str) {
    s.erase(c);
  }
  return str + *s.begin();
}

int main() {
  string s;
  cin >> s;
  cout << next(s) << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include<algorithm>

using namespace std;

int main()
{
	int A, B,C;
	cin >> A >> B >> C;

	if (C >= A && C <= B)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

def cube(x):
    """
    return x cubed

    >>> cube(2)
    8

    >>> cube(3)
    27

    >>> cube(10)
    1000

    """

    return x**3


if __name__ == '__main__':
    x = int(raw_input())
    print cube(x)

Measured memory_bytes: 6344
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

// x ** n % mods を求める
pub fn mod_pow(x: i64, n: i64, mods: i64) -> i64 {
    if n == 0 {
        return 1;
    }
    let mut res = mod_pow(x * x % mods, n / 2, mods);
    if n % 2 == 1 {
        res = res * x % mods;
    }
    return res;
}

// (1/n) % mods を求める
pub fn mod_inv(n: i64, mods: i64) -> i64 {
    return mod_pow(n, mods-2, mods);
}

// nCk % mods を求める
pub fn mod_comb(n: i64, k: i64, mods: i64) -> i64 {
    let sum1 = (n-k+1..n+1).fold(1, |ac, x| ac * x % mods);
    let sum2 = (1..k+1).fold(1, |ac, x| ac * x % mods);
    return sum1 * mod_inv(sum2, mods) % mods;
}


fn main() {
    input!{
        k: usize,
        a: usize,
        b: usize,
    }
    for i in a..b+1 {
        if i % k == 0 {
            println!("OK");
            return;
        }
    }
    println!("NG");
}


Measured memory_bytes: 2136
#include<bits/stdc++.h>
using namespace std;
#define int long
signed main(){
  int n,k;
  cin>>n>>k;
  vector<int> a(n),f(n),b;
  for(auto &i:a)cin>>i;
  for(auto &i:f)cin>>i;
  sort(a.begin(),a.end());
  sort(f.begin(),f.end(),greater<>());
  int l=0,r=0;
  for(int i=0;i<n;++i)r=max(r,a[i]*f[i]);
  //cerr<<"max:"<<r<<"\n";
  while(l<r){
    int mid=(l+r)/2;//+(l+1==r?1:0);
    int cost=0,v;
    for(int i=0;i<n;++i){
      v=a[i]*f[i];
      if(v>mid)cost+=(v-mid)/f[i]+((v-mid)%f[i]?1:0);
      //cerr<<"[l,r]:"<<l<<","<<r<<", mid:"<<mid<<", cost:"<<cost<<"\n";
      if(cost>k)break;
    }
    if(cost>k)l=mid+1;
    else r=mid;
  }
  cout<<l;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const int nmax = 8;
bool graph[nmax][nmax];
const int INF = 1e9;
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

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

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

int main()
{
    long long N;
    scanf("%lld", &N);
    string str1;
    string str2;
    cin >> str1 >> str2;
    ll ans = 1;
    int i = 0;
    bool tate = true;
    while (i < N)
    {
        if (str1[i] == str2[i])
        {
            //縦に並んでいる場合
            if (i == 0)
            {
                ans = mulMod(3, ans);
            }
            else if (tate)
            {
                ans = mulMod(2, ans);
            }
            else
            {
                ans = mulMod(1, ans);
            }
            i++;
            tate = true;
        }
        else
        {
            //横に並んでいる場合
            if (i == 0)
            {
                ans = mulMod(6, ans);
            }
            else if (tate)
            {
                ans = mulMod(2, ans);
            }
            else
            {
                ans = mulMod(3, ans);
            }
            i += 2;
            tate = false;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n, m);
  	int l = 1, r = n;
  	Rep(m){
      Cin(int, a, b);
      l = max(l, a);
      r = min(r, b);
    }
    Cout(max(r-l+1, 0));
}

Measured memory_bytes: 256
#include<stdio.h>
int FLG[10001][1261];
main(){
  int N,M,t,n,m,s,r,i,j,k,cnt,pc[1001];
  while(1){
    for(i=0;i<=1000;i++)pc[i]=0;
    scanf("%d %d",&N,&M);
    if(N==0&&M==0)break;
    for(i=0;i<=M;i++){
      for(j=0;j<1261;j++){
	FLG[i][j]=0;
      }
    }
    scanf("%d",&r);
    for(i=0;i<r;i++){
      scanf("%d %d %d %d",&t,&n,&m,&s);
      if(s==1){
	pc[n]=t;
      }else{
	for(j=pc[n];j<t;j++){
	  FLG[m][j]=1;
	}
      }
    }
    scanf("%d",&N);
    for(i=0,cnt=0;i<N;i++,cnt=0){
      scanf("%d %d %d",&t,&n,&m);
      for(j=t;j<n;j++){
	if(FLG[m][j]==1){
	  cnt++;
	}
      }
      printf("%d\n",cnt);
    }
  }
  return 0;
}

Measured memory_bytes: 49748
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] A = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            StringBuilder sb = new StringBuilder();
            sb.AppendLine(string.Join(" ", Array.ConvertAll(A, a => a.ToString())));

            for (int i = 1; i < n; i++)
            {
                int v = A[i];
                int j = i - 1;

                while (j >= 0 && A[j] > v)
                {
                    A[j + 1] = A[j];
                    j--;
                }

                A[j + 1] = v;

                sb.AppendLine(string.Join(" ", Array.ConvertAll(A, a => a.ToString())));
            }

            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9576
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

D = 20

N = read()
A = reads()

psum = [[0]*(N+1) for _ in range(D)]
for d in range(D):
  for i in range(N):
    psum[d][i+1] = psum[d][i] + (A[i] >> d & 1)

r = 0
count = 0
for l in range(N):
  while r < N and all(psum[d][r+1] - psum[d][l] <= 1 for d in range(D)):
    r += 1
  count += r - l
print(count)


Measured memory_bytes: 107468
n, k = map(int, input().split())
P = [*map(lambda x: int(x)-1, input().split())]
C = [*map(int, input().split())]

INF = 10**18
max_score = -INF
for st in range(n):
    lc = 0 # lap count
    lap_sc = 0 # lap score
    nx = st
    while True:
        lc += 1
        lap_sc += C[nx]
        nx = P[nx]
        if nx == st: break

    sum_sc = 0
    kc = 0
    while True:
        kc += 1
        if k < kc: break

        sum_sc += C[nx]
        score = sum_sc + max(0, lap_sc) * ((k - kc) // lc)
        max_score = max(max_score, score)

        nx = P[nx]
        if nx == st: break

print(max_score)

# print('===')
# print(n,k)
# print(P)
# print(C,end='\n\n')


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

int main(){
  int d,g;
  cin>>d>>g;
  vector<int> p(d),c(d);
  rep(i,d) cin>>p[i]>>c[i];
  
  int res = 10000;
  rep(i,1<<d){
    ll score = 0;
    int num = 0;
    rep(j,d){
      if(i>>j&1){
        score += (ll)p[j]*100*(j+1)+c[j];
        num += p[j];
      }
    }
    if(score>=g){
      res = min(res,num);
    }else{
      for(int j=d-1;j>=0;j--){
        if(!(i>>j&1)){
          rep(k,p[j]-1){
            score += (ll)100*(j+1);
            num++;
            if(score>=g){
              res = min(res,num);
              break;
            }
          }
        }
      }
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int a;
    cin>>a;
    cout<<((a+1)/2)-1<<endl;
    return 0;
}



Measured memory_bytes: 256
/**
 *	author:		Yoseph Weissman
 *	created:	01.07.2020 11:03:24
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int k,n;
	cin >> k >> n;
	if (k * 500 >= n) 
		cout << "Yes\n";
	else
		cout << "No\n";	
	return 0;
}


Measured memory_bytes: 3612
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		int[] A = new int[N];
		int[] Acopy = new int[N];
		int Max = 0;
		int index = -1;
        for(var i = 0; i < N; i++)
		{

			A[i] = int.Parse(Console.ReadLine());
			Acopy[i] = A[i];
			if (A[i] > Max)
			{
				Max = A[i];
				index = i;

			}
		}
		Array.Sort(Acopy);

        for(var i = 0; i < N; i++)
		{
			if (i == index)
			{
				Console.WriteLine(Acopy[N - 2]);
			}
			else { Console.WriteLine(Max); }
		}

        

	}
}


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

using namespace std;
using ll = long long;

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

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

  rep(i, n) if (a[i] == 0) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = 1;
  rep(i, n) {
    ll lim = (ll)(1e18) / ans;
    if (a[i] > lim) {
      cout << -1 << endl;
      return 0;
    }
    ans *= a[i];
  }

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


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

int main(){
    long i,n,fn;
    cin>>n;
    vector<long[3]> an(n);
    for(i = 0; i < n; i++){
        cin>>an[i][0]>>an[i][1]>>an[i][2];
    }
    long tx,ty,th;
    for(auto x:an){
        if(x[2]!=0){
            tx = x[0];
            ty = x[1];
            th = x[2];
            break;
        }
    }
    for(int i = 0; i <= 100; i++){
        for(int j = 0; j <= 100; j++){
            long h = th+abs(tx-i)+abs(ty-j);
            bool jud=true;
            for(auto x:an){
                if(max(h-abs(x[0]-i)-abs(x[1]-j),(long)0)!=x[2]){
                    jud=false;
                    break;
                }
            }
            if(jud){
                cout<<i<<" "<<j<<" "<<h;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

int main()
{
	int a, b;
	cin >> a >> b;

	for (int c = 1; c < 4; c++){
		if (a * b * c % 2){
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;
}


Measured memory_bytes: 256
#include <cstdio>
int main(){
	int n, m, x, y;
	scanf("%d %d %d %d",&n,&m,&x,&y);
	if (x >= y){
		printf("War\n");
		return 0;
	}
	int a, b, l = -2147483648, r = 2147483647;
	for (int i = 0; i < n; i++){
		scanf("%d",&a);
		if (a > l){
			l = a;
		}
	}
	l++;
	for (int i = 0; i < m; i++){
		scanf("%d",&b);
		if (b < r){
			r = b;
		}
	}
	if (l > r){
		printf("War\n");
		return 0;
	}
	int ll, rr;
	if (l > x + 1){
		ll = l;
	}else{
		ll = x + 1;
	}
	if (r < y){
		rr = r;
	}else{
		rr = y;
	}
	if (ll > rr){
		printf("War\n");
		return 0;
	}
	if (x < ll && ll <= y){
		printf("No War\n");
	}else if (x < rr && rr <= y){
		printf("No War\n");
	}else{
		printf("War\n");
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i = 0; i < (n); i++)
 
int main() {
	string N;
  	cin >> N;
  bool flag=false;
  
  REP (i,3){
  	if (N[i]=='7'){
		flag=true;
  	}
  }
  
  	if (flag){
    cout << "Yes";
    }
  	else{
    cout << "No";
    }
}

Measured memory_bytes: 3592
#include<stdio.h>
#include<string.h>


int main(){

  int n, t=0, h=0, i;
  char ta[100], ha[100];

  scanf("%d", &n);

  for(i=0;i<n;i++){
    scanf("%s %s", ta, ha);
    if(strcmp(ta, ha)>0) t+=3;
    else if(strcmp(ta, ha)<0) h+=3;
    else{
      t++;
      h++;
    }
  }

  printf("%d %d\n", t, h);


  return 0;
}




Measured memory_bytes: 2028
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
#include<set>
#include <numeric>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define DIVCEIL(a,b) ((a+b-1)/b)
//int CHMAX

int FACT(int a) {
	if (a == 0)
		return 1;
	else
		return a * FACT(a - 1);
}
int nPr(int n, int r) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++)
		sum *= i;
	return sum;
}
//int nCr(int n, int r)
int nCr2(int n, int r) {
	return FACT(n) / (FACT(r) * FACT(n - r));
}
int GCD(int a, int b)
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b)
{
	return  a * b / GCD(a, b);
}
int NUMOFDIV(int n) {
	int ans = 0;
	REP(i, n) {
		if (n % i == 0)
			ans++;
	}
	return ans;
}
int CEIL1(int n) {
	return (n + 9) / 10 * 10;
}
int DIGITSUM(int n) {
	int sum = 0, dig;
	while (n) {
		dig = n % 10;
		sum += dig;
		n /= 10;
	}
	return sum;
}
int DIVTIME(int n, int k) {
	int div = 0;
	while (n % k == 0) {
		div++;
		n /= k;
	}
	return div;
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
inline bool PRIMEOR(int x) {
	if (x == 1)
		return false;
	if (x == 2)
		return true;
	if (x % 2 == 0)
		return false;
	double sqrtx = sqrt(x);
	for (int i = 3; i <= sqrtx; i += 2) {
		if (x % i == 0)
			return false;
	}
	return true;
}
bool SQRTOR(int n) {
	if (sqrt(n) == (int)sqrt(n))
		return true;
	else
		return false;
}
// 順位付け
using namespace std;
#pragma endregion
signed main() {
	int x;
	cin >> x;
	rep(i, 10000000) {
		if (PRIMEOR(x + i)) {
			cout << x + i;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>

using namespace std;

int main(void)
{
    int h, w;
    int h2;
    double w2;
    for (;;) {
	scanf("%d %d", &h, &w);
	if (h == 0 && w == 0)
	    return 0;

	int z = pow(h, 2) + pow(w, 2);
	w2 = sqrt(z);
	for(h2 = h+1; h2 < w2; h2++) {
	    w2 = sqrt(z - pow(h2, 2));
	    if (w2 == static_cast<int>(w2))
		break;
	}
	if(w2 <= h2) {
	    z++;
	    for (int flag = 0; flag == 0; z++) {
		for(h2 = 1; pow(h2,2) < z/2; h2++) {
		    w2 = sqrt(z - pow(h2, 2));
		    if (w2 == static_cast<int>(w2)) {
			flag = 1;
			break;
		    }
		}
	    }
	}
	printf("%d %d\n", h2, static_cast<int>(w2));
    }
}

Measured memory_bytes: 1028
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue = BinaryHeap!(Array!long, "a<b");
// dfmt on

void main()
{
    writeln(sread()[0 .. $ - "FESTIVAL".length]);
}


Measured memory_bytes: 256
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list_t = [A,B,C,D,E]
lowest = list_t[0]

for i in range(len(list_t)):
    if lowest >= list_t[i]:
        lowest = list_t[i]
    
    
if (N % lowest) != 0:
    print(N // lowest + 5)
else:
    print(N // lowest + 4)

Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;
const int N=2e5+10;
int a[N],b[N];
vector<int>v[N];
map<pair<int,int>,int>mp;
queue<int>q;
int main()
{
    int n,k,l,i,j;
    cin>>n>>k>>l;
    for(i=0;i<k;i++)
    {
        int x,y;
        scanf("%d %d",&x,&y);
        v[x].push_back(y);
        v[y].push_back(x);
    }
    int cnt=0;
    for(i=1;i<=n;i++)
    if(a[i]==0)
    {
        a[i]=++cnt;
        q.push(i);
        while(!q.empty())
        {
            int x=q.front();
            for(j=0;j<v[x].size();j++)
            if(a[v[x][j]]==0)
            {
                a[v[x][j]]=cnt;
                q.push(v[x][j]);
            }
            q.pop();
        }
    }
    for(i=1;i<=n;i++)v[i].clear();
    for(i=0;i<l;i++)
    {
        int x,y;
        scanf("%d %d",&x,&y);
        v[x].push_back(y);
        v[y].push_back(x);
    }
    cnt=0;
    for(i=1;i<=n;i++)
    if(b[i]==0)
    {
        b[i]=++cnt;
        q.push(i);
        while(!q.empty())
        {
            int x=q.front();
            for(j=0;j<v[x].size();j++)
            if(b[v[x][j]]==0)
            {
                b[v[x][j]]=cnt;
                q.push(v[x][j]);
            }
            q.pop();
        }
    }
    for(i=1;i<=n;i++)
        mp[make_pair(a[i],b[i])]++;
    for(i=1;i<=n;i++)
        printf("%d ",mp[make_pair(a[i],b[i])]);
	return 0;
}


Measured memory_bytes: 22248
N=int(input())
A=list(map(int,input().split()))

if N > 2:
    A.sort()
    num_total = A[-1]
    A.pop()
    def isOK(index, key, l):
        if l[index] >= key:
            return True
        else:
            return False
    
    def meguru_search(l,key): # key以上の値を持つ最小のインデックスを返す
        left = -1
        right = len(l)

        while (right - left) > 1: # 二分探索
            mid = left + (right - left)//2
            if isOK(mid,key,l):
                right = mid
            else:
                left = mid
        
        return right
    
    if num_total%2 == 0:
        Max = num_total//2 
    else:
        Max = num_total//2 + 1
    
    Maxind1 = meguru_search(A,Max) # Max以上の値を持つインデックス
    Maxind2 = Maxind1 - 1 # Max未満の最大の値を持つインデックス
    abs_1 = abs(Max - A[Maxind1])
    abs_2 = abs(Max - A[Maxind2])
    if abs_1 > abs_2: # Maxに近いほどnCrが大きい
        r = A[Maxind2]
    else:
        r = A[Maxind1]
    print(num_total,r)

else:
    print(max(A),min(A))

Measured memory_bytes: 14428