akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;

int main()
{
    int N, W;
    cin >> N >> W;
    long long dp[100001], w[100000], v[100000];
    long long ans = 0;
    int sum = 0;
    for (int i = 0; i < N; i++){
        cin >> w[i] >> v[i];
        sum += v[i];
    }
    for (int i = 0; i <= sum; i++) {
        dp[i] = 1000000000000000001;
    }
    dp[0] = 0;
    for (int i = 0; i < N; i++){
        for (int j = sum - v[i]; j >= 0; j--){
            dp[j + v[i]] = min(dp[j + v[i]], dp[j] + w[i]);
            //cout << dp[j + weight] << " " << j + weight << endl; 
        }
    }
    for (int j = 0; j <= sum; j++){
        if (dp[j] <= W)
            ans = max(ans, (long long)j);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define INF 1e18
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A.at(i);
    
    auto maxIter = max_element(all(A));
    int maxValue = *maxIter;
    int maxIndex = distance(A.begin(), maxIter);

    REP(i, N) {
        if (maxIndex != i) {
            print(maxValue);
        } else {
            vector<int> tmp = A;
            tmp.erase(tmp.begin() + i);
            print(*max_element(all(tmp)));
        }
    }
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 3200
/*****************************************************
 *     created by: nayakashutosh9
 * "Winners Never Quit and Quitters Never Win".
*****************************************************/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define endl '\n'
#define mod 1000000007
#define inf 1e18
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
const int N = 300005;
/**********************************************************************************************/


void solve() {
	int a, b, c, d; cin >> a >> b >> c >> d;
	int turn = 0;
	while (a > 0 && c > 0) {
		if (turn == 0) c -= b;
		else a -= d;
		turn ^= 1;
	}
	if (a > 0) cout << "Yes\n";
	else cout << "No\n";
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int t = 1, z = 1;
	// cin >> t; cin.ignore();
	while (t--) {
		// cout << "Case #" << (z++) << ": ";
		// clock_t start = clock();
		solve();
		// clock_t end = clock();
		// cout << (end-start) << endl;
		//print execution time in ms
	}

	return 0;
}

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

#define pb push_back
#define F first
#define S second
#define fo(i,a,b)  for(int i = a; i < b; i++)

using ll = long long;
using ld = long double;
using ul = unsigned long long;
using ii = pair<int, int>;
#define Mosta     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ReadFile            freopen("input.in","r",stdin)
#define WriteFile           freopen("output.txt","w",stdout)
const ll mod7 = 1000000007,mod = 1000000000,OO = 0x3f3f3f3f;
const ld EPS = 1e-7;
double Pi=acos(-1);
const ld rad=Pi/180.0;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll nCr (ll n,ll m)
{
    return(m == 0)?1:n*nCr(n-1,m-1)/m;
}
/*****************************************************/

bool _check(ll i){
    string s = to_string(i);
    ll m = s.length();
    if(m % 2 == 1)
        return true;
    else
        return false;
}

int main()
{
    ll n , x = 0;

    cin >> n;

    for(ll i = 1; i <= n; ++i)
        if(_check(i))
            x++;

    cout << x << "\n";

	return 0;
}


Measured memory_bytes: 256
a = list(input().rstrip())


count = 0

for i in range(len(a)):
    if a[i] == 'k':
        count = count + 1
        a[i] = '-'
        if a[i+1] == 'e':
            count = count + 1
            a[i] = '-'
            if a[i+2] == 'y':
                count = count + 1
                a[i] = '-'
                if a[i+3] == 'e':
                    count = count + 1
                    a[i] = '-'
                    if a[i+4] == 'n':
                        count = count + 1
                        a[i] = '-'
                        if a[i+5] == 'c':
                            count = count + 1
                            a[i] = '-'
                            if a[i+5] == 'e':
                                count = count + 1
                                a[i] = '-'
                            else:
                                break
                        else:
                            break    
                    else:
                        break
                else:
                    break
            else:
                break    
        else:
            break   
    else:
        continue

a.reverse()

for j in range(len(a)):
    if a[i] == 'e':
        count = count + 1
        a[i] = '-'
        if a[i+1] == 'c':
            count = count + 1
            a[i] = '-'
            if a[i+2] == 'n':
                count = count + 1
                a[i] = '-'
                if a[i+3] == 'e':
                    count = count + 1
                    a[i] = '-'
                    if a[i+4] == 'y':
                        count = count + 1
                        a[i] = '-'
                        if a[i+5] == 'e':
                            count = count + 1
                            a[i] = '-'
                            if a[i+5] == 'k':
                                count = count + 1
                                a[i] = '-'
                            else:
                                break
                        else:
                            break    
                    else:
                        break
                else:
                    break
            else:
                break    
        else:
            break   
    else:
        continue

if count >= 7 and (i == 0 and j == 0):
    print('YES')
elif 'keyence' in a and (i == 0 or j == 0):
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
a,b,c,d=map(int,input().split())
if a>=0 and b>=0 and c >=0 and d>=0:
    print(b*d)
elif a<0 and b>=0 and c >=0 and d>=0:
    print(b*d)
elif a<0 and b<0 and c >=0 and d>=0:
    print(b*c)
elif a<0 and b<0 and c<0 and d>=0:
    print(a*c)
elif a<0 and b<0 and c<0 and d<0:
    print(a*c)
elif a<0 and b>=0 and c<0 and d>=0:
    if a*c>b*d:
        print(a*c)
    else:
        print(b*d)
elif a<0 and b>=0 and c<0 and d<0:
    print(a*c)
elif a>=0 and b>=0 and c<0 and d>=0:
    print(b*d)
elif a>=0 and b>=0 and c<0 and d<0:
    print(a*d)

Measured memory_bytes: 9236
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
float t,a,ondosa=INT_MAX,ans;
  cin >> n >> t >>a;
  float h[n];
  for (int i=0;i<n;i++){
  	cin >> h[i];
    if(abs((t-0.006*h[i])-a)<ondosa) {
      ondosa=abs((t-0.006*h[i])-a);
      ans=i+1;
    }
  }
  cout << ans <<endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,m; cin >> n >> m;
  string s,t; cin >> s >> t;
  for(int i = 0; i < __gcd(n,m); i++){
    if(s[i*(n/__gcd(n,m))] != t[i*(m/__gcd(n,m))]){
      cout << -1;
      return 0;
    }
  }
  cout << n*(m/__gcd(n,m));
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3816
#include <cstdio>
#include <functional>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
using namespace std;

int main() {
    int n; scanf("%d", &n);
    vector<vector<int> > g(n);
    repeat (i, n - 1) {
        int a, b; scanf("%d%d", &a, &b); -- a; -- b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<int> parent(n, -1);
    vector<int> size(n, 1);
    vector<int> depth(n);
    function<void (int)> go = [&](int i) {
        for (int j : g[i]) if (j != parent[i]) {
            parent[j] = i;
            depth[j] = depth[i] + 1;
            go(j);
            size[i] += size[j];
        }
    };
    go(0);
    int i = n - 1;
    repeat (j, (depth[n - 1] - 1) / 2) {
        i = parent[i];
    }
    int second = size[i];
    int first = n - second;
    printf("%s\n", first > second ? "Fennec" : "Snuke");
    return 0;
}


Measured memory_bytes: 14720
#include <iostream>
#include <cmath>

using namespace std;

int main() {
	int D, N;

	cin >> D >> N;

	int ans = N + floor((N - 1) / 99.0);
	for (int i = 0; i < D; i++)
		ans *= 100;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int a = scanner.nextInt();
		int b = scanner.nextInt();

		int sum = 0;
		for (int i = 1; i <= n; i++) {
			int tar = getTar(i);
			if (a <= tar && tar <= b)
				sum += i;
		}
		
		System.out.println(sum);

	}

	private static int getTar(int n) {
		int tar = 0;
		for (int i = n; i > 0; i /= 10) {
			tar += i % 10;
		}
		return tar;
	}

}


Measured memory_bytes: 23764
K=int(input())

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
ans = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):

            ans += gcd(a,b,c)
print(ans)



Measured memory_bytes: 69780
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long 
#define PB push_back
#define FAST ios::sync_with_stdio(false);cin.tie(0);
 
const int MAXN = 5e3 + 100;


int main() {
    FAST
    long long int n; cin >> n;
    string s; cin >> s;
    if (n % 2 != 0) {
    	cout << "No" << endl;
    	return 0;
	}
	int k = n / 2;
	for (int i = 0; i < k; ++i) {
		if (s[i] == s[i + k]) {
			continue;
		}
		else {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n, m;
    cin >> n >> m;
    vector<int> height(n);
    vector<int> count(n,0);
    for(int i=0;i<n;i++){
        cin >> height.at(i);
    }
    int a, b;
    for(int i=0;i<m;i++){
        cin >> a >> b;
        if(height.at(a-1) > height.at(b-1)){
            count.at(b-1)++;
        }
        if(height.at(a-1) < height.at(b-1)){
            count.at(a-1)++;
        }
        if(height.at(a-1) == height.at(b-1)){
            count.at(a-1)++;
            count.at(b-1)++;
        }
    }
    int sum = 0;
    for(int i=0;i<n;i++){
        if(count.at(i) == 0){
            sum++;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 4052
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include "bits/stdc++.h"
using namespace std;
#define int long long


class AInfiniteCoins {
public:
	void solve(std::istream& in, std::ostream& out) {
    int n,a;
    in >> n >> a;
    out << (n % 500 <= a ? "Yes" : "No") << endl;
	}
};


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


Measured memory_bytes: 3580
#include<cstdio>
#include<bitset>
using namespace std;
bitset<4000010> f;
int n,sum=0;
int main(){
	scanf("%d",&n);
	f[0]=1;
	for(int i=1,a;i<=n;i++){
		scanf("%d",&a);
		f|=f<<a;
		sum+=a;
	}
	int ans=(sum+1)/2;
	while(f[ans]==0) ans++;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1792
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        a: usize, b: usize
    };

    let res = if a < b || a == b && b <= a {
        std::iter::repeat(a).take(b)
    } else {
        std::iter::repeat(b).take(a)
    }
    .join("");
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2196
#include <iostream>
#include <string>
#include <vector>
using namespace std;
 
int main()
{
	int len, Q;	cin >> len >> Q;
	string s;	cin >> s;
	int sum = 0;
	vector <int> v(len);
	for (int i = 0; i < len-1; i++)
	{
		if (s[i] == 'A' && s[i + 1] == 'C')
		{
			v[i] = sum;
			v[i + 1] = ++sum;
		}
		else { v[i] = sum; v[i + 1] = sum; }
	}
	int start, end;
	for (int i = 0; i <	Q; i++)
	{
		cin >> start >> end;
		cout << v[end-1] - v[start-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>

int main()
{
    int n,i,j;
    char s[300000];

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

    int count = 0;
    for (i = 1; i < n; i++)
    {
        if(s[i] == 'E')count++;
    }
    int min = count;
    for (i = 1; i < n; i++)
    {
        if(s[i - 1] == 'W')count++;
        if(s[i] == 'E')count--;
        if(min > count)min = count;
    }
    
    printf("%d",min);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

int gcd(int x, int y)
{
  if(y == 0) return x;
  else return gcd(y, x%y);
}

int main(){
  int x, y;
  cin >> x >> y;

  cout << gcd(x, y) << endl;

  return 0;
}





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

int main(){
  string S;
  int Q;
  cin>>S>>Q;
  vector<char> s;
  vector<vector<int>> front(2);
  int state=0;
  for(int i=0;i<S.size();i++){
    s.push_back(S.at(i));
  }
  for(int i=0;i<Q;i++){
    int T;
    cin>>T;
    if(T==1){
      state=1-state;
    }else{
      int F;
      char C;
      cin>>F>>C;
      if(F==1){
        front.at(state).push_back(C);
      }else{
        front.at(1-state).push_back(C);
      }
    }
  }
  if(state==0){
    for(int i=0;i<front.at(1).size();i++){
      s.push_back(front.at(1).at(i));
    }
    reverse(s.begin(),s.end());
    for(int i=0;i<front.at(0).size();i++){
      s.push_back(front.at(0).at(i));
    }
    reverse(s.begin(),s.end());
  }else{
    for(int i=0;i<front.at(1).size();i++){
      s.push_back(front.at(1).at(i));
    }
    reverse(s.begin(),s.end());
    for(int i=0;i<front.at(0).size();i++){
      s.push_back(front.at(0).at(i));
    }
  }

  int n=s.size();
  for(int i=0;i<n;i++){
    cout<<s.at(i);
  }
  cout<<endl;
}


Measured memory_bytes: 2288
# coding: utf-8

def main():
    N, K, Q = map(int, input().split())
    A = [0] * N

    for _ in range(Q):
        tmp = int(input())
        A[tmp - 1] += 1

    for i in range(N):
        if A[i] + K > Q:
            print('Yes')
        else:
            print('No')

if __name__ == "__main__":
    main()


Measured memory_bytes: 9760
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main(int argc, const char * argv[]) {
    int N;
    char s;
    int x = 0;
    int ans = 0;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> s;
        if(s == 'I'){
            x++;
        }else{
            x--;
        }
        ans = max(x,ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    LL A,B,K;cin >> A >> B >> K;
    if(A <= K){
        K -= A;
        A = 0;
        if(B <= K){
            B = 0;
        }
        else{
            B -= K;
        }
    }
    else{
        A -= K;
    }
    cout << A << " " << B << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#ifdef STOPIT
#define debug(...) 0
#else
#define debug(...)\
do {\
  std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;\
} while (false)
#endif

template < class Value >
inline auto factor(Value x) {
  std::vector< std::pair< Value, int > > ret;
  for (Value p = 2; p * p <= x; p++) {
    int m = 0;
    for (; x % p == 0; m++)
      { x /= p; }
    if (m > 0)
      { ret.emplace_back(p, m); }
  }
  if (1 < x)
    { ret.emplace_back(x, 1); }
  return ret;
}

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int x; std::cin >> x;
  auto a = factor(x);
  std::cout << x << ":";
  for (auto pair : a) {
    int x, mul; std::tie(x, mul) = pair;
    loop(mul) {
      std::cout << " " << x;
    }
  }
  std::cout << std::endl;
  return 0;
}



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

int main(){

    int n,m;
    cin >>n >> m;
    vector<pair<int,char>> s(m);

    rep(i,m){
        cin >> s[i].first >> s[i].second;
    }

    for(int i=0;i<1000;i++){
        string t=to_string(i);
        bool f=true;
        for(int j=0;j<m;j++){
            if(t.size()<s[j].first){
                f=false;
                break;
            }else{
                if(t[s[j].first-1]!=s[j].second){
                    f=false;
                    break;
                }
            }
        }
        if(f&&t.size()==n){
            cout << t << endl;
            return 0;
        }
    }
    cout <<-1 << endl;

    return 0;
}

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

template<typename T>
T extgcd(T a,T b,T &x,T &y){
    T d = a;
    if(b!=0){
        d = extgcd(b,a%b,y,x);
        y -= (a/b)%x;
    }else{
        x = 1;y = 0;
    }
    return d;
}
ll gcd(ll a, ll b){
    if(b == 0)return a;
    return gcd(b,a%b);
}
int main(){
    int n; cin>>n;
    ll g;cin>>g;
    vector<ll> res;
    for(int i = 1; i < n ;i++){
        ll t;cin >> t;
        g = gcd(g,t);
        
    }
    for(int i = 1; i*i <= g ; i++){
        if(g%i==0){
            res.push_back(i);
            int tmp = g/i;
            if(i != tmp)res.push_back(tmp);
        }
    }
    sort(res.begin(),res.end());
    for(int i = 0; i < res.size() ; i++){
        cout << res[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 1e3 + 5;
const ll MOD = 1e9 + 7;
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pis pair<ll,string>
#define F first
#define S second
#define LCM(a,b) ((a*b)/__gcd(a,b))
#define inf 1e15
#define test ll cse;cin>>cse;for(ll _i=1;_i<=cse;_i++)
#define PI 3.14159265
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const double EPS = 1E-9;
typedef vector< vector<double> > matrix;
typedef vector< vector<int> > array_2D;
typedef pair<int, pair<int, int> > ppi;
typedef vector<int> vi;

vector< int > snuke[N];
int main() {

    int n, k;
    cin >> n >> k;

    int snukes, snukes_index;
    for(int i = 1; i <= k; i++) {
        cin >> snukes;
        for(int j = 0; j < snukes; j++) {
            cin >> snukes_index;
            snuke[ snukes_index ].push_back(i);
        }
    }


    int cnt = 0;

    for(int i = 1; i <= n; i++)
        if(snuke[i].size() == 0) cnt++;

    cout << cnt << "\n";

    return 0;
}

Measured memory_bytes: 3628
a,b,x = map(int,input().split())

#for i in range(a,b+1):
#	if i % x == 0:
#		ans = ans + 1

ans1 = a//x
ans2 = b//x

#print(ans1)
#print(ans2)

if a%x == 0:
	print(ans2-ans1+1)
else:
	print(ans2-ans1)


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


namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int x = N / 100;
            int y = N % 100;
            int a = y / 5;
            int b = N % 5;
            if (b > 0) b = 1;
            int ans = 0;
            if (x + 1> a + b) ans = 1;
            Console.WriteLine(ans);
            
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>   //PBDS
#include <ext/pb_ds/tree_policy.hpp>       //PBDS
#define int long long int
#define vi vector<int>
#define vii vector<pair<int,int>>
#define pi pair<int,int>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
#define F first
#define S second
#define mi map<int,int>
#define PI   3.141592653589
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define f(n) for(int i=0;i<n;i++)
#define rf(n) for(int i=n-1;i>=0;i--)
#define check(x)   cerr<<#x<<" : "<<x<<endl;
#define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
#define fbo find_by_order                    //return iterator PBDS
#define ook order_of_key                     //return number :)) PBDS
#define baar exit(0)
using namespace __gnu_pbds;
using namespace std;
signed main()
{   
   int n;
   cin>>n;
   int ans=0;
   int val=n/500;
   ans+=(val*1000);
   n-=(val*500);
   val=n/5;
   ans+=(val*5);
   cout<<ans;
	return 0;
}

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

int main()
{
    int arr[3] ;
    for(int i = 0 ; i < 3 ; i++) cin >> arr[i] ;
    sort(arr , arr + 3) ;
    cout << arr[0] ;
    for(int i = 1 ; i < 3 ; i++) cout << " " << arr[i] ;
    cout << endl ;
}


Measured memory_bytes: 3172
#include <stdio.h>

int main(void)
{
        int a=0,b=0;
        scanf("%d %d",&a,&b);

        if(a < b){
                printf("a < b\n");
        }else if(a > b){
                printf("a > b\n");
        }else if(a == b){
                printf("a == b\n");
        }

        return 0;
}

Measured memory_bytes: 580
n  = int(input())
li = list(map(int,input().split()))

for i in range(n):
    if li[i] % 2 == 1:
        continue
    if li[i] % 3 == 0 or li[i] % 5 == 0:
        continue
    else:
        print("DENIED")
        exit()
else:
    print("APPROVED")

Measured memory_bytes: 3060
K,A,B=map(int,input().split())

if A+1<B:
    if K<A+1:
        print(1+K)
    else:
        M=A
        M=M+((K-(A-1))//2)*(B-A)
        if (K-(A-1))%2==1:
            M+=1
        print(M)
else:
    print(1+K)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <limits>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>
#include <array>
#include <algorithm>

using namespace std;
using namespace boost;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    array<uint, 200000> counts;
    counts.fill(0U);
    uint N, K;
    cin >> N >> K;
    for (auto &&i: irange(0U, N)) {
        uint a;
        cin >> a;
        counts.at(a)++;
    }


    sort(counts.rbegin(), counts.rend());


    uint remaining{0U};
    for (auto &&i: irange(0U, K)){
        remaining += counts.at(i);
    }

    cout << N - remaining << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;

int dp[3][110][2], num[110];
int n,k;

int main(){
	rep(i,110) num[i] = -1;
	cin >> n >> k;
	rep(i,k){
		int a,b;
		cin >> a >> b;
		a--; b--;
		num[a] = b;
	}
	if(num[0] == -1) rep(i,3) dp[i][0][0] = 1;
	else dp[num[0]][0][0] = 1;
	for(int i = 1; i < n; i++){
		rep(j,3){
			if(num[i] != -1 && num[i] != j) continue;
			dp[j][i][1] += dp[j][i-1][0];
			dp[j][i][1] %= 10000;
			rep(u,3){
				if(j == u) continue;
				dp[j][i][0] += dp[u][i-1][0]+dp[u][i-1][1];
				dp[j][i][0] %= 10000;
			}
		}
	}
		/*
	rep(i,n){
		rep(j,3){
			rep(u,2){
				cout << dp[j][i][u] << " ";
			}
			cout << endl;
		}
		cout << endl;
	}
	*/
	int ans = 0;
	rep(i,3) rep(j,2) ans += dp[i][n-1][j];
	cout << ans%10000 << endl;
}

Measured memory_bytes: 1164
#include<stdio.h>

int dp[50];

int fib(int n)
{
	if(n == 0 || n == 1) return dp[n] = 1;
	if( dp[n] != -1) return dp[n];
	return dp[n] = fib(n-1)+fib(n-2);
}

int main()
{
	int n , i;
	for( i = 0; i < 50; i++)
	{
		dp[i] = -1;
	}
	scanf("%d",&n);
	printf("%d\n",fib(n));
	return 0;
}


Measured memory_bytes: 2144
/**
 *    author:  Daredevil666
 *    institution: IIT Patna
**/
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define nl cout<<"\n";
#define ll long long int
#define IOS  ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
ll mod=1e9+7;
int main()
{
IOS
ll n,m;
cin>>n>>m;
cout<<n*m;
return 0;
}


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

int main(){
  int N;
  cin >> N;
  int res;
  if(N % 2 == 0){
    res = N;
  } else if(N % 2 == 1){
    res = 2 * N;
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include <cstdio>
int n;
char s[100001],r[100001];
bool c(char a,char b) {
    r[0]=a;r[1]=b;
    for (int i=2;i<n;++i)
        r[i]=r[i-1]=='S'?s[i-1]=='o'?r[i-2]:r[i-2]=='S'?'W':'S':s[i-1]=='x'?r[i-2]:r[i-2]=='S'?'W':'S';
    return !(r[n-1]=='S'&&((s[n-1]=='o'&&r[n-2]!=r[0])||(s[n-1]=='x'&&r[n-2]==r[0])))&&
           !(r[0]=='S'&&((s[0]=='o'&&r[1]!=r[n-1])||(s[0]=='x'&&r[1]==r[n-1])))&&
           !(r[n-1]=='W'&&((s[n-1]=='x'&&r[n-2]!=r[0])||(s[n-1]=='o'&&r[n-2]==r[0])))&&
           !(r[0]=='W'&&((s[0]=='x'&&r[1]!=r[n-1])||(s[0]=='o'&&r[1]==r[n-1])));
}
int main()
{
    scanf("%d%s",&n,s);
    puts(c('S','W')||c('W','S')||c('W','W')||c('S','S')?r:"-1");
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n; cin >> n;
    string s; cin >> s;
    const ll mod = (ll) 1e9 + 7, p = 31 ;
    vector<ll> powers(n + 10), h(n + 10, 0);
    powers[0] = 1;
    for (int i = 1; i <= n; i++) {
        powers[i] = powers[i - 1] * p % mod;
    }
    for (int i = 0; i < n; i++) {
        h[i + 1] = (h[i] + (s[i] - 'a' + 1) * powers[i]) % mod;
    }
    auto getHash = [&](int l, int r) {
        ll ret = (h[r] + mod - h[l]) % mod;
        ret = (ret * powers[n - l - 1]) % mod;
        return ret;
    };
    int low = 1, high = n, best = 0;
    while (low <= high) {
        int l = low + (high - low) / 2;
        bool ok = false;
        for (int i = 0; i + l <= n; i++) {
            for (int j = i + l; j + l <= n; j++) {
                if (getHash(i, i + l) == getHash(j, j + l)) {
                    ok = true;
                }
            }
        }
        if (ok) {
            best = l;
            low = l + 1;
        } else {
            high = l - 1;
        }
    }
    cout << best << "\n";
}


Measured memory_bytes: 384
import sys
import itertools
while True:
    data = sys.stdin.readline().strip().split(' ')
    n = int(data[0])
    x = int(data[1])
        
    if n == 0 and x == 0:
        break
    
    add = 0
    for i in itertools.combinations(range(1,n + 1),3):
        if sum(i) == x:
            add += 1
    print(add)


Measured memory_bytes: 5636
#include<bits/stdc++.h>
#include<tr1/unordered_map>
#define pb push_back
#define pii pair<int,int>
#define SZ(x) (int)x.size()
#ifdef __linux__
#define getchar getchar_unlocked
#endif
#define mem(a,b) memset(a,b,sizeof(a))
#define  For(i,a,b) for(int i=a,i##E=b;i<=i##E;++i)
#define rFor(i,a,b) for(int i=a,i##E=b;i>=i##E;--i)
typedef long long LL;
using namespace std;
const int N=20010;
const int inf=0x3f3f3f3f;
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
template<typename T>inline void read(T &x)
{
	x=0;int _f(0);char ch=getchar();
	while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
	while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x=_f?-x:x;
}
inline void file()
{
#ifdef ztzshiwo
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
}
char S[N];
int n,lena,lenb,a[N],b[N],x,y;
int A[N],B[N],*f=A+10000,*g=B+10000;
inline bool cmp(int a,int b){return a>b;}
inline bool can(int x,int len,int *a)
{
	sort(a+1,a+len+1,cmp);
	int ret=0;
	For(i,1,len)
		if(ret>x)
			ret-=a[i];
		else
			ret+=a[i];
	return ret==x;
}
int main()
{
	file();
	scanf("%s",S);
	n=strlen(S);
	read(x),read(y);
	int cnt=0,flag=0;
	For(i,0,n)
	{
		if(S[i]!='F')
		{
			if(flag)b[++lenb]=cnt;
			else a[++lena]=cnt;
			flag^=1;
			cnt=0;
		}
		else cnt++;
	}
	if(S[0]!='T')
	{
		x-=a[1];
		swap(a[1],a[lena]);
		lena--;
	}
	if(can(x,lena,a)&&can(y,lenb,b))puts("Yes");else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
ll C[20];
ll x[100500];
ll dp[100500][300];

void chmin(ll &a, ll b) {
    a = min(a, b);
}
void chmax(ll &a, ll b) {
    a = max(a, b);
}
int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(true) {
        ll N, M;
        cin >> N >> M;
        if(N == 0) break;
        for(int i = 1; i <= M; i++) cin >> C[i];
        for(int i = 1; i <= N; i++) cin >> x[i];
        for(int i = 0; i <= N; i++) {
            for(int val = 0; val <= 255; val++) dp[i][val] = 1e18;
        }
        //for(int val = 0; val <= 255; val++) dp[0][val] = 0;
        dp[0][128] = 0;
        for(int i = 0; i < N; i++) {
            for(int before = 0; before <= 255; before++) {
                for(int j = 1; j <= M; j++) {
                    ll newval = before + C[j];
                    chmax(newval, 0);
                    chmin(newval, 255);
                    chmin(dp[i+1][newval], dp[i][before] + (x[i+1] - newval) * (x[i+1]-newval));
                }
            }
        }
        ll ans = 1e18;
        for(int i = 0; i <= 255; i++) chmin(ans, dp[N][i]);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 50160
// Problem : F - Intervals on Tree
// Contest : AtCoder - AtCoder Beginner Contest 173
// URL : https://atcoder.jp/contests/abc173/tasks/abc173_f
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;	

#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 mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;
int n;
vi graph[maxN];

// Elements from 1 to n inclusive
struct FindUnion {
	int n, unions = 0;
	vector<int> parent, rank;
	
	FindUnion(int _n) : n(_n) {
		parent.resize(n + 1);
		rank.resize(n + 1);
		iota(parent.begin(), parent.end(), 0);
	}
	
	int find(int x) {
		if (parent[x] != x) parent[x] = find(parent[x]);
		return parent[x];
	}
	
	void union_(int x, int y) {
		int fx = find(x);
		int fy = find(y);
		
		if (fx == fy) return;
		unions++;
		if (rank[fx] > rank[fy]) swap(fx, fy);
		
		parent[fx] = fy;
		if (rank[fx] == rank[fy]) rank[fy]++;
	}
	
	bool is_same(int x, int y) {
		return find(x) == find(y);
	}
};
int ile[maxN], deg[maxN];

// sprawdz MODULO!
int main() {
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> n;
	REP(_, n - 1) {
		int a, b;
		cin >> a >> b;
		graph[a].pb(b);
		graph[b].pb(a);
		deg[a]++;
		deg[b]++;
	}
	ll ans = 0;
	FindUnion fu(n);
	RI(i, n) {
		sort(graph[i].begin(), graph[i].end());
		for (auto x: graph[i]) {
			if (x < i) {
				fu.union_(x, i);
			}
		}
		ile[i] = i - fu.unions;
		// cout << ile[i] << " ";
		ans += i - fu.unions;
	}
	// cout << ans << endl;
	ll sum = ans;
	FOR(i, 1, n - 1) {
		sum--;
		if (deg[i] == 0) {
			sum -= (n - i);
		} else {
			if (deg[i] == 1) {
				int v = graph[i].back();
				sum -= (v - i - 1);
				deg[v]--;
			}
			if (deg[i] != 1) {
				bool fst = true;
				REP(j, sz(graph[i])) {
					deg[graph[i][j]]--;
					if (graph[i][j] > i) {
						if (fst) {
							sum -= (graph[i][j] - i) - 1;
							fst = false;
							continue;	
						}
						// cout << i << " " << graph[i][j] << endl;
						sum += (n - graph[i][j] + 1);
					}
				}
			}
		}
		// cout << sum << endl;
		ans += sum;
	}
	cout << ans;
	return 0;
}
 


Measured memory_bytes: 37004
N = int(input())
B = list(map(int,input().split()))
l = len(B)
A = []
ans = -1
for i in range(N):
  max_j = -1
  for j in range(N-i):
    if B[j] == j+1:
      max_j = j
  if (max_j == -1):
    break
  else:
    A.append(B.pop(max_j))
if (l == len(A)):
  for i in reversed(A):
    print(i)
else:
  print(ans)

Measured memory_bytes: 38512
#include <stdio.h>

int main(void) {
	long a, b, k;
	scanf("%ld%ld%ld", &a, &b, &k);
	if(k <= a)
		a -= k;
	else if(k - a <= b) {
		b -= k - a;
		a = 0;
	} else {
		a = 0;
		b = 0;
	}
	printf("%ld %ld\n", a, b);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try (Scanner in = new Scanner(System.in)) {
			int[] antena = new int[5];
			for (int i = 0; i < 5; i++) {
				antena[i] = Integer.parseInt(in.next());
			}
			int k = Integer.parseInt(in.next());
			
			for (int i = 0; i < 5; i++) {
				int antena_i = antena[i];
				for (int comp = i; comp < 5; comp++) {
					int dist = antena[comp] - antena_i;
					if (k < dist) {
						System.out.println(":(");
						return;
					}
				}
			}
			System.out.println("Yay!");
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}


Measured memory_bytes: 22996
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int A, B, K, ans[810], j = 0,temp;
	cin >> A >> B >> K;
	for (int i = 1; i<= min(A, B); i++) {
		if (A%i == 0 && B%i == 0) {
			ans[j] = i;
			j++;
		}
	}
	sort(ans, ans + j);


	cout << ans[j-K] << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
N=int(input())
A=list(map(int,input().split()))
A.sort()
ans=[]

if A[0]>0:
    num=A[0]
    for i in range(1,N-1):
        ans.append([num,A[i]])
        num-=A[i]
    ans.append([A[-1],num])
    print(A[-1]-num)
    for i in range(len(ans)):
        print(ans[i][0],ans[i][1])
elif A[-1]<0:
    A.sort(reverse=True)
    num=A[0]
    for i in range(1,N):
        ans.append([num,A[i]])
        num-=A[i]
    print(num)
    for i in range(len(ans)):
        print(ans[i][0],ans[i][1])
else:
    M=A[-1]
    m=A[0]
    for i in range(1,N-1):
        if A[i]<0:
            ans.append([M,A[i]])
            M-=A[i]
        else:
            ans.append([m,A[i]])
            m-=A[i]
    ans.append([M,m])
    print(M-m)
    for i in range(len(ans)):
        print(ans[i][0],ans[i][1])

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

int main() {
  string S; cin >> S;
  long long res = 0;
  long long memo = -1;
  long long N = S.size();
  
  if(N == 1){
    cout << 1 << endl;
    return 0;
  }
  
  for(int i = 0; i < N; ++i){
    if(i == 0){
      if(S.at(i) == '>'){
        long long j = i;
        long long cnt = 0;
        while(S.at(j) == '>' && j < N){
          cnt++;
          j++;
          if(j >= N) break;
        }
        res += cnt*(cnt+1)/2;
        if(cnt == 1 && S.at(1) == '<') memo = 1;
//        cout << res << "A" << endl;
        continue;
      }else if(S.at(0) == '<' && S.at(1) == '<'){
        memo = 0;
        continue;
      }
    }
    if(i == N-1){
      if(S.at(i) == '<'){
        long long x = N - memo;
        res += x*(x+1)/2;
//        cout << res << "B" << endl;
        break;
      }else{
        break;
      }
    }
    if(S.at(i) == '<' && S.at(i+1) == '>'){
      long long j = i+1;
      long long cnt = 0;
      while(S.at(j) == '>' && j < N){
        cnt++;
        j++;
        if(j >= N) break;
      }
      if(memo == -1) memo = 0;
      long long x = i - memo + 1;
      res += max(x*(x+1)/2, cnt*(cnt+1)/2);
      res += min(x*(x-1)/2, cnt*(cnt-1)/2);
//      cout << res << "C" << endl;
      continue;
    }else if(S.at(i) == '>' && S.at(i+1) == '<'){
      memo = i+1;
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 900
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long int n;
	cin >> n;
	map<string,int> m;
	while(n--){
		char a[11];
		string s1;
		cin >> a;
		sort(a,a+10);
		for(int i=0;i<10;i++){
			s1+=a[i];
		}
		m[s1]++;
	}long long int ans=0;
	map<string,int> ::iterator it;
	for(it=m.begin();it!=m.end();it++){
		for(int i=1;i<=it -> second-1;i++){
			ans+=i;
		} 
	}
	cout << ans << endl;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std ;
#define Next( i, x ) for( register int i = head[x]; i; i = e[i].next )
#define rep( i, s, t ) for( register int i = (s); i <= (t); ++ i )
#define drep( i, s, t ) for( register int i = (t); i >= (s); -- i )
#define re register
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 400 + 5 ; 
const int M = 1e5 + 5 ; 
int n, m, R, cnt, head[N], S[N][N], flag[N], vis[N] ; 
struct E {
	int to, next, w ; 
} e[M << 1] ;
void add( int x, int y, int z ) {
	e[++ cnt] = (E){ y, head[x], z }, head[x] = cnt,
	e[++ cnt] = (E){ x, head[y], z }, head[y] = cnt ; 
}
void dfs( int x, int t ) {
	if( vis[x] ) { flag[R] = 1 ; return ; }
	vis[x] = 1 ; 
	Next( i, x ) if( e[i].w < t ) dfs( e[i].to, e[i].w ) ;
}
signed main()
{
	n = gi(), m = gi() ; int x, y ; 
	rep( i, 1, m ) x = gi(), y = gi(), add( x, y, i ) ;
	rep( i, 1, n ) {
		R = i, memset( vis, 0, sizeof(vis) ) ; 
		dfs( i, m + 1 ) ; 
		rep( j, 1, n ) S[i][j] = vis[j] ; 
	}
	int Ans = 0 ;
	rep( i, 1, n ) rep( j, 1, n ) {
		if( flag[i] || flag[j] ) continue ; 
		++ Ans ; 
		rep( k, 1, n ) if( S[i][k] && S[j][k] ) { -- Ans ; break ; } 
	}
	printf("%lld\n", Ans / 2 ) ;
	return 0 ;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define int long long
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;

signed main(){
	ios_base::sync_with_stdio(0);
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	if((a[0]==a[1]&&a[0]!=a[2])||(a[2]==a[1]&&a[2]!=a[0])) cout<<"Yes";
	else cout<<"No";
	re 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>


int main(){
    int n, max = -10000010, min = 10000010, v;
    long long int sum = 0;

    
    std::cin >> n;      //はじめの一整数を読み込む

    for (int i = 0; i < n; i++){        //整数たちを読み込む
        std::cin >> v;
        if(v > max){max = v;}
        if(v < min){min = v;}
        sum = sum + v;
    }

    std::cout << min <<" " << max<<" " << sum << std::endl;

    return 0;
}


Measured memory_bytes: 3116
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)

def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())

def pne(n):
    print(n,end='')

rem = pow(10,9)+7

n = ip()                                     #入力整数1つ
k = ip()
#a,b,c= (int(i) for i in input().split())       #入力整数横2つ以上
a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[input() for i in range(n)]    #入力セット(文字列改行あり)(2/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
#''' なんだかんだ必要じゃねと思って残す複数入力
s = 0
for i in range(n):
    s+= 2*min(abs(k-a[i]),a[i])
print(s)


Measured memory_bytes: 13684
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
#define Test(tt) cout << "Case #" << tt << ": "

using namespace std;

void euclid(ll a, ll b, ll c, ll& x, ll& y) {
    if(b == 0) {
        y = 0;
        x = c / a;
        return ;
    }
    euclid(b, a % b, c, x, y);
    ll x0 = x, y0 = y;
    x = y0;
    y = x0 - (a / b) * y0;
}


int main() {
#ifdef HOME
    ifstream cin("B.in");
    ofstream cout("B.out");
#endif
    //int ;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    ll n;
    cin >> n;
    n *= 2;

    ll k = n - 1;
    for(ll a = 1; a * a <= n; a++) {
        if(n % a == 0) {
            ll b = n / a;
            if(__gcd(a, b) == 1) {
                /*ll x, y;
                euclid(a, b, 1, x, y);
                
                ll cur = min(llabs(a * x), llabs(b * y));
                if(cur > 0)
                    k = min(k, cur);
                */
                
                for(ll val = b; val - 1 < k; val += b) {
                    ll r = val % a;
                    if(r == 1) {
                        k = min(k, val - 1);
                        break;
                    }
                    if(r == a - 1) {
                        k = min(k, val);
                        break;
                    }
                }
            }
        }
    }
    cout << k;


    return 0;
}

Measured memory_bytes: 3652
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;


template<typename T>
T absi(T x) {
    if (x < static_cast<T>(0)) {
        x *= static_cast<T>(-1);
    }
    return x;
}


int main()
{
    int64_t N, A, B, C, D;
    std::cin >> N >> A >> B >> C >> D;

    auto NN = N-1;
    auto G = absi(B - A);

    for (int64_t i = 0; i < NN; ++i) {
        if (((NN-i) * C) - i * D <= G &&
            G <= (NN-i) * D - i * C) {
            std::cout << "YES" << std::endl;
            return 0;
        }
    }

    std::cout << "NO" << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
#define MD 1000000007
#define INF 1ll<<60
const double PI=3.141592653589;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main(){
    int n;
    cin>>n;
    vector<int> v(n+3);
    for(int i=0;i<n-1;i++){
        int tmp;
        cin>>tmp;
        v[tmp]++;
    }
    for(int i=1;i<=n;i++) cout<<v[i]<<endl;
    return 0;
}


Measured memory_bytes: 3984
#include <stdio.h>
#include <stdlib.h>

int main(void){
	int n, *t, m, max = 0, p, x, sum = 0;
	scanf("%d", &n);
	t = malloc(sizeof(int) * n);
	for(int i = 0; i < n; i++){
		scanf("%d", t + i);
		sum += t[i];
	}
	scanf("%d", &m);
	for(int i = 0; i < m; i++){
		scanf("%d %d", &p, &x);
		printf("%d\n", sum - t[p - 1] + x);
	}
	return 0;
}


Measured memory_bytes: 128
N = int(input())
L = list(sorted(list(map(int, input().split()))))
count = 0
         
for i in range(2, N):
    for j in range(1, i):
        if L[i] != L[j]:
            for k in range(0, j):
                if L[j] != L[k] and (L[j] + L[k] > L[i]):
                    count += 1

print(count)

Measured memory_bytes: 9196
n = int(input())
a = list(map(int,input().split()))

ans = [1 for i in range(n+1)]; ans[0] = 0
for i in range(n,0,-1):
    s = 0
    for j in range(i,n+1,i): s += ans[j]
    if (s - a[i-1])%2 == 0: pass
    else: ans[i] = 0

print(sum(ans))
anss = []
for i in range(n+1):
    if ans[i] == 1: anss.append(i)
print(*anss)




Measured memory_bytes: 14132
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1

h,w=map(int,input().split())
data=[""]*(2*h)
for i in range(0,2*h,2):
    data[i]=input()
for i in range(0,2*h,2):
    data[i+1]=data[i]
print(*data,sep="\n")

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main()
{
    int n,a=0,b=0,ab=0,ans=0,tmp=0;
    cin>>n;
    vector<string> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
        int len=v[i].length();
        if(v[i][0]=='B' && v[i][len-1]=='A') ab++;
        else if(v[i][0]=='B') b++;
        else if(v[i][len-1]=='A') a++;
        for(int j=0;j<len-1;j++){
            if(v[i].substr(j,2)=="AB") ans++;
        }
    }
    if(ab==0) tmp=min(a,b);
    else if(a+b>0) tmp=ab+min(a,b);
    else if(a+b==0) tmp=ab-1;
    ans+=tmp;
    cout<<ans<<endl;
    /*
    tmp=min(a,b)+min(abs(a-b),ab)+max(0,ab-1-(max(0,abs(a-b)-1)));
    int mm=min(a,min(b,ab));
    if(mm==a) tmp=max(tmp,a+min(b-a,ab-a)+max(0,ab-a-(b-a)-1));
    else if(mm==b) tmp=max(tmp,b+min(a-b,ab-b)+max(0,ab-b-(a-b)-1));
    else if(mm==ab) tmp=max(tmp,ab+min(a-ab,b-ab));
    */
    return 0;
}

Measured memory_bytes: 768