akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define all(c) begin(c),end(c)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
//最大公約数
ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}
//最小公倍数
ll lcm(ll x, ll y) {
  return x/gcd(x, y)*y;
}
//素因数分解
vector<pair<ll,int>> factorize(ll n) {
  vector<pair<ll,int>> res;
  for (ll i = 2; i*i <= n; ++i) {
    if (n%i) continue;
    res.emplace_back(i,0);
    while (n%i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.emplace_back(n,1);
  return res;
}
 
 
 ll mod=998244353;
 
int main() {
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  int magic=0;
  while(a>=b){
    magic++;
    b=2*b;
  }
  while(b>=c){
    magic++;
    c=2*c;
  }
  if(magic>k){
    cout<<"No";
  }else{
    cout<<"Yes";
  }



}



Measured memory_bytes: 3624
using System;
using System.Linq;

namespace A___Meal_Delivery
{
    class Program
    {
        static void Main(string[] args)
        {
            var x_a_b = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int x = x_a_b[0], a = x_a_b[1], b = x_a_b[2];

            Console.WriteLine(Math.Abs(x - a) < Math.Abs(x - b) ? "A" : "B");
        }
    }
}


Measured memory_bytes: 13268
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long ll;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,k;
  long long a,cnt=0;
  vector<long long> s;
  cin>>n;
  s.resize(n+1);
  s[0]=0;
  FOR(i,1,n+1){
    cin>>a;
    s[i]=s[i-1]+a;
  }
  VSORT(s);

  REP(i,n+1){
    if(i==0||s[i]>s[i-1])  k=i;
    cnt+=i-k;
  }
  cout << cnt << '\n';

  return 0;
}


Measured memory_bytes: 1792
fun main(args: Array<String>){
    val age = readLine()!!.toInt()

    when(age){
        1 -> { ageIsOne() }
        2 -> { ageIsTwo() }
        else -> throw
    IllegalArgumentException("1歳か2歳のみ許容します")
    }
    
}

fun ageIsOne(){
    println("Hello World")
}

fun ageIsTwo(){
    val num1 = readLine()!!.toInt()
    val num2 = readLine()!!.toInt()
    println(num1 + num2)
}

Measured memory_bytes: 31696
//线段树-区间修改，查询区间和
#include<bits/stdc++.h>
#include <iostream>
#include <cstdio>
#define ints long long
#define ll long long
#define maxn 1000005
using namespace std;

ll sum[maxn];//序号为k的区间的区间和
ll a[maxn];
ll add[maxn];//lazy标记
ints n,m;
struct node
{
    ll x,h;
    void get()
    {
        cin>>x>>h;
    }
}p[maxn];
bool cmp(node a,node b)
{
    return a.x<b.x;
}
void build(ints k,ints l,ints r)
{
    if(l==r)
    {
        sum[k]=a[l];
        return;
    }
    ints mid=(l+r)/2;
    build(2*k,l,mid);
    build(2*k+1,mid+1,r);
    sum[k]=sum[2*k]+sum[2*k+1];
}//建立线段树，维护区间和

void Add(ints k,ints l,ints r,ll v)//给定区间[l,r]所有数加上v(打标记)
{
    add[k]+=v;
    sum[k]+=(r-l+1)*v;//维护区间和
    return;
}

void pushdown(ints k,ints l,ints r,ints mid)//标记下传
{
    if(add[k]==0)return;
    Add(k*2,l,mid,add[k]);//下传到左子树
    Add(k*2+1,mid+1,r,add[k]);//下传到右子树
    add[k]=0; //清零标记
}

void modify(ints k,ints l,ints r,ints x,ints y,ll v)//给区间[x,y]所有的数加上v(真的加上)
{
    if(l>=x&&r<=y)
    {
        return Add(k,l,r,v);
    }
    ints mid=(l+r)/2;
    pushdown(k,l,r,mid); //到达每一个结点都要下传标记
    if(x<=mid)modify(2*k,l,mid,x,y,v);//修改左子树
    if(y>mid)modify(2*k+1,mid+1,r,x,y,v);//修改右子树
    sum[k]=sum[2*k]+sum[2*k+1];
}

ll query(ints k,ints l,ints r,ints x,ints y)
{
    if(l>=x&&r<=y)
    {
        return sum[k];
    }
    ints mid=(l+r)/2;
    ll res=0;
    pushdown(k,l,r,mid);
    if(x<=mid)
    {
        res+=query(k*2,l,mid,x,y);
    }
    if(y>mid)
    {
        res+=query(k*2+1,mid+1,r,x,y);
    }
    return res;
}//询问区间[x,y]的区间和

int  main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    ll D,A;
    cin>>n>>D>>A;
    for(ints i=1;i<=n;i++)
    {
        p[i].get();
    }
    sort(p+1,p+n+1,cmp);
   // scanf("%d%d",&n,&m);
    for(ints i=1;i<=n;i++)
    {
        a[i]=p[i].h;
    }
    build(1,1,n);
    ll res=0;
    for(ints i=1;i<=n;i++)
    {
        ll ans=query(1,1,n,i,i);
        if(ans<=0)
            continue;
        m=ans/A+(ans%A!=0);
        res+=m;
     //   cout<<res<<endl;
       ll g=p[i].x+2*D,rr=i;
        ints l=i,r=n;
        while(l<=r)
        {
            ints mi=(l+r)/2;
            if(p[mi].x>g)
            {
                r=mi-1;
            }
            else {
                l=mi+1;
                rr=mi;
            }
        }
        modify(1,1,n,i,rr,-m*A);
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 20736
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0)
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (lli i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli c[5];
int main() {
  fill(begin(c), end(c), 0);
  for (lli i=0; i<6; ++i) {
    lli j; cin >> j;
    c[j]++;
  }

  lli d[5]; d[1] = d[2] = 0;
  for (lli x : c) d[x]++;

  cout << (d[1]==2 && d[2]==2 ? "YES" : "NO") << endl;
  return 0;
}


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

int main()
{
    int k, s;
    cin >> k >> s;
    int ans = 0;
    rep(x, k + 1) {
        rep(y, k + 1) {
            int z = s - x - y;
            if(z >= 0 && z <= k) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3568
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            Console.Write(input[0]);
            Console.Write(input.Length - 2);
            Console.WriteLine(input[input.Length - 1]);
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  int count=0;
  int l=s.length();
  for(int i=0;i<l;i++){
    if(s[i]!=t[i])
      count++;
  }
  cout<<count<<endl;
}

Measured memory_bytes: 3916
# coding:utf-8


def main():
    # N = int(input())
    # N, M = map(int, input().split())
    # A = list(map(int, input().split()))
    S = list(input())
    d = {}
    flag = True
    for si in S:
        if si in d:
            d[si] += 1
        else:
            d[si] = 1
    for k in d:
        if d[k] != 2:
            flag = False

    if flag:
        print("Yes")
    else:
        print("No")
    # print(ans)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 38384
#include<iostream>
#include<vector>
#include <unordered_map>  
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <sstream>
#include <cmath>
using namespace std;


int main() {
	int n;
	unsigned long long int y;
	cin >> n >> y;
	vector<int> sen, gosen, ichi;
	for (int i = 0; i < n; ++i) {
		gosen.push_back(1);
	}
	unsigned long long int sum = sen.size() * 1000 + gosen.size() * 5000 + ichi.size() * 10000;
	while (sum != y) {
		if (sum > y) {
			if (gosen.size() == 0) {
				cout << "-1 -1 -1" << endl;
				return 0;
			}
			gosen.erase(gosen.begin());
			sen.push_back(1);
		}
		else {
			if (gosen.size() == 0) {
				cout << "-1 -1 -1" << endl;
				return 0;
			}
			gosen.erase(gosen.begin());
			ichi.push_back(1);
		}
		sum = sen.size() * 1000 + gosen.size() * 5000 + ichi.size() * 10000;
	}
	cout << ichi.size() << " " << gosen.size() << " " << sen.size() << endl;
	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 a, b, c, d;
    cin >> a >> b >> c >> d;

    bool f = true;
    while (true)
    {
        c -= b;
        if (c <= 0)
        {
            break;
        }
        a -= d;
        if (a <= 0)
        {
            f = false;
            break;
        }
    }

    if (f)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

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

int main(){
  ll x;cin >> x;
  if( x < 600 ) cout << 8 << endl;
  else if( x < 800 ) cout << 7 << endl;
  else if( x < 1000 ) cout << 6 << endl;
  else if( x < 1200 ) cout << 5 << endl;
  else if( x < 1400 ) cout << 4 << endl;
  else if( x < 1600 ) cout << 3 << endl;
  else if( x < 1800 ) cout << 2 << endl;
  else cout << 1 << endl;
  return 0;
}

Measured memory_bytes: 3632
i=0
x=[0,0,0,0,0,0]
k=0
while i<6 :
    x[i]=int(input())
    i=1+i
while k<3 :
    if x[k]<x[k+1] : 
        ex=x[k]
        x[k]=x[k+1]
        x[k+1]=ex
    k=k+1
if int(x[4])<int(x[5]) : ave=x[0]+x[1]+x[2]+x[5]
else : ave=x[0]+x[1]+x[2]+x[4]
print(ave)


Measured memory_bytes: 5600
pub struct ProconReader<R: std::io::Read> {
    reader: R,
}

impl<R: std::io::Read> ProconReader<R> {
    pub fn new(reader: R) -> Self {
        Self { reader }
    }
    pub fn get<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&byte| byte == b' ' || byte == b'\n' || byte == b'\r')
            .take_while(|&byte| byte != b' ' && byte != b'\n' && byte != b'\r')
            .collect::<Vec<_>>();
        std::str::from_utf8(&buf)
            .unwrap()
            .parse()
            .ok()
            .expect("Parse Error.")
    }
}

mod rolling_hash {
    const MASK_30: u64 = (1 << 30) - 1;
    const MASK_31: u64 = (1 << 31) - 1;
    const M: u64 = (1 << 61) - 1;
    const B: u64 = 1_000_000_000 + 9;
    pub struct RollingHash {
        h: Vec<u64>,
        p: Vec<u64>,
    }
    impl RollingHash {
        pub fn new(s: &[u64]) -> Self {
            let n = s.len();
            let mut h = vec![0; n + 1];
            let mut p = vec![0; n + 1];
            p[0] = 1;
            for i in 0..n {
                h[i + 1] = mul(h[i], B) + s[i];
                p[i + 1] = mul(p[i], B);
            }
            Self { h, p }
        }
        pub fn get(&self, range: std::ops::Range<usize>) -> u64 {
            let l = range.start;
            let r = range.end;
            (self.h[r] + M - mul(self.h[l], self.p[r - l])) % M
        }
    }
    fn mul(a: u64, b: u64) -> u64 {
        let au = a >> 31;
        let ad = a & MASK_31;
        let bu = b >> 31;
        let bd = b & MASK_31;
        let mid = ad * bu + au * bd;
        let midu = mid >> 30;
        let midd = mid & MASK_30;
        (au * bu * 2 + midu + (midd << 31) + ad * bd) % M
    }
}

fn main() {
    let stdin = std::io::stdin();
    let mut rd = ProconReader::new(stdin.lock());

    use rolling_hash::RollingHash;

    let n: usize = rd.get();
    let s: String = rd.get();
    let t = s.chars().map(|c| c as u64).collect::<Vec<_>>();
    let rh = RollingHash::new(&t);
    let mut ans = 0;
    for i in 0..n {
        for j in (i + 1)..n {
            let mut ok = 0;
            let mut ng = std::cmp::min(j - i, n - j) + 1;
            while ng - ok > 1 {
                let m = (ng + ok) / 2;
                if rh.get(i..(i + m)) == rh.get(j..(j + m)) {
                    ok = m;
                } else {
                    ng = m;
                }
            }
            ans = std::cmp::max(ans, ok);
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 2248
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};

#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (i64)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define bit(n) (1LL<<(n))

typedef pair<i64,i64> P;
typedef vector<i64> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;

void Main()
{
  i64 N;
  cin >> N;

  vvi dp(N+1,vi(3,0));

  i64 a,b,c;
  rep(i,N){
    cin >> a >> b >> c;
    dp[i+1][0] = max(dp[i][1],dp[i][2])+a;
    dp[i+1][1] = max(dp[i][0],dp[i][2])+b;
    dp[i+1][2] = max(dp[i][0],dp[i][1])+c;
  }
  i64 ans = dp[N][0];
  maxs(ans,dp[N][1]);
  maxs(ans,dp[N][2]);

  cout << ans << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}


Measured memory_bytes: 5760
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>
#include <functional>
#include <map>
#include <cstdlib>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

int main()
{
    int N;
    cin >> N;
    ll A, B;
    ll m = 1e18, s = 0;
    for(int i=0; i<N; i++){
        cin >> A >> B;
        s += A;
        if(A > B) m = min(m, B);
    }

    cout << ((m > 1e17) ? 0 : s - m) << endl;
}

Measured memory_bytes: 256
//
//  main.cpp
//  Test
//
//  Created by Nag on 2017/08/18.
//  Copyright ?? 2017??´ Nag. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>

using namespace std;

int main(void) {
    int r, c;
    int i, j;
    int sum;
    
    cin >> r >> c;
    
    int a[r+1][c+1];
    
    //read
    for(i=0; i<r; i++) {
        for(j=0; j<c; j++) {
            cin >> a[i][j];
        }
    }

    //calc. row sum
    for(i=0; i<r; i++) {
        sum = 0;
        for(j=0; j<c; j++) {
            sum += a[i][j];
        }
        a[i][c] = sum;
    }
    
    //calc. column sum
    for(j=0; j<c+1; j++) {
        sum = 0;
        for(i=0; i<r; i++) {
            sum += a[i][j];
        }
        a[r][j] = sum;
    }
    
    //display
    for(i=0; i<r+1; i++) {
        for(j=0; j<c+1; j++) {
            if(j==0) cout << a[i][j];
            else cout << " " << a[i][j];
        }
        cout << endl;
    }
    
    
    return 0;
    
}

Measured memory_bytes: 3064
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=10000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 1000000007
#define eps 1e-8
int n,d,a[100100],dp[10010][110][2];
char s[100100];

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

int dfs(int pos,int mod,int lim)
{
	if (pos>n) dp[pos][mod][lim]=(mod==0);
	if (dp[pos][mod][lim]>-1) return dp[pos][mod][lim];
	int sum=0,up=9;
	if (lim) up=a[pos];
	rep(i,0,up)
	{
		int tmp=dfs(pos+1,(mod+i)%d,lim&&(i==up));
		sum=(sum+tmp)%maxd;
	}
	dp[pos][mod][lim]=sum;
	return sum;
}

int main()
{
	scanf("%s",s+1);d=read();n=strlen(s+1);
	rep(i,1,n) a[i]=s[i]-'0';
	memset(dp,-1,sizeof(dp));
	printf("%d",(dfs(1,0,1)+maxd-1)%maxd);
	return 0;
}


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

#define dump(x) cerr << #x << "=" << (x) << endl;
using namespace std;
using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define IN(x) int (x); cin >> x
#define INS(x) string (s); cin >> s
#define INL(x) ll (x); cin >> x
#define VINT(a,n) vector<int> a(n)
#define VIN(a,n) VINT(a,n); REP(i,n){cin >> a[i];}
#define ALL(x) (x).begin(),(x).end()

int main () {
  IN(a);
  IN(b);
  if((a+b)%2==0)
    cout<<(a+b)/2;
  else
    cout<<"IMPOSSIBLE";
  
}


Measured memory_bytes: 256
N = int(input()) #数値
V =[int(i) for i in input().split()] #数値


V = sorted(V)
ans = 0
for i in range(N-1):
  if i == 0:
    ans = float((V[i]+V[i+1])/2)
  else:
    ans = float((ans+V[i+1])/2)
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <numeric>
#include <string>
#include <bitset>
#include <functional>

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pll = std::pair<ll, ll>;
using vpll = std::vector<pll>;
using str = std::string;
using vstr = std::vector<str>;

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool isprime(ll n) {
    if (n < 2) return false;
    for (ll i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}
ll rpow(ll x, ll n) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) k *= x;
        x *= x;
    }
    return k * x;
}
ll modpow(ll x, ll n, ll mod) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) (k *= x) %= mod;
        (x *= x) %= mod;
    }
    return k * x % mod;
}
ll modcomb(ll n, ll r, ll mod) {
    if (r < 0 || n < r) return 0;
    chmin(n - r, r);
    ll mul = 1, div = 1;
    for (ll i = 0; i < r; i++) {
        (mul *= n - i) %= mod;
        (div *= i + 1) %= mod;
    }
    return mul * modpow(div, mod - 2, mod) % mod;
}

/*------------------------------------------------------------------------*/

constexpr ll MOD = 1e9 + 7;

void solve();

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

    solve();
}
void solve() {
    ll n;
    std::cin >> n;

    auto sieve = [](ll n) -> vll {
        vll v(n + 1, 0);
        v[0] = v[1] = 1;
        for (ll i = 2; i * i <= n; i++) {
            if (v[i] == 1) continue;
            for (ll j = 2; i * j <= n; j++)
                v[i * j] = 1;
        }

        vll res;
        for (ll i = 2; i <= n; i++)
            if (v[i] == 0) res.emplace_back(i);

        return res;
    };

    vll prime = sieve(n);

    auto legendre = [&](ll n, ll p) -> ll {
        ll res = 0;
        for (ll i = 1; rpow(p, i) <= n; i++)
            res += n / rpow(p, i);

        return res;
    };

    ll ans = 1;
    for (ll p : prime)
        (ans *= legendre(n, p) + 1) %= MOD;

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


Measured memory_bytes: 3628
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
int main(){
    int x,a;cin>>x>>a;
    if(x<a)cout<<0<<endl;
    else cout<<10<<endl;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N, K;
cin >> N >> K;
int sunuke[110];
for(int i = 0; i < N; i++){
sunuke[i] = 0;
}


for(int i = 0; i < K; i++){
    int O;
    cin >> O;
for(int j = 0; j < O; j++){
    int o;
cin >> o;
o--;
sunuke[o]++;

}


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



}

Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

// constexpr inline ll mod = 1'000'000'007;
// constexpr int max_n = 200'000 + 5;

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(15); // 浮動小数の表示の精度

    double pi = acos(-1);
    double r; cin>>r;
    cout << 2.0 * r * pi << '\n';

    return 0;
}


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

int main() {
    int n;
    int a[100010];
    cin >> n;
//奇数の数をカウントし偶数個ならYESと出力するだけ！
    int odd = 0;
    for (int i=0; i<n; i++) {
        cin >> a[i];
        if (a[i] % 2 == 1) odd++;
    }
    if (odd % 2 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 640
import sys
input = sys.stdin.readline
def main():
    N, M = map(int, input().split())
    m = {}
    for i in range(1, N+1):
        m[i] = set()
    for _ in range(M):
        s, c = map(int, input().split())
        m[s].add(c)
    exists_ans = True
    for i in range(1, N+1):
        if len(m[i]) > 1:
            exists_ans = False
            break
    if (N > 1) and (0 in m[1]):exists_ans = False
    if exists_ans:
        ans = 0
        for i in range(1, N+1):
            if len(m[i]) > 0:
                num = m[i].pop() * (10**(N-i))
                ans += num
            elif i == 1:
                ans += 10**(N-i)
    else:
        ans = -1
    if N == 1 and M == 0:ans = 0
    print(ans)
if __name__ == "__main__":
    main()

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


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    swap(a[0], a[1]);
    swap(a[0], a[2]);
    for (auto it : a) 
        cout << it << " ";
}

Measured memory_bytes: 256
s = input()
t = input()

ssize = len(s)
tsize = len(t)

# dp[i][j]: sのi文字目まで、tのj文字目までのLongestCommonSubsequence
dp = [[0] * (tsize+1) for _ in range(ssize+1)]

for i in range(1, ssize+1):
    for j in range(1, tsize+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = dp[i-1][j-1] + 1
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])

i, j = ssize, tsize

ans = ""
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1] + ans
        i -= 1
        j -= 1

print(ans)

Measured memory_bytes: 139040
import sys
input = sys.stdin.readline
import math


class RAQ():
    
    def __init__(self, size):
        """初期化"""
        self.size = size
        n = 2 ** ((size-1).bit_length())
        treesize = n * 2
        st = [0] * treesize
        self.st = st
        self.offset = len(st) // 2

    @classmethod
    def from_array(cls, a):
        st = cls(len(a))
        for i, x in enumerate(a):
            st.add(i, i+1, x)
        return st

    def _add_topdown(self, a, b, value, k=1, l=0, r=-1):
        """区間[a, b) に対する加算
        k: 着目しているノード (1-indexed)
        l: 探索区間 st[l, r) の左端 (0-indexed)
        r: 探索区間 st[l, r) の右端 (0-indexed)
        """
        if r == -1:
            r = self.offset
        if r <= a or b <= l:
            return
        if l == r - 1:
            self.st[k] += value
            return
        if a <= l and r <= b:
            self.st[k] += value
            return
        mid = (l + r) // 2
        self._add(a, b, value, k * 2, l, mid)
        self._add(a, b, value, k * 2 + 1, mid, r)

    def _add_bottomup(self, a, b, value):
        """区間[a, b) に対する加算
        """
        a += self.offset
        b += self.offset - 1
        while a < b:
            if a & 1:
                self.st[a] += value
                a += 1
            a >>= 1
            if not b & 1:
                self.st[b] += value
                b -= 1
            b >>= 1
        if a == b:
            self.st[a] += value

    def add(self, a, b, value):
        """区間[a, b) に対する加算"""
        if a > b:
            raise ValueError("a must be less than equal b.")
        return self._add_bottomup(a, b, value)

    def get(self, key):
        """値の取得"""
        offset = len(self.st) // 2
        k = offset + key
        v = self.st[k]
        k >>= 1
        while k > 0:
            v += self.st[k]
            k >>= 1
        return v


def read():
    N, K = map(int, input().strip().split())
    A = list(map(int, input().strip().split()))
    return N, K, A


def solve(N, K, A):
    KL = N.bit_length() * 2 + 4
    if K > KL:
        print(*([N] * N))
        return
    raq = RAQ.from_array(A)
    a = [0 for i in range(N)]

    for k in range(min(K, KL)):
        for i in range(N):
            a[i] = raq.get(i)
            raq.add(i, i+1, -a[i])
        for i in range(N):
            l = max(0, i-a[i])
            r = min(N, i+1+a[i])
            raq.add(l, r, 1)
    print(*[raq.get(i) for i in range(N)])


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 105760
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,A,B;
  cin>>K>>A>>B;
  if(A%K==0){
    cout <<"OK"<<endl;
  }
  else if(B>= A+ K-A%K){
    cout <<"OK"<<endl;
  }
  else{
    cout <<"NG"<<endl;
  }
}



Measured memory_bytes: 3636
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In,' '));
        }

        public void Solve(ConsoleInput cin)
        {
            int A = cin.ReadInt;
            int B = cin.ReadInt;
            int C = cin.ReadInt;

            if(A==B && B==C) WriteLine("Yes");
            else WriteLine("No");

        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream,char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if(inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for(int i = 0;i < tmp.Length;i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }

        
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }

}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mk make_pair
#define rint register int
using namespace std;
inline int read(){int w=1,s=0;char ch=getchar();while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}return w*s;}
struct seg{
	int l,r,x,y;
};
int maxx1[2000100],pos1[2000010],maxx2[2000010],pos2[2000010];
int N,A[1000010];
inline bool operator > (seg p,seg q){if(p.x!=q.x) return A[p.x]>A[q.x];else return A[p.y]>A[q.y];}
priority_queue<seg ,vector<seg>,greater<seg> > q; 
inline void Update1(int now){
	if(maxx1[now<<1]<maxx1[now<<1|1])
	{
		maxx1[now]=maxx1[now<<1];pos1[now]=pos1[now<<1];
	}
	else maxx1[now]=maxx1[now<<1|1],pos1[now]=pos1[now<<1|1];
}
inline void Update2(int now){	
//cout<<maxx2[now<<1]<<" "<<maxx2[now<<1|1]<<"\n";
	if(maxx2[now<<1]<maxx2[now<<1|1])
	{
		maxx2[now]=maxx2[now<<1];pos2[now]=pos2[now<<1];
	}
	else maxx2[now]=maxx2[now<<1|1],pos2[now]=pos2[now<<1|1];
//	cout<<pos2[now]<<'\n';
}
inline void Build1(int now,int l,int r)
{
	if(l==r)
	{
		if(l%2==0)
		{
			maxx1[now]=A[l];
			pos1[now]=l;
		}
		else maxx1[now]=1e9,pos1[now]=l;
		return ;
	}int mid=(l+r)>>1;
	Build1(now<<1,l,mid);Build1(now<<1|1,mid+1,r);
	Update1(now);
}
inline int Query1(int now,int l,int r,int x,int y)
{
	if(x<=l&&r<=y) return pos1[now];
	int mid=(l+r)>>1;int res1=0,res2=0;
	if(x<=mid) res1=Query1(now<<1,l,mid,x,y);
	if(y>mid) res2=Query1(now<<1|1,mid+1,r,x,y);
//	cout<<res1<<" "<<res2<<"\n";
	if(!res1) return res2;
	if(!res2) return res1;
	if((!(res1&1))&&(!(res2&1)))
	{
		if(A[res1]<A[res2]) return res1;
		else return res2;
	}
	if(!(res1&1)) return res1;
	else return res2;
}
inline void Build2(int now,int l,int r)
{
	if(l==r)
	{
		if(l%2==1)
		{
			maxx2[now]=A[l];
			pos2[now]=l;
		}
		else maxx2[now]=1e9,pos2[now]=l;
		return ;
	}int mid=(l+r)>>1;
	Build2(now<<1,l,mid);Build2(now<<1|1,mid+1,r);
	Update2(now);
}
inline int Query2(int now,int l,int r,int x,int y)
{
	if(x<=l&&r<=y) return pos2[now];
	int mid=(l+r)>>1;int res1=0,res2=0;
	if(x<=mid) res1=Query2(now<<1,l,mid,x,y);
	if(y>mid) res2=Query2(now<<1|1,mid+1,r,x,y);
	if(!res1) return res2;
	if(!res2) return res1;
	if((res1&1)&&(res2&1))
	{
		if(A[res1]<A[res2]) return res1;
		else return res2;
	}
	if(res1&1) return res1;
	else return res2;
}
inline void ADD(int l,int r)
{
	if(l>r) return ;int pos1=0,pos2=0;
//	cout<<l<<" "<<r<<"debug\n";
	if(l&1) pos1=Query2(1,1,N,l,r),pos2=Query1(1,1,N,pos1,r);
	else pos1=Query1(1,1,N,l,r),pos2=Query2(1,1,N,pos1,r);
//	cout<<pos1<<" "<<pos2<<"\n";
	q.push((seg){l,r,pos1,pos2});
}
int main()
{	memset(maxx1,0x3f,sizeof(maxx1));memset(maxx2,0x3f,sizeof(maxx2));
	memset(A,1e9,sizeof(A));
	N=read();
	for(rint i=1;i<=N;++i) A[i]=read();
	Build1(1,1,N);Build2(1,1,N);
	ADD(1,N);//return 0;
	int cnt=0;
	while(!q.empty())
	{	cnt++;
		seg tmp=q.top();q.pop();
		cout<<A[tmp.x]<<" "<<A[tmp.y]<<" ";
		int l=tmp.l,r=tmp.r;
		ADD(l,tmp.x-1);ADD(tmp.x+1,tmp.y-1);ADD(tmp.y+1,r);
//		if(cnt==2) break;
	}
	return 0;
}

Measured memory_bytes: 29172
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>
#include <list>
#include <cmath>
#include <map>

using namespace std;
typedef long long ll;

ll N;
ll A[200000];
ll CountLessThanP(ll p){
	ll value = 0;
	for(int i = 0; i < N; i++){
		int min = i;
		int max = N;
		while(max - min > 0){
			if(A[i] > 0){
				int mid = (min + max + 1)/2;
				if(A[i] * A[mid] < p){
					min = mid;
				}else{
					max = mid - 1;
				}
			}else if(A[i] < 0){
				int mid = (min + max)/2;
				if(A[i] * A[mid] < p){
					max = mid;
				}else{
					min = mid+1;
				}
			}else{
				break;
			}
		}
		if(A[i] == 0){
			if(p > 0){
				value += N-1-i;
			}
		}else{
			if(A[i] > 0 && min == N){
				value += N - 1 - i;
			}else if(A[i] < 0 && max == i){
				value += N - 1 - i;
			}else{
				value += ( A[i] > 0 ? (min-i) : (N-max) );
			}
		}
	}
	return value;
}

int main()
{
	ll K;
	cin >> N >> K;
	for(int i = 0; i < N; i++){
		cin >> A[i];
	}
	sort(A, A+N);
	// p 未満の数が K個未満になるような最小の整数p を２分探索
	
	ll min = -LLONG_MAX/2;
	ll max = LLONG_MAX/2;
	while(max - min > 0){
		ll mid = min + (max-min+1)/2;
		if(CountLessThanP(mid) < K){
			min = mid;
		}else{
			max = mid - 1;
		}
	}
	
	cout << min << endl;
	
	return 0;
}

Measured memory_bytes: 1792
//Author: master19
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ff first 
#define ss second 
#define pb push_back
#define endl "\n"
#define mod 1000000007LL // fixed...
#define modd 1000000007LL // Can be changed for global use
#define all(arr) arr.begin(),arr.end()
#define x(arr) arr.begin(),arr.end()
#define ulli unsigned long long int
#define assign(x,val) memset(x,val,sizeof(x))
#define prec(val, dig) fixed << setprecision(dig) << val
#define Sort(arr) sort(arr.begin(), arr.end())
#define time() std::chrono::high_resolution_clock::now();
#define lower(str) transform(str.begin(), str.end(), str.begin(), ::tolower);
#define upper(str) transform(str.begin(), str.end(), str.begin(), ::toupper);
#define crap ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define get(arr, num) vector < ll > arr(num); for(int i=0; i<num; i++)cin >> arr[i];
#define get_set(arr, num, st, type) set < type > st; for(int i=0; i<num; i++) st.insert(arr[i]);
#define put(arr, num) for(int i=0; i<num; i++)cout << arr[i] << " "; cout << endl;
#define Time(start, finish) std::chrono::duration<double> elapsed = finish - start; cout << elapsed.count() << endl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > new_ds; 
void debug_out() { cerr << endl; }
template <typename HeadStart, typename... TailEnd>
void debug_out(HeadStart H, TailEnd... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
ll lets_do_it();
pair < ll, ll > xy[] = {{-1, 0}, {1, 0} , {0, -1}, {0, 1}};
pair < ll, ll > dig[] = {{-1, -1}, {-1, 1}, {1, 1}, {1, -1}};
bool isValid(ll x, ll y, ll row, ll col){
    return ((x>=0) && (y >=0)  && (x < row) && (y < col));
}
int main(int argc, const char** argv) {
    crap;
    ll test = 1;
    // cin >> test;.
    for(int loop=0; loop<test; loop++){
        // cout << "Case #" << (loop+1) << ": "; 
        lets_do_it();
    }
    return 0;
}
ll lets_do_it(){
    // Your code goes by here !!
    ll num;
    cin >> num;
    vector < pair < ll, ll > > arr;
    for(int i=0; i<num; i++){
        ll a, b;
        cin >> a >> b;
        arr.pb({a, b});
    }
    ll res = 0;
    for(int i=0; i<num-2; i++){
        if(arr[i].ff == arr[i].ss){
            if(arr[i+1].ff == arr[i+1].ss){
                if(arr[i+2].ff == arr[i+2].ss)  
                    res = 1;
            }
        }
    }
    if(res)
        cout  <<"Yes\n";
    else
        cout << "No\n";




    return 0;
}


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

using namespace std;

int main()
{
    string input;
    const int alph_lim = 26;

    while (getline(cin, input, '\n')) {
        for (int i = 0; i < alph_lim; i++) {
            for (int j = 0; j < input.size(); j++) {
                if (islower(input[j])) {
                    input[j]++;
                    if (input[j] > 'z') 
                        input[j] -= alph_lim;
                }
            }

            if (input.find("the") != string::npos ||
                input.find("this") != string::npos ||
                input.find("that") != string::npos) {
                cout << input << endl;
                break;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 1180
#include <stdio.h>
#include <stdlib.h>
 
int main(void)
{

    int N;
    int T;
    scanf("%d %d", &N, &T);

    if(N < 1 || N > 100) {
        exit(0);
    }

    if(T < 1 || T > 1000) {
        exit(0);
    }

    int c[10000];
    int t[10000];
    int sum;
    int mincost = 10000;
    for(int i = 0;i < N;i++) {
        scanf("%d %d", &c[i], &t[i]);

        if(c[i] < 1 || c[i] > 1000 || t[i] < 1 || t[i] > 1000) {
            exit(0);
        }

        if(t[i] > T) {
            continue;
        }

        if(mincost > c[i]) {
            mincost = c[i];
        }
    }

    if(mincost == 10000) {
        printf("TLE\n");
    } else {
        printf("%d\n", mincost);
    }

    return 0;
}

Measured memory_bytes: 128
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) {
	if os.Getenv("ONLINE_JUDGE") == "false" {
		fmt.Fprintln(os.Stderr, a...)
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	a, b := scanInt(), scanInt()
	if a*b%2 == 1 {
		fmt.Fprintln(wr, "Yes")
	} else {
		fmt.Fprintln(wr, "No")
	}
}


Measured memory_bytes: 1776
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N, K;
	cin >> N >> K;
	vector<lint> data(N);
	for (int i = 0; i < N; i++)
	{
		cin >> data[i];
	}
	sort(all(data));

	lint min_diff = INF64;
	for (int i = 0; i + K - 1 < N; i++)
	{
		min_diff = min(min_diff, data[i + K - 1] - data[i]);
	}
	cout << min_diff << endl;
	return;
}

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

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 1024
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Hassan El Desouky
 */


#include "bits/stdc++.h"

using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define el '\n'
#define F first
#define S second
#define M_PI 3.14159265358979323846  /* pi */
#define FOR(i,a,b) for(int i = a; i <= b; ++i)
#define FORD(i,a,b) for(int i = a; i >= b; --i)
#define RI(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(n)-1)
#define SQR(x) (x)*(x)
#define all(v)  	((v).begin()),((v).end())
#define degreesToRadians(angleDegrees) (angleDegrees * M_PI / 180.0) // Converts degrees to radians.
#define radiansToDegrees(angleRadians) (angleRadians * 180.0 / M_PI) // Converts radians to degrees.
#define ordered_set1 tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef long double ld;
typedef vector<int>		vi;
typedef vector<int>		vll;
typedef vector<pii>		vpii;
const double EPS = 1e-9;
const int N = 1e3+2, M = 3e5+5, OO = 0x3f3f3f3f;
int dx[] = {1,-1,0,0} , dy[] = {0,0,1,-1}; // 4 Direction
//int dx[] = {1,-1,0,0,1,1,-1,-1}, dy[] = {0,0,1,-1,1,-1,1,-1}; // 8 Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; */ // Knight Direction
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */ // Hexagonal Direction


class ACantWaitForHoliday {
public:
	void solve(std::istream& in, std::ostream& out) {
        string s; in >> s;
        if(s=="SAT")cout<<"1"<<endl;
        else if(s=="SUN")cout<<"7"<<endl;
        else if(s=="MON")cout<<"6"<<endl;
        else if(s=="TUE")cout<<"5"<<endl;
        else if(s=="WED")cout<<"4"<<endl;
        else if(s=="THU")cout<<"3"<<endl;
        else if(s=="FRI")cout<<"2"<<endl;

	}
};


int main() {
	ACantWaitForHoliday solver;
	std::cout << std::fixed;
	ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
int main()
{
	int n,m,q;
	cin>>n>>m>>q;
	vector<string> grid;
	for(int i=0;i<n;i++)
	{
		string s;cin>>s;
		grid.push_back(s);
	}
	int ans=0;
	for(int i=0;i<(1<<n);i++)
	{
		for(int j=0;j<(1<<m);j++)
		{
			vector<string> t = grid;
			for(int k=0;k<n;k++)
			{
				if(((1<<k)&i)!=0)
				{
					for(int l=0;l<m;l++)
					{
						t[k][l] = '0';
					}
				}
			}
			for(int k=0;k<m;k++)
			{
				if(((1<<k)&j)!=0)
				{
					for(int l=0;l<n;l++)
					{
						t[l][k] = '0';
					}
				}
			}
			int cnt=0;
			for(int k=0;k<n;k++)
			{
				for(int l=0;l<m;l++)
				{
					if(t[k][l]=='#')	cnt++;
				}
			}
			if(cnt==q)	++ans;
		}
	}
	cout<<ans;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define INF 100000000000000

int main(){
    ll n, k; cin >> n >> k;
    vector<ll> a(n); ll atot = 0;
    REP(i,n) cin >> a[i];
    REP(i,n) atot+=a[i];
    vector<ll> divl;
    FOR(i,1,23000){
        if (atot%i==0&&i<=atot/i){
            divl.pb(i);
            divl.pb(atot/i);
        }
    }
    sort(divl.begin(),divl.end());
    ll ans = 1;
    REP(j,divl.size()){
        vector<ll> b(n);
        REP(i,n) b[i]=a[i]%divl[j];
        sort(b.begin(),b.end());
        FOR(i,1,n-1) b[i]=b[i]+b[i-1];
        bool jud = false;
        FOR(i,0,n-2){
            ll z = max(b[i],(n-i-1)*divl[j]-b[n-1]+b[i]);
            if (z<=k) jud = true;
        }
        if (jud) ans = max(ans,divl[j]);
    }
    cout << ans << endl;
}

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

typedef long long ll;

const int MAX_N = 100030;
ll A[MAX_N];

int main(){
  int n; cin >>n;
  for(int i=1;i<=n;i++) cin >> A[i];
  
  ll ans = 0;
  for(int i=1;i<=n;i++){
    if(A[i-1] && A[i]){ ans++; A[i]--; }
    ans += A[i]/2;
    A[i] %= 2;
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]", B: "List[int]"):
    B.append(0)
    ans = 0
    tmp = 0

    for i in range(N+1):
        diff = A[i] + tmp - B[i]
        if diff < 0:
            ans += A[i]
            tmp = max(diff,-B[i])
        else:
            ans += A[i] - diff
            tmp = 0

    print(ans)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N + 1)]  # type: "List[int]"
    B = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 19504
n = int(input())
l = list(map(int, input().split()))

i=0
i_index=0
j=0
j_index=0
for a in range(1, n+1):
  if a != l[a-1] and i == 0:
    i = l[a-1]
    i_index = a - 1
  elif a != l[a-1] and j == 0:
    j = l[a-1]
    j_index = a - 1

if i==0 and j==0:
  print("YES")
else:
  l[i_index]=j
  l[j_index]=i
  if sorted(l) == l:
    print("YES")
  else:
    print("NO")

Measured memory_bytes: 3064
x,n = map(int,input().split())
if n == 0:
    print(x)
else:
    plist = list(map(int,input().split()))
    answer = 0
    diff = 0
    while answer == 0:
        if (x - diff) not in plist:
            answer = x - diff
            break
        elif (x + diff) not in plist:
            answer = x + diff
            break
        diff += 1
    print(answer)

Measured memory_bytes: 61860