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

//関数
void display(vector<long> B){
    for(int i=0;i<B.size();i++){
        cout<<B.at(i)<<endl;
    }
    cout<<endl;
}


    
//main関数
int main() {
    
    
    //入力
    long N;
    cin>>N;
    vector<long> A(N);
    for(int i=0;i<N;i++){
        cin>>A.at(i);
    }
    
    
    
    
    
    //計算
    long sum=0,times=0;
    for(int i=0;i<N;i++){
        sum+=A.at(i);
    }
    if(sum%((N*(N+1))/2)!=0){
        cout<<"NO"<<endl;
        return 0;
    }else{
        times=sum/((N*(N+1))/2);
    }
    vector<long> B(N);
    B.at(0)=A.at(0)-A.at(N-1);
    for(int i=1;i<N;i++){
        B.at(i)=A.at(i)-A.at(i-1);
    }
    
    //display(B);
    //cout<<times<<endl;
    
    for(int i=0;i<N;i++){
        B.at(i)-=times;
    }
    
    //display(B);
    
    vector<long> C(N);
    for(int i=0;i<N;i++){
        if((0-B.at(i))%N!=0 ||(0-B.at(i))<0){
            cout<<"NO"<<endl;
            return 0;
        }
        C.at(i)=(0-B.at(i))/N;
    }
    //display(C);
    
    long sumC=0;
    for(int i=0;i<N;i++){
        sumC+=C.at(i);
    }
    if(sumC!=times){
        cout<<"NO"<<endl;
        return 0;
    }
    
    
    
    //出力
    cout<<"YES"<<endl;

}

Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
    double xa, xb, ya, yb;
    cin >> xa >> ya >> xb >> yb;

    double dd = (yb - ya) * (yb - ya) + (xb - xa) * (xb - xa);
    double d = sqrt(dd);

    printf("%.6f\n", d);

    return 0;
}

Measured memory_bytes: 3208
/*==============================================*\
Codeforces ID:    mdshihab
                                                  |
Name:     Md. Shihabul Minhaz                     |
Study:      CSE, JKKNIU                           |
Address:  Trishal, Mymensingh, Bangladesh         |
                                                  |
 mail:   mdshihabul20171@gmail.com                |
 FB  :   fb.com/mdshihabul.minhaz.7               |
 github: Shihabulminhaz                           |
stopstalk :  mdshihab                             |
                                                  |
@uthor   Md. Shihabul Minhaz (shihab)             |
\*===============================================*/


#include<bits/stdc++.h>
using namespace std;
#define fi(a) scanf("%d",&a);
#define fli(a) scanf("%ld",&a);
#define fll(a) scanf("%lld",&a);
#define pi(a) printf("%d\n",a);
#define ppi(i,a) printf("Case %d: %d\n",i,a);
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
void FI()
{
#ifndef ONLINE_JUDGE
    freopen("C:\\Users\\SHIHAB\\Desktop\\input.in","r",stdin);
#endif // ONLINE_JUDGE
}

int main()
{
    fast
    FI(); /// skip this line for compile
    int m,d,a,b;
    cin >> m >> d >> a >> b;
    if(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12 ){
        if(d==31) cout << 1 << endl;
        else cout << 0 << endl;
    }
    else if(m==2){
        if(d==28) cout << 1 << endl;
        else cout << 0 << endl;
    }
    else{
        if(d==30) cout << 1 << endl;
        else cout << 0 << endl;
    }
    return 0;
}



Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
const int maxn = 200010;
long long n, m;
int tem, cnt[maxn] = {0};
int read()
{
  int x = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * w;
}
inline void write(int x)
{
  static int sta[35];
  int top = 0;
  do {
    sta[top++] = x % 10, x /= 10;
  } while (x);
  while (top) putchar(sta[-- top] + 48);
}
int main()
{
    n = read();
    m = n;
    n --;
    while(n --) {
        tem = read();
        cnt[tem] ++;
    }
    for(int i = 1; i <= m; i ++) {
        printf("%d\n", cnt[i]);
    }
    return 0;
}

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

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
int p[10][10];
bool f[10][10];
using namespace std;
 
void ck(int x, int y){
  rep(i, 9){
    if(i != x && p[i][y] == p[x][y]) f[i][y] = f[x][y] = 1;
    if(i != y && p[x][i] == p[x][y]) f[x][i] = f[x][y] = 1;
  }
  FOR(i, 3 * (x / 3), 3 * ((x / 3) + 1)) FOR(j, 3 * (y / 3), 3 * ((y / 3)+1)){
    if(i == x && j == y) continue;
    if(p[i][j] == p[x][y])
      f[i][j] = f[x][y] = 1;
  }
} 
                        
int main(){
  int n;
  scanf("%d", &n);
  rep(i, n){
    if(i != 0) puts("");
    rep(i, 9) rep(j, 9) f[j][i] = 0;
    rep(i, 9) rep(j, 9)
      scanf("%d", &p[i][j]);
 
    rep(i, 9){
      rep(j, 9){
    ck(i, j);
    printf(f[i][j] ? "*":" ");
    printf("%d", p[i][j]);
      }
      puts("");
    }
  }
  return 0;
}

Measured memory_bytes: 3128
import Control.Monad
import qualified Data.IntMap as M

main :: IO ()
main = do
  (n:m:as) <- map read . words <$> getContents
  print $ solve n m as

solve :: Int -> Int -> [Int] -> Int
solve n m as = go mp0 m
 where
  mp0 = foldr (\a mp -> M.insertWith (+) a 1 mp) M.empty as

  go mp 0 = M.foldrWithKey (\k v acc -> k * v + acc) 0 mp
  go mp m = go mp1 (m - 1)
   where
    mp1 = case M.findMax mp of
      (k, 1) -> M.insertWith (+) (k `div` 2) 1 $ M.delete k mp
      (k, _) -> M.insertWith (+) (k `div` 2) 1 $ M.adjust pred k mp


Measured memory_bytes: 18812
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>
#include <math.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)
#define repv(x, arr) for (auto &x : arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a, b) make_pair(a, b)
#define pb(x) push_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 2147483600;
const ll infl = 1e17;

int main()
{
    int n;cin>>n;
    vll a(n);
    map<ll, ll> idx;
    rep(i, n){
        cin >> a[i];
        idx[a[i]] = i;
    }
    multiset<ll> exist;
    exist.insert(-1);
    exist.insert(n);
    ll ans = 0;
    repf(i,1,n+1){
        auto itr = exist.lower_bound(idx[i]);
        int l,r;
        r = *itr;
        itr--;
        l = *itr;
        exist.insert(idx[i]);
        ans += i * (r - idx[i]) * (idx[i] - l);
    }
    cout << ans << endl;
}


Measured memory_bytes: 23680
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

struct P {
    int a;
    int b;

    bool operator<(const P &another) const {
        if (a == another.a)
            return b > another.b;
        else
            return a < another.a;
    };
};

int main() {
    int N;
    cin >> N;
    vec<P> r(N), b(N);
    rep(i, N) cin >> r[i].a >> r[i].b;
    rep(i, N) cin >> b[i].a >> b[i].b;
    sort(all(r));
    sort(all(b));

    int ans = 0;
    rep(i,N){
        int ba = b[i].a,bb = b[i].b;

        int maxrb = -1;
        int maxj = -1;
        rep(j,N){
            int ra = r[j].a,rb =r[j].b;
            if(ba <= ra) break;
            if(bb <= rb) continue;
            if(rb > maxrb){
                maxrb = rb;
                maxj = j;
            }
        }
        if(maxj!=-1) {
            r[maxj].b = 300;
            ++ans;
        } 
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

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

func main() {
	c := make([][]int, 3)
	for i := 0; i < 3; i++ {
		c[i] = ReadInts(3)
	}
	s := 0
	ok := true
	for i := 0; i < 3; i++ {
		for j := 0; j < 3; j++ {
			s += c[i][j]
		}
	}
	if s%3 > 0 {
		ok = false
	}
	s /= 3
	for k := 0; k < 3; k++ {
		v := 0
		for i := 0; i < 3; i++ {
			j := (k + i) % 3
			v += c[i][j]
		}
		if s != v {
			ok = false
		}

		v = 0
		for i := 0; i < 3; i++ {
			j := (k - i + 3) % 3
			v += c[i][j]
		}
		if s != v {
			ok = false
		}
	}
	if ok {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1844
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

A, B, K = list(map(int, sys.stdin.readline().split()))

a = []
for k in range(1, min(A, B) + 1):
    if A % k == 0 and B % k == 0:
        a.append(k)
print(a[-K])


Measured memory_bytes: 13572
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
static const int MAX = pow(10, 5);
// chokudaiさんのまね
int main()
{
    int N, K;
    std::string S;
    scanf("%d %d", &N, &K);
    std::cin >> S;
    int ans = 0;
    std::vector<int> Nums;
    int now = 1; // 今見ている数 
    int cnt = 0; // nowが幾つ並んでいるか
    for (int i = 0; i < N; ++i)
    {
        if (S[i] == (char)('0' + now)) cnt++;
        else
        {
            Nums.push_back(cnt);
            now = 1 - now; // 見る数を切り替える(0 < -- > 1)
            cnt = 1;
        }
        
    }
    if (cnt != 0) Nums.push_back(cnt); //末尾まで連続していた場合も忘れずに格納する
    
    // 0で終わっていた場合、適当に一つ足す
    if (Nums.size() % 2 == 0) Nums.push_back(0);
    
    int Add = 2 * K + 1;

    for (int i = 0; i < Nums.size(); i += 2)
    {
        int tmp = 0;

        int left = i;
        int right = std::min(i + Add, (int)Nums.size());
        for (int j = left; j < right; j++)
        {
            tmp += Nums[j];
        }
        ans = std::max(tmp, ans);
    }

    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1020
H,W,K=map(int,input().split())
s=[list(i)for i in [input() for i in range(H)]]
a=2**H-1
b=2**W-1
count=0
ans=0
for niti in range(2**(H+W)-1):
    count=0
    for i in range(H):
        for j in range(W):
            if niti>>i&1:
                continue
            if niti>>j+H&1:
                continue
            if s[i][j]=="#":
                count+=1
    if count==K:
        ans+=1
print(ans)

Measured memory_bytes: 9092
bingo = []

for _ in range(3):
	bingo.extend(list(map(int, input().split(' '))))

# print(bingo)

n = int(input())

nums = []
for _ in range(n):
  nums.append(int(input()))
  
# print(nums)
flag = [False for _ in range(9)]
for n in nums:
  for i in range(9):
    if bingo[i] == n:
      flag[i] = True
      
# print(flag)

result = False
for i in [0, 3, 6]:
  if (flag[i] and flag[i+1] and flag[i+2]):
    result = True
    
for i in [0, 1, 2]:
  if (flag[i] and flag[i+3] and flag[i+6]):
    result = True
    
if (flag[0] and flag[4] and flag[8]):
    result = True
    
if (flag[2] and flag[4] and flag[6]):
    result = True
    
if result:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
import java.util.*;

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

    int A = sc.nextInt();
    int P = sc.nextInt();

    int sumP = A * 3 + P;

    int result = sumP / 2;

    System.out.println(result);
  }
}


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

using namespace std;

void __start__() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef MY
    freopen("/home/ainur/CLionProjects/wow/input.txt", "r", stdin);
    freopen("/home/ainur/CLionProjects/wow/output.txt", "w", stdout);
#else
#define endl '\n'
    //freopen("search.in", "r", stdin);
    //freopen("search.out", "w", stdout);
#endif
}

#define sz(x) (int)x.size()
#define yes cout<<"Yes\n"
#define  no cout << "No\n"
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ft first
#define sd second
#define read(a) for(auto &qwqw:a)cin >> qwqw;
#define print(a) for(auto qwqw:a)cout<<qwqw<<' ';
#define print_plus(a) for(auto qwqw:a)cout<<qwqw+1<<' ';
//#define FOR(i, b, n) for(int i=b;i<n;i++) #define FOR(i, n) FOR(i, 0, n) #define FOR(n) FOR(i, 0, n)
mt19937_64 rnd(time(0));
#define int long long
using ll = long long;
using vi = vector<int>;
using ld = long double;
using vb = vector<bool>;
using pii = pair<int, int>;
using vd = vector<long double>;


int log2(int q) {
    int c = 0;
    while (q) {
        q >>= 1;
        c++;
    }
    return c;
}


void test_case() {

}


signed main() {
    __start__();
    int n, s = 0, mx = 0;
    cin >> n;
    vi a(n);
    read(a);
    mx = a[0];
    for (int i = 1; i < n; ++i) {
        if (a[i] > mx) {
            mx = a[i];
        } else
            s += mx - a[i];

    }
    cout << s;
}

Measured memory_bytes: 4760
import sys
import collections

input = sys.stdin.readline

def chmax(a,b):
	if a>b : 
		return a
	return b

N,M = map(int, input().split())
lst_edge = [[] for _ in range(N)]
deg = [0]*N
for _ in range(M):
	x,y = map(int, input().split())
	lst_edge[x-1].append(y-1)
	deg[y-1] += 1

que = collections.deque()
for v in range(N):
	if deg[v] == 0:
		que.append(v)

dp = [0]*N

while que:
	v = que.popleft()
	for nv in lst_edge[v]:
		deg[nv] -= 1
		if(deg[nv] == 0):
			que.append(nv)
			dp[nv] = chmax(dp[nv], dp[v]+1)
print(max(dp))

Measured memory_bytes: 23036
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
// #define mod  1000000007
#define N 102
// #define MAX 200005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcount
#define PI acos(-1)
//#define endl "\n"
const int inf = (int)1e18 + 10;
vector < pair< pii , int > >  v;
int dp[1003][20004] = {{0}};
const int MAX = 20000;
bool cmp(pair < pii , int >  a , pair< pii , int > b){
    if(a.ff.ff + a.ff.ss  == b.ff.ff + b.ff.ss)
      return (a.ff.ss < b.ff.ss);
    else
    return (a.ff.ff + a.ff.ss < b.ff.ff + b.ff.ss);
  }
signed main(){
  fast;
  int n , ans = 0;
   cin >> n;
   v.resize(n);
   for(int i = 0 ; i < n ; i++){
        cin >> v[i].ff.ff >> v[i].ff.ss >> v[i].ss;
   }

   sort(v.begin() , v.end() , cmp);
   dp[0][v[0].ff.ff] = v[0].ss;
   for(int i = 1  ; i < n ; i++){
        for(int j = 0 ; j<=   MAX ; j++){
           dp[i][j] = max(dp[i][j] , dp[i-1][j]);
           if(j  <= v[i].ff.ss && j + v[i].ff.ff <= MAX){
            if(dp[i-1][j] > 0 || j == 0 )
               dp[i][j + v[i].ff.ff] = max(dp[i][j + v[i].ff.ff] , dp[i-1][j] + v[i].ss);
            
           }

           // cout << i << " " << j << " " << dp[i][j]<<endl;
          
        }
   }


   for(int i = 0 ; i<=MAX ; i++)
    ans = max(ans , dp[n-1][i]);

  cout << ans << endl;


}	

Measured memory_bytes: 156416
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main(void) {

	string s;

	cin >> s;

	for (int k = 0; k < s.size(); k++) {
		if (s.at(k) == '1') {
			s.at(k) = '9';
		}else if (s.at(k) == '9') {
			s.at(k) = '1';
		}
	}

	cout << s << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int H,W,i,j;

  scanf("%d %d",&H,&W);
 while( H != 0 || W !=0){
 for( j=1 ; j<=H ; j++){
  for( i=1 ; i<=W ; i++){

  printf("#");
 }
  printf("\n");
 }
  scanf("%d %d",&H,&W);
  printf("\n");
 }
 return 0;
}

Measured memory_bytes: 572
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int dp[100010];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int h[100100];
    rep(i, n) cin >> h[i];
    dp[1] = abs(h[0] - h[1]);
    rep(i, n - 2) {
        dp[i + 2] = min(dp[i + 1] + abs(h[i + 2] - h[i + 1]), dp[i] + abs(h[i + 2] - h[i]));
    }
    cout << dp[n - 1] << endl;

    return 0;
}


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

int main ()
{
  int x, a, b;

  cin >> x >> a >> b;

  int A, B;
  A = abs(x - a);
  B = abs(x - b);
  A < B ? cout << 'A' << endl : cout << 'B' << endl;

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int a,n,m,i,j,cnt,b;
	long long sum,s;
	scanf("%d %d %d",&a,&n,&m);
	cnt=0;
	i=0;
	while(1)	{
		sum=a+i;
		for(j=1;j<n;j++)	{
			sum=sum*(a+i);
		}
		if(sum>m)	break;
		b=0;
		s=sum;
		while(s>0)	{
			b+=s%10;
			s=s/10;
		}
		if(b==i && sum!=0)	{
			cnt++;
//			printf("%lld\n",sum);
		}
		i++;
	}
	printf("%d\n",cnt);	
	return 0;
}


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


int main(){
  int n; cin>>n;
  int arr[n]={0};
  int temp;
  for (int i = 0; i<n-1; i++){
      cin>>temp;
      arr[temp-1]++;
  }

  for (int i = 0; i<n; i++){
      cout<<arr[i]<<"\n";
  }

  return 0;
}


Measured memory_bytes: 4412
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		//条件分岐
		if((a + b == c) || (b + c == a) || (a + c == b)) {
			System.out.println("Yes");
			return;
		}else {
			System.out.println("No");
		}
	}

}


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

int main() {
  int N;
  cin >> N;
  
  int n2=1;
  while (n2*2 <= N) {
    n2 *= 2;
  }
  
  if (N == n2) {
    cout << "No" << endl;
    return 0;
  }
  
  cout << "Yes" << endl;
  
  if (N == n2*2-1) {
    for (int i=1; i<N*2; i++) {
      cout << i << " " << i+1 << endl;
    }
    return 0;
  }
      
  for (int i=1; i<n2-1; i++) {
    cout << i << " " << i+1 << endl;
    cout << i+N << " " << i+1+N << endl;
  }
  cout << n2-1 << " " << N+1 << endl;
  
  int nq;
  if ((N - n2 - 1) % 2 != 0) {
    cout << n2+2 << " " << n2 << endl;
    cout << 2 << " " << n2 << endl;
    cout << 2 << " " << n2+2+N << endl;
    cout << n2+2+N << " " << n2+N << endl;
    cout << n2+2+N << " " << n2+1+N << endl;
    cout << 1 << " " << n2+1 << endl;
    for (int i=n2+3; i<N; i++) {
      nq = (i) ^ (i+1);
      cout << i << " " << i+1 << endl;
      cout << nq << " " << i+1 << endl;
      cout << i+N << " " << nq << endl;
      cout << i+N << " " << i+1+N << endl;
      i++;
    }
  }
  else {
    for (int i=n2; i<N; i++) {
      nq = (i) ^ (i+1);
      cout << i << " " << i+1 << endl;
      cout << nq << " " << i+1 << endl;
      cout << i+N << " " << nq << endl;
      cout << i+N << " " << i+1+N << endl;
      i++;
    }
  }
  
  return 0;
}

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

int main() {
	string s;
	cin >> s;
	int a = 0;
	long long sum = 0;
	bool expectC = false;
	for(int i=0;i<s.size();i++) {
		if(expectC) {
			switch (s[i]) {
				case 'A':
					a = 1;
					break;
				case 'B':
					a = 0;
					break;
				case 'C':
					sum += a;
					break;
			}
			expectC = false;
		} else {
			switch (s[i]) {
				case 'A':
					a++;
					break;
				case 'B':
					expectC = true;
					break;
				case 'C':
					a = 0;
					break;
			}
		}
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-


def main():
    a, b = map(int, input().split())

    if a == 1:
        a += 13
    if b == 1:
        b += 13

    if a > b:
        print('Alice')
    elif a < b:
        print('Bob')
    else:
        print('Draw')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n, l = Is()
A = [l+i-1 for i in range(1, n+1)]
index = bisect_left(A, 0)
if index == n:
    m = A[-1]
else:
    m = A[index]
print(sum(A)-m)

Measured memory_bytes: 38396
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[60][2];
int a[60],n,P;
int main(){
	scanf("%d%d",&n,&P);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	dp[0][0]=1;
	for(int i=1;i<=n;++i){
		int x=a[i]%2;
		dp[i][0]=dp[i-1][0]+dp[i-1][(2-x)%2];
		dp[i][1]=dp[i-1][1]+dp[i-1][(1-x)%2];
	}
	printf("%lld",dp[n][P]);
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {

	var N, K int
	fmt.Scan(&N, &K)
	sl := make([]int, N)

	for i, _ := range sl{
		fmt.Scan(&sl[i])
	}
	var count int

	for i, _ := range sl {
		if K <= sl[i] {
			count++
		} else {

		}
	}
	fmt.Println(count)

}


Measured memory_bytes: 5504
let n, m, c = Scanf.scanf " %d %d %d" @@ fun a b c -> a, b, c
let bs = Array.init m @@ fun _ -> Scanf.scanf " %d" (+) 0
let a_ss = Array.init n @@ fun _ -> Array.init m @@ fun _ -> Scanf.scanf " %d" (+) 0
let f ans a_s =
  let s = ref c in for i = 0 to m - 1 do s := !s + a_s.(i) * bs.(i) done; ans + if !s > 0 then 1 else 0
let _ = Array.fold_left f 0 a_ss |> Printf.printf "%d\n"

Measured memory_bytes: 512
n = int(input())
m,a,r,c,h = 0,0,0,0,0
for i in range(n):
    b = input()
    if b.startswith("M"):m+=1
    if b.startswith("A"):a+=1
    if b.startswith("R"):r+=1
    if b.startswith("C") : c += 1
    if b.startswith("H") : h += 1
l = [m,a,r,c,h]
#print(l)
ans = 0
for i in range(5):
    for j in range(i+1,5):
        for m in range(j+1,5):
            ans += l[i]*l[j]*l[m]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//約数列挙(√N)
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
//素因数分解(√N)
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
//素数テーブル(NloglogN)
vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}
//二項係数(K)
template< typename T >
T binomial(int64_t N, int64_t K) {
  if(K < 0 || N < K) return 0;
  T ret = 1;
  for(T i = 1; i <= K; ++i) {
    ret *= N--;
    ret /= i;
  }
  return ret;
}
//二項係数テーブル(N^2)
template< typename T >
vector< vector< T > > binomial_table(int N) {
  vector< vector< T > > mat(N + 1, vector< T >(N + 1));
  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= i; j++) {
      if(j == 0 || j == i) mat[i][j] = 1;
      else mat[i][j] = mat[i - 1][j - 1] + mat[i - 1][j];
    }
  }
  return mat;
}

int main(){
  ll n;
  cin >> n;
  if(n%2==1)
    cout << 0 << endl;
  else{
    ll ans=0;
    n/=2;
    while(n!=0){
      n/=5;
      ans+=n;
    }
    cout << ans << endl;
  }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

bool used[114][114];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int n;
	cin>>n;
	int ans[114514][2];
	int cnt=0;
	FOR(i, 1, n){
		FOR(j, i+1, n+1){
			if(j==n-i+1-(n&1)){
				continue;
			}
			ans[cnt][0]=i;
			ans[cnt][1]=j;
			++cnt;
		}
	}
	cout<<cnt<<'\n';
	REP(i, cnt){
		cout<<ans[i][0]<<' '<<ans[i][1]<<'\n';
	}
	return 0;
}


Measured memory_bytes: 384
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

a,b,c = LI()
print(max(c-(a-b),0))


Measured memory_bytes: 5460
#include <bits/stdc++.h>
#define forna(i,a,n) for(int i=a;i<n;i++)
typedef long long int lli;
#define MOD 1000000007
using namespace std;
int fastexpo(int b, int exp){
    if(exp == 0) return 1;
    if(exp == 1) return b;
    int ans = (fastexpo(b,exp/2) % MOD);
    ans *= ans;
    ans %= MOD;
    if(exp % 2 == 1){
        ans *= b;
    }
    ans %= MOD;
    return ans;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli t,n,m;string s;
cin>>s;
n=s.length();
if(s[n-1]!='s')s+='s';
else {s+='e';s+='s';}
cout<<s<<endl;
}


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

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

  if (N % 1000 == 0){
    cout << "0" << endl;
  }
  else {
    cout << 1000 - (N - (N/1000)*1000) << endl;
  }
  return 0;
}

Measured memory_bytes: 3540
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
int main() {
  cout << fixed << setprecision(30);
 ll a,b,k;
  cin3(a,b,k);
  if(a<=k){
    ll t=a;
    a=0;
    k-=t;
    b=max(b-k,0ll);
    putout2(a,b);
  }
  else{
    a-=k;
    putout2(a,b);
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
  int n,C0=0,C1=0,C2=0,C3=0;
  string s;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s;
    if(s=="AC")C0++;
    else if(s=="WA")C1++;
    else if(s=="TLE")C2++;
    else if(s=="RE")C3++;
  }
  cout<<"AC x "<<C0<<endl;
  cout<<"WA x "<<C1<<endl;
  cout<<"TLE x "<<C2<<endl;
  cout<<"RE x "<<C3<<endl;
}

Measured memory_bytes: 3616
using System;

class ABC_140_B
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());

        string[] input = Console.ReadLine().Split(' ');
        int[] A = new int[N];
        for (int i = 0; i < N; i++)
        {
            A[i] = int.Parse(input[i]);
        }
        input = Console.ReadLine().Split(' ');
        int[] B = new int[N];
        for (int i = 0; i < N; i++)
        {
            B[i] = int.Parse(input[i]);
        }
        input = Console.ReadLine().Split(' ');
        int[] C = new int[N];
        for (int i = 0; i < N-1; i++)
        {
            C[i] = int.Parse(input[i]);
        }

        int before = int.MinValue;
        int ans = 0;
        for (int i = 0; i < A.Length; i++)
        {
            int number = A[i];
            ans += B[number-1];
            if(before == number-2)
            {
                ans += C[before];
            }
            before = number - 1;
        }

        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11092
// *** creator : cfmasterr *** //
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int ans = 0;
	vector<int> v;
	v.push_back(a[0] + a[1]);
	for (int i = 2; i < n; i++) {
		for (int k : v) {
			ans += (a[i] < k);
		}
		for (int j = 0; j < i; j++) {
			v.push_back(a[i] + a[j]);
		}
	}
	cout << ans << '\n';
  return 0;
}



Measured memory_bytes: 10604
import java.util.Scanner;

public class Main {
	static int MAX;
	static int MOD = 1000000007;

	static long[] fac, finv, inv;

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

		int X = Integer.parseInt(sc.next());
		int Y = Integer.parseInt(sc.next());

		sc.close();

		if ((2 * X - Y) % 3 == 0 || (-X + 2 * Y) % 3 == 0) {

		} else {
			System.out.println(0);
			return;
		}

		int x = X * 2 / 3 - Y / 3;
		int y = -X / 3 + Y * 2 / 3;

		MAX = x + y + 2;

		fac = new long[MAX];
		finv = new long[MAX];
		inv = new long[MAX];

		COMinit();
		System.out.println(COM(x + y, x));

		//		FastScanner fs = new FastScanner();
		//		int N = fs.nextInt();

	}

	static void COMinit() {
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		for (int i = 2; i < MAX; i++) {
			fac[i] = fac[i - 1] * i % MOD;
			inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
			finv[i] = finv[i - 1] * inv[i] % MOD;
		}
	}

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

}


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

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

using f64 = double;
using f128 = long double;

template <typename T> using Vec = vector<T>;
template <typename K, typename V> using HashMap = unordered_map<K, V>;
template <typename T> using HashSet = unordered_set<T>;
template <typename T> using PQueue = priority_queue<T>;

using StrView = string_view;

auto solve(i64 const A, i64 const B, i64 const N) -> void {
  i64 max = 0;
  if (N < B - 1) {
    max = A * N / B - A * (N / B);
  } else {
    i64 x = B - 1;
    max = A * x / B - A * (x / B);
  }
  cout << max << "\n";
}

auto main() -> int {
  i64 A;
  scanf("%" SCNd64, &A);
  i64 B;
  scanf("%" SCNd64, &B);
  i64 N;
  scanf("%" SCNd64, &N);
  solve(A, B, N);
  return 0;
}


Measured memory_bytes: 3724
/*
cat <<EOF >mistaken-paste
*/

#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>

#define BIG 2000000007
#define VERYBIG 200000000000007LL

#define MOD 1000000007
typedef uint64_t ull;
typedef  int64_t sll;


ull n, m;
ull h, w;
ull k;
ull q;
ull vua, vub, vuc, vud, vue, vuf;
sll vsa, vsb, vsc, vsd, vse, vsf;
long double vra, vrb, vrc;
double vda, vdb, vdc;
size_t slen;
size_t tlen;
char ch, dh;

ull primes[5][11111];
ull plen[5] = {0};

bool isprime(ull x) {
	sll i;
	for (i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

ull solve () {
	sll i, j, ki, li;
	ull result = 0;
	// sll result = 0;
	// double result = 0;
	// ull maybe = 0;
	sll maybe = 0;
	// ull sum = 0;
	sll sum = 0;
	ull item;
	ull *dpcell;

	for (i = 2; i <= 55555; i++) {
		if (isprime(i)) {
			primes[i % 5][plen[i % 5]] = i;
			plen[i % 5]++;
		}
	}

	// for (i = 0; i < 5; i++) {
	// 	printf("%lld: %llu\n", i, plen[i]);
	// }

	for (i = n - 1; i >= 0; i--) {
		printf("%llu%c", primes[1][i], (i ? ' ' : '\n'));
	}

	return 0;
}

int32_t main (void) {
	int32_t i, j;
	int32_t x, y;

	scanf("%llu", &n, &m);
	solve();

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1e18
int a,b,c;
signed main(){
	cin>>a>>b>>c;
	cout<<a*b/2<<endl;
	return 0;
}


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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define MODA 1000000007 

int main() {
    ll ans = 0;
    priority_queue<int> q;
    int n, m, a;
    cin >> n >> m;
    REP(i, n){
        cin >> a;
        q.push(a);
    }
    REP(i, m){
        q.push(q.top()/2);
        q.pop();
    }
    REP(i, n){
        ans += q.top();
        q.pop();
    }
    cout << ans << endl;
}

Measured memory_bytes: 892
# -*- coding: utf-8 -*-

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, M, L = MAP()
A = LIST()
B = LIST()

mn = min(A) + min(B)
for _ in range(L):
    x, y, c = MAP()
    x -= 1; y -= 1
    mn = min(mn, A[x] + B[y] - c)
print(mn)


Measured memory_bytes: 18864
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    int a,b;
    cin>>a>>b;
    int result = 0;
    while(a<=b){
        if(a/10000==a%10&&(a/1000)%10==(a/10)%10){
            result++;
        }
        a++;
    }
    cout<<result<<endl;
    return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    ($ttype:ty) => {
        {
            let mut input = String::new();
            let _= std::io::stdin().read_line(&mut input);
            input.trim().parse::<$ttype>().unwrap()
        }
    };

    ($($ttype:ty),*) => {
        {
            use std::io::BufRead;
            let mut input = String::new();
            let stdin = std::io::stdin();
            let _ = stdin.lock().read_line(&mut input);
            let mut iter = input.trim().split_whitespace();
            (
                $(iter.next().unwrap().parse::<$ttype>().unwrap(),)*
            )
        }
    };

    ($ttype:ty; $x:expr) => {
        {
            use std::io::BufRead;
            let mut input = String::new();
            let stdin = std::io::stdin();
            let _ = stdin.lock().read_line(&mut input);
            let v: Vec<$ttype> = input
                .trim()
                .split_whitespace()
                .map(|x| x.parse().unwrap())
                .collect();
            v
        }
    };

    ($ttype:ty; $x:expr; $y:expr) => {
        {
            use std::io::BufRead;
            let mut matrix = Vec::with_capacity($y);
            for _ in 0..$y {
                let mut input = String::new();
                let stdin = std::io::stdin();
                let _ = stdin.lock().read_line(&mut input);
                let v: Vec<$ttype> = input
                    .trim()
                    .split_whitespace()
                    .map(|x| x.parse().unwrap())
                    .collect();
                matrix.push(v);
            }
            matrix
        }
    };
}

fn main() {
    let (n, m) = input!(usize, usize);
    let mut edges: Vec<(usize, usize)> = Vec::with_capacity(m);
    let mut graph: Vec<Vec<bool>> = vec![vec![false; n+1]; n+1];
    for _ in 0..m {
        let (from, to) = input!(usize, usize);
        graph[from][to] = true;
        graph[to][from] = true;
        edges.push((from, to));
    }

    let mut cnt = 0;
    for &(from, to) in edges.iter() {
        graph[from][to] = false;
        graph[to][from] = false;
        let mut trail: Vec<bool> = vec![false; n+1];
        let mut stack: Vec<usize> = vec![1];
        while let Some(edge_from) = stack.pop() {
            trail[edge_from] = true;
            for (edge_to, &is_exits_path) in graph[edge_from].iter().enumerate() {
                if is_exits_path == true && trail[edge_to] != true && stack.contains(&edge_to) == false {
                    stack.push(edge_to);
                }
            }
        }
        if trail.iter().skip(1).any(|&x| x == false) {
            cnt += 1;
        }
        graph[from][to] = true;
        graph[to][from] = true;
    }
    println!("{}", cnt);
}

Measured memory_bytes: 4352
#include<stdio.h>

int main()
{
  int i, n;
  int fib[45];
  fib[0]=1;
  fib[1]=1;
  
  scanf("%d", &n);

  for(i = 2; i <= n; i++)
    {
      fib[i] = fib[i-1] + fib[i-2];
    }

  printf("%d\n", fib[n]);

  return 0;
}



Measured memory_bytes: 2108
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_left, bisect_right

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

S = set(A)
C = Counter(A)
cnt = 0
for s in S:
    if C[s] != s:
        if C[s] > s:
            cnt += C[s] - s
        else:
            cnt += C[s]
print(cnt)

Measured memory_bytes: 28828
#include <stdio.h>
int main(){

  int a,b,c,blank,tri=0,chokkaku=0,don=0,ei=0;

  while (1){

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

    if(b < c){

      blank=b;
      b=c;
      c=blank;

    }
    
    if(a < b){

      blank=a;
      a=b;
      b=blank;

    }

    if(a >= b+c){

      printf("%d %d %d %d\n",tri,chokkaku,ei,don);

      break;

    }

    tri++;

    if(a*a < b*b + c*c) ei++;
    if(a*a == b*b + c*c) chokkaku++;
    if(a*a > b*b + c*c) don++;

  }
    
  return 0;

}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

ll power(ll x, ll k, ll p){
    if (k==0) return 1;
    else if (k==1) return x%p;
    else if (k%2==0){
        ll a=power(x,k/2,p);
        return a*a%p;
    }
    else {
        ll a=power(x,k/2,p);
        a=a*a%p;
        return a*x%p;
    }
}

ll dp[2][1010];

int main() {
    ll N, M;
    cin >> N >>M;
    
    if (M==1){
        cout << 1<< endl;
    }
    else {
        int a=0;
        ll b=2;
        while (b<=1000){
            if (M%b==0){
                dp[0][a]=b;
                while (M%b==0){
                    M/=b;
                    dp[1][a]++;
                }
                a++;
            }
            b++;
        }
        if (M!=1){
            dp[0][a]=M;
            dp[1][a]=1;
            a++;
        }
        ll ans=1;
        if (a==0){
            cout << N << endl;
        }
        else {
            rep(i, 0, a){
                ll p=1;
                ll q=1;
                for (ll j=N ;j< dp[1][i]+N; j++){
                    p*=j;
                    p%=MOD;
                }
                for(ll j=1; j<dp[1][i]+1; j++){
                    q*=j;
                    q%=MOD;
                }
                ans*=(p*power(q, MOD-2, MOD)) % MOD;
                ans%=MOD;
            }
            cout << ans << endl;
        }
    }
}



Measured memory_bytes: 384
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

const int MOD = 1e9 + 7;

ll comb(int n, int r){
    static ll dp[4000][2005] = { 0 };
    if (dp[n][r] != 0)
        return dp[n][r];
    for (int i = 1; i <= n; i++)
        for (int j = 0; j <= i; j++){
            if (j == 0 || j == i)
                dp[i][j] = 1;
            else
                dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % MOD;
        }

    return dp[n][r];
}

ll getH(int num, int x){
    if(x == 0)
        return 1;
    return comb(num+x-1, num-1);
}
int main() {
    int n, k;
    cin >> n >> k;

    IFOR(i, 1, k){
        if(n-k-i+1 < 0){
            cout << 0 << endl;
            continue;
        }
        ll ans = 1;
        ans = (ans * getH(i, k-i)) % MOD;
        ans = (ans * getH(i+1, n-k-i+1)) % MOD;
        cout << ans << endl;
        
    }


    return 0;
}

Measured memory_bytes: 31616
#include <stdio.h>
#include <string.h>
#define LEN 100005

typedef struct pp{
	int t;
	char name[100];
}p;

p Q[LEN];

int head,tail,n;

void enqueue(p x){
	Q[tail] = x;
	tail=(tail+1)%LEN;
	}
	
p dequeue(){
	p x = Q[head];
	head = (head+1)%LEN;
	return x;
}

int min(int a,int b){
	return a<b? a:b;
}

int main(){
	int n,q;
	int els=0;
	p temp;
	scanf("%d %d",&n,&q);
	for(int i=1;i<=n;i++){
		scanf("%s",Q[i].name);
		scanf("%d",&Q[i].t);
	}
	 head=1,tail=n+1;
	
	while(head!=tail){
	 temp = dequeue();
	int c = min(temp.t,q);
	temp.t-=c;
	els+=c;
	if(temp.t>0){
		enqueue(temp);
	}else{
		printf("%s %d\n",temp.name,els);
	}
	}
	return 0;
}

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

public class Main {
    private void solve() {
        int N = sc.nextInt();
        int M = sc.nextInt();

        int left = 1, right = M + 1;
        while (left < right) {
            out.println(String.format("%d %d", left, right));
            ++left;
            --right;
        }

        left = M + 2;
        right = M * 2 + 1;
        while (left < right) {
            out.println(String.format("%d %d", left, right));
            ++left;
            --right;
        }
    }

    private static PrintWriter out;
    private static MyScanner sc;

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        private MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    public static void main(String[] args) {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        sc = new MyScanner();
        new Main().solve();
        out.close();
    }
}

Measured memory_bytes: 92348