akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
//#pragma comment(linker,"/STACK:1024000000,1024000000")
//251103FD
//4008802802
//4008160009
//1175114440
using namespace std;
#define PB pop_back
#define PF pop_front
#define np next_permutation
#define eb emplace_back
#define pb push_back
#define bf push_front
#define mp make_pair
#define s second
#define f first
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
#define Foreach(it, a) for(__typeof((a).rbegin()) it=(a).rbegin(); it!=(a).rend(); it++)
#define forn(i, a) for(register int i=0; i<a; i++)
#define Forn(i, a) for(register int i=1; i<=a; i++)
#define memINF 127
#define all(x) x.begin(), x.end()
#define FAST ios::sync_with_stdio(false)

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<pi,int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef unsigned int uint;
typedef vector<vector<ll> > matrix;

inline int in() 
{
    int x=0, c;
    while((uint)((c=getchar())-48)>=10) 
        if(c=='-') 
            return -in();
    do 
    { x=(x<<3)+(x<<1)+(c^48); }
    while((uint)((c=getchar())^48)<10);
    return x;
}
inline int lcm(int a, int b){return a*b/__gcd(a, b);}

const int MAX=1e5+5;

int N, K, a, b, val[MAX], L[MAX], R[MAX];
vi e[MAX];

inline void Dfs(int x, int p)
{
    L[x]=-1e9-1, R[x]=1e9+1;
    if(val[x]!=-1)
        L[x]=R[x]=val[x];
    foreach(it, e[x])
        if(*it!=p)
        {
            Dfs(*it, x);
            if(L[*it]<-1e9/2)
                continue;
            if(L[x]<-1e9/2)
            {
                L[x]=L[*it]-1;
                R[x]=R[*it]+1;
                continue;
            }
            if(abs(L[x])%2==abs(L[*it])%2)
            {
                puts("No");
                exit(0);
            }
            L[x]=max(L[x], L[*it]-1);
            R[x]=min(R[x], R[*it]+1);
        }
    if(L[x]>R[x])
    {
        puts("No");
        exit(0);
    }
}

inline void Make(int x, int p)
{
    foreach(it, e[x])
        if(*it!=p)
        {
            if(val[*it]==-1)
            {
                if(L[*it]<=val[x]-1&&val[x]-1<=R[*it])
                    val[*it]=val[x]-1;
                else
                    val[*it]=val[x]+1;
            }
            Make(*it, x);
        }
    
}

int main()
{
    memset(val, -1, sizeof(val));
    N=in();
    Forn(i, N-1)
    {
        a=in(), b=in();
        e[a].eb(b);
        e[b].eb(a);
    }
    
    K=in();
    while(K--)
        a=in(), val[a]=in();
    
    Dfs(1, 0);
    
    puts("Yes");
    if(val[1]==-1)
        val[1]=L[1];
        
    Make(1, 0);
    Forn(i, N)
        printf("%d\n", val[i]);
    return 0;
}

Measured memory_bytes: 10752
N, M = map(int, input().split())
red = [0] * N
red[0] = 1
num = [1] * N
for _ in range(M):
    x, y = map(int, input().split())
    num[x - 1] -= 1
    num[y - 1] += 1
    if red[x - 1] == 1:
        red[y - 1] = 1
        if num[x - 1] == 0:
            red[x - 1] = 0
print(sum(red))

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

int main() {
  int h, w;
  cin >> h >> w;
  
  for (int i = 0; i < w + 2; i++)
    cout << "#";
  cout << endl;
  
  for (int i = 0; i < h; i++) {
    string s;
    cin >> s;
    cout << "#" + s + "#" << endl;
  }
  
  for (int i = 0; i < w + 2; i++)
    cout << "#";
  cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
        string n;
        cin >> n;
        if(n[2] == n[3]&&n[4]==n[5])
        {
                cout << "Yes"<< endl;
        }
        else
        {
                cout << "No" << endl;
        }
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int ans[] = new int[1000];
        int n = sc.nextInt();

        for(int i=0;i<n;i++){
            ans[i]=sc.nextInt();
        }
        
        for(int i =0;i<n;i++){
            System.out.print(ans[(n-1-i)]);
            if(i!=n-1)System.out.print(" ");
            else System.out.println("");
        }
        sc.close();
    }
}


Measured memory_bytes: 26112
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

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

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	S := sc.nextStr()
	// dp[i:ケタ][j:S以下確定] = 組み合わせ数
	var dp [100010][2]int
	dp[0][0] = 1
	for i := 1; i <= len(S); i++ {
		d := int(S[i-1] - '0')
		for j := 0; j < 2; j++ {
			if j == 0 {
				if d == 1 {
					// (1,0), (0,1)のパターン => 未確定
					dp[i][0] += dp[i-1][0] * 2
					dp[i][0] %= MOD
					// (0,0)のパターン => 確定
					dp[i][1] += dp[i-1][0]
					dp[i][1] %= MOD
				} else {
					// (0,0)のパターン => 未確定
					dp[i][0] += dp[i-1][0]
					dp[i][0] %= MOD
				}
			} else {
				dp[i][1] += dp[i-1][1] * 3
				dp[i][1] %= MOD
			}
		}
	}
	fmt.Fprintln(wtr, (dp[len(S)][0]+dp[len(S)][1])%MOD)
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
int main(void){
	int n;
	scanf("%d",&n);
	ll a[n];
	for(int i=0;i<n;i++)scanf("%lld",&a[i]);
	int ans=1;
	bool big=false,small=false,undefine=true;
	for(int i=0;i<=n-2;i++){
		if(a[i+1]>a[i]){
			if(undefine){
				big=true;
				undefine=false;
			}
			if(small){
				small=false;
				undefine=true;
				ans++;
			}
		}
		if(a[i+1]<a[i]){
			if(undefine){
				small=true;
				undefine=false;
			}
			if(big){
				big=false;
				undefine=true;
				ans++;
			}
		}
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 896
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,m;
	cin>>n>>m;
	vector<int> r1(n+1,0),rn(n+1,0);
	FOR(i,0,m){
		int a,b;
		cin>>a>>b;
		if(a==1)r1[b]=1;
		if(b==1)r1[a]=1;
		if(b==n)rn[a]=1;
		if(a==n)rn[b]=1;
	}
	FORQ(i,1,n){
		if(r1[i]&&rn[i]){
			cout<<"POSSIBLE";
			return 0;
		}
	}
	cout<<"IMPOSSIBLE";
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int A,B,C,X,Y;
	cin >> A >> B >> C >> X >> Y;
	
	//適当に大きい値をとっておく
	long long answer = 1000000000000000LL;
	
	//ハーフのピザをi枚買うとして考える(最大で200000枚まで買う可能性がある)
	for(int i = 0;i < 200010;i++){
		long long now = i * C;
		now += max(0,(X - (i/2))) * A;
		now += max(0,(Y - (i/2))) * B;
		answer = min(answer,now);
	}
	
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 256
// AtCoder template
// 見た奴全員saba!
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; ++i)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    vector<int> a(n); rep(i,n) cin >> a[i];
    map<int,int> m;
    int cnt = 0;
    rep(i,n){
        if(m[a[i]] == 0) cnt++;
        m[a[i]]++;
    }
    int evencnt = 0;
    for(auto i:m){
        if(i.second % 2 == 0) evencnt++;
    }
    if(evencnt % 2 == 0) cout << cnt << endl;
    else cout << cnt-1 << endl;
}

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

// UnionFind -- from here
struct UnionFind {
    vector<int> par;
    UnionFind(int n) : par(n, -1) {}
    int find(int x) {
        if (par[x] < 0) return x;
        return par[x] = find(par[x]);
    }
    bool unite(int x, int y) {
        int a = find(x);
        int b = find(y);
        if (a == b) return false;
        if (-par[a] < -par[b]) swap(a, b);
        par[a] += par[b];
        par[b] = a;
        return true;
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
    int size(int x) {
        return -par[find(x)];
    }
};
// UnionFind -- above here

int main() {
    int N, M, K;
    cin >> N >> M >> K;
    UnionFind uf(N);
    vector<int> deg(N, 0);
    rep(i, M) {
        int A, B;
        cin >> A >> B;
        --A; --B;
        uf.unite(A, B);
        deg[A]++;
        deg[B]++;
    }
    vector<vector<int>> to(N);
    rep(i, K) {
        int C, D;
        cin >> C >> D;
        C--; D--;
        to[C].push_back(D);
        to[D].push_back(C);
    }
    rep(i, N) {
        int ans = uf.size(i);
        --ans;
        ans -= deg[i];
        for (int v : to[i]) if (uf.same(v, i)) --ans;
        printf("%d%c", ans, i < N-1 ? ' ' : '\n');
    }
}

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

using namespace  std;


int main() {
	int n, k, q;
	cin >> n >> k >> q;

	vector<int> a(n);
	int aa;
	for (int i = 0; i < q; i++) {
		cin >> aa;
		a.at(aa - 1) += 1;
	}

	for (int i = 0; i < n; i++) {
		if (k - q + a.at(i) > 0) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define pii pair<ll,ll > 
#define mod 998244353
ll power(ll a,ll b){
    ll res=1;
    while(b>0){
        if(b%2!=0) res=(res*a)%mod;
        a=(a*a)%mod;
        b/=2;
    }
    return res;
}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a;
    string str;
    cin>>a>>str;
    if(a>=3200) cout<<str;
    else cout<<"red";
    return 0;
}


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

int main() {
    long long n, h, w;
    cin >> n >> h >> w;
    long long ans = 0;
    while(n--){
        long long a, b;
        cin >> a >> b;
        if(h <= a && w <= b) ans++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3580
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 05/02/20 20:07:37
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n,m; cin>>n>>m;
  vector<pair<int,int>> ans;
  for (int i = 0; i < m/2; i++) {
    ans.emplace_back(m/2-i, m/2+2+i);
  }
  for (int i = 0; i < (m+1)/2; i++) {
    ans.emplace_back(n-(m+1)/2-i, n-(m+1)/2+1+i);
  }
  for (auto a:ans)
    cout<<a.first<<" "<<a.second<<endl;

  return 0;
}


Measured memory_bytes: 4208
#include<bits/stdc++.h>
#define ll long long
#define fast_i_o ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
int main()
{
    string s,s1;
    cin>>s;
    cin>>s1;
    string t="";
    for(int i=0;i<s1.length()-1;i++)
        t+=s1[i];
    if(t==s)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}


Measured memory_bytes: 3600
//   //  /////       ///      
//  //   //  //     // //     
// //    //   //   //   //    
////     //   //  //     //   
// //    //   //  /////////    
//  //   //  //   //     //    
//   //  /////    //     //    

#include <bits/stdc++.h>
using namespace std;
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define iter(it,a,b) for(a::iterator it=b.begin(); it!=b.end();++it)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (binary me 1 kitne hai) (if longlong popcount ll)
#define ln "\n"
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define dbg2(x,y) cerr<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define dbgstl32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it<<ln;} cerr<<endl
#define dbgstlp32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it.fi<<" , "<<it.se<<ln;} cerr<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(n) n.begin() , n.end() 
#define tfi first.first
#define tse first.second
#define tth second
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
typedef pair< pair<int,int> , int> tri;
typedef vector<bool> vbool;
typedef priority_queue<p32> pq32;
typedef priority_queue<p32, vector<p32>, greater<p32> > pq32l;

#pragma GCC optimize ("-O2")
const ll LIM = 2e5+5;
const ll MOD = 1e9+7;
const ll inf = 1e10;



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

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

	int T = t.length();
	int S = s.length();

	ll dp[S+1][T+1];

	forn(i,S+1) forn(j,T+1) dp[i][j] = 0;

	forn(i,S){
		forn(j,T){
			if(s[i]==t[j]){
				dp[i+1][j+1] = dp[i][j]+1;
			}
			else{
				dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
			}
		}
	}

	vector<char> k;

	if(dp[S][T]==0) cout << ' ';
	else{
		int i = S, j = T;

		while(i!=0 && j!=0){
	//		cout << i << " " << j << ln;
			if(dp[i][j] == dp[i-1][j]) i--;
			else if(dp[i][j] == dp[i][j-1]) j--;
			else if(dp[i][j] == dp[i-1][j-1] + 1){
				k.pb(s[i-1]);
	//			cout << i << " " << j << "hoo" << ln;
				i--;
				j--;
			}
		}
	}

	for(int ab = (int)k.size(); ab>0; ab--) cout << k[ab-1];

}


Measured memory_bytes: 70656
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int N;
struct S{
	int index;
	int num;
	bool operator <(const S& x)const{
		return num<x.num;
	}
}A[maxn];

int main()
{
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>A[i].num;
		A[i].index=i+1;
	}
	sort(A,A+N);
	for(int i=0;i<N;i++)
        cout<<A[i].index<<' ';
    cout<<endl;
	
	
	return 0;
}

Measured memory_bytes: 1536
def solve():
    x, n = map(int, input().split(" "))
    if n == 0 :
        return x
    if x < 0 :
        return x-1
    elif x >= 102 :
        return x-1
    
    used = [False]*102
    for p in map(int, input().split(" ")):
        used[p]=True
    
    _min = float('inf')
    ans = 0
    for i in range(0, 102):
        if used[i] :
            continue
        if abs(i-x) < _min :
            _min = abs(i-x)
            ans = i
    
    return ans

print(solve())

Measured memory_bytes: 9232
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
const int maxn=200005;
typedef long long int ll;
int aa[maxn];
int main(){
	int n;
	scanf("%d",&n);
	rep(i,1,n)scanf("%d",aa+i);
	rep(i,1,n)aa[i]-=i;
	sort(aa+1,aa+n+1);
	ll ans=0;
	rep(i,1,n)ans+=abs(aa[n/2+1]+0ll-aa[i]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;
public class Main{
	static String TemMatch(int p, int q, String[] s, String[] t){
		for(int i=0; i<=p-q; i++){
			for(int j=0; j<=p-q; j++){
				if(s[i].substring(j, j+q).equals(t[0])){
					if(q==1)return "Yes";
					for(int k=1; k<q; k++){
						if(!s[i+k].substring(j,j+q).equals(t[k]))break;
						if(k==q-1)return "Yes";
					}
				}
			}
		}
		return "No";
	}

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

Measured memory_bytes: 23636
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h1 = sc.nextInt();
        int m1 = sc.nextInt();
        int h2 = sc.nextInt();
        int m2 = sc.nextInt();
        int k = sc.nextInt();

        int h = h2 - h1;
        int m = (h * 60 + m2) - m1;
        int ret = m - k;
        System.out.printf(String.valueOf(ret));
    }
}


Measured memory_bytes: 35732
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
int book;
int main()
{
	string s1;
	cin>>s1;
	for(int i=0;i<s1.size();i++)
	{
		if(s1[i]=='C')
		book=1;
		if(s1[i]=='F'&&book)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <vector>
using namespace std;

int main() {
	int ans = INT_MAX, sum;
	size_t N;
	cin >> N;
	vector<int> a(N);
	for (auto& x : a) cin >> x;
	for (int i = -100; i <= 100; ++i) {
		sum = 0;
		for (auto&x : a) sum += (x - i) * (x - i);
		ans = min(ans, sum);
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> p;
	p.resize(n);
	int i;
	for(i=0;i<n;i++)
		cin>>p[i];
	int ans = 0;
	for(i=1;i<(n-1);i++)
	{
		if(((p[i]<p[i-1])&&(p[i]>p[i+1]))||((p[i]>p[i-1])&&(p[i]<p[i+1])))
			ans++;
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 256
#![allow(unused)]

use std::cmp;
use std::io::{self, BufRead};
use std::iter;

macro_rules! destruct_ {
  ($e: expr, ()) => (
    //assert!($e.next().is_none())
  );
  ($e: expr, ($arg: ident, $( $args: ident )*)) => (
    $arg = $e.next().unwrap();
    destruct_!($e, ($($args)*))
  );
  ($e: expr, ($arg: ident $( $args: ident )*)) => (
    $arg = $e.next().unwrap();
    destruct_!($e, ($($args)*))
  );
}

macro_rules! split {
  ($e: expr, ($($name: ident)*)) => {
    let mut iter = $e.into_iter();
    destruct_!(iter, ($($name)*));
  }
}

macro_rules! gets {
  ($id: ident) => (
    let stdin = io::stdin();
    $id = Vec::new();
    for line in stdin.lock().lines() {
      $id.push(
        line
          .unwrap()
          .split_whitespace()
          .map(|a| a.parse().unwrap())
          .collect()
      );
    }
  )
}

macro_rules! get {
  ($id: ident) => (
    let stdin = io::stdin();
    $id = Vec::new();
    for line in stdin.lock().lines() {
      $id.push(
        line
          .unwrap()
          .parse().unwrap()
      );
    }
  )
}

macro_rules! p {
  ($a: expr) => (
    println!("{}", $a);
  )
}

macro_rules! pp {
  ($a: expr) => (
    println!("{:?}", $a);
  )
}

fn main() {
  let mut argss: Vec<Vec<i32>>;
  let mut a;
  let mut b;
  let mut c;
  gets!(argss);
  split!(argss[0].clone(), (a b c));

  let r = if a >= b && a >= c {
    b + c
  } else if b >= a && b >= c {
    a + c
  } else if c >= a && c >= b {
    a + b
  } else {
    a + b
  };

  p!(r);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

int n,x;
int a[100010];

int main() {
    scanf("%d%d",&n,&x);
    for (int i=0;i<n;i++) scanf("%d",a+i);
    ll eat=0;
    for (int i=0;i<n-1;i++) {
        if (a[i]+a[i+1]>x) {
            int ex=a[i]+a[i+1]-x;
            eat+=ex;
            if (a[i+1]>=ex) {
                a[i+1]-=ex;
            } else {
                a[i+1]=0;
            }
        }
    }
    printf("%lld\n",eat);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, x;
    cin >> n >> x;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll ans = abs(a[0] - x);
    rep(i, n) {
        ans = __gcd(ans, abs(a[i] - x));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int ans=0;
    cin >> n;
    for(int i = 1;i <= n;i++){
    	int x;
    	cin >> x;
    	if(i % 2 && x % 2)
    		ans++;
	}
	cout << ans << endl;
    return 0;
}

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

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

	int dp[n+1]={0};
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	for(int i=2;i<n;i++){
		dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),abs(a[i]-a[i-2])+dp[i-2]);
		
	}

	cout<<dp[n-1]<<endl;
}


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

// 💖 Hi, thanks for using ICIE! 💖
// 🔧 To use a custom code template, set it in Settings(Ctrl+,) in "Icie Template List" entry 🔧
// 📝 If you spot any bugs or miss any features, create an issue at https://github.com/pustaczek/icie 📝

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

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

    int cnt = 0;
    for(int i = 0; i < n-2; ++i)
    {
        if(v[i] < v[i+1] && v[i+1] < v[i+2])
            cnt++;
        else if(v[i] > v[i+1] && v[i+1] > v[i+2])
            cnt++;
    }
    std::cout<<cnt<<endl;
}


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

const ll INF = 1LL << 60;

struct Edge {
    int from;
    int to;
    int cost;
    Edge(int f, int t, int c) : from(f), to(t), cost(c) {}
};

bool BellmanFord(vector<Edge> &E, vector<ll> &D, int V, int S) {
    D.resize(V, -INF);
    D[S] = 0;

    REP(i, 0, V) {
        for (auto e : E) {
            if (D[e.from] == -INF) continue;
            if (D[e.to] < D[e.from] + e.cost) {
                D[e.to] = D[e.from] + e.cost;
            }
        }
    }


    int inf[V] = {};
    vector<ll> dist(D.size());
    copy(D.begin(), D.end(), dist.begin());
    REP(i, 0, V) {
        for (auto e : E) {
            if (dist[e.from] == -INF) continue;
            if (dist[e.to] < dist[e.from] + e.cost) {
                dist[e.to] = dist[e.from] + e.cost;
                inf[e.to] = true;
            }
            if(inf[e.from]) inf[e.to] = true;
        }
    }


    return !inf[V - 1];
}

int main() {
    int N, M; cin >> N >> M;
    vector<Edge> E;
    REP(i, 0, M) {
        int a, b, c; cin >> a >> b >> c;
        E.push_back(Edge(--a, --b, c));
    }

    vector<ll> D;
    bool ok = BellmanFord(E, D, N, 0);
    if (ok) {
        cout << D[N - 1] << endl;
    } else {
        cout << "inf" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)

pair<vector<ll>, ll> check(vector<ll> v, ll k){
    ll ans = 0;
    FOR(i,0,3)if(v[i] == k)ans++;
    FOR(i,0,3)if(v[i] == k){
        v[i]++;
        break;
    }
    sortAl(v);
    return pair<vector<ll>, ll>(v,ans);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<ll> color(3);
    ll ans = 1;
    ll MOD = 1e9+7;
    FOR(i,0,n){
        ll in;
        cin>>in;
        pair<vector<ll>,ll> p;
        p = check(color,in);
        color = p.first;
        ans = (ans*p.second)%MOD;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pii pair<int,int>
const long long MOD=1e9+7;

int main() {
  int n;
  cin>>n;
  map<string,long long> b;
  {
    rep(i,n){
      string s;
      cin>>s;
      sort(s.begin(),s.end());
      b[s]++;
    }
  }
  long long ans=0;
  for(auto p:b) ans+=p.second*(p.second-1)/2;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 11136
#include<stdio.h>
#include<string.h>

int main() {
	int n, i, flg;
	if (scanf("%d", &n) == 0) return 1;
	flg = 0;
	for (i = 0; i <= n / 7; i++) {
		if ((n - i * 7) % 4 == 0) {
			flg = 1;
			break;
		}
	}
	printf(flg ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  vector<int>p(n+1);
  for(int i=1;i<n+1;i++){
    cin >> p.at(i);
  }
  vector<int>m(n+1);
  int x=n+1,cnt=0;
  for(int i=1;i<=n;i++){
    m.at(i)=min(x,p.at(i));
    x=m.at(i);
  }
  for(int i=1;i<=n;i++){
    if(m.at(i)==p.at(i)){
      cnt++;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
int main(void)
{
    char word[1000][33];
    int max_length=0;
    int index_max_length;
    int i,j;
    int count_appear[1000]={0};//荳区?譛ェ蜀呎署遉コsubscripted value neither array nor vector
    int index_most_appear;
    while(scanf("%s",word[i])!=EOF)
    {
        if(strlen(word[i])>max_length)
        {
            max_length=strlen(word[i]);
            index_max_length=i;
        }
        for(j=0;j<i;j++)
        {
            if(strcmp(word[i],word[j])==0)
            {
                count_appear[j]++;
                i--;
                break;
            }
        }
        i++;
    }
    for(j=0,index_most_appear=0;j<i;j++)
    {
        if(count_appear[index_most_appear]<count_appear[j])
            index_most_appear=j;
    }
    printf("%s %s\n",word[index_most_appear],word[index_max_length]);

    return 0;
}

Measured memory_bytes: 572
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] a) {
		Scanner sc = new Scanner(System.in);
		int[] mountainHigh = new int[10];
		for (int i = 0; i < 10; i++) {
			mountainHigh[i] = sc.nextInt();
		}
		Arrays.sort(mountainHigh);
		for (int i = 9; i > 9 - 3; i --) {
			System.out.println(mountainHigh[i]);
		}
	}
}

Measured memory_bytes: 17308
import sys
N, H = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

attack = 0

FWA = max(A)
B.append(0)
B.sort()

while True: 
    D = B.pop()
    if FWA >= D:
        break
    H -= D
    attack += 1
    if H <= 0:
        print(attack)
        sys.exit()

attack += H // FWA
if H % FWA > 0:
    attack += 1

print(attack)

Measured memory_bytes: 11324
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<utility>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int,int>

struct edge {int to, number;};



int main(){
    int n;
    cin >> n;
    vector<edge> G[n];
    rep(i, n-1) {
        edge g;
        int a, b;
        cin >> a >> b;
        a--; b--;
        g.to = b;
        g.number = i;
        G[a].push_back(g);
        g.to = a;
        G[b].push_back(g);
    }
    int color[n-1];
    fill(color, color + n - 1, 0);

    queue<P> q;
    q.push(P(0,0));
    int ans = 0;
    while(q.size() > 0){
        P e = q.front();
        q.pop();
        int u = e.first;
        int col = e.second;
        int c = 1;
        int sz = G[u].size();
        ans = max(ans, sz);
        rep(i, G[u].size()){
            if (color[G[u][i].number] == 0){
                if (c == col){
                    // cout << color[G[u][i].number] << " " << c << " " << col << endl;
                    color[G[u][i].number] = c + 1;
                    q.push(P(G[e.first][i].to, c + 1));
                    c += 2;
                    
                }else{
                    // cout << color[G[u][i].number] << " " << c << " " << col << endl;
                    color[G[u][i].number] = c;
                    q.push(P(G[e.first][i].to, c));
                    c++;
                }
            }
            
        }
    }
    cout << ans << endl;
    rep(i, n - 1){
        cout << color[i] << endl;
    }
}

Measured memory_bytes: 7040
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> x(N);
  for (int i = 0; i < N; i++) { cin >> x[i]; }

  int total = 0;
  for (int i = 0; i < N; i++) {
    total += 2 * min(x[i], K - x[i]);
  }
  cout << total << endl;
}


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

int main(){
    vector<int> a(3);
    cin>>a.at(0)>>a.at(1)>>a.at(2);
    sort(a.begin(),a.end());


    cout<<a.at(2)*10+a.at(1)+a.at(0)<<endl;
}

Measured memory_bytes: 256
k = int(input())
# a,b,c
# A,A,A = A
# A,A,B = compare A with B
# A,B,C = cpmpare A with B, then C

# for k
# count
# pattern1 = k
# pattern2 = k * (k - 1) 
# pattern3 = k * (k - 1) * (k - 2)
def gcd (m, n):
    while m % n != 0:
        tmp = n
        n = m % n
        m = tmp
    return n

res = (1 + k) * k /2

for i in range(1, k + 1):
    for j in range(i + 1, k + 1):
        res += 6 * gcd(i,j)

for a in range(1, k + 1):
    for b in range(a + 1, k + 1):
        for c in range(b + 1, k + 1):
            res += 6 * gcd(a,gcd(b,c))
print(int(res))

Measured memory_bytes: 9208
#include <iostream>
#include <cmath>
using namespace std;
 
int main() {
	int i,n;
	string sa,sb;
	cin >> n >> sa >> sb;
	for(i = n;i > 0;i--){
		int pos = (int)sa.rfind(sb.substr(0,i));
		if(pos == n - i) break;
	}
	cout << n * 2 - i << endl;
	return 0;
}

Measured memory_bytes: 256
n= int(input())

a= list(map(int, input().split(" ")))

k = len(list(filter(lambda x: x%4 == 0, a)))
j = len(list(filter(lambda x: x%2 == 0, a)))-k
i = len(a)-j-k

if (j > 0) and (i <= k):
    print("Yes")
elif (j == 0) and (i-1 <= k):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14252
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;
using Graph = vector<vector<ll>>; // グラフ型

int main()
{
    ll N;
    cin >> N;
    ll res = 0;

    vector <ll> A(N+1);
    vector <ll> B(N);

    REP(i,N+1)
    {
        cin >> A[i];
    }

    REP(i,N)
    {
        cin >> B[i];
    }

    //貪欲に
    for(ll i = 0; i < N; ++i)
    {
        //モンスターのほうがおおい
        if(A[i] >= B[i])
        {
            //B[i] = 0;
            res += B[i];
        }
        else
        {
            res += A[i];
            B[i] -= A[i];
            if(A[i+1] >= B[i])
            {
                //B[i] = 0;
                res += B[i];
                A[i+1] -= B[i];
            }
            else
            {
                //B[i]
                res += A[i+1];
                A[i+1] = 0;
            }
        }
    }
    
    cout << res << endl;


    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
using namespace std;
int mod = 1e9+7;

int main() {
  int n, k;
  cin >> n >> k;

  int cnt = 0;
  int tmp = 0;
  if( n-2 > 11 ){
    for(int i=1; i<=11; i++){
      for(int j=1; j<=5; j++){
        int sum = 9 * (7*i + j + 1);
        if( sum % 11 == k ) {
          tmp++;
        }
      }
    }
    tmp *= (n-2)/11;
  }
  cnt += tmp;
  for(int i=1; i<=(n-2)%11; i++){
    for(int j=1; j<=5; j++){
      int sum = 9 * (7*i + j + 1);
      if( sum % 11 == k ) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;

  return 0;
}

//


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define y1 cgbngfgn
#define pb push_back
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fir first
#define m_p make_pair
#define sec second
#define files(name) freopen(name".in","r",stdin); freopen (name".out","w",stdout);
#define time pdojegoritg
#define left eorgjrptgj
#define right rtyjtokh
#define int ll
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const int arr=3e5+100;

int a[arr];

signed main()
{
    int n;
    cin>>n;
    for (int i=1;i<=n;i++)
        cin>>a[i];
    reverse(a+1,a+1+n);

    int mn=2;
    int mx=2;
    for (int i=1;i<=n;i++)
    {
        if (mx<a[i])
        {
            cout<<-1;
            return(0);
        }
        mx=(mx/a[i])*a[i]+a[i]-1;
        mn=mn/a[i]*a[i]+a[i]*(mn%a[i]!=0);
    }

    if(mn>mx)
    {
        cout<<-1;
        return(0);
    }

    cout<<mn<<' '<<mx<<'\n';
}
/*
*/


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

using namespace std;

char s[11];

int main() {
	ignore = scanf("%s", s);
	
	bool ans = false;
	for (int i = 0; s[i + 1] != 0; i++) ans = ans || (s[i] == 'A' && s[i + 1] == 'C');
	
	printf(ans ? "Yes\n" : "No\n");
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int main()
{	int n,m,k; cin>>n>>m>>k;
	for(rint i=0;i<=n;i++)
	for(rint j=0;j<=m;j++) if(i*m+(n-2*i)*j==k) return !printf("Yes");
	printf("No");
	return 0;
}


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

#define pb push_back
#define mp make_pair

int A,B,K;

void solve()
{
	for(int i=A;i<=B;++i){
		if(i%K==0){
			cout << "OK\n";
			return;
		}
	}
	cout << "NG\n";
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> K >> A >> B;
	solve();
	return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<cstring>
using namespace std;
int dp[11][1<<10][331];
int ans(int n, int x, int s);
int main(){
  int n,m;
  memset(dp,-1,sizeof(dp));
  while(cin >>n>>m){
    if(n>10 || 330<m){cout <<"0"<<endl;}
    else{cout <<ans(n,0,m)<<endl;}
  }
  return 0;
}
int ans(int n, int x, int s){
  int y = 0;
  if(dp[n][x][s]>=0){return dp[n][x][s];}
  if(s<0){return 0;}
  if(n == 1){
    if(s<10 && !(x&(1<<s))){y = 1;}
  }
  else{
    for(int i=0; i<10; i++){
      if(!(x&(1<<i))){
	y+=ans(n-1,x|(1<<i),s-i*n);
      }
    }
  }
  dp[n][x][s] = y;
  return y;
}

Measured memory_bytes: 15732
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

const int INF = 1000000000000000000;

int n, k, a[310];
int d[310][310];
int ans = INF;

signed main() {
	cin >> n >> k;
	for (int i = 1; i <= n; i++)cin >> a[i];
	for (int i = 0; i <= n; i++)for (int j = 0; j <= n; j++)d[i][j] = INF;
	d[0][0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < i; j++)for (int l = 0; l < n; l++)d[i][l + 1] = min(d[i][l + 1], d[j][l] + max((int)0, a[i] - a[j]));
	}
	for (int i = n - k; i <= n; i++)for (int j = n - k; j <= n; j++) {
		ans = min(ans, d[i][j]);
	}
	cout << ans << endl;
}


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

const int MAX_N = 110000;

int dp[MAX_N]; // dp[i] が i についての答え

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

    // 初期化
    for (int i = 0; i < MAX_N; ++i) dp[i] = N; // INF の気持ち
    dp[0] = 0;

    // 配る DP --- dp[n] から遷移を出して行く
    for (int n = 0; n < N; ++n) {
        for (int pow6 = 1; n + pow6 <= N; pow6 *= 6) {
            dp[n + pow6] = min(dp[n + pow6], dp[n] + 1);
        }
        for (int pow9 = 1; n + pow9 <= N; pow9 *= 9) {
            dp[n + pow9] = min(dp[n + pow9], dp[n] + 1);
        }
    }

    cout << dp[N] << endl;
}

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

int main() {
	ios_base::sync_with_stdio( false );

	int N, A, B;
	cin >> N >> A >> B;

	int result = 0;
	for( int i = 1; i <= N; ++i ) {
		int sum = 0;

		for( int j = i; j > 0; j /= 10 ) {
			sum += j % 10;
		}

		if( sum >= A && sum <= B ) {
			result += i;
		}
	}

	cout << result << endl;
	return 0;
}


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

int main(){
    int n,m;
    cin >> n >> m;
    vector <int> a(m),b(m);
    vector <vector <int>> ma(n);
    rep(i,m){
        cin >> a[i] >> b[i];
        ma[a[i]-1].push_back(b[i]-1);
        ma[b[i]-1].push_back(a[i]-1);
         
    }

    queue <int> q,q2;
    int qq;
    int ans=0;
    vector <int> to(n,0),to2(n,0);
    to2[0]=1;
    int k=1;
    int l;
    rep(i,m){
        k=1;
        to=to2;
        q=q2;
        q.push(0);
        while(q.size()!=0){
            qq=q.front();
            //cout << qq << endl;
            q.pop();
            l=ma[qq].size();
            rep(j,l){
                if(a[i]==qq+1 and b[i]==ma[qq][j]+1){
                    k=k;
                }
                else if(b[i]==qq+1 and a[i]==ma[qq][j]+1){
                    k=k;
                }
                else{
                    if(to[ma[qq][j]]==0){
                        //cout << ma[qq][j] << endl;
                        q.push(ma[qq][j]);
                        to[ma[qq][j]]=1;
                        ++k;
                    }
                }
            }
        }
        //cout << k << endl;
        if(k!=n){
            ++ans;
        }
    }

    cout << ans << endl;


    

    return 0;
}

Measured memory_bytes: 3668
import math
A, B, H, M = map(int, input().split())
L_rad = (H + M / 60) * math.pi / 6
S_rad = M / 30 * math.pi
LS_d = max(L_rad, S_rad) - min(L_rad, S_rad)
if LS_d > math.pi:
    LS_d = 2 * math.pi - LS_d
print(math.sqrt(A**2+B**2-2*A*B*math.cos(LS_d)))

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

int main(){
  int N;
  string S,T;
  string out="";
  cin >> N;
  cin >> S >> T;
  for(int i=0; i<N; i++){
    out += S[i];
    out += T[i];
  }
  cout << out << endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	_ "sort"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

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

func convertToInt(s []string, len int) []int {
	ret := make([]int, len)
	for i := 0; i < len; i++ {
		ret[i], _ = strconv.Atoi(s[i])
	}
	return ret
}

func main() {
	line := nextLine()
	cols := strings.Split(line, " ")
	A, _ := strconv.Atoi(cols[0])
	B, _ := strconv.Atoi(cols[1])
	K, _ := strconv.Atoi(cols[2])

	check := make(map[int]bool)
	//n := make([]int, 0)

	for i := A; i < A+K; i++ {
		if A <= i && i <= B {
			if !check[i] {
				check[i] = true
				//n = append(n, i)
				fmt.Println(i)
			}
		}
	}

	for i := B - K + 1; i <= B; i++ {
		if A <= i && i <= B {
			if !check[i] {
				check[i] = true
				// n = append(n, i)
				fmt.Println(i)
			}
		}
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iostream>
#include <ctime>
using namespace std;
#define _LL long long

int main()
{
    _LL a, v, b, w, t;
    cin >> a >> v;
    cin >> b >> w;
    cin >> t;

    if( abs(b - a) <= t * (v - w) )
    {
        cout << "YES";
    }
    else
    {
        cout << "NO";
    }
    return 0;    
}


Measured memory_bytes: 3624
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()

	fmt.Fprintln(wtr, ((N-1)*N)/2)
	wtr.Flush()
}


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

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N, Q;
    ll sum = 0;
    cin >> N;
    vector<ll> num(100001, 0);
    rep(i, N) {
        ll a;
        cin >> a;
        sum += a;
        num[a] += 1;
    }
    cin >> Q;
    rep(i, Q) {
        ll b, c;
        cin >> b >> c;
        sum = sum - (b * num[b]);
        sum = sum + (c * num[b]);
        num[c] = num[c] + num[b];
        num[b] = 0;
        cout << sum << endl;
    }
}

Measured memory_bytes: 3980
#include <cstdio>

int main()
{
  char s[4], t[4];
  scanf("%s %s", s, t);
  printf("%d\n", (s[0] == t[0] ? 1 : 0) + (s[1] == t[1] ? 1 : 0) + (s[2] == t[2] ? 1 : 0));
  return 0;
}


Measured memory_bytes: 128
n=gets.chomp.to_i
number_digit = n.to_s.length
a = []
b = []
i = 0
sum = 0
while(i < number_digit) do
    a[i] = 10**i
    b[i] = [10**(i+1) - 1, n].min
    if (i+ 1).odd?
      sum += b[i] - a[i] + 1
    end
  	i += 1
end

puts sum


Measured memory_bytes: 1788
//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define f first
#define s second
#define rep(i,x) for(int i=0;i<x;i++)
struct house
{
	int x,y;
	house(){}
	house(int x,int y):x(x),y(y){}
}h[100005];
struct comp_x
{
	bool operator()(const house& a, const house& b)const
	{
		if(a.x!=b.x) return a.x<b.x;
		return a.y<b.y;
	}
};
struct comp_y
{
	bool operator()(const house& a, const house& b)const
	{
		if(a.y!=b.y) return a.y<b.y;
		return a.x<b.x;
	}
};
int main()
{
	srand((unsigned int)time(NULL));
	int hh,w,n; scanf("%d %d",&hh,&w); scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d %d",&h[i].x,&h[i].y);
	}
	set<int>se1,se2;
	sort(h,h+n,comp_x());
	se1.insert(h[(n-2)/2].x);
	se1.insert(h[n/2].x);
	sort(h,h+n,comp_y());
	se2.insert(h[(n-2)/2].y);
	se2.insert(h[n/2].y);
	ll ret=1e15;int px=INF,py=INF;
	for(set<int>::iterator it=se1.begin();it!=se1.end();++it)
	{
		for(set<int>::iterator it2=se2.begin();it2!=se2.end();++it2)
		{
			int X=*it; int Y=*it2; //cout << X << " " << Y << endl;
			ll val=0,gen=0;
			for(int i=0;i<n;i++)
			{
				val+=2LL*(abs(h[i].x-X)+abs(h[i].y-Y));
				gen=max(gen,1LL*(abs(h[i].x-X)+abs(h[i].y-Y)));
			}
			if(ret>val-gen || (ret==val-gen && ((px>X)||(px==X&&py>Y))))
			{
				ret=val-gen;
				px=X;py=Y;
			}
		}
	}
	printf("%lld\n%d %d\n",ret,px,py);
}

Measured memory_bytes: 1972
N, L=map(int, input().split())
s=0
S=[L+i-1 for i in range(1, N+1)]
T = [abs(S[i]) for i in range(N)]

for i in range(N-1):
    if T[i] < T[i+1]:
        del S[i]
        break
    elif i == N-2:
        del S[N-1]

for i in range(0,N-1):
    s+=S[i]
print(s)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i < r; i++)
#define tms(x) ___ = x; while(___--)
#define D(x) cout<<"D: "<<#x<<'='<<x<<endl;
#define R(x, l) cout<<"R: Array "<<#x<<endl; rep(i, 0, l) cout<<' '<<i<<':'<<*(x+i)<<endl;
#define pb push_back
#define int ll
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int ___;
template<typename tn> inline tn next(void);
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v);
signed main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a = next<int>();
	int b = a/500;
	a %= 500;
	cout<<b*1000+a/5*5<<endl;
	return ~~(0-0);
}
template<typename tn> inline tn next(void)
{
	tn k;
	cin>>k;
	return k;
}
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v)
{
	rep(i, 0, v.size()) os<<v[i]<<' ';
	return os;
}


Measured memory_bytes: 256
#abc066_b
def is_odd_str(str):
    length=len(str)
    if length%2==1:
        return False
    else:
        if str[:length//2]==str[length//2:]:
            return True
        else :
            return False
S = input()
rep = len(S)
for i in range(rep):
    S = S[:-1]
    if is_odd_str(S):
        print(len(S))
        break

Measured memory_bytes: 3060