akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int main(){
  ll n, m;
  cin >> n >> m;
  vector<bool> vec(n+1, false);
  vll graph(n + 1, vl());
  vl ans(n + 1);
  rep(i, m){
    ll a,b;
    cin >> a >> b;
    graph[a].pb(b);
    graph[b].pb(a);
  }
     //1 から始める幅優先探索(zは頂点の番号)
    queue<int> Q;                 //空のキューQ を用意
    vec[1] = true;                //z に訪問済みの印を付ける
    Q.push(1);                    //z をキューQ に追加

    while(!Q.empty()){            //キューQ が空でなければ
        int v = Q.front();        //キューQ の一番上にある要素を取り出す
        Q.pop();                  //キューQ の一番上にある要素を削除

        /*   v を処理する   */

        for(int i : graph[v]){    //v に接続している各頂点i に対し
            if(vec[i]==false){    //i が未訪問なら
                vec[i] = true;    //i に訪問済みの印を付ける
                ans[i] = v;
                Q.push(i); //i をキューQ に追加
            }
        }
    }
  print("Yes");
  for (ll i = 2; i <= n;i++){
    print(ans[i]);
  }
}

Measured memory_bytes: 12640
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int n;
	cin >> n;
	int ans = 800 * n;
	ans -= 200 * int(n / 15);
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3636
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 'APPROVED'
    
    for a in A:
        if a % 2 == 0:
            if a % 3 != 0 and a % 5 != 0:
                ans = 'DENIED'

    return ans

print(solve())


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

const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.1415926;
using namespace std;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++)
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
#define lld long double
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> vp;
typedef vector<tuple<ll, ll, ll>> vt;
//vector<vector<ll>> vv(n, vector<ll>(n));

using namespace std;

int main() {
    ll n, d, ans = 0;
    cin >> n >> d;
    ll v[20][20];
    REP(i, n) {
        REP(j, d) {
            cin >> v[i][j];
        }
    }
    REP(i, n) {
        FOR(j, i + 1, n) {
            ll tmp = 0;
            REP(k, d) {
                tmp += (v[i][k] - v[j][k]) * (v[i][k] - v[j][k]);
            }
            ll tmp2 = sqrt(tmp);
            tmp2 *= tmp2;
            if (tmp == tmp2) ans++;
        }
    }
    cout << ans << endl;
}


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



int main(){
    std::ios::sync_with_stdio(false); // toggler av synkronisjon mellom c og c++ data streams. kan ikke blade de etter skrudd av
    std::cin.tie(NULL);//gj;r at man ikke venter på cout og de can printe samtidig tror jeg

    int stripSize;
    std::cin >> stripSize;
    int newEach = stripSize - 1;

    int goal;
    std::cin >> goal;
    goal = goal -1; //you already have one socket

    if (goal < 1){
        std::cout << 0;
    }else{
        std::cout << (goal-1)/newEach +1;
    }
}



Measured memory_bytes: 3660
from collections import deque
n, m = map(int, input().split())

friends = [[]*n for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    friends[a].append(b)
    friends[b].append(a)

id_list = [-1]*n


def dfs(friends, start):
    d = deque()
    group_count = 0
    if id_list[start] == -1:
        id_list[start] = start
        d.append(start)
        group_count += 1
    while d:
        p = d.pop()
        for child in friends[p]:
            if id_list[child] != -1:
                continue
            group_count += 1
            id_list[child] = start
            d.append(child)
    return group_count

max_friend = 0
for i in range(n):
    max_friend = max(max_friend, dfs(friends, i))
print(max_friend)


Measured memory_bytes: 111704
n = int(input())
A =  [int(x) for x in input().split()]
B =  [int(x) for x in input().split()]
C =  [int(x) for x in input().split()]

total = 0
mae = -1

for i in range(n):
    total += B[i]
    if mae == A[i]-1:
        total += C[mae-1]
    
    mae = A[i]
    
print(total)

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

int main(void) {
    int d,N;
    cin >> N;
    unordered_set<int> ds;
    for(int i=0;i<N;i++) {
        cin >> d;
        ds.insert(d);
    }

    cout << ds.size() << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rt "\n"
#define sp " "
#define test1 cout << "test1" << endl;
#define test2 cout << "test2" << endl;
#define fixprecision(n) fixed; cout << setprecision(n)
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL);
#define MOD 1000000007
#define rep(i, s, N) for(ll i{s}; i < N; i++)
using namespace std;
using ll = long long;
using iikae = ll&;
using ld = long double;
using P = pair<ll,ll>;

int main(){
  kyopro;
  ll r, D, x;
  cin >> r >> D >> x;
  rep(i, 0, 10){
    x = r*x - D;
    cout << x << rt;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n;
	scanf("%d", &n);
	while (n > 0){
		n = n - 1000;
	}
	if (n < 0){
		printf ("%d\n", n * -1);
	}
	else if (n == 0){
		printf ("0\n");
	}

	return 0;
}

Measured memory_bytes: 1688
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		int A = scn.nextInt(), B = scn.nextInt(), C = scn.nextInt(), D = scn.nextInt();
		scn.nextLine();
		char[] ch = scn.nextLine().toCharArray();
		boolean can = true;
		if(A < B) {
			if(C < D) {
				can &= check(ch,B,D);
				can &= check(ch,A,C);
			}else {
				can &= check(ch,B,D);
				can &= check(ch,A,C);
				can &= check_space(ch,B,D);
			}
		}

		System.out.println(can?"Yes":"No");
	}

	public static boolean check(char[] ch, int S, int G) {
		boolean can = true;
		boolean before = false;
		for(int i = S;i < G;i++) {
			if(ch[i] == '#') {
				if(before) {
					can = false;
					break;
				}
				before = true;
			}else {
				before = false;
			}
		}

		return can;
	}

	public static boolean check_space(char[] ch, int S, int G) {
		boolean can = false;
		int count_space = 0;
		for(int i = S-2;i < G+1;i++) {
			if(ch[i] == '.') {
				count_space++;
				if(count_space==3) {
					can = true;
					break;
				}
			}else {
				count_space = 0;
			}
		}

		return can;
	}

}


Measured memory_bytes: 26660
import sys
input=lambda: sys.stdin.readline().rstrip()
a,b,m=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
ans=min(A)+min(B)
for i in range(m):
  x,y,c=map(int,input().split())
  ans=min(ans,A[x-1]+B[y-1]-c)
print(ans)


Measured memory_bytes: 18488
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <cmath>
#include <cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
#define ALL(x) x.begin(), x.end()
#define INF (1001000000)
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i:c)
#define EXIST(cs,v) (find(ALL(cs),(v))!=cs.end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define UNIQ(c) (c).erase(unique((c).begin(),(c).end()), (c).end());
#define P(p) cout<<(p)<<endl;

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

    string s, t;
    cin >> s >> t;

    int s_count[26];
    int t_count[26];
    fill(s_count, s_count + 26, 0);
    fill(t_count, t_count + 26, 0);
    REP(i, s.length()) {
        s_count[s[i] - 'a']++;
        t_count[t[i] - 'a']++;
    }
    sort(s_count, s_count + 26);
    sort(t_count, t_count + 26);

    REP(i, 26) {
        if (s_count[i] != t_count[i]) {
            P("No");
            return 0;
        }
    }
    P("Yes");

    return 0;
}


Measured memory_bytes: 916
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define endl "\n"

const int INF = 2e9;

int n, m;
vector <vector <int> > adj(100005);
vector <int> previous(100005);
vector <int> dist(100005, INF);

void bfs(int source){
	dist[source] = 0;
	previous[source] = -1;
	queue <int> q;
	q.push(source);

	while (!q.empty()){
		int hello = q.front();
		q.pop();

		for (auto neighbour:adj[hello]){
			if (dist[hello] + 1 < dist[neighbour]){
				dist[neighbour] = dist[hello] + 1;
				previous[neighbour] = hello;
				q.push(neighbour);
			}
		}
	}
}

int main ()
{
	
	ios_base::sync_with_stdio(false);
 	cin.tie(NULL);
 	   
	cin >> n >> m;

    while (m--){
    	int a, b;
    	cin >> a >> b;
    	adj[a].emplace_back(b);
    	adj[b].emplace_back(a);
    }

    bfs(1);
    bool flag = true;
    for (int i=2; i<=n; i++){
    	if (dist[i] == INF){
    		flag = false;
    		break;
    	}
    }

    if (!flag) cout << "No" << endl;
    else{
    	cout << "Yes" << endl;
    	for (int i=2; i<=n; i++){
    		cout << previous[i] << endl;
    	}
    }

	return 0;
	
}


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

int main(){
    ll n;
    cin >> n;
    queue<ll> q;
    for (int i = 1; i <=9; ++i) {
        q.push(i);
    }
    rep(i, n-1) {
        ll p = q.front();
        q.pop();
        if(p%10!=0) q.push(p*10+p%10-1);
        q.push(p*10+p%10);
        if(p%10!=9) q.push(p*10+p%10+1);
    }
    cout << q.front() << endl;
    return 0;
}


Measured memory_bytes: 5176
#include <algorithm>
#include <cmath>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() { 
    ll A, B;
    cin >> A >> B;
    cout << (B-1 + A-1 - 1) / (A-1) << endl;
}


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

const long Day_num = 365;
const long type_num = 26;

class Scoring {
public:
    Scoring(const long arg_days, const std::vector<long>& arg_costs, const std::vector<std::vector<long>>& arg_incentives);
    std::vector<long> score(const std::vector<long>& arg_types);
private:
    long days;
    std::vector<long> costs;
    std::vector<std::vector<long>> incentives;
};

std::vector<long> Scoring::score(const std::vector<long>& arg_types) {
    std::vector<long> result(days);
    long satisfy = 0;
    std::vector<long> last_days(type_num, 0);


    for (long day = 1; day <= days; ++day) {
        const auto exe_type = arg_types[day-1];
        satisfy += incentives[day-1][exe_type-1];
        last_days[exe_type-1] = day;
        for (long type = 1; type <= type_num; ++type) {
            satisfy -= costs[type-1] * (day - last_days[type-1]);
        }
        result[day-1] = satisfy;
    }
    return result;
}

Scoring::Scoring(const long arg_days, const std::vector<long>& arg_costs, const std::vector<std::vector<long>>& arg_incentives) {
    days = arg_days;
    costs = arg_costs;
    incentives = arg_incentives;
}

int main() {
    clock_t start_clock = clock();
    std::mt19937 engine(20000123);
    std::uniform_int_distribution<> type_random(1, type_num);
    std::uniform_int_distribution<> day_random(1, Day_num);
    long D;
    std::cin >> D;
    std::vector<long> costs(type_num);
    for (long type = 1; type <= type_num; ++type) {
        std::cin >> costs[type-1];
    }
    std::vector<std::vector<long>> incentives(D, std::vector<long>(type_num));
    for (long day = 1; day <= D; ++day) {
        for (long type = 1; type <= type_num; ++type) {
            std::cin >> incentives[day-1][type-1];
        }
    }

    Scoring scoring(D, costs, incentives);

    std::vector<long> types(D);
    for (long day = 1; day <= D; ++day) {
        types[day-1] = type_random(engine);
    }

    while (static_cast<double>(clock() - start_clock)/CLOCKS_PER_SEC*1000.0 < 2000.0-20.0) {
        const auto old_types = types;
        types[day_random(engine)-1] = type_random(engine);
        if (scoring.score(old_types).back() > scoring.score(types).back()) {
            types = old_types;
        }
    }

    for (long day = 1; day <= D; ++day) {
        std::cout << types[day-1] << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3768
import itertools
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

N, M = map(int, readline().split())
AB = []
C = []
for _ in range(M):
    AB.append(tuple(int(x) for x in readline().split()))
    C.append(sum(1 << (int(x)-1) for x in readline().split()))

INF = 10**18
dp = [INF] * (1 << N)
dp[0] = 0

for n, ((a, b), c) in itertools.product(range(1 << N), zip(AB, C)):
    m = n | c
    x = dp[n]+a
    if dp[m] > x:
      dp[m] = x

answer = dp[-1]
if answer == INF:
    answer = -1
print(answer)


Measured memory_bytes: 3444
#include<bits/stdc++.h>
#define int long long
#define pb emplace_back
#define mp make_pair
#define tci(v,i) for(auto i=v.begin();i!=v.end();i++)
#define all(v) v.begin(),v.end()
#define rep(i,start,lim) for(long long (i)=(start);i<(lim);i++)
#define revrep(i,n) for(long long i=n-1;i>=0;i--)
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define osit ostream_iterator<int> output (cout," ")
#define pv(x) copy(all(x),output)
#define pa(a) rep(i,0,sizeof(a)/sizeof(a[0]))cout<<a[i]<<" "
#define endl '\n'
#define f first
#define s second
#define PI 3.141592653589793
#define test int t;cin>>t; while(t--)
#define set0(x) memset(x,0,sizeof(x))
#define set1(x) memset(x,1,sizeof(x))
#define getarr(arr,n) int arr[n];rep(i,0,n)cin>>a[i]
#define getvec(vec,n) vi vec;int x;rep(i,0,n){cin>>x;vec.pb(x);}
#define dg(x) cout<<#x<<':'<<x<<endl;
#define dg2(x,y) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<endl;
#define dg3(x,y,z) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<endl;
#define dg4(x,y,z,zz) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<' '<<#zz<<':'<<zz<<endl;
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
vi b_v;void bin(unsigned int n) { if (n > 1) bin(n>>1); b_v.pb(n & 1); }
int isPowerof2(int x) { return (x && !(x & x-1)); }

const int mod=1e9+7;

int32_t main(){
    boost;osit;
    int n,m;
    cin>>n>>m;
    char ch[n][m];
    rep(i,0,n){
        rep(j,0,m){
            cin>>ch[i][j];
        }
    }
    int dp[n][m];dp[0][0]=1;
    rep(i,1,n){
        if(ch[i][0]=='.'){
            dp[i][0]=dp[i-1][0];
        }else{
            dp[i][0]=0;
        }
    }
    rep(j,1,m){
        if(ch[0][j]=='.'){
            dp[0][j]=dp[0][j-1];
        }else{
            dp[0][j]=0;
        }
    }
    rep(i,1,n){
        rep(j,1,m){
            if(ch[i][j]=='.'){
                dp[i][j]=dp[i-1][j]+dp[i][j-1];
                dp[i][j]%=mod;
            }else{
                dp[i][j]=0;
            }
        }
    }
    cout<<dp[n-1][m-1];
    return 0;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}


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

  lol n, y;
  cin >> n >> y;
  y /= 1000;
  rep(i, n + 1){
    rep(j, n + 1){
      if(i + j <= n){
	lol nasu = n - (i + j);
	if(10 * i + 5 * j + nasu == y){
	  cout << i << " " << j << " " << nasu << '\n';
	  return 0;
	}
      }
    }
  }
  cout << "-1 -1 -1\n";
  return 0;
}


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

using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vvvd = vector<vector<vector<double>>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pint = pair<int, int>;
using Graph = vvi;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

bool cmp(pint a, pint b) {return a.second < b.second;}
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}

int main() {
    int n;
    cin >> n;
    vi l(n);
    rep(i, n) cin >> l[i];

    sort(all(l));

    int cnt = 0;
    for(int i = 0; i < n - 2; i++) {
        for(int j = i + 1; j < n - 1; j++) {
            int a, b;
            a = l[i];
            b = l[j];

            int left = j;
            int right = (int)l.size();
            while(abs(right - left) > 1) {
                int mid = (right + left) / 2;
                if(l[mid] < a + b) left = mid;
                else right = mid;
            }

            //cout << left << endl;

            cnt += (left - j);

        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
people, foods = [int(x) for x in input().split()]
favors = []
for person in range(people):
  favor = [int(x) for x in input().split()]
  favors.append(favor[1:])
  
test_result = 0
if len(favors) == 1:
  test_result = len(favors[0])
else:
  all_taste = [x for favor in favors for x in favor ]
  
  for food in set(all_taste):
    if all_taste.count(food) == people:
      test_result += 1

print(test_result)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
using namespace std;

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

int main() {
  for(;;) {
    int N; cin >> N; if( N == 0 ) break;

    vector< pair<double, string> > v;
    REP(n, N) {
      string L;
      int P, A, B, C, D, E, F, S, M;
      cin >> L>> P>> A>> B>> C>> D>> E>> F>> S>> M;

      double time = A + B + C + (D + E) * M;
      double get = F * S * M - P;

      v.push_back( make_pair(-1.0 * get / time, L) );
    }
    sort( v.begin(), v.end() );
    REP(i, v.size())
      cout << v[i].second << endl;
    cout << "#" << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>

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

using namespace std;

int count0(ll x)
{
  int s = 0;
  while(!((x >> s)&1))
  {
    ++s;
  }
  return s;
}
int main()
{
  int n;
  cin >> n;
  int ans = 300;
  rep(i, n)
  {
    ll x;
    cin >> x;
    ans = min(ans, count0(x));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
def main():
    N, P = map( int ,input().split())
    S = [ int(s) for s in list(input())][::-1]
    if P == 2 or P == 5:
        ans = 0
        for i in range(N):
            if S[i]%P == 0:
                ans += N-i
        print(ans)
        return
    L = [0]*P
    L[0] = 1
    t = 0
    for i in range(N):
        t = (S[i]*pow(10,i,P)+t)%P
        L[t] += 1
    ans = 0
    for l in L:
        ans += l*(l-1)//2
    print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 6436
def submit():
    n = int(input())
    s = list(input())

    if "W" not in s or "R" not in s:
        print(0)
        return
        
    l = 0
    r = n - 1
    swap = 0
    while True:
        while s[l] != "W":
            l += 1
        while s[r] != "R":
            r -= 1
    
        if r < l:
            break
        s[l] = "R"
        s[r] = "W"
        swap += 1

    print(swap)

submit()

Measured memory_bytes: 77320
#pragma region
#include <bits/stdc++.h>
using namespace std;
/*
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);i++)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;i--)
#define FOR(i,s,n) for(int i = s;i < (int)n;i++)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;}
template<class T>istream&operator >>(istream&is,vector<T>&vec){for(T&x:vec)is>>x;return is;}
template<class T>inline void in(T&t){cin>>t;}
template<class T,class... Ts>inline void in(T&t,Ts&...ts){cin>>t;in(ts...);}
template<class T>inline void out(T t){cout<<t<<endl;}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout<<t<<" ";out(ts...);}
template<typename T=int>vector<T>mv(size_t a){return vector<T>(a);}
template<typename T=int,typename... Ts>auto mv(size_t a,Ts... ts){return vector<decltype(mv<T>(ts...))>(a,mv<T>(ts...));}
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type fill(T&t,const V&v){t=v;}
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type fill(T&t,const V&v){for(auto &e:t)fill(e,v);}
constexpr long long INF = 1e18;
#pragma endregion

signed main(){
	int N;
	in(N);
	vector<vector<int>>g(N);
	map<pair<int,int>,int>mp;
	int count = 0;
	REP(i,N-1){
		int a,b;
		in(a,b);
		a--;b--;
		g[a].push_back(b);
		g[b].push_back(a);
		mp[minmax(a,b)]=count++;
	}
	int M;
	in(M);
	vector<int>a(M),b(M);
	REP(i,M){
		in(a[i],b[i]);
		--a[i];--b[i];
	}
	auto bits = mv(1ll << M);
	auto dfs = [&](auto&&f,int now,int par,int target,int bit)->bool{
		if(now == target)return true;
		int flg = 0;
		for(auto e:g[now]){
			if(e == par)continue;
			if(f(f,e,now,target,bit)){bits[1ll << bit] |= 1ll << mp[minmax(now,e)];flg = 1;}
		}
		return flg;
	};
	REP(i,M){
		dfs(dfs,a[i],-1,b[i],i);
	}
	REP(i,1ll<<M){
		REP(j,M){
			if(i & (1ll << j))continue;
			bits[i ^ (1ll << j)] |= bits[i];
		}
	}
	int ans = 0;
	REP(i,1ll<<M){
		int cnt = __builtin_popcountll(i);
		int edges = __builtin_popcountll(bits[i]);
		if(cnt % 2)ans -= 1ll << (N - 1ll - edges);
		else ans += 1ll << (N - 1ll - edges);
	}
	out(ans);
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  string A, B;
  cin >> A >> B;
  
  if (A.size() > B.size())
  {
    cout << "GREATER" << endl;
    return 0;
  }
  if (A.size() < B.size())
  {
    cout << "LESS" << endl;
    return 0;
  }
  if (A > B)
  {
    cout << "GREATER" << endl;
    return 0;
  }
  if (A < B)
  {
    cout << "LESS" << endl;
    return 0;
  }
  cout << "EQUAL" << endl;
}

Measured memory_bytes: 256
// @Author :- Gaurav Bharti
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define empb emplace_back
#define mp make_pair
#define F first
#define S second
#define endl "\n"
#define vii vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define mapii map<int,int> 
#define mapll map<ll,ll>
#define all(a) a.begin(),a.end()
#define test ll t; cin>>t; while(t--)
#define prec(n) fixed<<setprecision(n)
#define jaldibazi ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007


int main(){
	jaldibazi;

	ll n, x, t; cin >> n >> x >> t;


	ll ans = n%x==0 ? n/x : floor(n/x) +1 ;

	cout << ans*t << "\n";

	return 0;
}


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

vector<ll> x;
vector<ll> xx;
vector<ll> y;
vector<ll> yy;

char mp[444][444];
char cmp[444][444];

void zaatu(){
	REP(i,x.size()){
		xx.PB(x[i]);
		xx.PB(x[i]+1);
		xx.PB(x[i]-1);
	}
	REP(i,y.size()){
		yy.PB(y[i]);
		yy.PB(y[i]+1);
		yy.PB(y[i]-1);
	}
	sort(ALL(xx));
	sort(ALL(yy));
	xx.erase(unique(ALL(xx)),xx.end());
	yy.erase(unique(ALL(yy)),yy.end());
	
	REP(i,x.size()){
		x[i] = lower_bound(ALL(xx),x[i]) - xx.begin();
		y[i] = lower_bound(ALL(yy),y[i]) - yy.begin();
	}
}
	
int main(){
	int n;
	while(cin >> n,n){
		REP(i,444)REP(j,444)mp[i][j] = '.';
		REP(i,444)REP(j,444)cmp[i][j] = '.';
		x.clear();
		y.clear();
		xx.clear();
		yy.clear();
		REP(i,n+4){
			int a,b;cin >> a >> b;
			x.PB(a);
			y.PB(b);
		}
		
		zaatu();
		
		REP(i,n){
			mp[y[i]][x[i]] = '#';
		}
		
		bool flag = false;
		REP(i,444){
			REP(j,444){
				if(mp[i][j] == '#')flag = !flag;
				if(flag)mp[i][j] = '#';
				else mp[i][j] = '.';
			}
			flag = false;
		}
		//SHOW2d(mp,3*n,3*n);
		
		flag = false;
		REP(j,444){
			REP(i,444){
				if(mp[i][j] == '#')flag = !flag;
				if(flag)mp[i][j] = '#';
				else mp[i][j] = '.';
			}
			flag = false;
		}
		//SHOW2d(mp,3*n,3*n);
		
		REP(i,4){
			cmp[y[i+n]][x[i+n]] = '!';
		}
		
		flag = false;
		REP(i,444){
			REP(j,444){
				if(cmp[i][j] == '!')flag = !flag;
				if(flag)cmp[i][j] = '!';
				else cmp[i][j] = '.';
			}
			flag = false;
		}
		
		flag = false;
		REP(j,444){
			REP(i,444){
				if(cmp[i][j] == '!')flag = !flag;
				if(flag)mp[i][j] = '!';
				else cmp[i][j] = '.';
			}
			flag = false;
		}
				
		REP(i,444){
			REP(j,444){
				if(cmp[i][j] == '!')mp[i][j] = '!';
			}
		}
		//SHOW2d(mp,3*n,3*n);	

		//SHOW1d(xx,xx.size());
		//SHOW1d(yy,yy.size());
		
		ll ans = 0;
		
		REP(i,444){
			REP(j,444){
				if(mp[i][j] == '#'){
					//cout << i << ' ' << j << ' '<< yy[i+1] << ' ' << yy[i] << ' ' << xx[j+1] << ' ' << xx[j] << endl;
					ans += (yy[i+1] - yy[i]) * (xx[j+1] - xx[j]);
				}
			}
		}
		
		cout << ans << endl;
	}
	return 0;
}


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

#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
using namespace std;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int d[n];
    rep(i,0,n) cin >> d[i];
    ll sum =0;
    rep(i,0,n){
        rep(j,i+1,n){
            sum += d[i]*d[j];
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
N,K = map(int,input().split())

cities = list(map(int,input().split()))

cities.append(K)

cities.sort()

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

dif = []

for i in range(N):
	dif.append(cities[i+1] - cities[i])
    

if len(dif) == 1:
	x = dif[0]

else:
    
	x = gcd(dif[0],dif[1])

	for i in range(2,N):
		x = gcd(x,dif[i])

print(x)

Measured memory_bytes: 14224
n,x = map(int, input().split())
l = [int(i) for i in input().split()]

d = 0
cnt = 0
for i in range(0, n + 1):
  if i == 0:
    d = 0
  else:
    d = d + l[i-1]
  if d <= x:
    cnt += 1

print (cnt)

Measured memory_bytes: 38384
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;
// x_1,...,x_j から k 枚選んで x_i の合計を s にするような選び方の総数
int dp[55][55][2510];
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	// ∧ -> 論理積(AND)
	int n; cin >> n;
	VE t(n), a(n); rep(i, n)cin >> t[i] >> a[i];
	// A,B->得票数
	int A = 1, B = 1;
	rep(i, n) {
		// A <= nx && B <= ny となるような最小の自然数nを求める
		int MINN = max((A + t[i] - 1) / t[i], (B + a[i] - 1) / a[i]);
		A = MINN * t[i]; B = MINN * a[i];
	}
	cout << A + B << endl;
	return 0;
}

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

// Shortcut

#define int long long
#define endl '\n'
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << ' ';
#define PrintVl(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << endl;
#define PrintA(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << ' ';
#define PrintAl(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a));
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 1e3 + 5, M = 2e3 + 5, mod = 1e9 + 7, inf = 1e9 + 7;

int n, k, ans;
int a[N], pow2[45];
vi x, y;
bool ck;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    pow2[0] = 1;
    For(i, 1, 45){
        pow2[i] = pow2[i - 1] * 2;
    }
    cin >> n >> k;
    ForE(i, 1, n){
        cin >> a[i];
    }
    ForE(i, 1, n){
        int ans = 0;
        ForE(j, i, n){
            ans += a[j];
            x.pb(ans);
        }
    }
    FordE(i, 44, 0){
        y.clear();
        For(j, 0, x.size()){
            if (x[j] & pow2[i]){
                y.pb(x[j]);
            }
        }
        if (y.size() < k){
            continue;
        }
        ans += pow2[i];
        x.clear();
        x = y;
    }
    cout << ans;
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/


Measured memory_bytes: 6512
#include<bits/stdc++.h>
using namespace std;
int main(){
   long long n;
	cin>>n;
  	long long dp[n+1]={0};
    long long ans=0;
  	for(long long i=1;i<=n;i++){
      for(long long j=i;j<=n;j+=i){
        dp[j]+=1;
      }
      ans=ans+i*dp[i];
    }
  printf("%lld",ans);
return 0;
}



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

using namespace std;

typedef long long LL;

int main() {
    int n;
    scanf("%d", &n);
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        int x;
        scanf("%d", &x);
        cnt += x & 1;
    }
    puts(cnt & 1 ? "NO" : "YES");
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <random>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
ll mod = 1e9 + 7;


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

	vi v(3);
	rep(i, 3) cin >> v[i];
	sort(all(v));
	int x = v[2] * 3;
	ll ans = (x - (v[0] + v[1] + v[2])) / 2;
	//cout << ans << endl;
	if ((v[0] + v[1]) % 2 != 0) {
		ans+=2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define fi first
#define se second
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define out(t, a) copy(all(a), ostream_iterator<t>(cout, " ")); cout << "\n";
// #define DEBUG
#define int long long

using namespace std;

void set_program() {
	#ifdef DEBUG
		freopen ("test.in", "r", stdin);
		freopen ("test.out", "w", stdout);
	#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

typedef long double ld;
typedef long long ll;
typedef pair <int, int> pt;

const int INF = 1e9 + 1;
const int MAXN = 3000;
const int LOGN = 20;
const int MOD = 1e7;
const int ALF = 26;

void solve() {
	int a, b;
	cin >> a >> b;
	for (int x = 1; x <= 10000; ++x) {
		int aa = floor(x * 0.08);
		int bb = floor(x * 0.1);
		if (a == aa && b == bb) {
			cout << x << "\n";
			return;
		} 
	}
	cout << "-1\n";
}

main() {
	set_program();
	int t;
	#ifdef DEBUG
		// cin >> t;
		t = 3;
	#else
		// cin >> t;
		t = 1;
	#endif
	for (; t--; ) {
		solve();
		cout << "\n";
	}
 	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a = sc.nextInt();
    int b = a;
    int m;
    for (int i = 0;i<n-1;i++) {
      m = sc.nextInt();
      if (m<a) a=m;
      if (b<m) b=m;
    }
    System.out.println(b-a);
  }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt();
    cout<<n*800-(n/15)*200<<endl;
    
    
    return 0;   
}




 
 


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <random>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)


int main() {
	VI v(3);
	int n;
	cin >> v[0] >> v[1] >> v[2] >> n;
	int cnt = 0;
	long long sum1 = 0,sum2=0;

	SORT(v);
	reverse(v.begin(), v.end());

	int r = n / v[0];
	for (int r = n/v[0]; r >= 0; r--) {
		sum1 = r*v[0];
		for (int g = (n - sum1) / v[1]; g >= 0; g--) {
			sum2 = sum1+g*v[1];
			if ((n - sum2) % v[2] == 0) {
				cnt++;
			}
		}
	}
	ANS(cnt);



	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
  static void trace(int[] a){
    int i;
    for(i = 0; i < a.length - 1; i++)
      System.out.print(a[i] + " ");
    System.out.println(a[i]);
  }

  public static void main(String[] args){
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int a[] = new int[n];
    for(int i = 0; i < n; i++)
      a[i] = stdIn.nextInt();

    int count = 0;
    for(int i = 0; i < n; i++){
      int minj = i;
      for(int j = i; j < n; j++){
        if(a[j] < a[minj])
          minj = j;
      }
      if(minj != i){
        int tmp = a[minj];
        a[minj] = a[i];
        a[i] = tmp;
        count++;
      }
    }

    trace(a);
    System.out.println(count);

  }
}

Measured memory_bytes: 26376
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(ll i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(a) a.begin(), a.end()
typedef long long ll;
#define MOD 1000000007
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll func(ll A, ll B, ll x) {
  ll res = floor(A*x/B)-A*floor(x/B);
  return (int)res;
}

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

  ll A,B,N; cin>>A>>B>>N;

  ll x = min(B-1, N);
  cout<<floor(A*x/B)-A*floor(x/B)<<endl;

  return 0;
}

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

#define ll long long int
#define ull unsigned long long int
#define db double
#define ld long double
#define MOD 1000000007
#define inf (1LL << 62)
#define pi acos(-1.0)
#define si(a) scanf("%lld",&a)
#define sd(n) scanf("%lf", &n)
#define for1(i, stop) for(ll i = 1; i <= stop; i++)
#define for0(i, stop) for(ll i = 0; i < stop; i++)
#define rep1(i, start) for(ll i = start; i >= 1; i--)
#define rep0(i, start) for(ll i = (start-1); i >= 0; i--)
#define loop(i, start, stop, inc) for(ll i = start; i <= stop; i += inc)
#define pb(v,a) v.push_back(a)
#define pll pair <ll, ll>
#define mp make_pair
#define pbp(v,a,i) v.push_back(make_pair(a,i))
#define srt(v) sort(v.begin(),v.end())
#define rv(v) reverse(v.begin(),v.end())
#define ms(n, i) memset(n, i, sizeof(n))
#define debug printf("Debug\n");
#define en '\n'



#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
/*typedef tuple<ll,ll,ll>tpl;

ll bigmod(ll n,ll pow)
{
    if(pow==0)
        return 1;
    if(pow==1)
        return n%MOD;

    ll ans=bigmod(n,pow/2);
    ans=(ans*ans)%MOD;

    if(pow%2==1)
    {
        ans=(ans*n)%MOD;
    }
    return ans%MOD;
}

ll fact[1000005];

ll nCr(ll n,ll r)
{

    ll ans=fact[n];
    ans=(ans*bigmod(fact[r],MOD-2))%MOD;
    ans=(ans*bigmod(fact[n-r],MOD-2))%MOD;
    return ans;
} */

int main()
{
    _fastio
    double d,t,s;
    cin>>d>>t>>s;
    if((d/s)<=t) cout<<"Yes"<<en;
    else cout<<"No"<<en;
}


Measured memory_bytes: 3760
#if defined(_WIN32)
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

using ulong = unsigned long;
using ll = long long;
using ull = unsigned long long;

#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)

using namespace std;

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


	ll n, y;
	cin >> n >> y;

	REP(a, n + 1)
	{
		REP(b, n - a + 1)
		{
			ll c = n - a - b;
			if (10000 * a + 5000 * b + 1000 * c == y)
			{
				cout << a << ' ' << b << ' ' << c;
				return 0;
			}
		}
	}

	cout << -1 << ' ' << -1 << ' ' << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
import queue
class gridMan:
  def __init__(s, L):
    s.L = L
    s.H = len(s.L)
    s.W = len(s.L[0])
  def makeWall(s, x = -2):
    w = len(s.L[0]) + 2
    s.L = [[x] * w] + [[x] + i + [x] for i in s.L] + [[x] * w]
  def dist(s, S): #Sから上下左右に進んで何手かかるかのリスト　および　最大値
    T = [[-1] * s.W for _ in range(s.H)]
    q = queue.Queue()
    q.put([S[0], S[1]])
    T[S[0]][S[1]] = 0
    k = 0
    while not q.empty():
      h, w = q.get()
      k = T[h][w]
      for i, j in [[1, 0], [-1, 0], [0, 1], [0, -1]]:
        hh = h + i
        ww = w + j
        if s.L[hh + 1][ww + 1] >= 0 and T[hh][ww] == -1:
          q.put([hh, ww])
          T[hh][ww] = k + 1
    return T, k

H, W = list(map(int, input().split()))
s = [list(input()) for _ in range(H)]

ans = 0
D = [[0] * W for _ in range(H)]
for i in range(H):
  for j in range(W):
    if s[i][j] == ".":
      D[i][j] = 0
      ans += 1
    else:
      D[i][j] = -1

g = gridMan(D)
g.makeWall()

L, ma = g.dist([0, 0])

if L[-1][-1] == -1:
  print(-1)
  exit()

print(ans - L[-1][-1] - 1)




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

long long f(int a, int b, int c){
    return a*b*c;
}

int main() {
    int N; cin >> N;

    vector<ll> cnt(5, 0);
    string tmp = "MARCH";
    vector<string> S(N);
    rep(i, N) {
        cin >> S.at(i);
        rep(j, 5){
            if(S.at(i).at(0) == tmp.at(j)){
                cnt.at(j)++;
                break;
            }
        }
    }

    ll ans = 0;
    rep(i, 5){
        for(int j=i+1; j<5; j++){
            for(int k=j+1; k<5; k++){
                ans += cnt.at(i) * cnt.at(j) * cnt.at(k);
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 6144
#include <iostream>

using namespace std;

#define WH 52

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

void dfs(int,int);

int main(int argc, char const *argv[])
{
	int w,h;


	int cnt;

	while(1){
		cin>>w>>h;
		if(w+h==0) break;

		for(int i1=0;i1<WH;i1++){
			for(int i2=0;i2<WH;i2++){
				f[i1][i2]=0;
			}
		}

		for(int i1=1;i1<=h;i1++){
			for(int i2=1;i2<=w;i2++){
				cin>>f[i1][i2];
			}
		}

		cnt=0;
		for(int i1=1;i1<=h;i1++){
			for(int i2=1;i2<=w;i2++){
				if(f[i1][i2]==1){
					f[i1][i2]=0;
					dfs(i2,i1);
					cnt++;
				}
			}
		}

		cout<<cnt<<endl;

	}

	return 0;
}

void dfs(int x,int y){
	for(int i1=0;i1<8;i1++){
		for(int i2=0;i2<8;i2++){
			if(f[y+dy[i1]][x+dx[i2]]==1){
				f[y+dy[i1]][x+dx[i2]]=0;
				dfs(x+dx[i2],y+dy[i1]);
			}
		}
	}
}

Measured memory_bytes: 1272
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>

using namespace std;

struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int N, M; cin >> N >> M;
  vector<int> b(N);
  rep(i, N) cin >> b[i];
  vector<int> tb1, tb2;
  int flag = 0;
  rep(i, M) {
    int p; cin >> p;
    rep(j, p) {
      tb1.push_back(flag);
      tb2.push_back(flag^1);
    }
    flag ^= 1;
  }
  set<vector<int>> st = {b};
  queue<pair<vector<int>, int>> q;
  q.emplace(b, 0);

  auto check_run_length = [&](vector<int>& v) {
    return v == tb1 || v == tb2;
  };

  while(!q.empty()) {
    vector<int> p; int cost; tie(p, cost) = q.front(); q.pop();
    if(check_run_length(p)) { cout << cost << endl; return 0; }
    rep(i, N-1) {
      swap(p[i], p[i+1]);
      if(!st.count(p)) {
        q.emplace(p, cost + 1);
        st.insert(p);
      }
      swap(p[i], p[i+1]);
    }
  }
  
  return 0;
}

Measured memory_bytes: 4064