akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
using namespace std;
map<ll,ll> mp;
int main(){
    int a[]={0,1,3,1,2,1,2,1,1,2,1,2,1};
    int x,y;
    cin>>x>>y;
    if(a[x]==a[y]) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> p(n);
    for(int i=0;i<n;i++){
        cin>>p.at(i);
    }
    sort(p.begin(),p.end());
    reverse(p.begin(),p.end());
    int ans=p.at(0)/2;
    for(int i=1;i<n;i++){
        ans+=p.at(i);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3608
if __name__ == '__main__':

    S = input()

    if S[0] != "A":
        print("WA")
    elif S[2:-1].count("C") != 1:
        print("WA")
    elif S[1].islower() is not True or S[-1].islower() is not True:
        print("WA")
    else:
        print("AC")

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int, int>
#define Point Vect
#define no {cout << "No\n"; return;}
 
const int N = 2e5 + 7, INF = 1e9 + 7;
 
 void solve() {
    int n, k, c, lst = -INF;
    string s;
    cin >> n >> k >> c >> s;
    vector <int> was;
    loop(i, n)
        if (s[i] == 'o' && i - lst - 1 >= c) {
            lst = i;
            was.pb(i);
        }
    if (was.size() > k)
        return;
    was.pb(n);
    vector <int> nw(k + 1), ans;
    nw[k] = INF;
    for (int i = k - 1; i >= 0; --i) {
        int j = was[i];
        for (; j < was[i + 1] && j + c < nw[i + 1]; ++j);
        --j;
        while (s[j] == 'x') --j;
        nw[i] = j;
        if (was[i] == nw[i])
            ans.pb(was[i]);
    }
    reverse(all(ans));
    for (int x : ans)
        cout << x + 1 << "\n";
 }
 
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

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

int main()
{
	int n;
	int cost = 100000;
	bool check = false;

	cin >> n;
	for(int i=0;i<n;i++) {
		cost *= 1.05;
		if(cost % 1000 > 0)
			check = true;
		else
			check = false;
		cost /= 1000;
		cost *= 1000;
		if(check) {
			cost += 1000;
		}
	}

	cout << cost << endl;

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define puts(i) cout<<i<<endl
using ll = long long;
using P = pair<int,int>;

int main(){
	int k,n;
	cin>>n>>k;
	int h[n];
	rep(i,n)cin>>h[i];
	sort(h,h+n);
	int diff = 1e9;
	rep(i,n-k+1){
		diff=min(diff,h[k+i-1]-h[i]);
	}
	puts(diff);
	
}

Measured memory_bytes: 640
package main

import "fmt"

func main() {
	var h, w int
	fmt.Scan(&h, &w)
	a := make([][]int, h)
	for i := 0; i < h; i++ {
		a[i] = make([]int, w)
		for j := 0; j < w; j++ {
			fmt.Scan(&a[i][j])
		}
	}

	op := make([][4]int, 0)
	for i := 0; i < h; i++ {
		ci := i
		for j := 0; j < w; j++ {
			cj := j
			if ci%2 == 1 {
				cj = w - 1 - j
			}

			if a[ci][cj]%2 == 0 {
				continue
			}

			ni, nj := ci, cj
			if ci%2 == 0 {
				nj++
				if w-1 < nj {
					nj--
					ni++
				}
			} else {
				nj--
				if nj < 0 {
					nj++
					ni++
				}
			}

			if ni < h {
				a[ci][cj]--
				a[ni][nj]++
				op = append(op, [4]int{ci, cj, ni, nj})
			}
		}
	}

	fmt.Println(len(op))
	for _, o := range op {
		fmt.Println(o[0]+1, o[1]+1, o[2]+1, o[3]+1)
	}
}


Measured memory_bytes: 21248
n=gets.to_i;h=gets.split.map &:to_i
d=[0]*n
(1...n).each{|j|
  d[j]=d[j-1]+(h[j]-h[j-1]).abs
  d[j]=[d[j],d[j-2]+(h[j]-h[j-2]).abs].min if j>1
}
p d[n-1]

Measured memory_bytes: 11396
#include<cstdio>
#include<iostream>

using namespace std;

long long a[100005];

int main()
{
    long long n,x,t;
    while(~scanf("%lld%lld",&n,&x))
    {
        long long sum = 0;
        a[0] = 0;

        for(int i = 1; i <= n; i++)
        {
            scanf("%lld",&a[i]);
            if(a[i] + a[i-1] > x)
            {
                t = a[i] + a[i-1] - x;  
                sum += t;  //Statistics to the sum
                a[i] -= t;   // Change the original value, so that the next number is judged
            }
        }
        printf("%lld\n",sum);

    }
    return 0;
}



Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

/*

*/

int main(void){
	ll N;
	cin>>N;
	reg(i,1,3500){
		reg(j,1,3500){
			if((4*i*j-N*j-N*i)>0 && (N*i*j)%(4*i*j-N*j-N*i)==0){
				ll k=(N*i*j)/(4*i*j-N*j-N*i);
				printf("%d %d %lld\n",i,j,k);
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

set<int> se;
using tup = tuple<int, int, int>;
vector<pair<int, int> > G[110]; // G[i] := i??????G[i].fi?????§????????¢G[i].se
ll dist[110][110]; // dist[i][j] := ??????i?????§???????????????j??§????????????????????????

void dijkstra(int start, int M){
	rep(i, 110)rep(j, 110) dist[i][j] = INFF;
	dist[start][M] = 0;
	priority_queue<tup, vector<tup>, greater<tup>> que; // ?????¢ ?????? ????????????
	que.push(make_tuple(0, start, M));

	while(!que.empty()){
		int cost, u, nokori;
		tie(cost, u, nokori) = que.top(); que.pop();
		if(dist[u][nokori] < cost) continue;

		for (auto tmp : G[u]){ // u -> v
			int v = tmp.first, time = tmp.second;//??£??\???????????? ?????¢
			int nnokori = nokori - time;
			if(nnokori < 0) continue;
			if(se.count(v)) {
				reps(i, nnokori, M + 1){ // ???????????????i?????????
					int wait = i - nnokori;
					if(dist[v][i] <= dist[u][nokori] + time + wait) continue;
					dist[v][i] = dist[u][nokori] + time + wait;
					que.push(make_tuple(dist[v][i], v, i));
				}
			}else { // ???????????????
				if(dist[v][nnokori] <= dist[u][nokori] + time) continue;
				dist[v][nnokori] = dist[u][nokori] + time;
				que.push(make_tuple(dist[v][nnokori], v, nnokori));
			}
		}
	}

}


int main(void) {
	while(1) {
		rep(i, 110) G[i].clear();
		se.clear();
		int N, M, L, K, A, H;
		scanf("%d %d %d %d %d %d", &N, &M, &L, &K, &A, &H);
		if(N == 0 && M == 0 & L == 0 && K == 0 && A == 0 && H == 0) break;
		rep(i, L) {
			int l; scanf("%d", &l);
			se.insert(l);
		}
		rep(i, K) {
			int X, Y, T; scanf("%d %d %d", &X, &Y, &T);
			G[X].pb(mp(Y, T)), G[Y].pb(mp(X, T));
		}
		dijkstra(A, M);
		ll ans = INFF;
		rep(i, M + 1) {
			chmin(ans, dist[H][i]);
		}
		if(ans == INFF) printf("Help!\n");
		else printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3452
#include <stdio.h>

int main(void) {
	int S, h, m,amari, s;
	scanf("%d", &S);
	h = S/3600;
	amari= S % 3600;
	m = amari / 60;
	s = amari % 60;
	printf("%d:%d:%d\n", h, m, s);
    return 0;
}

Measured memory_bytes: 2728
#include <stdio.h>

int gcd(int d,int e){
  if(d%e==0)return e;
  return gcd(e,d%e);
}

int main(){
 int K,x,sum=0;
  scanf("%d",&K);
  for(int a=1;a<=K;a++)
     for(int b=1;b<=K;b++)
        for(int c=1;c<=K;c++){
          x=gcd(a,b);
          sum+=gcd(c,x);
        };
  printf("%d",sum);
};

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;


int main() {
    int N, ans = 0;
    string A, B, C;
    cin >> N >> A >> B >> C;
    for (int i = 0; i < N; i++){
        set<char> T;
        T.insert(A.at(i));
        T.insert(B.at(i));
        T.insert(C.at(i));
        if (T.size() == 2){
            ans++;
        }
        else if (T.size() == 3){
            ans += 2;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 1;i<n;i++)
int main(){
long n, min;
cin >> n;
min = n-1;
rep(i, sqrt(n)+1){
    if(n%i == 0 && i + n/i -2 < min)min = i + n/i -2;
}

cout << min<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        if(a==1) a+=13;
        if(b==1) b+=13;
        if(a > b){
            System.out.println("Alice");
        }else if(a < b){
            System.out.println("Bob");
        }else if(a == b){
            System.out.println("Draw");
        }
    }
}

Measured memory_bytes: 21588
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.14159265358979323846
ll fac[MAX], finv[MAX], inv[MAX];


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}

ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


string Toupper(string s){
  string ans="";
  rep(i,s.size()){
    if('a'<=s[i] && s[i]<='z') ans+=(char)s[i]-32;
    else ans+=s[i];
  }
  return ans;
}
string Tolower(string s){
  string ans="";
  rep(i,s.size()){
    if('A'<=s[i] && s[i]<='Z') ans+=(char)s[i]+32;
    else ans+=s[i];
  }
  return ans;
}


const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*bool cmp(pint a, pint b) { return a.second < b.second; }*/

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n,m,k;
  cin>>n>>m>>k;
  bool flag=false;
  rep(i,n+1){
    rep(j,m+1){
      if(i*j+(m-j)*(n-i)==k) flag=true;
    }
  }
  if(flag) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  long long n; scanf ("%lld",&n);
  long long c = 1;
  for (int l=1;;l++){
    c *= 26;
    if (n > c) n -= c;
    else{
      char ans[1000]; n--; ans[l] = 0;
      for (int i=0;i<l;i++){
ans[l - i - 1] = n % 26 + 'a';
        n /= 26;
      }
      puts(ans);
break;
    }
  }
return 0;
}

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

int main(){
  int a=100000,n;
  scanf("%d",&n);
  
  while(n--){
    int b=a/20;
    a+=b-b%1000;
    if(b%1000!=0)
      a+=1000;
  }

  printf("%d\n",a);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    string S;
    cin>>S;
    int l=0,r=S.size()-1;
    int ans=0;
    while(r-l>0){
        if(S[l]==S[r]) {
            l++;
            r--;
        }else if(S[l]=='x'){
            l++;
            ans++;
        }else if(S[r]=='x'){
            r--;
            ans++;
        }
        else {
            ans=-1;
            break;
        }

    }
    cout << ans << endl;



}


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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << fixed;
    ll a, b, c;
    cin >> a >> b >> c;
    cout << b + min(c, a + b + 1) << endl;
    return 0;
}

Measured memory_bytes: 256
def solve():
    from itertools import combinations
    from sys import stdin
    f_i = stdin
    
    N = int(f_i.readline())
    
    evidence = dict(zip(range(N), [[] for i in range(N)]))
    for i in range(N):
        A_i = int(f_i.readline())
        for j in range(A_i):
            x, y = map(int, f_i.readline().split())
            x -= 1
            evidence[i].append((x, y))
    
    for num in range(N, 0, -1):
        for people in combinations(range(N), num):
            rec = [0] * N
            for person in people:
                rec[person] = 1
            
            for person in people:
                for x, y in evidence[person]:
                    if rec[x] != y:
                        break
                else:
                    continue
                break
            else:
                return num
    else:
        return 0

print(solve())

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main(){
  string s,t;
  cin >> s >> t;
  int a,b;
  cin >> a >> b;
  string u;
  cin >> u;
  if(u == s)
    a--;
  else
    b--;
  
  cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int n, m, i;
    int sum = 0, count = 0;

    int a[1000];

    scanf("%d %d", &n, &m);

    for (i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        sum += a[i];
    }

    for (i = 0; i < n; i++)
    {
        if (a[i] * 4 * m >= sum) count++;
    }

    if (count >= m) printf("Yes");
    else printf("No");

    return 0;
}


Measured memory_bytes: 1704
#include<stdio.h>

#define mod 1000000007

int main(){
	int n,i,j;
	char s[100000];
	long long ko[2][27]={0};
	long long ans=0;
	scanf("%d%s",&n,s);
	for(i=n-1;i>=0;i--){
		long long tmp=1;
		for(j=0;j<27;j++)ko[i%2][j]=0;
		ko[i%2][s[i]-'a']++;
		for(j=0;j<27;j++){
			ko[i%2][j]+=ko[(i+1)%2][j];
			if(s[i]-j!='a')tmp*=ko[i%2][j]+1;
			tmp=tmp%mod;
		}
		ans+=tmp;
		ans=ans%mod;
	}
	printf("%lld\n",ans);
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef vector<pll> vpll;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  ll N;
  IN(N);
  FOR(i,1,10){
    FOR(j,1,10){
      if(i*j==N){
        OUT("Yes");
        return 0;
      }
    }
  }

  OUT("No");

  return 0;
}


Measured memory_bytes: 256
#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 light ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define REP(i,a,b) for(ll i = a; i < b; i++)
#define REPE(i,a,b) for(ll i = a; i <= b; i++)
#define REPR(i,a,b) for(ll i = a; i >= b; i--)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define bins(v, x) binary_search(v.begin(), v.end(), x)
const double pi = 2*acos(0.0);
const int INF = 1e9+1;
const int MOD = 1e9+7;
const int MOD1 = 998244353;

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vi = vector<int>;

#define oset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define osetll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set
 
ll modExp(ll base, ll exp, ll mod) {
   ll res = 1;
   while (exp > 0) {
    	if (exp % 2 == 1) {
        	res= (res * base) % mod;
		}
      exp = exp >> 1;
      base = (base * base) % mod;
   }
   return res;
}

ll inverse(ll base, ll exp, ll mod) {
   return modExp(base, exp - 2, mod);
}

bool compare(const pair<int,int> &i, const pair<int,int> &j) {
   return (i.S > j.S || (i.S == j.S && i.F > j.F));
}

const int N = 1e5+1;
vector<int> edges[N];
vector<bool> vis(N, 0);

void dfs(int u) {
   vis[u] = 1;
   for(auto x : edges[u]) {
      if(!vis[x]) {
         dfs(x);
      }
   }
}

void test() {
   int n, m;
   cin >> n >> m;

   for(int i = 1; i <= m; i++) {
      int a, b;
      cin >> a >> b;
      edges[a].pb(b);
      edges[b].pb(a);
   }

   int sep = 0;
   for(int i = 1; i <= n; i++) {
      if(!vis[i]) {
         sep++;
         dfs(i);
      }
   }

   for(int i = 1; i <= n; i++) {
      sep += vis[i] == 0;
   }

   cout << sep-1;
}

int main() {
   //freopen("input.txt","r",stdin);
   //freopen("output.txt","w",stdout);
   light;
   cout.precision(15);
   cout << fixed;

   int t = 1;
   //cin >> t;
   for(int i = 1; i <= t; i++) {
      //cout << "Case #" << i << ": ";
      test();
   }
   return 0;
}


Measured memory_bytes: 9576
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> data(n);
  for(int i=0;i<n;i++)cin>>data[i];
  sort(data.begin(),data.end());
  int sum=0;
  for(int i=0;i<n;i++)sum+=data[i];
  if(sum>2*data[n-1])cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
while True:
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        if i == 0 or i == H-1:
            print("#"*W)
        else:
            print("#"+"."*(W-2)+"#")
            
    print()


Measured memory_bytes: 5608
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    int X;
    cin >> X;
    int a = X / 100;
    int limit;
    limit = a * 100 + a * 5;
    if(X <= limit) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
int main() {
	int n, x[100], y, i;
	double d1 = 0, d2 = 0, d3 = 0, dinf = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &x[i]);
	}
	for (i = 0; i < n; i++) {
		scanf("%d", &y);
		y = x[i] > y ? x[i] - y : y - x[i];
		d1 += y;
		d2 += y*y;
		d3 += y*y*y;
		dinf = dinf < y ? y : dinf;
	}
	printf("%f\n%f\n%f\n%f\n", (double)d1, std::sqrt(d2), std::cbrt(d3), (double)dinf);
	return 0;
}


Measured memory_bytes: 2924
import sys
import fractions
def input(): return sys.stdin.readline().rstrip()

def main():
    a, b, c, d = map(int, input().split())
    cd_gcd = c * d // fractions.gcd(c, d)
    cnt = lambda n: n - n // c - n // d + n // cd_gcd
    print(cnt(b) - cnt(a-1))

if __name__ == '__main__':
    main()


Measured memory_bytes: 5724
#include <bits/stdc++.h>
using namespace std;
#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++)
typedef long long ll;

bool isMM(int num) {
  return num >= 1 && num <= 12 ? true : false;
}

int main() {
  string s;
  cin >> s;
  int s1 = atoi(s.substr(0, 2).c_str());
  int s2 = atoi(s.substr(2, 2).c_str());
  bool isMMS1 = isMM(s1);
  bool isMMS2 = isMM(s2);
  if (!isMMS1 && isMMS2) {
    cout << "YYMM" << "\n";
  } else if (isMMS1 && !isMMS2) {
    cout << "MMYY" << "\n";
  } else if (isMMS1 && isMMS2) {
    cout << "AMBIGUOUS" << "\n";
  } else {
    cout << "NA" << "\n";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

long long gcd(long long a, long long b) {
    for(;;) {
        if(a == 0)
            return b;
        b %= a;
        if(b == 0)
            return a;
        a %= b;
    }
}

vector<pair<long long, long long>> prime_factorize(long long n) {
    vector<pair<long long, long long>> res;
    for(long long p = 2; p * p <= n; ++p) {
        if(n % p != 0)
            continue; //因数じゃない
        int num = 0;
        while(n % p == 0) {
            ++num;
            n /= p;
        }
        res.push_back(make_pair(p, num));
    }
    if(n != 1)
        res.push_back(make_pair(n, 1)); // nが素数だった場合
    return res;
}

int main() {
    ll A, B;
    cin >> A >> B;
    ll res = gcd(A, B);
    auto hoge = prime_factorize(res);
    cout << hoge.size() + 1LL << endl;
    return 0;
}

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

using namespace std;

inline double add(double a, double b){
    return abs(a+b)<(1e-10)*(abs(a)+abs(b)) ? 0.0 : a+b;
}

struct vec{
    double x,y;
    vec operator-(vec b){
        return (vec){add(x,-b.x),add(y,-b.y)};
    }
    vec operator+(vec b){
        return (vec){add(x,b.x),add(y,b.y)};
    }
    vec operator*(double d){
        return (vec){x*d,y*d};
    }
    double dot(vec v){
        return add(x*v.x,y*v.y);
    }
    double cross(vec v){
        return add(x*v.y,-y*v.x);
    }
    double norm(){
        return sqrt(x*x+y*y);
    }
};

int ccw(vec& a, vec& b, vec& c){
    vec ab = b-a, ac = c-a;
    double o = ab.cross(ac);
    if(o>0) return 1; //CCW
    if(o<0) return -1; //CW
    if(ab.dot(ac)<0){
        return 2; //C-A-B
    }else{
        if(ab.dot(ab)<ac.dot(ac)){
            return -2; //A-B-C
        }else{
            return 0; //A-C-B
        }
    }
}

vector<vec> convex_hull(vector<vec>& V){
    vector<vec> C;
    vector<vec>::iterator ite;
    sort(V.begin(),V.end(),[](const vec& a, const vec& b){return a.y==b.y ? a.x < b.x : a.y< b.y;});
    C.push_back(V[0]),C.push_back(V[1]);
    for(auto i=V.begin()+2; i!=V.end();++i){
        C.push_back(*i);        
        while(ite=C.end()-1, C.size()>2&&ccw(*(ite-2),*(ite-1),*ite)==-1){
            C.erase(ite-1);
        }
    }
    C.pop_back();

    sort(V.begin(),V.end(),[](const vec& a, const vec& b){return a.y==b.y ? a.x > b.x : a.y>b.y;});
    C.push_back(V[0]),C.push_back(V[1]);
    for(auto i=V.begin()+2; i!=V.end();++i){
        C.push_back(*i);
        while(ite=C.end()-1, C.size()>2&&ccw(*(ite-2),*(ite-1),*ite)==-1){
            C.erase(ite-1);
        }
    }
    C.pop_back();
    return C;
}

int main(){
    int n;
    cin >> n;
    vec v;
    vector<vec> V,C;
    while(n--){
        cin >> v.x >> v.y;
        V.push_back(v);
    }
    C=convex_hull(V);
    cout << C.size() << endl;
    for(auto& i : C) cout << i.x << " " << i.y << endl;
    return 0;
}

Measured memory_bytes: 7368
#include <bits/stdc++.h>
#define int long long
std::string dp[3][3005];
using namespace std;

signed main(){
  string s,t;cin>>s>>t;
  int S=s.size();int T=t.size();
  for(int i=1;i<=S;i++){
    for(int j=1;j<=T;j++){
      if(dp[0][j].size()<dp[1][j-1].size())dp[1][j]=dp[1][j-1];
      else dp[1][j]=dp[0][j];
      if(dp[0][j-1].size()==dp[1][j].size()&&s[i-1]==t[j-1])dp[1][j]=dp[0][j-1]+s[i-1];
    }
    for(int j=1;j<=T;j++)dp[0][j]=dp[1][j];
  }
  cout<<dp[1][T]<<endl;
}


Measured memory_bytes: 8176
function Main(input){
  var X = parseInt(input);
  
  var fX = 0;
  var x = X;
  while(x > 0){
    fX += x % 10;
    x = Math.floor(x / 10);
  }
  (X % fX === 0) ? console.log('Yes') : console.log('No');
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;

int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	int cnt=0;
	int now=0;
	while(true)
	{
		cnt++;
		now+=a+(cnt%7==0 ? b:0);
		if(now>=c)break;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define f(i,a,b) for(ll i=a;i<=b;i++)
#define fi(i,a,b) for(ll i=a-1;i>=b;i--)
#define endl '\n'
#define spc " "
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.14159265358979323
#define sz(a) (int)((a).size())
#define len(a) (int)(a.length())
#define FOR(i,j,k,l) for(ll i=j;i<k;i+=l)
#define CC(x) cout<<x<<endl


void Fast_IO() {
   ios::sync_with_stdio(0);
   cin.tie(0);
   #ifndef ONLINE_JUDGE
   freopen("input.in","r",stdin);
   freopen("output.out","w",stdout); 
   #endif
} 

int main(){
   Fast_IO();
   ll n;
   cin>>n;
   set<pair<ll,ll> >v;
   map<ll,ll>m;
   f(i,1,n) m[i]=0;
   ll ptr=0;
   f(i,1,sqrt(n)){
      f(j,1,sqrt(n)){
         f(k,1,sqrt(n)){
            ll val = (pow((i+j),2)+pow((k+j),2)+pow((i+k),2));
            val/=2;
            if(i==j && j==k) m[val]+=1;
            else m[val]+=1;
         }
      }
   }
   f(i,1,n){
      cout<<m[i]<<endl;
   }
   // }
}



Measured memory_bytes: 6008
#include <stdio.h>
 
int main(void) {
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	if (a<b && b<c) {
		printf("Yes\n");
	} 
	else {
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 580
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int A = in.Int();
            int B = in.Int();
            int C = in.Int();

            out.println(A <= C && C <= B ? "Yes" : "No");

        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 23380
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int h, w, odd = 0;
    cin >> h >> w;
    vector<vector<int>> a(h, vector<int>(w, 0));
    vector<string> res;
    repi(i, h, 0)
    {
        repi(j, w, 0)
        {
            cin >> a[i][j];
            if (a[i][j] % 2)
                odd++;
        }
    }
    bool ok = odd % 2 == 0;
    repi(i, h, 0)
    {
        repi(j, w, 0)
        {
            if (!ok && odd == 1)
                break;
            else if(ok && odd == 0) break;
            if (i % 2 == 0)
            {
                if (i != h - 1 || j != w - 1)
                {
                    if (a[i][j] % 2)
                    {
                        if (j != w - 1)
                        {
                            a[i][j + 1]++;
                            res.push_back(to_string(i + 1) + " " + to_string(j + 1) + " " + to_string(i + 1) + " " + to_string(j + 2));
                            if(a[i][j + 1]%2)odd--;
                            // cout << i + 1 << " " << j + 1 << " " << i + 1 << " " << j + 2 << "\n";
                        }
                        else
                        {
                            a[i + 1][j]++;
                            res.push_back(to_string(i + 1) + " " + to_string(j + 1) + " " + to_string(i + 2) + " " + to_string(j + 1));
                            if(a[i + 1][j]%2)odd--;
                            // cout << i + 1 << " " << j + 1 << " " << i + 2 << " " << j + 1 << "\n";
                        }
                    }
                }
            }
            else
            {
                if (i != h - 1 || j != w - 1)
                {
                    if (a[i][w - j - 1] % 2)
                    {
                        if (j != w - 1)
                        {
                            a[i][w - j - 2]++;
                            res.push_back(to_string(i + 1) + " " + to_string(w- j) + " " + to_string(i + 1) + " " + to_string(w - j - 1));
                            if(a[i][w - j - 2]%2)odd--;
                            // cout << i + 1 << " " << w - j << " " << i + 1 << " " << w - j - 1 << "\n";
                        }
                        else
                        {
                            a[i + 1][w - j - 1]++;
                            res.push_back(to_string(i + 1) + " " + to_string(w - j) + " " + to_string(i + 2) + " " + to_string(w - j));
                            if(a[i + 1][w - j - 1]%2)odd--;
                            // cout << i + 1 << " " << w - j << " " << i + 2 << " " << w - j << "\n";
                        }
                    }
                }
            }
        }
    }
    cout << res.size() << endl;
    for(auto itr = res.begin();itr != res.end();itr++){
        cout << *itr << "\n";
    }
    return 0;
}

Measured memory_bytes: 11892
#include <stdio.h>
int main() {
	int A, B, C,i;
	scanf("%d %d %d",&A, &B, &C);
	for (i = 0; i <C; i++) {
		if (B + i >= A)
			break;
	}
	printf("%d", C - i);
	return 0;
}
	

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

using namespace std;

long long x;

int main() {
	cin >> x;
	for (long long i = -1000; i < 1000; i++) {
		for (long long j = -1000; j < 1000; j++) {
			if ((j * j * j * j * j) - (i * i * i * i * i) == x) {
				cout << j << ' ' << i;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 3540
x, y = map(int, input().split())

ans = 0
if x == 1:
  ans += 300000
if x == 2:
  ans += 200000
if x == 3:
  ans += 100000
  
if y == 1:
  ans += 300000
if y == 2:
  ans += 200000
if y == 3:
  ans += 100000
  
if x == 1 and y == 1:
  ans += 400000
 
print(ans)

Measured memory_bytes: 9092
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
// int mod=1000000007;
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    ll t,i,j,k,temp,a,b=0,n;
    cin >> k>>a;
    for(i=0;i<a;i++){
        cin >> n;
        b+=n;
    }
    if(b>=k) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
# define maxn 100000 
# define maxm 50

int main() {
  int N,K,h[maxn];
  ll dp[maxn]={0};
  cin>>N>>K;
  for (int i(1);i<=N;i++)cin>>h[i];
  for (int i(2);i<=N;i++)dp[i]=1LL << 30;
  for (int i(1);i<=N;i++)
    for (int k(1);k<=K;k++)
      if (i+k<=N) dp[i+k]=min(dp[i+k],dp[i]+abs(h[i]-h[i+k]));
  cout << dp[N];
  return 0;
}


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

int main() {
  string s;
  cin >> s;
  if(s == "MON"){
    cout << 6 <<endl;
  }
  if(s == "TUE") {
    cout << 5 <<endl;
  }
  if(s == "WED") {
    cout << 4 <<endl;
  }
  if(s == "THU") {
    cout << 3 <<endl;
  }
  if(s == "FRI") {
     cout << 2 <<endl;
  }
  if(s == "SAT") {
    cout << 1 <<endl;
  }
  if(s == "SUN") {
    cout << 7 <<endl;
  }
}


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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    vector<bool> box(n, false);
    for(int& i: A) cin >> i;
    int m = 0;
    for(int i = n - 1; i >= 0; i--){
        int cnt = 0;  
        for(int j = i + 1; j <= n; j += i + 1){
            cnt += box[j - 1];
        }
        cnt %= 2;
        if(cnt != A[i]) box[i] = true, m++;
    }
    cout << m << endl;
    for(int i = 0; i < n; i++) if(box[i]) cout << i + 1 << " ";
    cout << endl;
}

Measured memory_bytes: 1792
n,k=map(int,input().split())
p=list(map(int,input().split()))
s=0
for i in range(0,k):
  s+=(1+p[i])/2
M=s
for i in range(1,n-k+1):
  s-=(1+p[i-1])/2
  s+=(1+p[i+k-1])/2
  if s>=M:
    M=s
print(M)

Measured memory_bytes: 25604
#include <stdio.h>
int SelectionSort(int *a,int b);

int main(int argc, const char * argv[]) {
    int a[100],n,i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    printf("%d\n",SelectionSort(&a,n));
}

int SelectionSort(int *a,int n){
    int i,j,tmp,minj,count=0;
    
    for(int i=0;i<n;i++){
        minj=i;
        for(j=i;j<n;j++){
            
            if(a[j]<a[minj]){
                minj=j;
            }
           
        }
        if(a[i]>a[minj]){
            tmp=a[minj];
            a[minj]=a[i];
            a[i]=tmp;
            count++;
        }
    }
    
    for(i=0;i<n-1;i++){
        printf("%d ",a[i]);
    }
    printf("%d\n",a[i]);
    return count;
}


Measured memory_bytes: 2140
from sys import stdin
import copy
N = int(stdin.readline())
time = [int(i) for i in stdin.readline().rstrip().split()]
M = int(stdin.readline())

for m in range(M):
    time_drink = copy.copy(time)
    P, X = [int(i) for i in stdin.readline().rstrip().split()]
    time_drink[P-1] = X
    print(sum(time_drink))

Measured memory_bytes: 3444
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1;
	while (b) {
		if (b & 1) { res = res * a%MOD; }
		a = a * a%MOD;
		b >>= 1;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑




int main() {
	int a, b;
	cin >> a >> b;
	if (a != b)
		cout << max(a, b) + max(a, b) - 1 << endl;
	else { cout << 2 * a << endl; }
}


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

int main() {
    int n, k;
    int h[100010];

    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> h[i];

    int count = 0;
    for(int i = 0; i < n; i++) {
        if (h[i] >= k) count++;
    }

    cout << count << endl;
}

Measured memory_bytes: 3976
#include<iostream>
#include<stack>
using namespace std;
int main(){
  int n;
  stack<int> st;
  while(cin>>n){
    if(n==0){
      cout<<st.top()<<endl;
      st.pop();
    }
    else{
      st.push(n);
    }
  }
  return 0;
}

Measured memory_bytes: 1200
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main(void){
   int A,B,C,D,ans;
   scanf("%d%d%d%d", &A,&B,&C,&D);
   if(D <= A) ans = 0;
   if(C <= A && A<=D) ans = D - A;
   if(A <= C && D <= B) ans = D -C;
   if(C <= B && B <= D) ans = B -C;
   if(B <= C) ans = 0;
   if(C <= A && B <= D) ans = B -A;
   printf("%d\n",ans);
}


Measured memory_bytes: 128
N = gets
AS = gets.chomp.split.map(&:to_i)
Q = gets
queries = readlines.map { |line| line.chomp.split.map(&:to_i) }

hash = Hash.new(0)

ans = 0
AS.each do |a|
  hash[a] += 1
  ans += a
end

queries.each do |b, c|
  ans += (c - b) * hash[b]
  hash[c] += hash[b]
  hash[b] = 0
  puts ans
end


Measured memory_bytes: 32788
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define pb push_back
const int mod=1e9+7;
 
int main(){
	int n;
	while(cin >> n){
		int cont[n+5] = {};
		int u[n+5] = {};
		f1(n)cin >> cont[i];
		for(int i=n;i>0;i--){
			int cnt = 0;
			for(int j = 2 * i ; j <= n ; j += i){
				if(u[j])cnt ^= 1;
			}
			if(cnt^cont[i]){
				u[i] = 1;
			}
		}
		vector<int>v;
		f1(n){
			if(u[i])v.pb(i);
		}
		cout << v.size() << endl;
		for(auto i:v){
			cout << i << ' ';
		}
		cout << endl;
	}
 
}

Measured memory_bytes: 3064
using System;
namespace ABC
{
    public class C
    {
        static void Main()
        {
            string[] input = Console.ReadLine().Split(' ');
            decimal A = decimal.Parse(input[0]);
            decimal B = decimal.Parse(input[1]);

            decimal C = A * B;
            decimal D = Math.Floor(C);

            Console.WriteLine(D);
        }
    }
}

Measured memory_bytes: 27620
let (h, w) = Scanf.scanf "%d %d" (fun x y -> (x, y)) in
let a = Array.init h (fun _ -> Array.make w 0) in
for i = 0 to h - 1 do
  for j = 0 to w - 1 do
    a.(i).(j) <- Scanf.scanf (if j = 0 then "\n%d" else " %d") (fun x -> x)
  done
done;
let ans = ref [] in
for i = 0 to h - 2 do
  for j = 0 to w - 1 do
    if a.(i).(j) mod 2 = 1 then begin
      a.(i).(j) <- a.(i).(j) - 1;
      a.(i + 1).(j) <- a.(i + 1).(j) + 1;
      ans := (i, j, i + 1, j)::!ans
    end
  done
done;
for j = 0 to w - 2 do
  if a.(h - 1).(j) mod 2 = 1 then begin
    a.(h - 1).(j) <- a.(h - 1).(j) - 1;
    a.(h - 1).(j + 1) <- a.(h - 1).(j + 1) + 1;
    ans := (h - 1, j, h - 1, j + 1)::!ans
  end
done;
let ans = List.rev !ans in
print_int (List.length ans);
print_newline ();
ans |> List.iter (fun (y1, x1, y2, x2) -> Printf.printf "%d %d %d %d\n" (y1 + 1) (x1 + 1) (y2 + 1) (x2 + 1));;



Measured memory_bytes: 17920
#include<math.h>
#include<ctype.h>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define il inline
#define rg register
using namespace std;
const int O=100010;
struct point{int id,p,y,ID;}a[O];
il int gi ( ){
	rg int o=0,fl=1;
	char ch=getchar();
	while(!isdigit(ch))fl^=ch=='-',ch=getchar();
	while(isdigit(ch))o=10*o+ch-48,ch=getchar();
	return fl?o:-o;
}
int n,m,now,k,g;
il bool cmp(point a,point b){return (a.p==b.p)?(a.y<b.y):(a.p<b.p);}
il bool Cmp(point a,point b){return a.id<b.id;}
int main ( ){
	n=gi(),m=gi();
	for(int i=1;i<=m;i++){
		a[i].id=i;
		a[i].p=gi();
		a[i].y=gi();
	}
	sort(a+1,a+m+1,cmp);
	a[1].ID=now=k=1;
	for(int i=2;i<=m;i++){
		if(a[i].p!=a[now].p)now=i,k=0;
		a[i].ID=++k;
	}
	sort(a+1,a+m+1,Cmp);
	for(int i=1;i<=m;i++)
		printf("%06d%06d\n",a[i].p,a[i].ID);
	return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const ll MOD=1e9+7;
const ll INF=1ll<<60;

//
//　定数, 変数 *********************************************
ll A,B,C,K;

// *********************************************************
int main(){

    // 入力スタンダード
    cin >> A >> B >>C >>K;
    
    if(A>=K){
        cout << K <<endl;
    }else if(A+B>=K){
        cout << A << endl;
    }else{
        cout << A - (K-A-B) << endl;
    }




    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main(){
	//int a,b,c,k;
	//cin>>a>>b>>c>>k;
	long long int arr[3];
	for(int i=0;i<3;i++){
		cin>>arr[i];
	}
	long long int k;
	cin>>k;
	long long sum=0;
	for(int i=0;i<3;i++){
		if(k>=arr[i]){
		k = k-arr[i];
	      if(i==0){
	      	sum+=arr[i];
	      }else if(i==2){
	      	sum+=arr[i]*(-1);
	      }
	      continue;
	   } if(k<arr[i]&&k!=0){
           if(i==0){
	      	sum+=k;
	      }else if(i==2){
	      	sum+=k*(-1);
	      }
	      k =0;
           }
	   
		if(k==0){
			break;
		}
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 3596
import java.util.*;
 
public  class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int a = scan.nextInt();
      	int b = scan.nextInt();
      	int c = scan.nextInt();
      	if((a < c && c < b) ||(b < c && c < a)){
        	System.out.print("Yes");
        }
      	else{
        	System.out.print("No");
        }
    }
 
}

Measured memory_bytes: 24148
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var tmp = a[0];
        a[0] = a[1];
        a[1] = tmp;
        tmp = a[0];
        a[0] = a[2];
        a[2] = tmp;

        Console.WriteLine(string.Join(" ", a));
    }
}

Measured memory_bytes: 13396
N = int(input())
A = [int(x) for x in input().split()]

def count(n, Set):
    if not n in Set:
        Set.add(n)
        return 0
    else:
        return 1

Sieve = set()
extra = 0
for a in A:
    extra += count(a, Sieve)
print(N-extra if not extra&1 else N-extra-1)


Measured memory_bytes: 20596
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		long N=sc.nextLong();
		long K=sc.nextLong();
		long X=sc.nextLong();
		long Y=sc.nextLong();
		long ans=0;
		for(int i=1;i<=N;++i) {
			if(i<=K) {
				ans+=X;
			}else {
				ans+=Y;
			}
		}
		System.out.println(ans);
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
	
}


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

using namespace std;

long long dp[101][100001];

struct predmet
{
    long long w;
    long long v;
};

predmet predmeti[101];

bool acompare(predmet p1, predmet p2) {return p1.w < p2.w;}

int main()
{
    long long N,W;
    cin>> N >> W;

    for(int i = 0; i < N; i++)
    {
        cin>>predmeti[i].w>>predmeti[i].v;
    }

    sort(predmeti,predmeti+N,acompare);

    for(int i = 0; i < N; i++)
    {
        for(int j = 1; j <= W; j++)
        {
            long long nosivost = j;
            long long pred = i;

            if(i > 0)
            {
                if(predmeti[pred].w > nosivost) dp[i][j] = dp[i-1][j];
                else dp[i][j] = max(dp[i-1][j], dp[i-1][j-predmeti[pred].w] + predmeti[pred].v);
            }
            else
            {
                if(predmeti[pred].w > nosivost) dp[i][j] = 0;
                else dp[i][j] = predmeti[pred].v;
            }
        }
    }

    cout<<dp[N-1][W];

    return 0;
}


Measured memory_bytes: 78336
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 

using namespace __gnu_pbds;
using namespace std;

// MACROS

#define ll long long
#define ull unsigned long long
#define ld long double

#define vi vector<int>
#define vll vector<ll>
#define vld vector<ld>
#define u_s unordered_set

#define pii pair<int,int>
#define pll pair<ll,ll>

#define FOR(i, n) for (ll (i) = 0; i < n; i++)
#define FORN(i, a, b) for (ll (i) = a; i < b; i++)
#define FORE(i, l) for (auto (i) : l)

#define pb push_back
#define pob pop_back
#define emp emplace
#define fi first
#define se second

#define all(n) (n).begin(), (n).end()
#define in(n) cin >> (n);
#define debug(n) cout << #n << ": " << n << '\n';

// FUNCTIONS

template< typename T >
inline T gcd(T a, T b) { if (b) return gcd(b, a % b); return a; }

template< typename T >
inline T ext_gcd(T a, T b, T & x, T & y) { if (a == 0) { x = 0; y = 1; return b; } T x1, y1; T g = ext_gcd(b % a, a, x1, y1); x = y1 - (b / a) * x1; y = x1; return g; }

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);	
    cout << setprecision(15);
    ld n;
    cin >> n;
    n /= 3;
    cout << n * n * n << '\n';
}



Measured memory_bytes: 256
def main():
  s = map(int, input()[::-1])

  mod = 2019

  counts = [0] * mod
  counts[0] = 1
  t = 0
  x = 1
  for num in s:
    t = (t + num * x) % mod
    counts[t] += 1
    x = (x * 10) % mod

  ans = 0
  for count in counts:
    if count > 1:
      ans += count * (count - 1) // 2

  print(ans)

main()


Measured memory_bytes: 9228