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

using namespace std;
using ll = long long;

int main(int argc, const char *argv[]) {
  ll n, k;
  cin >> n >> k;
  vector<ll> va(n);
  for (int i = 0; i < n; ++i) {
    cin >> va[i];
  }

  ll sum = accumulate(va.begin(), va.end(), 0ll);
  vector<ll> divs;
  for (ll i = 1; i * i <= sum; ++i) {
    if (sum % i == 0) {
      divs.push_back(i);
      divs.push_back(sum / i);
    }
  }

  sort(divs.begin(), divs.end(), greater<ll>());

  ll ans = -1;
  for (auto d : divs) {
    vector<ll> vb;
    transform(va.begin(), va.end(), back_inserter(vb),
              [&](ll a) { return a % d; });
    sort(vb.begin(), vb.end());

    vector<ll> psum1(va.size() + 1, 0), psum2(va.size() + 1, 0);
    for (int i = 1; i < psum1.size(); ++i) {
      psum1[i] = psum1[i - 1] + vb[i - 1];
      psum2[i] = psum2[i - 1] + (d - vb[i - 1]);
    }

    bool ok = false;
    int cnt;
    for (int j = 0; j < psum1.size(); ++j) {
      if (psum1[j] == psum2.back() - psum2[j]) {
        ok = true;
        cnt = psum1[j];
        break;
      }
    }

    if (ok && cnt <= k) {
      ans = d;
      break;
    }
  }

  cout << ans << '\n';
}

Measured memory_bytes: 3624
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int cnt=0;

bool kaibun(string s){
  string t=s;
  reverse(t.begin(),t.end());
  if(s==t)return true;
  else{
    return false;
  }
}

string swaping(string s,int d){
  int size=s.size();
  if(kaibun(s))return s;
  if(size%2==0){
    while(s[size/2+d]==s[size/2-d-1]){
      d++;
    }
    s[size/2+d]=s[size/2-d-1];
    cnt++;
    return swaping(s,d+1);
  }else{
    while(s[size/2+d+1]==s[size/2-d-1]){
      d++;
    }
    s[size/2+d+1]=s[size/2-d-1];
    cnt++;
    return swaping(s,d+1);
  }
}

int main() {
  string s;
  cin>>s;
  swaping(s,0);
  cout << cnt <<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdio.h>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<vector>
#include <time.h>
#include<string.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 2005;
const int Mod=1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e=2.718281828459045235360287471352662;
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
int a[maxn];
int main()
{
    ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);
    int n,d,x;
    int ans=0;
    cin>>n>>d>>x;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n;i++)
    {
        for(int j=1;j<=d;j+=a[i])
            ans++;
    }
    cout<<ans+x<<endl;
    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}


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

typedef vector<int> VI;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
#define global sdajklasdnkl
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin) it = a.begin(); it != a.end(); ++it)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)(a.size())
#define debug(a) cout << #a << " = " << a << endl;
#define FILL(a, value) memset(a, value, sizeof a)

const double PI = acos(-1.0);
const int base = 1000 * 1000 * 1000;
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
const int mod = 1000 * 1000 * 1000 + 7;
const int half = (mod + 1) / 2;

int n , m;
LL LCM;
string s , t;
int gcd(int a , int b)
{
	if(!a)
		return b;
	return gcd(b % a , a);
}
LL lcm(int a , int b)
{
	return a * (LL)b / gcd(a , b);
}
	
map<LL , char> mm;
bool good()
{
	LL i = 1;
	int ptr = 0;
	while(i <= LCM)
	{
		mm[i] = s[ptr++];
		i += LCM / n;
	}	
	i = 1;
	ptr = 0;
	while(i <= LCM)
	{
		if(mm.count(i))
			if(t[ptr] != mm[i])
			{
				return false;
			}
		ptr++;
		i += LCM / m;
	}
}
int main()
{
        //ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
       // freopen("in.txt" , "r" , stdin);
      	cin >> n >> m >> s >> t;
      	LCM = lcm(n , m);
      	if(good())
      	{
      		cout << LCM;
      	}
      	else
      		cout << -1;
}




Measured memory_bytes: 6144
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int d;
  cin>>d;
  if(d==22) cout<<"Christmas Eve Eve Eve"<<endl;
  else if(d==23) cout<<"Christmas Eve Eve"<<endl;
  else if(d==24) cout<<"Christmas Eve"<<endl;
  else cout<<"Christmas"<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;

class Main {
    public static void main(String args[]) throws IOException {
		String a = null;
		String b = null;
      	String c = null;
		Scanner scan = new Scanner(System.in);
      a = scan.next();
      b = scan.next();
      c = scan.next();
		//while (scan.hasNext()) {
		//List<int> list = new ArrayList<int>();
		//list.add(scan.next());
		//}
      	//if(list.get(0) + list.get(1) <= list.get(2) && list.get(0) >= list.get(2)) System.out.println("YES");
      if(Integer.parseInt(a) + Integer.parseInt(b) >= Integer.parseInt(c) && Integer.parseInt(a) <= Integer.parseInt(c)) System.out.println("YES");	
      else System.out.println("NO");
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9 + 7;

int add(int a, int b)
{
    return (a % mod + b % mod) % mod;
}
int pw(int x, int y)
{
    int p = mod;
    int res = 1;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

int32_t main()
{
    int n;
    cin >> n;
    cout << (add((add(pw(10, n), -(2 * pw(9, n) % mod)) + mod) % mod, pw(8, n)) + mod) % mod;
}

Measured memory_bytes: 3584
from collections import defaultdict

def prime_factorize(N): #素因数分解
    exponent = 0
    while N%2 == 0:
        exponent += 1
        N //= 2
    if exponent: factorization = [[2,exponent]]
    else: factorization = []
    i=1
    while i*i <=N:
        i += 2
        if N%i: continue
        exponent = 0
        while N%i == 0:
            exponent += 1
            N //= i
        factorization.append([i,exponent])
    if N!= 1: factorization.append([N,1])
    assert N != 0, "zero"
    return factorization

N = int(input())

if N <= 2:
    print(N)
    exit()
else:
    num = defaultdict(int)
    for i in range(2,N+1):
        for n,m in prime_factorize(i):
            num[n] += m


ans = 1
mod = int(1e9+7)
for i in num.values():
    ans = ((i+1)*ans)%mod

print(ans) 

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

const long long MOD = 1000000007;



void solve(long long N, long long M, vector<long long> A, vector<long long> B){
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    
    for(size_t i = 0; i < A.size(); i++)
    {
        cerr<<A[i]<<" ";
    }
    cerr<<endl;
    for(size_t i = 0; i < B.size(); i++)
    {
        cerr<<B[i]<<" ";
    }
    cerr<<endl;
    
    long long iA=N-1,iB=M-1;
    long long ans=1;
    for(long long i=N*M;i>0&&ans>0;i--){
        bool a=(iA>=0&&A[iA]==i),b=(iB>=0&&B[iB]==i);
        if(a&&b){
            iA--;iB--;
        }else if(a){
            iA--;
            ans=ans*(M-iB-1)%MOD;
        }else if(b){
            iB--;
            ans=ans*(N-iA-1)%MOD;
        }else{
            long long tmp=(N-iA-1)*(M-iB-1)-(N*M-i);
            if(tmp<=0){
                ans=0;
            }
            ans=ans*(tmp)%MOD;
        }
    }
    cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    vector<long long> B(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&B[i]);
    }
    solve(N, M, A, B);
    return 0;
}


Measured memory_bytes: 256
import collections as c
ip = lambda : map(int, input().split())

##############

ans = 0
N = int(input())
n = int(N**0.5)+2
#print(n)
for i in range(1,n):
    if N%i == 0 and N//i - 1 > i :
        ans += N//i - 1
print(ans)


Measured memory_bytes: 3316
#include <algorithm>
#include <array>
#include <bitset>
#include <cstdint>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <memory>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>

// constexpr std::int64_t INF = 1ull << 50;
constexpr int INF = 1 << 20;

auto main() -> int {
  std::string n{};
  std::cin >> n;

  for (auto c : n) {
    if (c == '1')
      std::cout << '9';
    else if (c == '9')
      std::cout << '1';
    else
      std::cout << c;
  }
  std::cout << std::endl;
}


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

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

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

typedef long long ll;

const int INF=1e9+7;

int solve(int now,int pre,int d,int n,int k,int s){
	if(now>s ||d>k)return 0;
	if(now==s && d==k)return 1;
	int re=0;
	FOR(i,pre+1,n+1)re+=solve(now+i,i,d+1,n,k,s);
	return re;
}

int main(){
	int n,k,s;
	while(cin>>n>>k>>s &&n){
		cout<<solve(0,0,0,n,k,s)<<endl;
	}
}

Measured memory_bytes: 3092
gets
puts gets.chomp
  .gsub(/a+/, 'a')
  .gsub(/b+/, 'b')
  .gsub(/c+/, 'c')
  .gsub(/d+/, 'd')
  .gsub(/e+/, 'e')
  .gsub(/f+/, 'f')
  .gsub(/g+/, 'g')
  .gsub(/h+/, 'h')
  .gsub(/i+/, 'i')
  .gsub(/j+/, 'j')
  .gsub(/k+/, 'k')
  .gsub(/l+/, 'l')
  .gsub(/m+/, 'm')
  .gsub(/n+/, 'n')
  .gsub(/o+/, 'o')
  .gsub(/p+/, 'p')
  .gsub(/q+/, 'q')
  .gsub(/r+/, 'r')
  .gsub(/s+/, 's')
  .gsub(/t+/, 't')
  .gsub(/u+/, 'u')
  .gsub(/v+/, 'v')
  .gsub(/w+/, 'w')
  .gsub(/x+/, 'x')
  .gsub(/y+/, 'y')
  .gsub(/z+/, 'z')
  .length


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

using namespace std;

int main(){
  int N;
  cin >> N;
  
  vector<int> W(N);
  
  for(int i=0; i<N; i++) cin >> W[i];
  
  vector<int> sum(N+1, 0);
  for(int i=0; i<N; i++) sum[i+1] = sum[i] + W[i];
  
  int ans = 100000000;
  for(int i=1; i<N; i++){
    ans = min(ans, abs((sum[N]-sum[i])-sum[i]));
  }
  
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3596
n = int(input())
a = [int(input()) for _ in range(n)]
sorted_a = []
for item in a:
    sorted_a.append(item)
sorted_a.sort(reverse=True)
for num in a:
    if num == sorted_a[0]:
        print(sorted_a[1])
    else:
        print(sorted_a[0]) 

Measured memory_bytes: 14112
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	ll x;

	cin>>x;

	ll i=1, ans=0;

	while(ans<x){
		ans+=i;
		i++;
	}
	cout<<i-1<<endl;
}

Measured memory_bytes: 256
import bisect

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

for i in range(1, n):
  a[i] += a[i - 1]
a.insert(0, 0)

for i in range(1, m):
  b[i] += b[i - 1]

ans = 0
for i in range(n + 1):
  if a[i] > k:
    break
  idx = bisect.bisect_right(b, k - a[i])
  ans = max(ans, i + idx)

print(ans)

Measured memory_bytes: 40460
#include<stdio.h>
#include<math.h>
int main() {
    int n, i;
    double m, a, s[1000], sum;
    while (1) {
        a = 0;
        sum = 0;
        scanf("%d", &n);
        if (n == 0) {
            break;
        }
        for (i = 0;i < n;i++) {
            scanf("%lf", &s[i]);
            sum += s[i];
        }
        m = sum / n;
        for (i = 0;i < n;i++) {
            a += (s[i] - m)*(s[i] - m) / n;
        }
        printf("%.8lf\n", sqrt(a));
    }
    return 0;
}

Measured memory_bytes: 664
using System;
using System.Collections.Generic;
using System.Linq;
public class SegmentTree
{
    public int N { get; private set; }
    public int[] Node;
    public int InvalidVal { get; private set; }

    public SegmentTree(int[] a, int invVal)
    {
        InvalidVal = invVal;
        for (N = 1; N < a.Length; N *= 2) ;
        Node = new int[2 * N - 1];
        for (int i = 0; i < Node.Length; i++)
        {
            Node[i] = InvalidVal;
        }
        for (int i = 0; i < a.Length; i++)
        {
            Node[N + i - 1] = a[i];
        }
        for (int i = N - 2; i >= 0; i--)
        {
            Node[i] = Marge(Node[2 * i + 1], Node[2 * i + 2]);
        }
    }

    public void Update(int x, int v)
    {
        x += (N - 1);
        Node[x] = v;

        while (x > 0)
        {
            x = (x - 1) / 2;
            Node[x] = Marge(Node[2 * x + 1], Node[2 * x + 2]);
        }
    }

    public int Get(int a, int b)
    {
        return Get(a, b, 0, 0, N);
    }

    private int Get(int a, int b, int k, int l, int r)
    {
        if (r <= a || b <= l)
        {
            return InvalidVal;
        }
        if (a <= l && r <= b)
        {
            return Node[k];
        }

        var vl = Get(a, b, 2 * k + 1, l, (l + r) / 2);
        var vr = Get(a, b, 2 * k + 2, (l + r) / 2, r);
        return Marge(vl, vr);
    }

    private static int Marge(int a, int b)
    {
        return Math.Max(a, b);
    }


    public int At(int i)
    {
        return Node[N + i - 1];
    }
}

public static class Solution
{
    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var N = vals[0];
        var K = vals[1];
        var A = new int[N];
        for (int i = 0; i < N; i++)
        {
            A[i] = int.Parse(Console.ReadLine());
        }

        var aMax = A.Max();
        var segTree = new SegmentTree(new int[aMax + 1], 0);
        foreach (var a in A)
        {
            var min = Math.Max(0, a - K);
            var max = Math.Min(aMax, a + K);
            var next = segTree.Get(min, max + 1) + 1;
            segTree.Update(a, next);
        }

        var best = segTree.Get(0, aMax);

        Console.WriteLine(best);
    }
}

Measured memory_bytes: 44572
def drawone(f):
    v = list(range(1,11))
    for i in f:
        v.remove(i)
    win = 0
    lose= 0
    for i in v:
        if i + sum(f[:2]) <= 20:
            win += 1
        else:
            lose += 1
    return(True if win>=lose else False)

while True:
    try:
        f = list(map(int,input().strip().split()))
        if drawone(f):
            print('YES')
        else:
            print('NO')
    except EOFError:
        break

Measured memory_bytes: 7572
#define _CRT_SECURE_NO_WARNINGS

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

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef map<int, string> mis;
typedef pair<int, ii> edge;


#define sc(x)  scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,end) for(int i=0; i<end; i++)
#define rlop(i,start) for(int i=start-1; i>=0; i--)
#define loop(i,start,end) for(int i=start; i<end; i++)
#define rloop(i,start,end) for(int i=start-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define mP make_pair
#define f first
#define s second

const ll OO = (ll)(4e18) + 9;
const int MOD = (int)(1e9) + 7;
const int oo = 2147483647;
const double EPS = 1e-8;
const double PI = acos(-1.0);

//enum dir { d, r, u, l , dr, ur, dl, ul };
int dx[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

string abc = "abcdefghijklmnopqrstuvwxyz";
string vowels = "aeiouy"; //and sometimes "aeiouy"

template<typename X, typename Y> bool ckmin(X& a, Y b) { return a > b ? a = b, true : false; }
template<typename X, typename Y> bool ckmax(X& a, Y b) { return a < b ? a = b, true : false; }

int dcmp(ld d1, ld d2) { return fabs(d1 - d2) <= EPS ? 0 : d1 > d2 ? 1 : -1; } //Compare Double Numbers
ll gcd(ll x, ll y) { return !y ? x : gcd(y, x%y); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
//convert index from 2D array to 1D array. (Zero-indexed)
int conv_2_1(int r, int c, int nCol) { return (nCol*r) + c + 1; }
//convert index from 1D array to 2D array. (Zero-indexed)
ii conv_1_2(int n, int nCol) {
	int r = n / nCol, c = n % nCol;
	return ii(r, c);
}

void inter(string s) {
	cout << s << endl;
	fflush(stdout);
}


ll power(ll base, ll exp) {
	ll ans = 1;
	base %= MOD;
	while (exp > 0) {
		if (exp & 1) ans = (ans * base) % MOD;
		exp >>= 1;
		base = (base * base) % MOD;
	}
	return ans;
}

const int NN = 2e6 + 10;
ll fact[NN];

void init() {
	fact[0] = 1;
	for (int i = 1; i < NN; ++i) fact[i] = (fact[i - 1] * 1LL * i) % MOD;
}

ll nCr(ll n, ll r) {
	auto modInverse = [](ll a) { 
		return power(a, MOD - 2); 
	};
	return (fact[n] * modInverse(fact[r] * 1LL * fact[n - r])) % MOD;
}



int main()
{
#ifndef ONLINE_JUDGE

#else
	//freopen("pyramid.in", "r", stdin);
#endif
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll a; float b;
	cin >> a >> b;
	ll bb = b * 100 + 0.5;
	cout << (a*bb)/100 << endl;
	



	return 0;
}


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

using namespace std;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef pair<int, int> pii;

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

void solve() {
  int n;
  cin >> n;
  set<int> st;
  rep(i,n) {
    int d;
    cin >> d;
    st.insert(d);
  }
  cout << st.size() << endl;
}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    int a,b,x;
    cin>>a>>b>>x;
    if(b>=x-a&x-a>=0){
        cout<<"YES";
    }else{
        cout<<"NO";
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a[100]={0};
    int n=0;
    int counter=0;
    scanf("%d", &n);
    for(int i=0;i<n;i++){scanf("%d", &a[i]);}
    for(int m=0;m<=n-1;m++){
        for(int j=n-1;j>=m+1;j--){
            if(a[j]<a[j-1]){
                int temp=0;
                temp=a[j];
                a[j]=a[j-1];
                a[j-1]=temp;
                counter++;
            }
        }
        if(m!=n-1){printf("%d ", a[m]);}
        else{printf("%d\n", a[m]);}
    }
    printf("%d\n", counter);
    return 0;
}





Measured memory_bytes: 2052
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
const ll NN = 2e5 + 5;
ll n, i, x[99], y[99], has, mo = 1e9 + 7;
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n;
    for(i = 1; i <= n; i++)
    {
        ll ta;
        cin >> ta;
        for(ll j = 0; j < 60; j++)
            if(ta & (1LL<<j))
                x[j]++;
            else
                y[j]++;
    }
    ll K = 1;
    for(i = 0; i < 60; i++)
    {
        ll hz = (x[i] * y[i]) %mo;
        hz = (hz * K) % mo;
        has = (has + hz) % mo;
        K = (K * 2LL) % mo;
    }
    cout << has << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mx 200000
#define P pair<int,int>
int main(){
  int n,k,in,cnt=0;
  int a[mx+1]={};
  priority_queue<P,vector<P>,greater<P> > q;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>in;
    a[in]++;
  }
  for(int i=1;i<=n;i++){
    if(a[i]>0)
      q.push(P(a[i],i));
  }
  while(!q.empty()&&q.size()>k){
    P tp=q.top(); q.pop();
    cnt+=tp.first;
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 3188
N, K = map(int, input().split())
A = list(map(int, input().split()))
S = sum(A)

def isOk(n):
    B = [a % n for a in A]
    B.sort()

    now = 0
    S = sum(B)
    for i, b in enumerate(B[: -1]):
        now += b
        S -= b
        if now == n * (N - i - 1) - S and now <= K:
            return True
    return False

ans = 1
for i in range(1, int(S**0.5) + 100):
    if S % i != 0:
        continue
    j = S // i

    if isOk(i):
        ans = max(ans, i)
    if isOk(j):
        ans = max(ans, j)

print(ans)

Measured memory_bytes: 3188
#include <stdio.h>
int main(){
    unsigned long long int sum;
    int n;
    sum=0;
    scanf("%d",&n);
    for(int i =1;i<n+1;i++){
        if(i%3 != 0){
            if(i%5 != 0){
                sum=sum+i;
            }
        }
    }
    printf("%lu",sum);
    return 0;
}


Measured memory_bytes: 1732
n = int(input())
A = list(map(int, input().split()))

base = A[0]
up = False
down = False
kouho = [base]
for i in range(1, n):
    if A[i] - A[i - 1] > 0:
        up = True
        if down:
            kouho.append(A[i - 1])
            down = False
    elif A[i] - A[i - 1] < 0:
        down = True
        if up:
            kouho.append(A[i - 1])
            up = False
kouho.append(A[-1])
if A[1] < A[0]:
    kouho = kouho[1:]

ans = 1000
num = len(kouho)
money = 1000
stock = 0
for i in range(num):
    rate = kouho[i]
    if not stock:
        stock += money // rate
        money %= rate
    else:
        money += stock * rate
        stock = 0
        ans = max(ans, money)

print(ans)


Measured memory_bytes: 9252
package main

import(
    "fmt"
)



func main() {
    var n,x int
    fmt.Scan(&n,&x)
    var l = make([]int, n)
    for i:=0; i<n; i++{
        fmt.Scan(&l[i])
    }
    ans := 1
    d := 0
    for i:=0; i<n; i++{
        d = d + l[i]
        if d <= x{
            ans++
        }
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) REP(i, 0, n)
#define REP(i, l, r) for (long long i = l; i < r; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;

struct edge {
	int to, cost;
};
class dijkstra {
	int V;
	int d[100002];
	priority_queue<P, vector<P>, greater<P>> que;
	void update(int s, vector<edge> G[]) {
		fill(d, d + V + 1, 100000000000ll);
		d[s] = 0;
		que.push(make_pair(0, s));
		while (!que.empty()) {
			P p = que.top();
			que.pop();
			int v = p.second;
			if (d[v] < p.first) continue;
			rep(i, G[v].size()) {
				edge e = G[v][i];
				if (d[e.to] > d[v] + e.cost) {
					d[e.to] = d[v] + e.cost;
					que.push(make_pair(d[e.to], e.to));
				}
			}
		}
	}

  public:
	dijkstra(int v, int s, vector<edge> G[]) {
		V = v;
		update(s, G);
	}
	int find(int e) {
		return d[e];
	}
};
int gcd(int a, int b) {
	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}
int lcm(int a, int b) {
	return a * b / gcd(a, b);
}
bool prime(int a) {
	if (a == 1) return false;
	for (int i = 2; i * i <= a; i++) {
		if (a % i == 0) return false;
	}
	return true;
}
class Union_Find {
  private:
	vector<int> t, s;

  public:
	Union_Find(int max_length) {
		rep(i, max_length + 1) {
			t.push_back(i);
			s.push_back(1);
		}
	}
	void Union(int x, int y) {
		if (same(x, y)) return;
		int tx = Find(x), ty = Find(y);
		if (s[tx] < s[ty]) {
			s[ty] += s[tx];
			t[tx] = ty;
		}
		else if (s[tx] > s[ty]) {
			s[tx] += s[ty];
			t[ty] = tx;
		}
		else if (tx > ty) {
			t[tx] = ty;
			s[ty] += s[tx];
		}
		else {
			t[ty] = tx;
			s[tx] += s[ty];
		}
	}
	int Find(int n) {
		if (t[n] == n)
			return n;
		else
			return t[n] = Find(t[n]);
	}
	bool same(int x, int y) {
		return Find(x) == Find(y);
	}
	int get_Size(int a) {
		return s[a];
	}
	int get_tree(int size){
		set<int> st;
		rep(i,size){
			st.insert(Find(i+1));
		}
		return st.size();
	}
};
signed main() {
	int n,m;
	cin>>n>>m;
	Union_Find tree(n);
	rep(i,m){
		int x,y,z;
		cin>>x>>y>>z;
		tree.Union(x,y);
	}
	cout<<tree.get_tree(n)<<endl;
}


Measured memory_bytes: 6508
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

ll d[100100];

int main() {
	clr(d,0);
	ll n,k,q;
	cin>>n>>k>>q;
	rep(i,0,q){
		ll a;
		cin>>a;
		a--;
		d[a]++;
	}
	rep(i,0,n){
		d[i]-=q-k;
		if(d[i]>0){
			cout << "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}
	}
	return 0;
}

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

using namespace std;
int main(){
    int n,m,i,max=0;
    int t[110],p[110],x[110];
    cin>>n;
    for(i=1;i<=n;i++){
        cin>>t[i];
        max+=t[i];
    }
    cin>>m;
    for(i=1;i<=m;i++){
        cin>>p[i]>>x[i];
    }
    for(i=1;i<=m;i++){
        cout<<max-t[p[i]]+x[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;
typedef vector<pii> vpii;
#define reps(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define all(g) (g).begin(),(g).end()
#define pb push_back
const int mod = 1e9 + 7;
#define INF 1<<25
/*
input case
output case
*/

int N;
int A,B;
string s;

int a = 0;
int b = 0;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> A >> B;
    cin >> s;

    rep(i,N){
        if (s[i] == 'a'){
            if (A + B > a + b){
                a++;
                cout << "Yes" << endl;
            } else{
                cout << "No" << endl;
            }
        }
        else if (s[i] == 'b'){
            if ((A + B > a + b) and (b < B)){
                b++;
                cout << "Yes" << endl;
            } else{
                cout << "No" << endl;
            }
        }
        else{
            cout << "No" << endl;
        }
    }

}

Measured memory_bytes: 848
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define all(v) (v).begin(),(v).end()
#define endl "\n"
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define vi vector<int>
#define pii pair<int,int>
#define mii map<int,int>
#define SET(A,VAL) memset(A, VAL, sizeof(A))
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
const int MAX = 1e6 + 8;
const int MOD = 1e9 + 7;
const int sz = 1e5 + 5;
void f_io(){
    IOS;
    // #ifndef ONLINE_JUDGE
    // FRE
    // #endif
}


int32_t main(){
    f_io();
    int tc = 1;
    //cin>>tc;
    while(tc--){
        int n; cin >> n;
        vector<int> v(n); for(auto &el : v) cin >> el;
        sort(begin(v), end(v));
        reverse(begin(v), end(v));
        int ind = 1;
        int cnt = 0;
        int ans = v[0];
        for(int i = 2; i < v.size(); i++){
            ans += v[ind];
            // cout <<ind << endl;
            cnt++;
            if(cnt > 1){
                ind++;
                cnt = 0;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 4768
#include <iostream>

int getPrivateRating(int K, int R) {
    if(K >= 10) {
        return R;
    } else {
        return R + (100 * (10 - K));
    }
}

int main(int argc, const char * argv[]) {
    int N(0), R(0);

    std::cin >> N >> R;

    int PrivateRating = getPrivateRating(N, R);

    std::cout << PrivateRating;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<ll, int> P;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int h, w, k;
ll dp[110][11];

ll mod_pow(ll x, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}

bool check(int b) {
    for (int l = 0; l < w-2; l++) {
        if (((b>>l)&1) && ((b>>(l+1))&1))
            return false;
    }
    return true;
}

ll solve() {
    dp[0][1] = 1;

    int c[3][11];
    for (int i = 1; i <= w; i++) {
        c[0][i] = 0;
        for (int j = 0; j < (1<<(w-1)); j++) {
            if (!check(j)) continue;
            if (i-1 >= 1 && ((j>>(i-2))&1)) continue;
            if (i+1 <= w && ((j>>(i-1))&1)) continue;
            c[0][i]++;
        }

        c[1][i] = 0;
        for (int j = 0; j < (1<<(w-1)); j++) {
            if (!check(j)) continue;
            if (i-1 >= 1 && ((j>>(i-2))&1)) continue;
            if (i-2 >= 1 && ((j>>(i-3))&1)) continue;
            if (i+1 <= w && ((j>>(i-1))&1)) continue;
            c[1][i]++;
        }

        c[2][i] = 0;
        for (int j = 0; j < (1<<(w-1)); j++) {
            if (!check(j)) continue;
            if (i-1 >= 1 && ((j>>(i-2))&1)) continue;
            if (i+1 <= w && ((j>>(i-1))&1)) continue;
            if (i+2 <= w && ((j>>(i))&1)) continue;
            c[2][i]++;
        }

        cerr << i << ": " << c[0][i] << " " << c[1][i] << " " << c[2][i] << endl;
    }
    
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            dp[i][j] += dp[i-1][j] * c[0][j];
            dp[i][j] %= mod;

            dp[i][j] += dp[i-1][j-1] * c[1][j];
            dp[i][j] %= mod;

            dp[i][j] += dp[i-1][j+1] * c[2][j];
            dp[i][j] %= mod;
        }
    }
    
    return dp[h][k];
}

void input() {
    cin >> h >> w >> k;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 3576
package main

import "fmt"

// MOD is asssupmed to be a prime number 10^9+7 in this library
const MOD = int(1e9) + 7 // 100000007

func madd(a, b int) int {
	return (a + b) % MOD
}
func msub(a, b int) int {
	return (a + MOD - b) % MOD
}
func mmul(a, b int) int {
	return (a % MOD * b % MOD) % MOD
}
func mdiv(a, b int) int {
	return mmul(a, mpow(b, MOD-2))
}

func mpow(b, n int) int {
	if n == 0 {
		return 1
	}
	r := mpow(b, n/2)
	r = mmul(r, r)
	if n%2 == 1 {
		r = mmul(r, b)
	}
	return r
}
func minv(a int) int {
	return mpow(a, MOD-2)
}

func mcmb(n, a int) int {
	if n-a < a {
		a = n - a
	}
	// nCk = n! / k!(n-k)! = n*(n-1)*(n-2)*...*(n-k+1) / 1*2*3*...*k
	p, q := 1, 1
	for i := 0; i < a; i++ {
		p = mmul(p, n-i)
	}
	for i := 1; i <= a; i++ {
		q = mmul(q, i)
	}
	return p * mpow(q, MOD-2) % MOD
}

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)
	nCi := mpow(2, n) - 1
	nCa := mcmb(n, a)
	nCb := mcmb(n, b)
	fmt.Println(msub(nCi, madd(nCa, nCb)))
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<algorithm>
#include<functional>
//#include<boost/multiprecision/cpp_int.hpp>
#define f(n) for(long long int i=0;i<n;i++)
#define g(n) for(long long int j=0;j<n;j++)
#define ff(a,n) for(long long int i=a;i<n;i++)
#define gg(a,n) for(long long int j=a;j<n;j++)
#define t(a) long long int a;cin>>a
#define test(te) t(te); while(te--)
#define all(a) a.begin(),a.end()
#define end "\n"
#define pri(a,n) f(n){cout<<a[i]<<" ";}cout<<end
#define pb push_back
#define mp make_pair
#define mod 1000000007  
#define ll long long 
#define lli long long int
#define op std::ios_base::sync_with_stdio(false);cin.tie(NULL)
//using namespace boost::multiprecision;
using namespace std;

int main(int argc, char const *argv[])
{
    op;
    lli arr[3][3];
    map<lli,lli> m;
    f(3)
    {
    	g(3)
    	{
    		cin>>arr[i][j];
    		m[arr[i][j]]=1;
    	}
    }
    t(n);
    f(n)
    {
    	t(a);
    	if(m[a]==1)
    	{
    		f(3)
    		{
    			g(3)
    			{
    				if(arr[i][j]==a)
    					arr[i][j]=0;
    			}
    		}
    	}
    }
    lli ans=0;
    if(arr[0][0]+arr[0][1]+arr[0][2]==0)
    	ans=1;
    else if(arr[1][0]+arr[1][1]+arr[1][2]==0)
    	ans=1;
    else if(arr[2][0]+arr[2][1]+arr[2][2]==0)
    	ans=1;
    if(arr[0][0]+arr[1][0]+arr[2][0]==0)
    	ans=1;
    else if(arr[0][1]+arr[1][1]+arr[2][1]==0)
    	ans=1;
    else if(arr[0][2]+arr[1][2]+arr[2][2]==0)
    	ans=1;
    else if(arr[0][0]+arr[1][1]+arr[2][2]==0)
    	ans=1;
    else if(arr[0][2]+arr[1][1]+arr[2][0]==0)
    	ans=1;

    ans?cout<<"Yes\n" : cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cctype>
#include <map>

const int INT_INF = 1000000000;                 // 10^9
const long long LONG_INF = 1000000000000000000; // 10^18

using namespace std;

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

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

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int h[n];
  int cnt = 1;
  for(int i=0; i<n; i++){
    cin >> h[i];
  }
 
  for(int i=1; i<n; i++){
    int a = 1;
    for(int j=0; j<i; j++){
      if(h[j] > h[i]) {
        a = 0;
      }
    }
    if(a == 1) {
      cnt++;
    }
  }
  cout << cnt << endl;
  
}

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

int main()
{
    int a, b, c;
    cin >> a >> b;
    int num[4] = {0, 0, 0, 0};
    num[a] = 1;
    num[b] = 1;

    for (int i = 1; i <= 3; i++) {
        if (!num[i]) {
            cout <<i << "\n";
            break;
        }
    }
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace AtCoder.ABC067
{
    class Program
    {
        static void Main()
        {
            int[] inputs = Console.ReadLine().Split(' ')
                        .Select(int.Parse)
                        .ToArray();
            int A = inputs[0];
            int B = inputs[1];

            if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0)
            {
                Console.WriteLine("Possible");
            }
            else Console.WriteLine("Impossible");
        }
    }
}

Measured memory_bytes: 11220
ns = list(map(int, input().split()))
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
zs = list(map(int, input().split()))
xys = []
ans = []
for x in xs:
	for y in ys:
		xys.append(x+y)
xys.sort()
xys.reverse()
for i in range(min(ns[0]*ns[1], ns[3])):
	for j in range(min(ns[2], ns[3])):
		ans.append(xys[i]+zs[j])
ans.sort()
ans.reverse()
for i in range(ns[3]):
	print(ans[i])


Measured memory_bytes: 151896
// Library
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

// TYPEDEFS
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

// CONSTANTS
#define SZA 0
#define SZB 0

// MACRO
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
#define ABS(X) (((X) > 0)? (X) : -(X))
#define YN(X) ((X)? "Yes" : "No")
#define SWAP(T, X, Y) {T t; t = X; X = Y; Y = t;}

#define F first
#define S second
#define PB push_back
#define MP make_pair


// Global Tables

//ull gPreProcess[SZA][SZB];

// Functions

void Print2DVector(vector<vector<int>>& v)
{
    ull i, j; 
    for(i = 0; i < v.size(); i++)
    {
        for(j = 0; j < v[i].size(); j++)
        {
            cout << v[i][j];
            if(j == v[i].size()-1)
            {
                cout << endl;
            }
            else
            {
                cout << " ";
            }
        }
    }
}

void PrintVector(vi& v)
{
    ull i;
    for(i = 0; i < v.size(); i++)
    {
        cout << v[i];
        if(i == v.size()-1)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

void PrintArr(int* a, ull N)
{
    ull i;
    for(i = 0; i < N; i++)
    {
        cout << a[i];
        if(i == N-1)
        {
            cout << endl;
        }
        else
        {
            cout << " ";
        }
    }
}

void PreProcessTables()
{
    ull i, j;
    for(i = 0; i < SZA; i++)
    {
        for(j = 0; j < SZB; j++)
        {
            break;
        }
        break;
    }
}

void TC(int t)
{
    int n;
    string a, b;
    cin >> a >> b;
    if(a.size() + 1 != b.size())
    {
        cout << YN(0) << endl;
    }
    else
    {
        for(n = 0; n < a.size(); n++)
        {
            if(a[n] != b[n])
            {   
                cout << YN(0) << endl;
                break;
            }
        }
        if(n == a.size())
        {
            cout << YN(1) << endl;
        }
    }
}

// Main

int main(void)
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 
    PreProcessTables();

    int T = 1, t;
    for(t = 1; t <= T; t++)
    {
        TC(t);
    }
    return 0;
}


Measured memory_bytes: 3644
n = int(input())
p = [[0, 0, 0]]

for i in range(0, n):
    t, x, y = [int(i) for i in input().split(" ")]
    p.append([t, x, y])

f = True

for i in range(0, n):
    l = abs(p[i][1] - p[i + 1][1]) + abs(p[i][2] - p[i + 1][2])
    dt = p[i + 1][0] - p[i][0]
    if l == 0 and dt == 1:
        f = False
        break
    if dt < l:
        f = False
        break
    else:
        if (dt - l) % 2 == 1:
            f = False
            break

if f:
    print("Yes")
else:
    print("No")

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

using namespace std;

#define foru(i, l, r) for (register int i = l; i <= r; i++)
#define ford(i, r, l) for (register int i = r; i >= l; i--)

int read() {
  int res = 0;
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) res = res * 10 + c - '0', c = getchar();
  return res;
}

const int mod = 1e9 + 7, inv_2 = (mod + 1) >> 1;
void Inc(int &x, int y) { x += y, x -= x >= mod ? mod : 0; }
void Dec(int &x, int y) { x -= y, x += x < 0 ? mod : 0; }
int inc(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }
int dec(int x, int y) { return x < y ? x - y + mod : x - y; }
int mul(int x, int y) { return 1LL * x * y % mod; }

const int maxn = 3030;
int N, Q, A[maxn];
int f[maxn][maxn];

int main() {
  N = read(), Q = read();
  for (int i = 1; i <= N; i++) A[i] = read();
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= N; j++) f[i][j] = A[i] > A[j];
  for (int hhw = 1; hhw <= Q; hhw++) {
    int x = read(), y = read();
    f[x][y] = f[y][x] = mul(inc(f[x][y], f[y][x]), inv_2);
    for (int i = 1; i <= N; i++) {
      if (i == x || i == y) continue;
      f[i][x] = f[i][y] = mul(inc(f[i][x], f[i][y]), inv_2);
      f[x][i] = f[y][i] = mul(inc(f[x][i], f[y][i]), inv_2);
    }
  }
  int Ans = 0;
  for (int i = 1; i <= N; i++)
    for (int j = i + 1; j <= N; j++) Inc(Ans, f[i][j]);
  for (int i = 1; i <= Q; i++) Ans = mul(Ans, 2);
  printf("%d\n", Ans);
  return 0;
}


Measured memory_bytes: 35840
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      int[] seqS = new int[n];
      String line = br.readLine();
      StrSplitToInt stoi = new StrSplitToInt(line, " ");
      for (int i=0; i<n; i++)
        seqS[i] = stoi.nextInt();

      int q = Integer.parseInt(br.readLine());
      String[] lines = br.readLine().split(" ");
      
      int cnt=0;
      for (String ref : lines) {
        if( isExistSeachByBinary(seqS, Integer.parseInt(ref)) )
          cnt++;
      }

      System.out.println(cnt);
    }
  }

  static boolean isExistSeachByBinary(int[] tar, int ref) {
    int left = 0;
    int right= tar.length;
    int mid;
    while( left < right ) {
      mid  = (left + right) / 2;
      if( tar[mid] > ref ) right = mid;
      else if(tar[mid] < ref ) left = mid + 1;
      else return true;
    }

    return false;
  }
}

class StrSplitToInt {
  String s;
  String split;
  int currentPos;
  int nextPos;
  int endPos;
  int splitLen;

  public StrSplitToInt(String s,String split) {
    this.s = s;
    this.split = split;
    currentPos = 0;
    nextPos = s.indexOf(split, currentPos);
    endPos = s.length();
    splitLen = split.length();
  }

  public int nextInt() {
    if( currentPos < endPos ) {
      int ret = Integer.parseInt( s.substring(currentPos, nextPos) );
      currentPos = nextPos + splitLen;
      nextPos = s.indexOf(split, currentPos);
      if(nextPos == -1) nextPos = endPos;

      return ret;
    }
    else
      return -1;
  }
}


Measured memory_bytes: 50064
def dfs_sub(i, b, sx, sy, dx, dy):
    if 0 <= sx + dx < w and 0 <= sy + dy < h and b[sy + dy][sx + dx] == 1:
        # Blocked immediately
        return -1
    while 0 <= sx < w and 0 <= sy < h:
        if b[sy][sx] != 0:
            break
        sx += dx
        sy += dy
    else:
        # Got out of the board
        return -1
    if b[sy][sx] == 3:
        # Reached the goal
        return i + 1
    # Hit a block
    if i == 9:
        return -1
    b2 = [row[:] for row in b]
    b2[sy][sx] = 0
    return dfs(i + 1, b2, sx - dx, sy - dy)


def dfs(i, b, sx, sy):
    min_ans = 100
    for dx, dy in [[0, 1], [1, 0], [0, -1], [-1, 0]]:
        cnt = dfs_sub(i, b, sx, sy, dx, dy)
        if cnt != -1:
            min_ans = min(min_ans, cnt)
    return min_ans if min_ans != 100 else -1


while True:
    w, h = [int(_) for _ in raw_input().split()]
    if w == h == 0:
        break
    board = [[int(_) for _ in raw_input().split()] for __ in xrange(h)]
    for y in xrange(h):
        for x in xrange(w):
            cell = board[y][x]
            if cell == 2:
                sx = x
                sy = y
                board[y][x] = 0
            elif cell == 3:
                gx = x
                gy = y

    print dfs(0, board, sx, sy)

Measured memory_bytes: 6300
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n,m;
  	ci(n>>m)
      co((n-1)*(m-1))
}

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

int n,d;

int main(){
  int i,j=1;
  cin >> d >> n;
  for(i=0;i<d;i++)j*=100;
  if(n==100)cout << 101*j << endl;
  else cout << n*j << endl;
  

  return 0;
}


Measured memory_bytes: 256