akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(int argc, char const *argv[])
{
    int n, m;
    cin >> n >> m;
    vector<ll> x(n), y(n), z(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i] >> z[i];
    }
    
    set<ll> ans;
    for (int sign_x = 0; sign_x <= 1; sign_x++) {
        for (int sign_y = 0; sign_y <= 1; sign_y++) {
            for (int sign_z = 0; sign_z <= 1; sign_z++) {
                vector<ll> sum_list(n, 0LL);
                for (int i = 0; i < n; i++) {
                    if (sign_x == 0) {
                        sum_list[i] += x[i];
                    } else {
                        sum_list[i] -= x[i];
                    }
                    if (sign_y == 0) {
                        sum_list[i] += y[i];
                    } else {
                        sum_list[i] -= y[i];
                    }
                    if (sign_z == 0) {
                        sum_list[i] += z[i];
                    } else {
                        sum_list[i] -= z[i];
                    }
                }
                sort(sum_list.begin(), sum_list.end());
                ll s = 0LL;
                for (int i = 1; i <= m; i++) {
                    s += sum_list[n - i];
                }
                ans.insert(s);
            }
        }
    }
    cout << *max_element(ans.begin(), ans.end()) << endl;

    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner stdin = new Scanner(System.in);

        int N = stdin.nextInt();
        int A[] = new int[N+1];
        int ans[] = new int[N+1];

        for(int i=1;i<=N;i++) {
        	A[i] = stdin.nextInt();
        }
        for(int i=1;i<=N;i++) {
        	ans[A[i]] = i;
        }
        for(int i=1;i<=N;i++) {
        	System.out.printf("%d ", ans[i]);
        }
    }
}


Measured memory_bytes: 97848
def main():
    N, M = map(int, input().split())

    if abs(N - M) > 1:
        print(0)
        return

    h = max(N, M)
    l = min(N, M)
    ans = 1
    for i in range(l):
        ans *= h - i
        ans *= l - i
        ans = ans % 1000000007

    if h == l:
        ans = ans * 2 % 1000000007
    print(ans)

main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <unordered_map>
#include <algorithm> // std::sort(begin,end)
#include <utility> // std::swap

using namespace std;

int main(int argc, char const* argv[])
{
  int n,k;
  cin >> n >> k;

  int cnt = 1,tmp = k;

  for(cnt = 1; tmp < n;cnt++ ){
    tmp += k-1; 
  }

  cout << cnt << endl;

  return 0;
}


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

int main() {
  int a,b;
  cin>>a>>b;
  if (a==1) a=14;
  if (b==1) b=14;
  if (a>b) cout<<"Alice"<<endl;
  if (b>a) cout<<"Bob"<<endl;
  if (a==b) cout<<"Draw"<<endl;
}

Measured memory_bytes: 3588
package main

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

func max64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func chmax64(x *int64, y int64) bool {
	if *x < y {
		*x = y
		return true
	}
	return false
}

func main() {
	N := readi()
	W := readi()
	w := make([]int, N+1)
	v := make([]int64, N+1)
	for i := 1; i <= N; i++ {
		w[i] = readi()
		v[i] = readi64()
	}

	dp := make([][]int64, N+1)
	for i := range dp {
		dp[i] = make([]int64, W+1)
	}

	for i := 1; i <= N; i++ {
		for j := 0; j <= W; j++ {
			dp[i][j] = dp[i-1][j]
			k := j - w[i]
			if 0 <= k {
				dp[i][j] = max64(dp[i][j], dp[i-1][k]+v[i])
			}
		}
	}
	fmt.Println(dp[N][W])
}

/*-------------------utilities-------------------*/

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func chmin(x *int, y int) bool {
	if *x > y {
		*x = y
		return true
	}
	return false
}

func chmax(x *int, y int) bool {
	if *x < y {
		*x = y
		return true
	}
	return false
}

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

/*-------------------init-------------------*/

const (
	INF = 1000000000000000000
	MOD = 1e9 + 7
)

var (
	readString func() string
)

func init() {
	readString = newReadString(os.Stdin)
}

/*-------------------inputs-------------------*/

func readi() int {
	return int(readi64())
}

func readi64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readf() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}


Measured memory_bytes: 81792
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

int main(void){
    // char ;
    ll n,x,y;
    scanf("%lld%lld%lld",&n,&x,&y);
    ll dis[n];
    rep(i,0,n){
        dis[i]=0;
    }
    // ll d[n-1];
    // rep(i,0,n-1){
    //     if(i+1==x){
    //         d[i]=2;
    //     }else{
    //         d[i]=1;
    //     }
    // }
    // ll end;
    // if( (y-x)%2 ){
    //     end = (x-1) + ( (n-y) > (y-x)/2 ? n-y+1 : (y-x)/2+1);
    // }else{
    //     end = (x-1) + ( (n-y)+1 > (y-x)/2 ? n-y+1 : (y-x)/2);
    // }
    rep(i,1,n){
        rep(j,i+1,n+1){
            if(j<=x || i>=y){
                dis[j-i]++;
                // printf("%lld ",j-i);
            }else{
                if(i<=x&&j>=y){
                    dis[x-i+j-y+1]++;
                    // printf("%lld ",x-i+y-j+1);
                }else{
                    ll d=min2(j-i,ABS(j-y)+1+ABS(x-i));
                    dis[d]++;
                    // printf("%lld ",d);
                }
            }
        }
    }
    rep(i,1,n){
        printf("%lld\n",dis[i]);
    }
    // printf("\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

#define MAX_N 200005

class UnionFind
{
public:
  int par[MAX_N];
  int depth[MAX_N];
  int nGroup[MAX_N];

  UnionFind(int n) {
    init(n);
  }

  void init(int n) {
    for(int i=0; i<n; i++) {
      par[i] = i;
      depth[i] = 0;
      nGroup[i] = 1;
    }
  }

  int root(int x) {
    if(par[x] == x) {
      return x;
    } else {
      return par[x] = root(par[x]);
    }
  }

  bool same(int x, int y) {
    return root(x) == root(y);
  }

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return;

    if(depth[x] < depth[y]) {
      par[x] = y;
      nGroup[y] += nGroup[x];
      nGroup[x] = 0;
    } else {
      par[y] = x;
      nGroup[x] += nGroup[y];
      nGroup[y] = 0;
      if(depth[x] == depth[y])
        depth[x]++;
    }
  }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m, k; cin >> n >> m >> k;
  UnionFind uf(n);
  vector<int> ans(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    uf.unite(a, b);
    ans[a]--; ans[b]--;
  }
  rep(i, n) {
    ans[i] += uf.nGroup[uf.root(i)]-1;
  }
  rep(i, k) {
    int c, d;
    cin >> c >> d;
    c--; d--;
    if(uf.same(c, d)) {
      ans[c]--; ans[d]--;
    }
  }
  rep(i, n) cout << ans[i] << ' ';
  cout << endk;
  return 0;
}


Measured memory_bytes: 4788
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int x = stdIn.nextInt();
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        
        System.out.println((x - a) % b);
    }
}


Measured memory_bytes: 21460
#include<cmath>
#include<cstdio>
using namespace std;
typedef long long LL;
LL gcd(LL a,LL b){
	if (a>b)return gcd(b,a);
	if (a==0) return b;
	return gcd(a,b%a);
}

int main(){
	LL a,b,c;
	scanf("%lld%lld",&a,&b);
	//c=gcd(a,b);
	if (b==0){
		printf("%lld\n",a*2);
		return 0;
	}
	
	if (a%b==0){
		printf("-1\n");
		return 0;
	}
	LL k=2;
	while (a*k%b==0)k++;
	
	
	printf("%lld\n",(a*k));
}


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

namespace ABC042_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] info = Console.ReadLine()
                .Split(' ')
                .Select(str => int.Parse(str))
                .ToArray();

            int n = info[0];

            List<int> dislike = Console.ReadLine()
                .Split(' ')
                .Select(str => int.Parse(str))
                .ToList();

            while (true)
            {
                string strN = $"{n}";
                if (dislike.Any(number => strN.Contains(number.ToString())))
                {
                    // 嫌いな文字列が含まれる場合
                    n++;
                    continue;
                }
                break;
            }
            Console.WriteLine(n);
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 15424
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x[ohara], y, sum, k, q;
ll dp[55][55][2600];

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

  cin >> n >> a;
  rep(i, n) cin >> x[i];
  dp[0][0][0] = 1;
  rrep(i, 1, n + 1) {
    rep(j, n + 1) {
      rep(k, 2600) {
        dp[i][j][k] += dp[i - 1][j][k];
        if (k - x[i - 1] >= 0 && j >= 1) dp[i][j][k] += dp[i - 1][j - 1][k - x[i - 1]];
      }
    }
  }
  rrep(i, 1, n + 1) { ans += dp[n][i][a * i]; }
  Cout(ans);
  return 0;
}


Measured memory_bytes: 55644
#include <iomanip>
#include <utility>
#include <algorithm>
#include <type_traits>
#include <set>
#include <string>
#include <iostream>
#include <fstream>
#include <cassert>
#include <memory>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <queue>
#include <vector>
#include <array>
#include <chrono>
#include <random>
#include <forward_list>
#include <iomanip>
#include <functional>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <sstream>
#include <numeric>

using namespace std;
#define MFOR(i,end) for(size_t i = 0, end_i = (end); i < end_i; ++ i)

int main()
{
	std::string s;
	std::cin >> s;
	if (s.find('F', s.find('C')) != s.npos) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}
}

Measured memory_bytes: 256
// テ・ツ淞コテヲツ慊ャテ」ツδ?」ツδウテ」ツδ療」ツδャテ」ツδシテ」ツδ?

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int dp[100010];
int N, D, X, p[15][15];
signed main() {
    cin >> N >> D >> X;
    rep(i,0,D) rep(j,0,N) cin >> p[i][j];

    rep(i,0,D-1) {
        repq(j,0,X) dp[j] = j;
        repq(j,0,X) {
            rep(k,0,N) {
                if(j - p[i][k] < 0) continue;
                chmax(dp[j], dp[j-p[i][k]] + p[i+1][k]);
            }
        }
        int ma = 0;
        repq(j,0,X) chmax(ma, dp[j]);
        X = ma;
    }
    cout << X << endl;
    return 0;
}

Measured memory_bytes: 3236
#include "bits/stdc++.h"
using namespace std;

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

    if (N % 2) {
        cout << "No";
        return 0;
    }
    for (int i = 0; i < N / 2; ++i) {
        if (S[i] != S[N / 2 + i]) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(){
    int a,i = 0;
    cin >> a;
    int b[10001];
    for(i=0;i<a;i++) cin >> b[i];
    
    int cnt = 0;
    for(i=0;i<a;i++){
        while(b[i]%2==0){
            b[i]/=2;
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
import * as fs from 'fs';

const readString = (() => {
  const input = fs.readFileSync(0).toString();
  const words = input.split(/[ \n]/);
  let i = 0;
  return () => words[i++] || '';
})();
const readInt = () => parseInt(readString(), 10);
const readBigInt = () => BigInt(readString());

const gcd = (a: bigint, b: bigint) => {
  const _gcd = (a: bigint, b: bigint): bigint => {
    const q = a % b;
    return q === 0n ? b : _gcd(b, q);
  };
  return a > b ? _gcd(a, b) : _gcd(b, a);
};

const MOD = 1000000007;
const MOD_BIGINT = BigInt(MOD);
class ModBigInt {
  constructor(public v: bigint) {}

  static of(n: number | bigint) {
    return new ModBigInt(ModBigInt.toBigInt(n));
  }

  static toBigInt(other: number | bigint | ModBigInt) {
    if (typeof other === 'bigint') return other;
    if (typeof other === 'number') return BigInt(other);
    return other.v;
  }

  clone = () => new ModBigInt(this.v);
  plus = (other: number | bigint | ModBigInt) => {
    this.v = (this.v + ModBigInt.toBigInt(other)) % MOD_BIGINT;
    return this;
  };
  minus = (other: number | bigint | ModBigInt) => {
    this.v = (this.v + MOD_BIGINT - ModBigInt.toBigInt(other)) % MOD_BIGINT;
    return this;
  };
  multiply = (other: number | bigint | ModBigInt) => {
    this.v = (this.v * ModBigInt.toBigInt(other)) % MOD_BIGINT;
    return this;
  };
  pow = (other: number) => {
    const v = mod(1);
    for (let i = 0; i < other; i++) v.multiply(this.v);
    return v;
  };
}

const mod = ModBigInt.of;

const abs = (a: bigint) => (a > 0n ? a : -a);

(function main() {
  const T = readString();
  console.log(T.replace(/\?/g, 'D'));
})();


Measured memory_bytes: 37520
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for(int i = 0; i< N; i++) 
 
int main() {
    int N;
    string a[100000];
    cin >> N;
    rep(i, N) cin >> a[i];
 
    int res[4];
    rep(i, N) {
        if(a[i] == "AC") {
            res[0]++;
        } else if(a[i] == "WA") {
            res[1]++;
        } else if(a[i] == "TLE") {
            res[2]++;
        } else if(a[i] == "RE") {
            res[3]++;
        }
    }
    cout << "AC x " << res[0] << endl; 
    cout << "WA x " << res[1] << endl;
    cout << "TLE x " << res[2] << endl;
    cout << "RE x " << res[3] << endl;
}

Measured memory_bytes: 6760
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int count = 0;
		for (int i=1; i<=n; i++)
			if (in.nextInt()%2 == 1 && i%2 == 1)
				count++;
		System.out.println(count);
	}
}



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


public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        long n=Long.parseLong(reader.readLine());
        long count=0;
        for (long i = 1; i <= n; i++) {
            for (long j = 1; j <=n ; j++) {
                for (long k = 1; k <=n ; k++) {
                    count+=gcd3(i,j,k);
                }
            }
        }
        System.out.println(count);
    }
    static long gcd(long a,long b){
        if (b==0)
            return a;
        else
            return gcd(b,a%b);
    }
    static long gcd3(long a,long b,long c){
        return gcd(gcd(a,b),c);
    }
}

Measured memory_bytes: 32776
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Double a, b, v;
  cin>>a>>b>>v;
  v /= a;

  auto check = [&](Double x){
    {
      Double h = b * tan(PI/2 - x);
      if(h <= a){
        Double v2 = b * h / 2;
        pr(180 * (x/PI), b, h, v, v2, (v2>=v));
        return v2 >= v;
      }
    }
    Double h = a * tan(x);
    Double v2 = a * b - (a * h) / 2;
    return v2 >= v;
  };

  Double L = 0, R = PI/2;
  for(Int i=0;i<100;i++){
    Double M = (L + R)/2;
    check(M)? (L=M):(R=M);
  }
  cout<<180 * (L/PI)<<endl;

  return 0;
}


Measured memory_bytes: 1020
import sys
input = sys.stdin.readline

def gcd(a: int, b: int):
    """ https://cocodrips.hateblo.jp/entry/2014/03/05/143623
    """
    while b:
        a, b = b, a%b
    return a

def lcm(a: int, b: int):
    return a * b // gcd(a, b)


def main():
	A,B = map(int, input().split())
	#S = input().rstrip()
	#vA = list(map(int, input().split()))
	#vX = [input().rstrip() for _ in [0,]*N]
	
	X = 0.08
	Y = 0.10
	
	res = 0
	for i in range(1, 1101):
		if int(i*X)==A and int(i*Y)==B:
			res = i
			break
	else:
		res = -1
	
	#res = "No" if (S=="AAA" or S=="BBB") else "Yes"
	#res = -(-N//M)
	#res = gcd(N,M)
	print(res)
	
if __name__ == "__main__":
    main()


Measured memory_bytes: 39856
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
int main(){
  Int n,k;cin >> n >> k;
  Int a[100000] = {0};
  for(Int i=0;i<n;i++){
    Int s,t;cin >> s >> t;
    a[s-1]+=t;
  }
  Int sum = 0;
  for(Int i=0;i<100000;i++){
    sum+=a[i];
    if(sum>=k){
      cout << i+1 << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 1024
N=int(input())
D=dict()
for i in range(N):
    s=list(input())
    s.sort()
    s="".join(s)
    if s in D:
        D[s]+=1
    else:
        D[s]=1
        
#print(D)
ans=0
for i in D.values():
    ans+=i*(i-1)//2
print(ans)

Measured memory_bytes: 17808
#include<cstdio>

using namespace std;

void changing(int n,int a);
char num[100000];
char chg[100000][2];

int main(void)
{
   int n,m;
   char kari;
   while(scanf("%d",&n))
   {
      if(n == 0) break;
      scanf("%c",&kari);
      for(int i = 0;i < n;i++)
      {
         scanf("%c%c%c",&chg[i][0],&kari,&chg[i][1]);
         scanf("%c",&kari);
      }

      scanf("%d",&m);
      scanf("%c",&kari);
      for(int i = 0;i < m;i++)
      {
         scanf("%c",&num[i]);
         scanf("%c",&kari);
      }
      num[m] = 0;
      for(int i = 0;i < m;i++)
      {
         changing(n,i);
      }
      printf("%s\n",num);
   }
}


void changing(int n,int a)
{
   for(int i = 0;i < n;i++)
   {
      if(num[a] == chg[i][0])
      {
         num[a] = chg[i][1];
         return;
      }
   }
}

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

int c[3][3];
int b[3];

int main(){
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }
    for(int i = 0; i <= 100; i++){
        b[0] = c[0][0] - i;
        b[1] = c[1][0] - i;
        b[2] = c[2][0] - i;
        if(b[0] < 0 | b[1] < 0 | b[2] < 0) continue;
        for(int j = 0; j <= 100; j++){
            if(b[0] != c[0][1] - j | b[1] != c[1][1] - j | b[2] != c[2][1] - j) continue;
            for(int k = 0; k <= 100; k++){
                if (b[0] != c[0][2] - k | b[1] != c[1][2] - k | b[2] != c[2][2] - k)continue;
                cout << "Yes" <<endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

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

int a[1 << 20], b[1 << 20];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, k; cin >> n >> k;
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int times = 0; times < min(k, 1000); times++) {
		for (int i = 1; i <= n; i++) b[i] = 0;
		for (int i = 1; i <= n; i++) {
			b[max(1, i - a[i])]++;
			b[min(n, i + a[i]) + 1]--;
		}
		int now = 0;
		for (int i = 1; i <= n; i++) {
			now += b[i];
			a[i] = now;
		}
	}
	for (int i = 1; i <= n; i++) cout << a[i] << " \n"[i == n];
	return 0;
}



Measured memory_bytes: 5072
n, k, q = map(int, input().split())

score = [k - q for _ in range(n)]
for i in range(q):
    a = int(input())
    score[a - 1] += 1

for i in range(n):
    if score[i] > 0:
        print("Yes")
    else:
        print("No")


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

int main(){
    int n;
    ll res = 1;
    cin >> n;
    ll a;
    bool f = false;
    ll j;
    
    for(int i = 0;i<n;i++){
        cin >> a;
        
        if(a > j){
            f = true;
        } else{
            res *= a;
        }
        if(a == 0){
            f = false;
            res = 0;
            break;
        }
        j = 1000000000000000000/res;
    }

    if(f){
        cout << -1 << endl;
    }else{
        cout << res << endl;
    }
}

Measured memory_bytes: 3636
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};

vector<vector<ll> > dp(100, vector<ll>(100, -1));

ll comb(ll n, ll k) {
	if(n == 0 || k == 0 || n == k) return 1;
	else {
		if(dp[n][k] != -1) return dp[n][k];
		else {
			return dp[n][k] = comb(n - 1, k - 1) + comb(n - 1, k);
		}
	}
}

int main(void) {
	int n;
	cin>>n;
	int a, b;
	cin>>a>>b;
	vector<ll> v(n);
	REP(i, n) cin>>v[i];
	l_l res = l_l(0, 1);
	sort(ALL(v), greater<ll>());
	FOR(i, a, b + 1) {
		REP(j, n - i + 1) {
			ll sum = 0;
			FOR(k, j, i) {
				sum += v[k];
			}
			if(i * res.first < res.second * sum) {
				res.first = sum;
				res.second = i;
			}
		}
	}
	ll cnt = 0;
	FOR(i, a, b + 1) {
		REP(j, n - i + 1) {
			ll sum = 0;
			FOR(k, j, i) {
				sum += v[k];
			}
			if(i * res.first == res.second * sum) {
				ll cck1 = 0;
				ll cck2 = 0;
				REP(k, i) {
					if(v[j + i - 1 - k] == v[j + i - 1]) ++cck1;
				}
				FOR(k, j + i, n) {
					if(v[k] == v[j + i - 1]) ++cck2;
				}
				cnt += comb(cck1 + cck2, cck1);
			}
		}
	}
	cout<<fixed<<setprecision(39)<<res.first/(double)res.second<<endl;
	cout<<cnt<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
using namespace std;
int main(){
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  int k;
  cin >> k;
  while(a[0] >= a[1]){
    a[1] *= 2;
    k--;
  }
  while(a[1] >= a[2]){
    a[2] *= 2;
    k--;
  }
  if(k < 0) cout << "No" << endl;
  else cout << "Yes" << endl;
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<63;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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; }

int main(void){
    int N; cin >> N;
    VI deg(N,0), edge[N], a(N-1), b(N-1);
    int K = 0;
    REP(i,N-1){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        edge[a[i]].push_back(b[i]);
        deg[a[i]]++; deg[b[i]]++;
        chmax(K, deg[a[i]]); chmax(K, deg[b[i]]);
    }

    cout << K << endl;
    stack<P> stk;
    map<int,int> m[N];
    stk.push(P(0,K*(K+1)/2));
    while(stk.size()){
        P p = stk.top(); stk.pop();
        int node = p.first, color = p.second;
        int used = K*(K+1)/2 - color, ptr = 1;
        for(int n : edge[node]){
            if(ptr == used) ptr++;
            m[node][n] = ptr;
            stk.push(P(n,K*(K+1)/2-ptr));
            ptr++;
        }
    }

    REP(i,N-1){
        cout << m[a[i]][b[i]] << endl;
    }
    return 0;
}

Measured memory_bytes: 14976
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define int long long
using namespace std;
signed main() {
    int n;
    int ansa = 0;
    int ansb = 0;
    cin >> n;
    vector<int> a;
    rep(i, n) {
        int enter;
        cin >> enter;
        a.push_back(enter);
    }
    sort(a.begin(), a.end(), greater<int>());
    rep(i, n - 1) {
        if(a[i] == a[i + 1] && ansa == 0) {
            ansa = a[i];
            i++;
        } else if(a[i] == a[i + 1] && ansb == 0) {
            ansb = a[i];
            break;
        }
    }
    cout << ansa * ansb;
    return 0;
}

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

int a[100];
int main(){
	int n;
	scanf("%d", &n);
	rep(i,n)scanf("%d", &a[i]);
	sort(a, a+n, greater<>());
	int n1 = 0, n2 = 0;
	for(int i = 0;i < n;i++){
		if(i % 2 == 0)n1 += a[i];
		else n2 += a[i];
	}
	printf("%d\n", n1-n2);
	return 0;
}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    int n;
    cin>> n;

    int a[n];

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

        int *mx= max_element (a, a+n);
        int d= distance (a, mx);

        sort(a, a+n);


    for(int i=0; i<n; i++)
       {
           if(i== d)
            cout << a[n-2];
           else
            cout<< a[n-1];
           nl;
       }
    return 0;
}




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

const int mod = pow(10,9)+7;

long long modpow(long long a, long long b, long long m){
	long long c=1;
	while(b>0){
		if(b&1) c = c * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return c;
}

int main() {
	
	long long  n,a,b;
	cin >> n >> a >> b;
	long long ans = modpow(2,n,mod)-1;
		
	vector<long long> inv(b+1),finv(b+1),fac(b);
	inv.at(1)=1;
	finv.at(1)=1;
	fac.at(0) = n;
	for(int i=2; i<=b; i++) inv.at(i) = mod - inv.at(mod%i) * (mod/i) %mod;
	for(int i=2; i<=b; i++) finv.at(i) = finv.at(i-1) * inv.at(i) % mod;
	for(int i=1; i<b; i++) fac.at(i) = fac.at(i-1) * (n-i) % mod;
	long long bin = fac.at(b-1) * finv.at(b) % mod;
	ans -= bin;
	if(ans<0) ans += mod;
	bin = fac.at(a-1) * finv.at(a) % mod;
	ans -= bin;
	if(ans<0) ans += mod;
	
	cout << ans << endl;
	
	
}

Measured memory_bytes: 4992
#include<iostream>
using namespace std;
int main() {
    int x, minj, cnt = 0;
    cin >> x;
    int A[x];
    for ( int i = 0; i < x; i++ ){
        cin >> A[i];
    }
    for ( int i = 0; i < x; i++ ){
        minj = i;
        for ( int j = i; j < x; j++ ){
            if ( A[j] < A[minj] ){
                minj = j;
            }
        }
        if ( A[i] != A[minj] ) cnt += 1;
        swap( A[i], A[minj] );
    }
    for ( int i = 0; i < x; i++ ){
        if ( i == x-1 ){
            cout << A[i] << endl;
        } else {
            cout << A[i] << " ";
        }
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 3112
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
#include <chrono>

#define _ << " " <<
#define all(v) v.begin(), v.end()
#define sp(n) fixed << setprecision(n)
#define ff first
#define ss second

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const ll mod = 1e9 + 7;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	int ans = 0;
	vector<int> a(n), b(n), c(n - 1);
	vector<pii> s(n);
	for (int& i : a) cin >> i;
	for (int& i : b) cin >> i;
	for (int& i : c) cin >> i;
	for (int i = 0; i < n - 1; i++) {
		ans += b[a[i] - 1];
		if (a[i + 1] - a[i] == 1) ans += c[a[i] - 1];
	}
	cout << ans + b[a.back() - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <set>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

int dp[100001][3];

signed main(void) {
	int n;
	cin >> n;
	vector<int>a(n),b(n),c(n);
	rep(i, n) {
		cin >> a[i]>>b[i]>>c[i];
	}
	rep(i, 3) {
		dp[0][i] = 0;
	}
	rep1(i, n+1) {
		dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i-1];
		dp[i][1] = max(dp[i - 1][2], dp[i - 1][0]) + b[i-1];
		dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c[i-1];
	}
	print(max({ dp[n][0], dp[n][1], dp[n][2] }));
}

Measured memory_bytes: 4992
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	S, T := nextLine(), nextLine()
	ans := make([]byte, 0)
	for i := 0; i < N; i++ {
		ans = append(ans, S[i], T[i])
	}
	fmt.Println(string(ans))
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 640
using static System.Math;
using System.Linq;
using System;

public class Hello
{
	public static void Main()
	{
		var n = int.Parse(Console.ReadLine().Trim());
		string[] line = Console.ReadLine().Trim().Split(' ');
		var a = Array.ConvertAll(line, int.Parse);
		var s1 = 0;
		var s2 = a.Sum();
		var ans = int.MaxValue;
		for (int i = 0; i < n - 1; i++)
		{
			s1 += a[i];
			s2 -= a[i];
			ans = Min(ans, Abs(s1 - s2));
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define IOS   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define mp    make_pair
#define pb    push_back
#define F     first
#define pi 	  3.14159265358979323846
#define S     second
#define ll    long long
#define ld    long double
#define sz(s) (ll)s.size()
#define vl    vector < ll >
#define pll   pair < ll, ll >
#define ml    map < ll, ll >
#define mod   1000000007
#define qe	  998244353
#define maxn  100005
#define mx    1005
#define rep(i,a,b)  for(i=a;i<b;i++)
#define inv(i,a,b)  for(i=a;i>=b;i--)
#define all(a)  (a).begin(),(a).end()
using namespace std;
int main(){
//	#ifndef ONLINE_JUDGE
//    if (fopen("input.txt", "r"))
//    {
//        freopen("input.txt", "r", stdin);
//        freopen("output.txt", "w", stdout);
//    }
//	#endif
	IOS;
	ll t,n,l;
	ll i,m,mn,q,j,x,y,ans=0,sum=0,k,c;
	string s,s1;
	cin>>n;
	ll a[n],b[n];
	rep(i,0,n)cin>>a[i];
	b[n-1]=a[n-1];
	inv(i,n-2,0)b[i]=(a[i]+b[i+1])%mod;
	rep(i,0,n-1){
		ans+=(a[i]*b[i+1])%mod;
		ans%=mod;
	}
	cout<<ans;
}

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

using namespace std;

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

  string s;
  long long k;
  cin >> s >> k;
  for (int i = 0; i < k; ++i) {
    if (s[i] > '1') {
      cout << s[i] << endl;
      return 0;
    }
  }
  cout << 1 << endl;

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000


int main(){

	string s;
	cin>>s;
	
	if(s[0]=='9'||s[1]=='9'){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	
    return 0;
}



Measured memory_bytes: 256
import itertools as itt

n,m,x = map(int, input().split())
lsts = []
cbs = []
minp = -1

for i in range(n):
  lsts.append(input().split())
  for j in range(m+1):
    lsts[i][j] = int(lsts[i][j])
#

for i in range(1,n+1):
  cbs += list(itt.combinations(lsts,i))
#print(cbs)

for i in range(len(cbs)):
  p = 0
  algs = [0]*m
  flg = True
  for j in range(len(cbs[i])):
    p += cbs[i][j][0]
    for k in range(m):
      algs[k] += cbs[i][j][k+1]
  for alg in algs:
    if alg < x:
      flg = False
  if flg and (minp == -1 or p < minp):
    minp = p
#

print(minp)






Measured memory_bytes: 68932
def main():
    N = int(input())
    S = input()
    mcount = 0
    for i in range(N):
        l = S[:i]
        r = S[i:]
        c = len(set.intersection(set(l), set(r)))
        if mcount < c:
            mcount = c
    print(mcount)
main()

Measured memory_bytes: 2940
n,m=map(int,input().split())
ans = set()
for i in range(m):
  a,b=map(int,input().split())
  if a == 1:
    if b in ans:
      print("POSSIBLE")
      break
    else:
      ans.add(b)
  if b == n:
    if a in ans:
      print("POSSIBLE")
      break
    else:
      ans.add(a)
else:
  print("IMPOSSIBLE")

Measured memory_bytes: 98608
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;
    
}

Measured memory_bytes: 256
unittest
{
	assert( [ "3 5",
	          ".....",
	          ".#.#.",
	          "....." ].parse.expand.solve == "11211\n1#2#1\n11211" );
	assert( [ "3 5",
	          "#####",
	          "#####",
	          "#####" ].parse.expand.solve == "#####\n#####\n#####" );
	assert( [ "6 6",
	          "#####.",
	          "#.#.##",
	          "####.#",
	          ".#..#.",
	          "#.##..",
	          "#.#..." ].parse.expand.solve == "#####3\n#8#7##\n####5#\n4#65#2\n#5##21\n#4#310" );
}



import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto hw = input.front.split.to!( long[] );
	auto sss = new char[][]( hw[ 0 ], hw[ 1 ] );
	foreach( ref ss; sss )
	{
		input.popFront;
		ss = input.front.strip.to!( char[] );
	}
	return tuple( hw[ 0 ], hw[ 1 ], sss );
}

auto solve( long h, long w, char[][] sss )
{
	foreach( y, ref ss; sss )
	{
		foreach( x, ref s; ss )
		{
			if( s == '#' ) continue;
			
			char mc = '0';
			
			if( 0 < y )
			{
				if( 0 < x     && sss[ y - 1 ][ x - 1 ] == '#' ) mc++;
				if( x < w - 1 && sss[ y - 1 ][ x + 1 ] == '#' ) mc++;
				if(              sss[ y - 1 ][ x     ] == '#' ) mc++;
			}
			
			if( y < h - 1 )
			{
				if( 0 < x     && sss[ y + 1 ][ x - 1 ] == '#' ) mc++;
				if( x < w - 1 && sss[ y + 1 ][ x + 1 ] == '#' ) mc++;
				if(              sss[ y + 1 ][ x     ] == '#' ) mc++;
			}
			
			if( 0 < x     && sss[ y     ][ x - 1 ] == '#' ) mc++;
			if( x < w - 1 && sss[ y     ][ x + 1 ] == '#' ) mc++;
			if(              sss[ y     ][ x     ] == '#' ) mc++;
			
			s = mc;
		}
	}
	
	return sss.join( "\n" );
}


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

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
    ll n, m;
    cin >> n >> m;
    ll res = m % n;
    if(res == 0) cout << m/n << endl;
    else{
        ll loop = m / n;
        ll ans = 1;
        for (ll i = 1; i <= loop; ++i) {
            ll target = m - i * (n - 1);
            if(target % i == 0) ans = i;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF 1000000007 //1000000000000000003
#define MOD 1000000007
#define MAX 2000005

#define ll long long

//printf("%.10f", );
//cout << fixed << setprecision(10) << heikin << endl;
//vector<vector<int>> data(3, vector<int>(4, -1));
//left + 1 < top

using namespace std;
using P = pair<long long, long long>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };
const double PI = 3.141592653589793;
long long fact[MAX], inv[MAX];
int dx[] = { -1,0,1,0 };
int dy[] = { 0,-1,0,1 };

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

vector<vector<int>> tree(100005);
int color[100005];
map<P, int>colorMap;
int m = 0;

struct BridgeInfo {
	int town1;
	int town2;
	int year;
	BridgeInfo(int t1, int t2, int y) {
		town1 = t1;
		town2 = t2;
		year = y;
	}
};

struct People {
	int index;
	int town;
	int year;
	People(int i, int t, int y) {
		index = i;
		town = t;
		year = y;
	}
};

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

struct UnionFind {
	vector<int>uf;
	
	UnionFind(int size) :uf(size, -1) {};

	int root(int target) {
		if (uf[target] < 0)return target;
		else return uf[target] = root(uf[target]);
	}

	void merge(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b)return;
		if (uf[b] < uf[a])swap(a, b);
		uf[a] += uf[b];
		uf[b] = a;
	}
};

ll CalcPow(ll num, ll power) {
	if (power == 0)return 1;
	if (power % 2 == 0) {
		ll half = CalcPow(num, power / 2);
		return (half * half) % MOD;
	}
	else return (num * CalcPow(num, power - 1)) % MOD;
}

ll combination(ll all, ll select) {
	if (all < select) return 0;
	if (all < 0 || select < 0) return 0;
	return fact[all] * (inv[select] * inv[all - select] % MOD) % MOD;
}

void initCombination(int max) {
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= max; ++i) {
		fact[i] = fact[i-1] * i % MOD;
	}

	inv[max] = CalcPow(fact[max], MOD - 2);
	for (int i = max - 1; 0 <= i; --i) {
		inv[i] = (inv[i + 1] * (i + 1)) % MOD;
	}
}

void dfs(int from) {
	int c = 1;
	for (auto t : tree[from]) {
		c = c != color[from] ? c : c + 1;
		color[t] = c;
		colorMap[make_pair(from, t)] = c;
		m = max(c, m);
		dfs(t);
		c++;
	}
}

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

	vector<int>a(N);
	int count = 1;
	for (int i = 0; i < N; ++i) {
		int A; cin >> A;
		if (count == A)count++;
	}

	int ans = count == 1 ? -1 : N - (count - 1);
	cout << ans << endl;
}

Measured memory_bytes: 3456
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class Main {

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

		int n = Integer.parseInt(br.readLine());

		for (int i = 1; i <= 9; i++) {
			for (int j = 1; j <= 9; j++) {
				if (i * j == n) {
					System.out.println("Yes");
					return;
				}
			}
		}

		System.out.println("No");

	}
}

Measured memory_bytes: 32704
a,b,c=map(int,input().split())
if a%2==1 or b%2==1 or c%2==1:
 print(0)
 exit()
cnt=1
while True:
 aa=a
 bb=b
 cc=c
 a=(bb+cc)/2
 b=(cc+aa)/2
 c=(aa+bb)/2
 if a%2==1 or b%2==1 or c%2==1:
  print(cnt)
  exit()
 elif a==b==c:
  print(-1)
  exit()
 else:
  cnt+=1

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
const long long INF = 1LL << 60;

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;
}

int main()
{   
    ll n,m; cin >> n >> m;
    vector<ll> a(n),b(n);
    vector<vector<ll>> c(n,vector<ll>(2));
    for(int i=0;i<n;i++){
        cin >> a[i] >> b[i];
        c[i][0] = a[i];
        c[i][1] = b[i];
    }
    sort(c.begin(),c.end());
    ll res = 0;
    ll count = 0;
    for(int i=0;i<n;i++){
        while(c[i][1] > 0){
            res += c[i][0];
            c[i][1]--;
            count++;
            if(count >= m){
                cout << res << endl;
                return 0;
            }
        }
    }
}
    

Measured memory_bytes: 7296