akhauriyash/Code-Regression huggingface dataset:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


def divisors(m: int):
    i = 1
    div = []
    while i * i <= m:
        if m % i == 0:
            div.append(i)
            div.append(m // i)
        i += 1

    return list(set(div))

n = ni()
a = [0] + list(li())
b = [0]*(n+1)
ans = []
for i in range(n, 0, -1):
    into = False
    if b[i] % 2 != a[i]:
        b[i] += 1
        ans.append(i)
        into = True

    if into:
        bi_div = divisors(i)

        for divi in bi_div:
            b[divi] += 1

print(len(ans))
if len(ans) > 0:
    print(*ans)


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

#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                                                       \
    for(long long hoge = 0; (hoge) < (n); ++(hoge))                            \
    cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = LLONG_MAX / 2;
const ll MOD = 1e9 + 7;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    int inv[13] = {-1};
    ll N = S.length();
    ll dp[N + 1][13] = {};
    dp[0][0] = 1;
    for(ll i = 0; i < N; i++) {
        for(int j = 0; j < 13; j++) {
            if('0' <= S[i] && S[i] <= '9')
                dp[i + 1][j] = dp[i][(j - (S[i] - '0') + 13) % 13 * 4 % 13];
            else
                for(int k = 0; k < 10; k++) {
                    dp[i + 1][j] =
                        (dp[i + 1][j] + dp[i][(j - k + 13) % 13 * 4 % 13])
                        % MOD;
                }
        }
    }
    cout << dp[N][5] << endl;
    return 0;
}


Measured memory_bytes: 10704
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>*/
#define PII pair<int,int>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
#define maxn 400005
using namespace std;
//using namespace __gnu_pbds;
const double PI=acos(-1.0);
const double eps=1e-6;
struct Edge
{
	int to,nxt;
}edge[maxn];
bool vis[maxn];
int cnt,head[maxn],ans[maxn];
void addedge(int u,int v)
{
	edge[cnt].to=v;
	edge[cnt].nxt=head[u];
	head[u]=cnt++;
	return;
}
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
void bfs()
{
    queue<int>q;
    q.push(1);
    vis[1]=1;
    while(!q.empty()){
        int u=q.front();
        q.pop();
        for(int k=head[u];k!=-1;k=edge[k].nxt){
            int v=edge[k].to;
            if(!vis[v]){
                q.push(v);
                ans[v]=u;
                vis[v]=1;
            }
        }
    }
    return;
}
int main()
{
	//ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
	int n=read(),m=read();
	memset(head,-1,sizeof(head));
	for(int i=1;i<=m;i++){
        int u=read(),v=read();
        addedge(u,v);
        addedge(v,u);
	}
	bfs();
	for(int i=2;i<=n;i++){
        if(ans[i]==0){
            printf("No\n");
            return 0;
        }
	}
	printf("Yes\n");
	for(int i=2;i<=n;i++) printf("%d\n",ans[i]);
	return 0;
}


Measured memory_bytes: 9016
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i >= n; --i)
#define mod 1000000007
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<class T>void add(T &a, const T &b) { a = (a + b) % mod; }

int dp[1000][1000];
int main() {
  int H, W;
  cin >> H >> W;
  vector<string> a(H);
  rep(i, 0, H) cin >> a[i];
  dp[0][0] = 1;
  rep(i, 0, H) rep(j, 0, W) {
    if(a[i][j] == '#') continue;
    if(j + 1 < W && a[i][j + 1] == '.') add(dp[i][j + 1], dp[i][j]);
    if(i + 1 < H && a[i + 1][j] == '.') add(dp[i + 1][j], dp[i][j]);
  }
  cout << dp[H - 1][W - 1] << endl;
  return 0;
}


Measured memory_bytes: 5248
#include <math.h>
#include <stdio.h>
int n, sqrtN;
long long ans, d;
char buf[8], out[20];
k;
i;
s;
X;
int main() {
    s = read(0, buf, 8);
    for(;;) {
        k = buf[i++];
        if(k < '0') break;
        n = n * 10 + k - '0';
    }
    if(n == 1) {
        putchar(49);
    } else {
        const int sqrtN = sqrt(n);
        ans = -(long long)(sqrtN) * (sqrtN + 1) * (2 * sqrtN + 1) / 6;
        for(int i = 1; i <= sqrtN; ++i) {
            const int a = n / i;
            ans += ((long long)i * (i + a) * (a + 1 - i));
        }
        i = 20;
        do {
            out[--i] = ans % 10 + '0';
            ans /= 10;
        } while(ans);
        write(1, out + i, 20 - i);
    }
}


Measured memory_bytes: 1848
import java.util.*;
public class Main {
    public static void main(String[] args){
        Main start=new Main();
        start.start();

    }
    public Main(){
    }
    public void start(){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int N = sc.nextInt();
        int K=sc.nextInt();
        System.out.println(N-K+1);
        return;

    }
    int gcd (int a, int b) {
        int temp;
        while((temp = a%b)!=0) {
            a = b;
            b = temp;
        }
        return b;
    }
}

Measured memory_bytes: 22740
#include <iostream>
#include <stdlib.h>
#include <vector> //vector
#include <cmath>

#define rep(i, n) for(int i=0; i<(int)(n);i++)
#define all(x) (x).begin(), (x).end()
#define debug(a) if(flagdebug){cout << "debug (" #a "):" << endl << (a) << endl;}

typedef uint64_t ulint;
typedef int64_t lint;

using namespace std;



lint a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;

bool flagdebug = false;

int main(){
//////////////////////////////////////////////////////
    // flagdebug = true;

    cin >> a >> b >> c; 

    lint ans = c - (a - b);
    if(ans<0)ans = 0;

    cout <<  ans   << endl;


//////////////////////////////////////////////////////
// Ctrl + Opt + N to make
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

dif = []
ans = 0
tmp = 0
dsm = 0
for i in range(N):
    dif.append(A[i] - B[i])
    dsm += A[i] - B[i]
    if A[i] < B[i]:
        ans += 1
        tmp += B[i] - A[i]

if dsm < 0:
    print(-1)
else:
    dif.sort(reverse=True)
    i = 0
    while tmp > 0:
        tmp -= dif[i]
        i += 1
        ans += 1
    print(ans)


Measured memory_bytes: 18356
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}


using pll = pair<long long, long long>;
int N;
vector<pll> v;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    while (cin >> N) {
        v.resize(N);
        for (int i = 0; i < N; ++i) {
            long long a, l;
            cin >> a >> l;
            v[i] = {a - l, a + l};
        }

        sort(v.begin(), v.end(), [](pll a, pll b) {
                return a.second < b.second;});

        int res = 0;
        long long cur = -(1LL<<60);
        for (int i = 0; i < N; ++i) {
            if (cur > v[i].first) continue;
            ++res;
            chmax(cur, v[i].second);
        }
        cout << res << endl;
    }
}


















Measured memory_bytes: 1792
A = input()
B = input()
u = len(A)
v = len(B)
if u>v:
	print("GREATER")
elif v>u:
	print("LESS")
else:
	i , j=0 , 0
	while i<u:
		if A[i]>B[i]:
			print("GREATER")
			exit()
		elif A[i]<B[i]:
			print("LESS")
			exit()
		i=i+1
	print("EQUAL")
	exit()

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

#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long long ll;

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    vector<double> p;
    p.resize(n);

    for(auto &i:p) cin >> i;

    // dp[c][i] = probability of having i heads so far using first c coins

    double dp[n][n+1];
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1-p[0];
    dp[0][1] = p[0];
    for(int coin=1; coin < n; coin++){
        for(int numHeads=0; numHeads <= coin+1; numHeads++){
            if(numHeads == 0) dp[coin][0] = dp[coin-1][0] * (1-p[coin]);
            else{
                // having h heads for c coins is sum of having (h-1 heads + c-1 coins) * p(head this coin) + having (head heads + c-1 coins) * p(tails this coin)
                dp[coin][numHeads] = dp[coin-1][numHeads-1] * p[coin] + dp[coin-1][numHeads] * (1-p[coin]);
            }
        }
    }

    double ans = 0;

    for(int heads=0; heads <= n; heads++){
        int tails = n - heads;
        if(heads > tails){
            ans += dp[n-1][heads];
        }
    }

    cout.precision(10);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 70528
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
long long a[3001][3001];
long long dp[3001][3001][5];
int main(){
  ll r = 0;
  ll c = 0;
  ll n = 0;
  cin >> r >> c >> n;
  for(int i = 0;i < r;i++){
    for(int j = 0;j < c;j++){
      a[i][j] = 0;
    }
  }
  for(int i = 0;i < n;i++){
    ll ir = 0;
    ll ic = 0;
    ll iv = 0;
    cin >> ir >> ic >> iv;
    ir--;
    ic--;
    a[ir][ic] = iv;
  }
  
  for(int i = 0;i < 3000;i++){
    for(int j = 0;j < 3000;j++){
      for(int k = 0;k < 4;k++){
        dp[i][j][k] = 0;
      }
    }
  }
  
  if(a[0][0] != 0){
    for(int i = 1;i < 4;i++){
      dp[0][0][i] = a[0][0];//とる
    }
  }
  
  for(int i = 0;i < r;i++){
    for(int j = 0;j < c;j++){
      if(i == 0 && j == 0){
        continue;
      }
      
      if(i != 0){
        for(int k = 0;k < 4;k++){
          dp[i][j][k] = max((ll)dp[i][j][k],(ll)dp[i - 1][j][3]);//とらない
        }
        if(a[i][j] != 0){
          for(int k = 1;k < 4;k++){
            dp[i][j][k] = max((ll)dp[i][j][k],(ll)(dp[i - 1][j][3] + a[i][j]));//とる
          }
        }
    
      }
      if(j != 0){
        for(int k = 0;k < 4;k++){
          dp[i][j][k] = max((ll)dp[i][j][k],(ll)dp[i][j - 1][k]);//とらない
        }
        if(a[i][j] != 0){
          for(int k = 1;k < 4;k++){
            dp[i][j][k] = max((ll)dp[i][j][k],(ll)(dp[i][j - 1][k - 1] + a[i][j]));//とる
          }
        }
      }
    }
  }
  ll res = 0;
  res = dp[r - 1][c - 1][3];
  cout << res << endl;
  return 0;
}



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

int main() {
  int a,b;
  cin >> a >> b;
  
  int x = min(a,b);
  int X = max(a,b);
  
  for(int i=0;i<X;i++){
    
    cout << x;
  }
  
  cout << endl;
  
  
}

Measured memory_bytes: 3596
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
//const n = +input[0];
//const a = [];
//for(let i=0;i<n;i++){
//	a.push(input[i+1].split(" ").map((x:string):number=>+x));
//}

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);


const [a, b] = input[0].split(" ");

const bb = parseInt(b);
const aa = parseInt(a);
let ab:string = '';
let ba:string = '';
for (let i:number = 0; i< bb; i++){
    ab+=a;
}
for (let i:number = 0; i< aa; i++){
    ba+=b;
}

if(ab<ba){
    console.log(ab);
}else{
    console.log(ba);
}

Measured memory_bytes: 7372
package main

import "fmt"

func chmax(a *int, b int) {
	if *a < b {
		*a = b
	}
}

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

	sw := n * 3
	dp := make([][]int, n+1)
	for k := 0; k <= n; k++ {
		dp[k] = make([]int, sw+1)
	}
	for i := 0; i < n; i++ {
		for k := n - 1; k >= 0; k-- {
			for u := 0; u+(w[i]-w[0]) <= sw; u++ {
				chmax(&dp[k+1][u+(w[i]-w[0])], dp[k][u]+v[i])
			}
		}
	}
	ans := 0
	for k := 1; k <= n; k++ {
		wmax := W - w[0]*k
		if wmax >= 0 {
			for u := 0; u <= wmax && u <= sw; u++ {
				chmax(&ans, dp[k][u])
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 768
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << p.first << " " << p.second;
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll A, P;
  std::cin >> A >> P;

  ll ans = (A * 3 + P ) / 2;
  print(ans);
  return 0;
}


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


int main() {
	int a, b, c;
	int num_5=0;
	int num_7=0;

	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);

	if (a == 5){
		num_5 ++;
	}if (b == 5){
		num_5++;
	}if (c == 5){
		num_5++;
	}if (a == 7){
		num_7++;
	}if (b == 7){
		num_7++;
	}if (c == 7){
		num_7++;
	}
	
	if (num_5==2 && num_7 == 1){
		printf("YES\n");
	}else{
		printf("NO\n");
	}

	


	return 0;
}


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

int main(){
    string S, T; cin >> S >> T;
    int N=S.size();
    bool flag1=false; 
    for(int k=0; k<N;k++){
        bool flag2=true;
        for(int i=0; i<N; i++){
            if(S.at(i)!=T.at ((i+k)%N) ) flag2=false;
        }
        if(flag2) flag1=true;
    }
    if(flag1) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        n: usize, x: u64,
        m: [u64;n]
    }

    let mut mm = m;
    mm.sort();
    let rest = x - mm .iter().fold(0, |acc, &x| acc + x);
    println!("{}", mm.len() as u64 + rest / mm[0]);
}

Measured memory_bytes: 4352
import math

n, d = map(int, input().split())

count = 0
Xs = []
for i in range(n):
  x = [int(x) for x in input().split()]
  
  if i >= 1:
    for x_ in Xs:
      distance = 0
      for j in range(d):
        distance += (x[j] - x_[j]) ** 2
      distance = math.sqrt(distance)
      if distance == int(distance):
        count += 1
  Xs.append(x)
  
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std; 
  
int main(){
 int N,fb=0,tb=0,odd=0;
  
  cin>>N;
  vector<int> ln(N);

  for(int i=0;i<N;i++) cin>>ln.at(i); 

  

  for(auto it=ln.begin();it!=ln.end();++it){
  	if(*it%4==0) fb++;
  	if(*it%2==0) tb++;
	if(*it%2==1) odd++;
	}
  	

  	if(fb>=N/2){
      cout<<"Yes"<<endl;
    }else if(fb>=odd){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
 

}


Measured memory_bytes: 640
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		long[] x = new long[n];
		long[] y = new long[n];
		for(int i=0;i<n;i++) {
			x[i] = in.nextInt();
			y[i] = in.nextInt();
		}
		long ans = Integer.MAX_VALUE;
		for(int i=0;i<n;i++) {
			for(int j=i+1;j<n;j++) {
				long p = x[i]-x[j];
				long q = y[i]-y[j];
				int[] tree = new int[n];
				for(int k=0;k<n;k++) {
					tree[k] = k;
				}
				for(int a=0;a<n;a++) {
					for(int b=a+1;b<n;b++) {
						if((x[a]-x[b]==p&&y[a]-y[b]==q)||(x[a]-x[b]==-p&&y[a]-y[b]==-q)) {
							union(tree,a,b);
						}
					}
				}
				Set<Integer> set = new HashSet<>();
				for(int k=0;k<n;k++) {
					set.add(find(tree,k));
				}
				if(set.size()<ans) ans = set.size();
			}
		}
		System.out.println(n==1?1:ans);
		in.close();

	}
	
	//return root node idx O(a(N)) ( O(1)<O(a(N))<O(logN) )
	public static int find(int[] tree,int idx) {
		if(tree[idx]==idx) return idx;
		else return tree[idx] = find(tree,tree[idx]);
	}
	
	//union idx2 tree to idx1 tree O(a(N))
	public static void union(int[] tree,int idx1,int idx2) {
		int root1 = find(tree,idx1);
		int root2 = find(tree,idx2);
		tree[root2] = root1;
	}

}


Measured memory_bytes: 28084
x, y = map(int, input().split())
mod = 10 ** 9 + 7
h = (2 * x - y) / 3
v = x - 2 * h

if not v.is_integer() or v * h < 0:
    print(0)
    exit()


def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a


def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod


def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod


ans = comb(int(v + h), int(min(v, h)), mod)
print(ans % mod)



Measured memory_bytes: 3064
n=int(input())
def fct(x):
    res=[]
    sq=int(x**(1/2))+7
    if x%2==0:
        cnt=1
        while x%2==0:
            cnt*=2
            x//=2
        res.append(cnt)
    for i in range(3,sq,2):
        if x%i==0:
            cnt=1
            while x%i==0:
                cnt*=i
                x//=i
            res.append(cnt)
    if x>1:
        res.append(x)
    res=list(set(res))
    return res


#https://tex2e.github.io/blog/crypto/crt
from functools import reduce
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

def chinese_remainder(a, n):
    # a := [a1, a2, ..., ak]
    # n := [n1, n2, ..., nk]
    total = 0
    prod = reduce(lambda x, y: x*y, n)
    for n_i, a_i in zip(n, a):
        b_i = prod // n_i
        total += a_i * b_i * modinv(b_i, n_i)
    return total % prod

p=fct(2*n)
l=len(p)
bit=1<<l
k=10**20
for i in range(bit):
    f1=1;f2=1
    for j in range(l):
        if (i>>j)&1:
            f1*=p[j]
        else:
            f2*=p[j]
    tmp=chinese_remainder([0,-1],[f1,f2])
    if tmp:
        k=min(k,tmp)
print(k)


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

typedef long long ll;

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,l,n) for(int i=(l);i<=(n);i++)

template<class T>
using vt = vector<T>;
template<class T>
using vvt = vector<vector<T>>;

int main(){
    string a,b;
    cin >> a >> b;
    if(a.size() > b.size()) cout << "GREATER" << endl;
    else if(a.size() == b.size()) {
        if(a == b){
            cout << "EQUAL" << endl;
            return 0;
        }
        rep(i,a.size()){
            if(a[i] > b[i]){
                cout << "GREATER" << endl;
                return 0;
             }
            else if(a[i] < b[i]){
                 cout << "LESS" << endl;
                 return 0;
            }
        }
    }
    else cout << "LESS" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){
	int a;
	float b[10];
	char c[10][5];
	char d[]="JPY";
	cin>>a;
	for(int i=0;i<a;i++){
		cin>>b[i];
		scanf("%s",c[i]);
	}
	float y=0;
	for(int i=0;i<a;i++){
		if(strcmp(c[i],d)==0){
			y=y+b[i];
		}
		else{
			y=y+b[i]*380000.0;
		}
	}
	printf("%9.9lf\n",y);
	return 0;
}

Measured memory_bytes: 256
using System;

namespace Range
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine().Split(' ');
            var a = int.Parse(str[0]);
            var b = int.Parse(str[1]);
            var c = int.Parse(str[2]);

            if(a < b && b <c)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}



Measured memory_bytes: 15964
// 最後に食べるのを k としてみる。
// それ以外のものから選んでDPしてMAXを出して + Bi したら、i選択時のMAXが出る。
// その処理を k を全部振ると O(N^2T) になって間に合わない。
//
// 通常のDPでは、順番に1個ずつ、食べる、食べない、それぞれの場合でMAX値を
// 更新していく。なので i 番目まで処理が進んだ場合は、i までのものの内で最大値、ができている。
// これを利用すると、k よりも手前側の物を使ってのMAXがすでに求まっていることになる。
// なので、残りは k よりも向こう側の物だけを使ったMAX値が分かればいい。
// これは i を大きい順にDPを更新していけばOK。
// 
// それができれば、昇順DP[k][t1] と 降順DP[k][t2] の合計で、k 以外を使った場合のMAXが分かる。
// t1 と t2 は、t1 + t2 = T-1 となればいいので、時間を振って全部計算して最大値を見ればいい。
// O(NT) で分かる。

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPI(i,f,n) for(int i=(f);i<(n);++i)
using namespace std;
typedef long long ll;

ll dp1[3005][3005];
ll dp2[3005][3005];

int main() {
  ll N, T;
  cin >> N >> T;
  vector<int> A(N), B(N);
  REP(i,N) {
    cin >> A[i] >> B[i];
  }
  REP(i,N) {
    int k = N-i-1;
    REP( ti, T ) {
      if ( ti >= A[i]) dp1[i+1][ti] = max(dp1[i][ti-A[i]] + B[i], dp1[i][ti] );
      else dp1[i+1][ti] = dp1[i][ti];
      if ( k > 0 ) {
        if ( ti >= A[k]) dp2[k-1][ti] = max(dp2[k][ti-A[k]] + B[k], dp2[k][ti] );
        else dp2[k-1][ti] = dp2[k][ti];
      }
    }
  }
  ll ans = 0;
  REP(i,N) {
    REP(j,T-1) {
      ans = max( ans, dp1[i][j] + dp2[i][T-1-j] + B[i] );
    }
  }
//  REP(i,T) {
//    REP(j,N+1) {
//      printf("%3d ",dp[j][i]);
//    }
//    cout << endl;
//  }

  cout << ans << endl;
}


Measured memory_bytes: 141312
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for(int i = (int)(n); i>=0; --i)
struct fast_ios { fast_ios(){cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast_ios_;

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

    vector<bool> snuke(N);
    rep(i, K)
    {
        int d;
        cin >> d;
        rep(j, d)
        {
            int a;
            cin >> a;
            --a;
            snuke[a] = true;
        }
    }

    int ans=0;
    rep(i, snuke.size())
    {
        ans += snuke[i]==false ? 1 : 0;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <utility>
#include <string>

struct Dice
{
  int numbers[6];

  Dice (int n1, int n2, int n3, int n4, int n5, int n6) {
    numbers[0] = n1;
    numbers[1] = n2;
    numbers[2] = n3;
    numbers[3] = n4;
    numbers[4] = n5;
    numbers[5] = n6;
  }

  void move(char dir){
    if (dir == 'N') {
      setNum(numbers[1], numbers[0], numbers[2], numbers[5], numbers[3], numbers[4]);
    }
    if (dir == 'S') {
      setNum(numbers[4], numbers[5], numbers[2], numbers[0], numbers[3], numbers[1]);
    }
    if (dir == 'W') {
      setNum(numbers[2], numbers[4], numbers[5], numbers[1], numbers[0], numbers[3]);
    }
    if (dir == 'E') {
      setNum(numbers[3], numbers[4], numbers[0], numbers[1], numbers[5], numbers[2]);
    }
  }

  void roll(std::string dir){
    if (dir == "vertical") {
      setNum(numbers[1], numbers[0], numbers[2], numbers[5], numbers[3], numbers[4]);
    }
    if (dir == "horizontal") {
      setNum(numbers[0], numbers[2], numbers[1], numbers[3], numbers[4], numbers[5]);
    }
  }

  void setNum(int top, int north, int east, int south, int west, int bottom) {
    numbers[0] = top;
    numbers[4] = north;
    numbers[2] = east;
    numbers[1] = south;
    numbers[3] = west;
    numbers[5] = bottom;
  }

  void printDice() {
    std::cout << numbers[0] << " " << numbers[1] << " " << numbers[2] << " " << numbers[3] << " " << numbers[4] << " " << numbers[5] << "\n";
  }

  bool isSameDice(Dice dice) {
    for (int i = 0; i < 4; i++)
    {
      for (int j = 0; j < 4; j++)
      {
        if (dice.numbers[0] == numbers[0]
            && dice.numbers[1] == numbers[1]
            && dice.numbers[2] == numbers[2]
            && dice.numbers[3] == numbers[3]
            && dice.numbers[4] == numbers[4]
            && dice.numbers[5] == numbers[5]) {
              return true;
        }
        dice.roll("horizontal");
      }
      dice.roll("vertical");
    }
    move('E');
    for (int i = 0; i < 4; i++)
    {
      for (int j = 0; j < 4; j++)
      {
        if (dice.numbers[0] == numbers[0]
            && dice.numbers[1] == numbers[1]
            && dice.numbers[2] == numbers[2]
            && dice.numbers[3] == numbers[3]
            && dice.numbers[4] == numbers[4]
            && dice.numbers[5] == numbers[5]) {
              return true;
        }
        dice.roll("horizontal");
      }
      dice.roll("vertical");
    }
    return false;
  }
};

int main() {
  int n1, n2, n3, n4, n5, n6;
  std::cin >> n1 >> n2 >> n3 >> n4 >> n5 >> n6;
  Dice dice1(n1, n2, n3, n4, n5, n6);
  std::cin >> n1 >> n2 >> n3 >> n4 >> n5 >> n6;
  Dice dice2(n1, n2, n3, n4, n5, n6);
  if (dice1.isSameDice(dice2)) {
    std::cout << "Yes" << "\n";
  } else {
    std::cout << "No" << "\n";
  }
}


Measured memory_bytes: 3196
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
	
	public static void KochCurve(final int deep, final int n, double x1, double y1, double x2, double y2){
		final double x_diff = x2 - x1;
		final double y_diff = y2 - y1;
		
		final double x3_1 = x1 + x_diff / 3;
		final double y3_1 = y1 + y_diff / 3;
		final double x3_2 = x1 + 2 * x_diff / 3;
		final double y3_2 = y1 + 2 * y_diff / 3;
		final double x3_f = Math.cos(Math.toRadians(Math.toDegrees(Math.atan2(y_diff, x_diff)) + 60)) * (Math.sqrt(x_diff * x_diff + y_diff * y_diff) / 3) + x3_1;
		final double y3_f = Math.sin(Math.toRadians(Math.toDegrees(Math.atan2(y_diff, x_diff)) + 60)) * (Math.sqrt(x_diff * x_diff + y_diff * y_diff) / 3) + y3_1;
		
		if(deep == n - 1){
			System.out.printf("%.8f %.8f\n",   x1,   y1);
			System.out.printf("%.8f %.8f\n", x3_1, y3_1);
			System.out.printf("%.8f %.8f\n", x3_f, y3_f);
			System.out.printf("%.8f %.8f\n", x3_2, y3_2);
			//System.out.printf("%.8f %.8f\n",   x2,   y2);
		}else{
			KochCurve(deep + 1, n, x1, y1, x3_1, y3_1);
			KochCurve(deep + 1, n, x3_1, y3_1, x3_f, y3_f);
			KochCurve(deep + 1, n, x3_f, y3_f, x3_2, y3_2);
			KochCurve(deep + 1, n, x3_2, y3_2, x2, y2);
		}
	}
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		if(n == 0){
			System.out.printf("%.8f %.8f\n", 0.0, 0.0);
		}else{
			KochCurve(0, n, 0, 0, 100, 0);
		}
		System.out.printf("%.8f %.8f\n", 100.0, 0.0);
	}
	
	public static class Scanner {
	    private BufferedReader br;
	    private StringTokenizer tok;

	    public Scanner(InputStream is) throws IOException {
	        br = new BufferedReader(new InputStreamReader(is));
	    }

	    private void getLine() throws IOException {
	        while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }
	    }

	    private boolean hasNext() {
	        return tok != null && tok.hasMoreTokens();
	    }

	    public String next() throws IOException {
	        getLine(); return tok.nextToken();
	    }

	    public int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }
	    
	    public long nextLong() throws IOException {
	    	return Long.parseLong(next());
	    }
	    
	    public void close() throws IOException {
	        br.close();
	    }
	}

}

Measured memory_bytes: 36020
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <vector>

using namespace std;

typedef long long ll;
constexpr ll MOD = 1000000007LL;

int main(void) {
    vector<int> Q, R;
    int M, K;
    cin >> M >> K;
    if (M == 0) {
        if (K > 0) cout << -1 << endl;
        else cout << 0 << " " << 0 << endl;
    } else if (M == 1) {
        if (K >= 1) cout << -1 << endl;
        else cout << 0 << " " << 0 << " " << 1 << " " << 1 << endl;
    } else {
        if (K >= (1<<M)) cout << -1 << endl;
        else {
            for (int i=0;i<(1<<M);i++) Q.push_back(i);
            Q.erase(Q.begin()+K);
            R = Q;
            reverse(R.begin(), R.end());
            for (int i=0;i<Q.size();i++) cout << Q[i] << " ";
            cout << K << " ";
            for (int i=0;i<R.size();i++) cout << R[i] << " ";
            cout << K << endl;
        }
    }

    return 0;
}


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

int main()
{
    int n,k,a;
    cin>>n>>k;
    int arr[n];
    for(a=0;a<n;a++){
        cin>>arr[a];
    }
    sort(arr,arr+n);
    int sum=0;
    for(a=0;a<k;a++){
        sum+=arr[a];
    }
    cout<<sum;
    //cout << "Hello,World!\n";
    return 0;
}

Measured memory_bytes: 3600
/*******************************
 Author: i_o__o_i
 Created: Friday 2020-04-10
********************************/
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#pragma GCC optimization("Ofast")

using namespace std;
using namespace __gnu_pbds;

typedef     long long   ll;

#define     CS(x) cout << "Case " << x << ": ";
#define     _test int TC; cin >> TC; while(TC--)
#define     sq(x) ((x) * 1LL * (x))
#define     eb emplace_back
#define     pb push_back
#define     all(_n) _n.begin(), _n.end()
#define     rall(_n) _n.rbegin(), _n.rend()
#define     Clear(a, b) memset(a, b, sizeof(a))
#define     sp << ' ' <<
#define     endl "\n"
#define     nl cout << endl
#define     D(x) cout << #x << " >>>>>> " << x << endl;
#define     D2(x, y) cout << #x << " >>> " << x << " # " << #y << " >>> " << y << endl;
#define     DD cout << "--\n";
#define     dbg cout << "!!ERROR ERROR ERROR!!" << endl;
#define     show(x) cout << x << endl
#define     precision(n) cout << fixed << setprecision(n);
#define     exeTime(fun){clock_t start, end; start = clock(); fun; end = clock(); double time_taken = double(end - start) / double(CLOCKS_PER_SEC); cout << "Execution time: " << time_taken << " secs."; }
#define     F first
#define     S second
#define     mini(a, b) a = min(a, b)
#define     maxi(a, b) a = max(a, b)
#define     sz(x) int( x.size() )
#define     gcd(a, b) __gcd(a, b)
#define     lcm(a, b) (abs((a) * (b)) / gcd(a, b))
#define     getbit(n, i) (((n) & (1LL << i)) != 0)
#define     setbit0(n, i) ((n) & (~(1LL << i)))
#define     setbit1(n, i) ((n) | (1LL << i))
#define     kbits(n, k) ((n) & ((1LL << k) - 1))
#define     LSB(n) ((n) & (-(n)))
#define     MSB(n) (1LL << (int)log2(n))
#define     isPowOf2(n) ((n > 0) && (((n) & (n-1)) == 0))
#define     parity(a, b) (a&1 ^ b&1)
#define     cond(__C, __R1, __R2) (__C ? __R1 : __R2)

inline bool _equal(double a, double b) { return fabs(a-b) < 1e-9; }
template<typename T> void print (T t){ for(const auto &it : t) cout << it << ' '; nl; }
template<class T> inline T min(T a, T b, T c){ return min(min(a, b), c); }
template<class T> inline T max(T a, T b, T c){ return max(max(a, b), c); }
template <typename T>  using orderedSet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // order_of_key find_by_order

//mt19937 mrand(random_device{}());
//int rnd(int x) { return mrand() % x;}

const    double Pi = acos(-1.0);
const    int Mod = 1e9 + 7;
const    int Eps = 1e-9;
const    int Inf = 1 << 30;
const    int Maxx = 1e5 + 10;

/******************************[Code Starts Here]********************************/


void _case()
{
    ll a, b;
    cin >> a >> b;
    if(a >= b) show(min(b, (b - a%b), a%b));
    else show(min(a, b-a));
}

int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    _case();
    return 0;
}




Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

int A, B, C, D;

int main() {
  cin >> A >> B >> C >> D;

  if (B < C) {
    cout << 0;
  } else if (D < A) {
    cout << 0;
  } else {
    cout << min(B, D) - max(A, C);
  }
}


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

using namespace std;

#define int long long
#define N 100005



int32_t main()
{
    int l;
    cin>>l;

    vector < pair < pair < int , int > , int > > ans;

    int n = 1;
    int cur = 2, sum = 0;
    for(int i=1;i<=21;i++)
    {
        sum=cur;
        if( (cur*2) > l)
        {
            n = i;
            break;
        }
        cur*=2;
    }
    cur = 1;
    int pp = 1;
    n++;

    for(int i=1;i<=n-1;i++)
    {
        if(l%2!=0)
        {
            l--;
            ans.push_back({{i, n}, sum}); 
            sum+=cur;  
        }
        if(l==0)
            break;
        cur*=2;
        ans.push_back({{i, i+1}, pp});
        ans.push_back({{i, i+1}, 0});
        pp*=2;
        l/=2;
    }

    cout<<n<<" "<<ans.size()<<endl;
    for(int i=0;i<ans.size();i++)
    {
        cout<<ans[i].first.first<<" "<<ans[i].first.second<<" "<<ans[i].second<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
S = input()
RtoL = []
LtoR = []
for i in range(len(S)-1):
    if S[i] == 'R' and S[i+1] == 'L':
        RtoL.append(i+1)
    elif S[i] == 'L' and S[i+1] == 'R':
        LtoR.append(i+1)
LtoR.append(len(S))
LR_RL = [0]*(len(LtoR))
ans = [0]*len(S)
for i in range(len(LtoR)-1,-1,-1):
    LR_RL[i] = LtoR[i]-RtoL[i]
    if i-1 > -1:
        LtoR[i] = LtoR[i]-LtoR[i-1]
    k = LtoR[i]
    p = LtoR[i]//2
    z = RtoL[i]
    if k%2 ==0:
        ans[z] = p
        ans[z-1] = p
    else:
        if LR_RL[i]%2 == 0:
            ans[z] = p
            ans[z-1] = k-p
        else:
            ans[z] = k-p
            ans[z-1] = p


ans_str = ""
for i in range(len(ans)):
    ans_str += str(ans[i])
    ans_str += " "
    
print(ans_str[0:-1])

Measured memory_bytes: 9148
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
void dfs(int v, bool* flag, vector<vector<int> >& G, int t_from, int t_to){
  flag[v]=true;
  for(int i=0; i<G[v].size(); i++){
    int nx_v = G[v][i];
    if((v==t_from && nx_v==t_to) || (nx_v==t_from && v==t_to)) continue;
    if(!flag[nx_v]) dfs(nx_v, flag, G, t_from, t_to);
  }
}

int main(void)
{
    int N,M;cin>>N>>M;
    vector<vector<int> > G(N);
    std::vector<p> V;
    for(int i=0; i<M;i++){
      int a,b; cin>>a>>b;
      a--; b--;
      G[a].push_back(b); G[b].push_back(a);
      V.push_back(make_pair(a,b));
    }
    int ans =0; bool flag[51]; bool bridge=false;
    for(int i=0; i<M;i++){
      fill(flag, flag+51, false);
      dfs(0, flag, G, V[i].first, V[i].second);
      // cout<<i<<" ";
      for(int j=0;j<N;j++){
        if(!flag[j]) bridge=true;
        // cout<<flag[j]<<" ";
      }
      // cout<<endl;
      if(bridge) ans++;
      bridge = false;
    }

    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>
#include <cctype>
#include <cmath>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */

const int INF = 1 << 30;
const int mod = 1000000007;
const double pi = acos(-1); // cos(pi) = -1 <=> pi = arccos(-1)

/* global variables */
vector<int> dice(6);
/* function */

struct Dice{

  int s[6];

  void roll(char c){
    int b;
    if(c=='E'){
      b=s[0]; s[0]=s[3]; s[3]=s[5]; s[5]=s[2]; s[2]=b;
    }
    if(c=='W'){
      b=s[0]; s[0]=s[2]; s[2]=s[5]; s[5]=s[3]; s[3]=b;
    }
    if(c=='N'){
      b=s[0]; s[0]=s[1]; s[1]=s[5]; s[5]=s[4]; s[4]=b;
    }
    if(c=='S'){
      b=s[0]; s[0]=s[4];s[4]=s[5]; s[5]=s[1]; s[1]=b;
    }
  }

  int top() {
    return s[0];
  }

};

/* main */

int main(){
  Dice d;
  for(int i=0;i<6;i++) cin >> d.s[i];
  string s;cin >> s;
  for(int i=0;i<s.size();i++) d.roll(s[i]);
  cout << d.top() << endl;
  return 0;
}




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

#define io ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ll long long
#define ull unsigned long long
#define pii pair<ll, ll>
#define piii pair<ll, pair<ll, ll>>
#define debug(x) cout<<#x<<" = "<<x<<endl

using namespace std;
const int N = 200005;
ll t, n, m, k, q, a, b, x, y, ans, arr[N];
ll mod = 998244353;
string s;
bool vis[N];

int main() {
    io;
    t = 1;
//    cin >> t;
    while (t--) {
        cin >> s;
        s = (s == "ABC" ? "ARC" : "ABC");
        cout << s << endl;
    }
    return 0;
}
//  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second 
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define pp pair<ll,ll> 
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007 
#define slld(x) scanf("%lld",&x)
ll t = 1 ;
void solve()
{
    ll n , x ;
    cin >> n ; 
    vector<ll> v[n+1] ;
    rep( i , 0 , n ){
        rep( j , 1 , n ){
            cin >> x ;
            v[i+1].pb(x);
        }
        reverse(all(v[i+1]));
    }
    ll ans = 0 ;
    vector<ll> xyz , tmp ;
    rep( i , 1 , n + 1){
		xyz.pb(i);
	}
    while( 1 ){
        ll cur = 0 , f = 0 ;
        //cout << "ua\n";
        map<ll,ll> vis;
        tmp.clear();
        for(auto i : xyz ){
            if( sz(v[i])==0 || vis[i] == 1 || vis[v[i].back()] == 1 ) 
                continue;
            f = 1 ;
            if(v[v[i].back()].back()==i){
				tmp.pb(i);tmp.pb(v[i].back());
				vis[i]=vis[v[i].back()]=1;
				v[v[i].back()].pop_back();
                v[i].pop_back();
                cur++;
			}

        }
        if(cur==0 and f == 1 ){
            cout << -1 ;
            return ;
        }
        xyz.clear();
        for(auto u : tmp)
			xyz.pb(u);
        if(cur==0)break;
        ans++;
    }
    cout << ans ;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cin >> t ;
    while(t--){
        solve();
    }
    return 0 ;
}


Measured memory_bytes: 8320
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  input()
  vals = list(map(int, input().split()))
  s = 0
  b = sum(vals)

  for v in vals[:-1]:
    b -= v
    s += v * b

  print(s)


if __name__ == '__main__':
  main()


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

int main(){
  while(1){
    int data[101],i,j,k,result;
    int N,K; cin >> N >> K;
    if( N == 0 && K == 0 ) break;

    for( i = 0; i < N; i++ ) cin >> data[i];
  
    int maxv = -1;
    for( i = 0; i <= N-K; i++ ) {
      result = 1;
      for( j = i; j < i+K; j++ ) result *= data[j];
      maxv = max( result,maxv);
    }
    
    int maxv2 = -1;
    int result2;
    for( i = 0; i < N; i++ ){
      for( j = i+1; j < N; j++ ){
	swap( data[i],data[j] );
	for( k = 0; k <= N-K; k++ ) {
	  result2 = 1;
	  for( int l = k; l < k+K; l++ ) result2 *= data[l];
	  maxv2 = max( result2,maxv2 );
	}
	swap( data[i],data[j] );
      }
    }

    int ans = maxv2 - maxv;

    if( ans >= 0 ) cout << ans << endl;
    else cout << "NO GAME" << endl;
  }
  return 0;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

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

	ll a; cin >> a;
	double bb; cin >> bb;
	ll b = llround(100*bb);

	cout << a*b/100 << endl;

}



Measured memory_bytes: 3784
#include<bits/stdc++.h>
#define int long long
//#pragma gcc optimize("Ofast, unroll-loops")
//#pragma gcc target("sse, sse2, sse3, ssse3, sse4, popcnt, abm, mmx, avx, avx2, tune = native")

using namespace std;

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

    string a, b, c;
    int x, y;
    cin >> a >> b >> x >> y >> c;
    
    if (a == c)
        cout << x - 1 << ' ' << y << '\n';
    else
        cout << x << ' ' << y - 1 << '\n';

    return 0;
}

//      *   *  *****  *   *  *   *
//     *   *  *      **  *  *   *
//    *****  *****  * * *  *   *
//   *   *      *  *  **  *   *
//  *   *  *****  *   *   ***

//      ***** ***** *   * *     ***** *   * ***** *****
//        *  *   * *   * *       *   **  *   *   *   *
//       *  *   * ***** *       *   * * *   *   *****
//   *  *  *   *   *   *       *   *  **   *   *
//  ****  *****   *   ***** ***** *   *   *   *


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, d int
	fmt.Scan(&n, &d)
	if n%(1+d*2) == 0 {
		fmt.Print(n / (1 + d*2))
	} else {
		fmt.Print(n/(1+d*2) + 1)
	}
}


Measured memory_bytes: 1768