akhauriyash/Code-Regression huggingface dataset:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
A=Counter(a)
s=set(a)
S=sorted(list(s))
S.reverse()
h=0
w=0
for i in S:
  res=A[i]
  if res>=4:
    if h==0:
      h=i
    if w==0:
      w=i
  elif 2<=res<4:
    if w==0:
      w=i
    elif w!=0 and h==0:
      h=i
print(h*w)

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

char s[500010];
int a[500010],n;
queue<int> f;
int d[500010];

int main(){
	scanf("%s",s+1);
	n=strlen(s+1)+1;
	for(int i=1;i<n;i++){
		if(s[i]=='<') d[i+1]++;
		else d[i]++;
	}
	for(int i=1;i<=n;i++) if(d[i]==0) f.push(i);
	memset(a,63,sizeof(a));
	long long ans=0;
	while(!f.empty()){
		int x=f.front();f.pop();
		if(s[x-1]=='<' && s[x]=='>') a[x]=max(a[x-1],a[x+1])+1;
		else if(s[x]=='>') a[x]=a[x+1]+1;
		else if(s[x-1]=='<') a[x]=a[x-1]+1;
		else a[x]=0;
		ans+=a[x];
		if(s[x]=='<') {
			d[x+1]--;
			if(d[x+1]==0) f.push(x+1);
		}
		if(s[x-1]=='>'){
			d[x-1]--;
			if(d[x-1]==0) f.push(x-1);
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
 using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 int main(){
   string s,t,u;
   int a,b;
   cin >>s>>t>>a>>b>>u;
   if(s==u){
   a--;
   }
   else{
   b--;
   }
  cout<<a<<" "<<b<<endl;

}


Measured memory_bytes: 256
n,m = gets.split.map {|n| n.to_i}
mat = Array.new(n).map {Array.new(m)}
vec = Array.new(m)
for i in 1..n
  a = gets.split.map {|s| s.to_i}
  mat[i-1] = a
end
for i in 1..m
  j = gets.to_i
  vec[i-1] = j
end
for i in 1..n
  s = 0
  for j in 1..m
    s += mat[i-1][j-1] * vec[j-1]
  end
  puts s
end

Measured memory_bytes: 8964
#include<bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (ll i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
#define chmax(x, a)  do { x = max(x, a); } while(0)
#define chmin(x, a)  do { x = min(x, a); } while(0)

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


int main(void) {
  ll N, mon = 1000, stock = 0;
  cin >> N;
  vector<ll> a(N);
  rep(i, N)
    cin >> a[i];
  rep(i, N) {
    if (i + 1 < N && a[i] < a[i+1]) {
      ll n = mon / a[i];
      stock += n;
      mon -= n * a[i];
    }
    if (i + 1 < N && a[i] > a[i+1]) {
      mon += stock * a[i];
      stock = 0;
    }
  }
  mon += a[N-1] * stock;
  stock = 0;
  cout << mon << endl;
  return 0;
}


Measured memory_bytes: 3624
from sys import stdin, stdout
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()

def main():
	#a b c -> c a b
	x, y, z = (int(x) for x in rll())
	stdout.write(" ".join(str(x) for x in [z, x, y]))
	stdout.close()

if __name__ == "__main__":
	main()

Measured memory_bytes: 38384
#include <iostream>

using namespace std;

int main() {
    int T1, T2, R1, R2;
    cin >> T1 >> T2 >> R1 >> R2;

    int A, B;
    string ans;

    if (R1 != -1 && R2 != -1)
        A = R1, B = R2;
    else
        A = -T1, B = -T2;


    if (A == B)
        ans = "Draw";
    else if (A > B)
        ans = "Alice";
    else
        ans = "Bob";

    cout << ans << endl;
}



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

int main() {
	int n, i;
	long long temp, max, min, sum;
	
	cin >> n ;
	
	max = -1000000;
	min = 1000000;
	sum = 0;
	
	for ( i = 0; i < n; i++) {
		cin >> temp;
		if (max < temp) max = temp;
		if (min > temp) min = temp;
		sum += temp;
	}
	
	cout << min << " " << max << " " << sum << endl;

	return 0;
}


Measured memory_bytes: 3100
if __name__ == '__main__':
    MOD = 1000000007
    s = input()
    n = len(s)

    dp = [[0 for _ in range(13)]]
    dp[0][0] = 1

    for i, c in enumerate(s):
        if c == "?":
            cn = -1
        else:
            cn = int(c)

        dp.append([0 for _ in range(13)])
        for j in range(10):
            if cn != -1 and cn != j: continue
            for ki in range(13):
                dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]
        for j in range(13):
            dp[i + 1][j] %= MOD
    result = dp[n][5]

    print(result)

Measured memory_bytes: 69084
#include<algorithm>
#include<bitset>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<time.h>
#include<tuple>
#include<utility>
#include<vector>

using namespace std;
const long mod = 1000000007;

int main() {

	string S; cin >> S;
	long slen = S.length();
	long res = slen;

	for (long i = 0; i < slen - 1; i++) {
		if (S[i] != S[i + 1]) res = min(res, max(i + 1, slen - i - 1));
	}

	cout << res << endl;
}

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

string x;
int a,kusomina=1145141919;

int main(){
    cin>>x;

    for(int i=0;i<x.size()-2;i++){
        kusomina=min(kusomina,abs((x[i]-'0')*100+(x[i+1]-'0')*10+(x[i+2]-'0')-753));
    }
    cout<<kusomina<<endl;

}


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

#define MOD 1000000007

using namespace std;

using ll = long long;

template <class T, T M>
class modulo {
public:
    T data;

    modulo(T data = 0) : data(data % M) {
    }

    modulo operator+(const modulo &x) const {
        return modulo(data + x.data);
    }

    modulo operator-(const modulo &x) const {
        return modulo(data + (M - x.data));
    }

    modulo operator*(const modulo &x) const {
        return modulo(data * x.data);
    }

    modulo operator/(const modulo &x) const {
        return modulo(data * x.inv().data);
    }

    modulo operator+=(const modulo &x) {
        return data = (data + x.data) % M;
    }

    modulo operator-=(const modulo &x) {
        return data = (data + (M - x.data)) % M;
    }

    modulo operator*=(const modulo &x) {
        return data = (data * x.data) % M;
    }

    modulo operator/=(const modulo &x) {
        return data = (data * x.inv().data) % M;
    }

    modulo inv() const {
        return _pow(M - 2);
    }

    template <class Integer>
    modulo operator^(Integer n) const {
        if (n >= 0) {
            return _pow(n);
        } else {
            return _pow(M - 1 - (-n) % (M - 1));
        }
    }

    friend std::ostream& operator<<(std::ostream &os, const modulo &x) {
        os << x.data;
        return os;
    }

private:
    template <class NonNegativeInteger>
    modulo _pow(NonNegativeInteger n) const {
        modulo result(1);
        modulo x(*this);
        while (n) {
            if (n & 1) {
                result *= x;
            }
            x *= x;
            n >>= 1;
        }
        return result;
    }
};

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

    using Mod = modulo<ll, MOD>;

    int n, a, b;
    cin >> n >> a >> b;

    function<Mod(int, int)> factorial = [&](int n, int k) {
        Mod result = 1;
        while (k--) {
            result *= n;
            --n;
        }
        return result;
    };

    Mod result = (Mod(2) ^ n) - 1 - factorial(n, a) / factorial(a, a) - factorial(n, b) / factorial(b, b);

    cout << result << endl;

    return 0;
}


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

int main(){
  while(1){
    int total;
    cin >> total;
    if(total == 0) break;

    int sum = 0;

    for(int i = 0; i < 9; i++){
      int price;
      cin >> price;
      sum += price;
    }

    cout << total - sum << endl;
  }
}

Measured memory_bytes: 1160
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
bool used[100010] = {false};
vector<vector<ll>> g(100010);

void dfs(ll pos){
    used[pos] = true;
    rep(i, g[pos].size()){
        if(!used[g[pos][i]])dfs(g[pos][i]);
    }
}
int main(){
    ll n, m;
    cin >> n >> m;
    rep(i, m){
        ll x, y, z;
        cin >> x >> y >> z;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    ll ans = 0;
    rep(i, n){
        if(!used[i+1]){
            ans++;
            dfs(i+1);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 8960
# coding: utf-8


def main():
    Q, H, S, D = map(int, input().split())
    N = int(input())
    ans = 0
    Q *= 4
    H *= 2
    min_price = min([Q, H, S])
    if N % 2 == 1:
        ans += min_price
    ans += N // 2 * min(min_price * 2, D)

    print(ans)

if __name__ == "__main__":
    main()


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

int main(){
    int h, w; cin >> h >> w;
    vector<string> grid(h);
    for (int i=0; i<h; i++){
        cin >> grid[i];
    }
    
    vector<bool> row(h, false);
    vector<bool> col(w, false);
    for (int i=0; i<h; i++){
        for (int j=0; j<w; j++){
            if (grid[i][j]=='#'){
                row[i] = true; col[j] = true;
            }
        }
    }
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if (row[i] and col[j]){
                cout << grid[i][j];
            }
        }
        if (row[i]) cout << endl;
    }
}

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

int main(){
    int N, A, B; cin >> N >> A >> B;
    long long seki = (long long)A*B;
    if(seki < (long long)N || N < A+B-1 ) {cout << -1 << endl; return 0;}
    if(B==1){
        for(int i=0; i<N; i++){
            cout << i+1 << " ";
        }
        cout << endl;
        return 0;
    }
    if(A==1){
        for(int i=0; i<N; i++){
            cout << N-i << " ";
        }
        cout << endl;
        return 0;
    }
    int q = (N-A)/(B-1);
    int r = (N-A)%(B-1);
    for(int i=0; i<q; i++){
        for(int j=0; j<B; j++){
            cout << i*B+B-j << " ";
        }
    }
    if(q==A) { cout << endl; return 0;}
    for(int i=r+1; i>=1; i--){
        cout << q*B+i << " ";
    }
    for(int i=q*B+r+2; i<=N; i++){
        cout << i << " ";
    }
    cout << endl;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

int main(void){
  int x, a;
  cin >> x >> a;
  if (x < a)
    cout << 0 << endl;
  else
    cout << 10 << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
	
		Scanner sc = new Scanner(System.in);
		long N = sc.nextInt();
		long sum = 0;
		for(long i = 1 ; i < N + 1; i++) {
			if(i % 3 != 0 && i % 5 != 0)sum += i;
		}
		System.out.println(sum);
    }
}

Measured memory_bytes: 35824
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>
#include <map>
 
using namespace std;
typedef long long int ll;
ll f_flg[1145141];
ll s_flg[1145141];
vector<ll > G[1145141];
//各スタート位置から対戦相手のノードに到るまで繋がっているノードの総数
ll Fennec = -1;
ll Snuke = -1;
//FennecがSnukeまでたどり着くのに到達するまでにどの頂点を通ったか？とスターチ位置からの距離を格納するやつ
vector<pair <ll, ll > > where(1145141);
//取り合うことで勝負が決まる　ノードとノードで挟まれた回廊
ll battleZone[1145141];
ll N = 0;
ll ans = 0;
//flg = 1 すでに到達済み 0＝まだ到達していない
//player == 0 Fennec, player == 1 sunuke

ll dfs(ll idx, ll end , ll from = -1){
    
    //どこからどこへ行く？
    if(idx != 1) where[idx] = make_pair(from, battleZone[from]);  

    if(idx == end){
        //伝搬させておくと楽
        battleZone[idx] = battleZone[from];
        return 0;
    }

    if(from != -1){
        //はじめ以外伝搬
        battleZone[idx] = battleZone[from] + 1;
    }  

    if(f_flg[idx] == 1){
        return 0;
    }
    f_flg[idx] = 1;

    //cout << from << endl;
    for(ll i = 0; i < G[idx].size(); i++){
        //次の行き先は？
        ll to = G[idx][i];

        //同じだったらもう処理しない
        if(to == from){
            continue;
        }
        dfs(to, end, idx);
        ans++;
    }
    
    return 0;
}
 
int main(){
 
    cin >> N;
    vector<ll > u(N-1);
    vector<ll > v(N-1);
 
    for(ll i = 0; i < N-1; i++){
        cin >> u[i];
        cin >> v[i];
        G[u[i]].push_back(v[i]);
        G[v[i]].push_back(u[i]);
    }
 
    battleZone[0] = 0;
    battleZone[1] = 0;
    //Fennecが塗りつぶせる数 スタート：ノード１
    dfs(1, N);
    
    ll j = N;
    ll battaleZoneDistance = 0;
    vector<ll > battleZoneNode;

    while(j != 1){
        if(where[j].first != 0){
            //cout << where[j].first << endl;
            battleZoneNode.insert(battleZoneNode.begin(), where[j].first);
            j = where[j].first;
            battaleZoneDistance++;
        }
        if(where[j].first == 1){
            break;
        }
    }

    ll trueGoal = battleZoneNode[where[N].second / 2 + where[N].second % 2 ];
    //フラグ初期化
    for(ll i = 0; i < 1145141; i++){
        f_flg[i] = 0;
    }
    //cout << ans << endl;
    ans = 0;
    dfs(1,trueGoal);
    //cout << ans << "," << trueGoal << endl;

    if(N - ans - 1 < ans - 1){
        cout << "Fennec" << endl;
    }else{
        cout << "Snuke" << endl;
    }
 
 
} 

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

using namespace std;

int t[200010];

int main(){
  #ifdef HOME
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
  #endif
  int n, T;
  cin >> n >> T;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> t[i];
  }
  for (int i = 0; i < n - 1; i++) {
    if (t[i + 1] - t[i] < T) {
      ans += t[i + 1] - t[i];
    } else {
      ans += T;
    }
  }
  cout << ans + T << endl;

  #ifdef HOME
    fprintf(stderr, "Time:- %.3f\n", (double) clock() / CLOCKS_PER_SEC);
    fflush(stderr);
  #endif
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include <cmath>
#include <iomanip>
typedef long double ld;
using namespace std;

int main()
{
    int n;
    cin >> n;
    double v[n];
    for (int i = 0; i < n; i++) cin >> v[i];
    for (int i = 0; i < n; i++)
    {
        for (int j = i; j < n; j++)
        {
            if (v[i] > v[j]) swap(v[i],v[j]);
        }
    }
    double ans = v[0];
    for (int i = 1; i < n ; i++)
    {
        ans = (ans+v[i])/2;
    }
    cout <<  ans << endl;
}


Measured memory_bytes: 256
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
#include <string.h>
typedef long long ll;
const int MYINF = 1e9+7;
typedef int bool;
const bool true = 1;
const bool false = 0;

typedef struct node_st {
	int par;
	int left;
	int right;
} node_t;

enum {
	PREORDER,
	INORDER,
	POSTORDER,
};

#define MAX_N 64
int n;
node_t nd[MAX_N];

void print_if_match(int id, int o1, int o2) {
	if (o1 == o2) printf(" %d", id);
}

void dfs(int id, int order) {
	if (id == -1) return;
	print_if_match(id, order, PREORDER);
	dfs(nd[id].left, order);
	print_if_match(id, order, INORDER);
	dfs(nd[id].right, order);
	print_if_match(id, order, POSTORDER);
}

int main(int argc, char **argv)
{
	int i, id, l, r, root;

	memset(nd, -1, sizeof(node_t) * MAX_N);

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d %d %d", &id, &l, &r);
		nd[id].left = l;
		nd[id].right = r;
		if (l != -1) nd[l].par = id;
		if (r != -1) nd[r].par = id;
	}

	root = -1;
	for (i = 0; i < n; i++) {
		if (nd[i].par == -1) {
			root = i;
			break;
		}
	}
	puts("Preorder");
	dfs(root, PREORDER);
	puts("");
	puts("Inorder");
	dfs(root, INORDER);
	puts("");
	puts("Postorder");
	dfs(root, POSTORDER);
	puts("");
			
	return 0;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
#include<ctime>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	srand((unsigned int)time(NULL));
	int d;
	cin >>d;
	Vi ans(d,0);
	Vi res(d,0);
	Vi c(26,0);
	ll sum=0LL;
	rep(i,26){
		cin>>c[i];
		sum+=c[i];
	}
	VVi s(d,Vi(26,0));
	rep(i,d){
		rep(j,26){
			cin>>s[i][j];
		}
	}
	int up=1;
	ll val=-INFLL;
	ll now=0LL;
	ll pen=0LL;
	ll cnt=0;
	ll upr=-INFLL;
	Vi last(26,0);
	int J;
	rep(_,100000){
		srand((unsigned int)time(NULL));
		cnt=0LL;
		rep(i,26){
			last[i]=0;
		}
		rep(i, d)
		{
			val = -INFLL;
			J = rand() % 26;
			//rep(j,26){
			now=0;
			now=s[i][J]-pen-sum-c[J]+(i+1-last[J]);
			val = s[i][J] - pen - sum - c[J] + (i + 1 - last[J]);

				  //if(chmax(val,now)){
			up = J;
			//}
		//}
		res[i]=up;
		pen += sum-(i+1-last[up])*c[up];
		last[res[i]] = i + 1;
		cnt-=val;
	}
	if(chmax(upr,cnt)){
		ans=res;
	}
	}
	rep(i,d){
		cout<<ans[i]+1<<endl;
	}
	
}

Measured memory_bytes: 3656
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var N = cin.ReadInt;
            var ans = cin.ReadIntArray(N).Distinct().Count();
            WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 13280
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,c;

    cin>>n>>m>>c;

    int b[m];

    for ( int i=0 ; i<m ; i++ ) cin>>b[i];

    int v[n][m];

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

    int cnt = 0;
    for ( int i=0 ; i<n ; i++ )
    {
        int sum = 0;
        for ( int j=0 ; j<m ; j++ )
        {
            sum+=v[i][j]*b[j];
        }

        if ( sum+c>0 ) cnt++;
    }

    cout<<cnt<<"\n";
    return 0;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,a,n) for(ll i=a;i<n;i++)
int main(){
  char s;
  cin>>s;
  if(isupper(s))cout<<"A"<<endl;
  else cout<<"a"<<endl;
  return 0;
}

Measured memory_bytes: 3628
a, b,m = map(int, input().split())
a = list(map(int,input().split()))
b = list(map(int, input().split()))
xyc = [list(map(int, list(input().split()))) for i in range(m)]

nowari = min(a) + min(b)
ans = nowari
for i in range(m):
    wari = a[xyc[i][0] - 1] + b[xyc[i][1] - 1] - xyc[i][2]
    ans = min(ans, wari)

print(ans)

Measured memory_bytes: 38444
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	kx = input[0].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
    var k = parseInt(kx[0], 10);
    var x = parseInt(kx[1], 10);

    var K = 500*k;
    if(K>=x){console.log('Yes');}else{console.log('No');}

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

ll k;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> k;
	ll a = k / 50, b = k % 50;
	cout << 50 << endl;
	if (b == 0) {
		FOR(i, 50) {
			if (i < 49) cout << 49 + a << " ";
			else cout << 49 + a << endl;
		}
	}
	else {
		ll c = (49 + a) + (51 - b), d = (49 + a) - b;
		FOR(i, 50) {
			if (i < b) cout << c;
			else cout << d;
			if (i < 49) cout << " ";
			else cout << endl; 
		}
	}

	return 0;
}

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

int min(int a,int b){
  if(a<=b) return a;
  else return b;
}
int max(int a,int b){
  if(a>=b) return a;
  else return b;
}

int main(){
  char s[11];
  int flag = 0;int count = 0;int k=0;
  scanf("%s",s);
  while(s[k] != '\0')k++;
  if(s[0] != 'A')flag = 1;
  for(int i=2;i<k-1;i++){
    if(s[i] == 'C')count ++;
  }
  if(count != 1)flag = 1;
  count = 0;
  for(int i=0;i<k;i++){
    if(s[i] >= 'A' && s[i]<= 'Z')count++;
  }
  if(count != 2)flag = 1;
  if(flag == 1)printf("WA");
  else printf("AC");
  return 0;
}


Measured memory_bytes: 128
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt(),b = sc.nextInt(),c = sc.nextInt();
    int k=a; a=b;b=k;
    k=a;a=c;c=k;
    pl(a+" "+b+" "+c);
  }

  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
}


Measured memory_bytes: 23252
#!/usr/bin/env python3
# -*- coding:utf-8 -*-

from datetime import datetime

def main():
  date = input().strip()
  date = datetime.strptime(date, '%Y/%m/%d')
  if date <= datetime.strptime('2019/4/30', '%Y/%m/%d'):
    print('Heisei')
  else:
    print('TBD')
  pass

if __name__=='__main__':
  main()

Measured memory_bytes: 4712
#include<iostream>

using namespace std;

int main(){
  int i,N,M;
  int judge,sum,ans;
  string go;
  cin>>N>>M;
  int A[N];
  sum=ans=0;
  
  for(i=0;i<N;i++){
    cin>>A[i];
    sum+=A[i];
  }
  judge=sum/M/4;

  for(i=0;i<N;i++){
    if(A[i]*4*M>=sum){
      ans++;
    }
  }
  
  if(ans>=M){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int a,b,c;
	scan(a);scan(b);scan(c);
	prin(a*b/2);
	return 0;
}


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

int main()
{
	while(1)
	{
		string s="",a="",a_min="",a_max="";
		int L=0,out_i=0,out_j=0,x=0,out_a=0;
		vector<int> suuretu;
		bool ok=false;

		cin >> s >> L;
		suuretu.push_back(stoi(s));
		if(s=="0"&&L==0) break;
		for(int k=0;k<=20;k++)
		{	a="";
			for(int i=0;i<L-s.size();i++)
			{
				a+="0";
			}
			a+=s;//a=083268
			//cout << a << endl;
			//suuretu.push_back(a);
			a_min=a;
			sort(a_min.begin(),a_min.end());
			a_max=a;
			sort(a_max.begin(),a_max.end(),greater<char>());
			x=stoi(a_max)-stoi(a_min);
			//cout << x << endl;
			//cout << a_max << " " << a_min << endl;
			s=to_string(x);
			suuretu.push_back(x);
		}

		for(int j=0;j<21;j++)
		{
			for(int i=j+1;i<21;i++)
			{
				if(suuretu[j]==suuretu[i]&&i!=j)
				{
					out_i=i;
					out_j=j;
					out_a=suuretu[j];
					ok=true;
					break;
				}
			}
			if(ok) break;
		}
		cout << out_j << " " << out_a << " " << out_i-out_j << endl;
	}
}

Measured memory_bytes: 3236
import sys
sys.setrecursionlimit(10**9)
MOD=10**9+7

def input():
    return sys.stdin.readline().rstrip()

def main():
    L=input()
    n=len(L)
    dp=[[0]*2 for _ in range(n+1)]
    dp[0][0]=1
    for i in range(n):
        dp[i+1][1]=dp[i][1]*3%MOD
        if L[i]=='1':
            dp[i+1][0]=dp[i][0]*2%MOD
            dp[i+1][1]+=dp[i][0]
        else:
            dp[i+1][0]=dp[i][0]
    print(sum(dp[n])%MOD)

if __name__ == '__main__':
    main()


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

int main() {
  char c;
  cin >> c;
  
  if(c==97 || c==101 || c==105 || c==111 || c==117) cout << "vowel" << endl;
  else cout << "consonant" << endl;
  return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
int main()
{
	char a,b;
	scanf("%c %c",&a,&b);
	
		if(a>b)printf("%c\n",'>');
		if(a==b)printf("%c\n",'=');
		if(a<b)printf("%c\n",'<');
	
	return 0;
}


Measured memory_bytes: 128
import math

a, b, h, m = map(int, input().split())

a_angle = 360 * h /12 + (360 / 12) * m / 60
b_angle = 360 * m / 60
diff_angle = abs(a_angle - b_angle)
ans = math.sqrt(a*a + b*b - 2*a*b*math.cos(math.radians(diff_angle)))
print (ans)


Measured memory_bytes: 9376
#include <stdio.h>

int main()
{
	int i,flag = 0;
	char s[3];
	
	for(i = 0;i < 3;i++)
		scanf("%c",&s[i]);
		
	if((s[0] == 'A') && (s[1] == 'B' ||s[2] == 'B') ||(s[0] == 'B') && (s[1] == 'A' ||s[2] == 'A'))
		flag = 1;
		
	printf("%s\n",flag == 1?"Yes":"No");
	
	return 0;
}


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

int main(){
    int a, b, c, count;
    count = 0;
    cin >> a >> b >> c;
    for(int i = 1; i <= c; i++){
        if(b - i * a >= 0){
            count += 1;
        }
    }
    cout << count << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
   int n;
   cin >> n;
   vector<ll> a(n);
   rep(i,n){
       cin >> a.at(i);
   }
   ll ans1=0;
   ll ans2=1;
   sort(a.begin(),a.end());
   reverse(a.begin(),a.end());
   rep(i,n-3){
       if(a.at(i)==a.at(i+3)){
           ans1=a.at(i)*a.at(i+3);
           break;
       }
   }
    int cnt=0;
    set<ll> chk;
   rep(i,n-1){
       if(a.at(i)==a.at(i+1)){
           if(chk.count(a.at(i))){
           }
           else{
            ans2*=a.at(i);
            chk.insert(a.at(i));
            cnt++;   
           }
       }
       if(cnt>=2)break;
       if(i==n-2 && cnt<=1)ans2=0;
   }
   ll ans=max(ans1,ans2);
   cout << ans << endl;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var s = "";
			while ((s = Console.ReadLine()) != null)
			{
				var cap = s.Split(' ');
				int a = int.Parse(cap[1]), p = int.Parse(cap[2]);
				Console.WriteLine("{0} {1} {2}", cap[0], a + p, a * 200 + p * 300);
			}
		}
	}
}

Measured memory_bytes: 5636
#include <iostream>
using namespace std;
int main(void){
    
    int N;
    cin >> N;
    
    for(int i = 0; i < N; i++){
        string S;
        cin >> S;
        if(S == "Y"){
            cout << "Four" << endl;
            return 0;
        }
    }
    
    cout << "Three" << endl;
}


Measured memory_bytes: 3020
import scala.io.Source
import scala.annotation.tailrec

object Main{
  def main(args: Array[String]){
    val lines = for{
      in <- Source.stdin.getLines.toVector
    }yield in.toInt

    println(rec(lines.tail, Int.MinValue, Int.MaxValue))
  }

  @tailrec
  def rec(vec: Vector[Int], preMax: Int, preMin: Int): Int ={
    if(vec.length == 1) preMax
    else rec(vec.tail, Math.max(vec.tail.head - Math.min(preMin, vec.head), preMax), Math.min(preMin, Math.min(preMin, vec.head)))
  }
}

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

using namespace std;

const int N = 1e5 + 5 , M = 17;
int p[N][M];

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.in" , "r" , stdin);
#endif
    int n;
    cin >> n;

    vector<int> a(n);
    for (int &x : a)
        cin >> x;

    int l , q;
    cin >> l >> q;

    memset(p , -1 , sizeof p);

    p[0][0] = 0;
    for (int i = 0 ;i < n ; i++) {
        while (p[i][0] + 1 < n && a[p[i][0] + 1] - a[i] <= l)
            p[i][0]++;

        p[i + 1][0] = p[i][0];
    }

    for (int i = n - 1 ;i >= 0 ;i--)
        for (int j = 1 ;j < M ;j++)
            if (~p[i][j - 1])
                p[i][j] = p[p[i][j - 1]][j - 1];


    while (q--) {
        int a , b;
        cin >> a >> b;
        a-- , b--;

        if (a > b)
            swap(a , b);

        int ans = 0;
        for (int i = M - 1 ;i >= 0 ;i--) {
            if (p[a][i] != -1 && p[a][i] < b) {
                ans += 1 << i;
                a = p[a][i];
            }
        }

        cout << ans + 1 << '\n';
    }
}

Measured memory_bytes: 10276
#include <iostream>
using namespace std;
int main() {
	long long int h, w;
	cin >> h >> w;
	long long int ans;
	if (h == 1 || w == 1)
		ans = 1;
	else
		ans = ((w * h) + 1) / 2;
	cout << ans << "\n";
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define ll long long
#define re register
#define ull unsigned ll
using namespace std;
inline int read(){
	int s=0,t=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')t=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*t;
}
const int N=4e5+5;
const int P=998244353;
char s[N];
int n,Ans,a[N],b[N],f[N];
int Mod(int x){return x>=P?x-P:x;}
void Solve(int x){
	int res=0,flag=1;
	for(int i=1;i<=x/2;i++)res=Mod(2*res%P+a[i]);
	for(int k=1,t=0;k<=n;k+=x/2,t++)
	for(int i=k;i<k+x/2;i++)b[i]=a[i-k+1]^(t&1);
	for(int i=1;i<=n;i++){
		if(b[i]>a[i]){flag=0;break;}
		if(b[i]<a[i])break;
	}f[x]=Mod(res+flag);
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n=read(),scanf("%s",s+1);
	for(int i=1;i<=n;i++)a[i]=s[i]-'0';
	for(int i=1;i<=2*n;i++)if(n%i&&2*n%i==0)Solve(i);
	for(int i=1;i<=2*n;i++)if(n%i&&2*n%i==0)
	for(int j=2*i;j<=2*n;j+=i)if(n%j&&2*n%j==0)f[j]=Mod(f[j]+P-f[i]);
	for(int i=1;i<=2*n;i++)Ans=Mod(Ans+1ll*i*f[i]%P);
	printf("%d",Ans);
	return 0;
}

Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(x) ll(x.size()) 
using P = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 2e9;
const ll LINF = (1LL<<60);

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int d,t,s;
  cin >> d >> t >> s;
  cout << (t*s<d ? "No\n" : "Yes\n");

  return 0;
}


Measured memory_bytes: 3644
#include<stdio.h>

static const int N=100;

int main(void)
{
  int M[N][N];
  int n,u,k,v;
  int i,j;

  scanf("%d",&n);

  for(i=0;i<n;i++)
    {
      for(j=0;j<n;j++)
	{
	  M[i][j]=0;
	}
      
    }

  for(i=0;i<n;i++)
    {
      scanf("%d%d",&u,&k);
      
      u--;

      for(j=0;j<k;j++)
	{
	  scanf("%d",&v);

	  v--;

	  M[u][v]=1;
	}
      
    }

  for(i=0;i<n;i++)
    {
      for(j=0;j<n;j++)
	{
	  if(j)
	    {
	      putchar(' ');
	    }

	  printf("%d",M[i][j]);
	  
	}

      putchar('\n');
    }

  return 0;
}



Measured memory_bytes: 2108
// BROWNIE TK
 
#include <bits/stdc++.h>
 
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define pb push_back
#define popb pop_back()
#define pf push_front
#define popf pop_front()
#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en
#define le length()
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
 
#define forz(i, n) for (int i = 0; i < n; i++)
#define bui(i, m, n) for (int i = m; i < n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)
#define mui(i, m, n) for (int i = n - 1; i >= m; i--)
#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
 
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
 
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define osetlli tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set
#define ofk order_of_key
#define fbo find_by_order

using namespace std;
 
/*STD fucntions*/
lli power(lli x,lli y,lli p)
{
    lli res=1;
    x=x%p;
    while(y>0)
    {
        if(y&1)
            res=(res*x)%p;
        //y must be even now
        y=y>>1; //y=y/2
        x=(x*x)%p;
    }
    return res;
}
lli gcd(lli a, lli b)
{
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
lli lcm(lli a, lli b)
{ return a * b / gcd(a, b); }
lli modi(lli a,lli m)
{
// fermat little thm where m is prime
return power(a,m-2,m);
}
/*CODE BEGINS*/
int main()
{
 kira;
 lli n;
 cin>>n;
 lli a[n+1][3];
 lli dp[n+1][3]={0};
 for(int i=1;i<=n;i++)
 {
   cin>>a[i][0]>>a[i][1]>>a[i][2];
 }
 for(int i=1;i<=n;i++)
 {
   forz(j,3)
   {
     forz(k,3)
     {
       if(k!=j)
       dp[i][j]=max(dp[i][j],dp[i-1][k]+a[i][j]);
     }
   }
 }
 cout<<max({dp[n][0],dp[n][2],dp[n][1]});
 return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>
int main(){
    int n,sum=0;
    scanf("%d",&n);
    int cpyn=n;
    while(cpyn>=10){
        sum+=cpyn%10;
        cpyn/=10;
    }
    sum+=cpyn;
    if(n%sum==0)printf("Yes");
        else printf("No");
        
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using LL = long long;
using ULL = unsigned long long;

void solve() {
	int n, t; cin >> n >> t;
	int a[3000], b[3000];
	rep(i, n) cin >> a[i] >> b[i];

	LL dp[3001][3001] = {};
	LL dp2[3001][3001] = {};
	for (int i1 = 1; i1 <= n; i1++) {
      int ap = a[i1-1], bp = b[i1-1];
		for (int i2 = 0; i2 <= t - 1; i2++) {
			LL Mp = dp[i1 - 1][i2];
			Mp = max(Mp, dp[i1][i2 - 1]);
			if(i2 >= ap)Mp = max(Mp, dp[i1 - 1][i2 - ap] + bp);
            dp[i1][i2] = Mp;
          
			Mp = dp2[i1 - 1][i2];
			Mp = max(Mp, dp2[i1][i2 - 1]);
			if(i2 >= ap)Mp = max(Mp, dp2[i1 - 1][i2 - ap] + bp);
			Mp = max(Mp, dp[i1][i2]);
			Mp = max(Mp, dp[i1 - 1][i2] + bp);
            dp2[i1][i2] = Mp;
		}
	}

	cout << dp2[n][t - 1] << endl;
}

int main() {

	solve();

	return 0;
}


Measured memory_bytes: 141056
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int n = Integer.parseInt(scanner.nextLine());

		if(n % 2 == 0) {
			System.out.println(n);
		}else {
			System.out.println(n * 2);
		}

	}

}

Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h,w;
    cin>>h>>w;
    vector<vector<char>> mat(h,vector<char>(w));
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            cin>>mat[i][j];
        }
    }
    vector<int> dp(w);
    dp[0]=1;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if(i==0 && j==0)
                continue;
            if(mat[i][j]=='.')
            {
                dp[j]=dp[j-1] + dp[j];
                dp[j]=dp[j]%1000000007;
            }
            else
            {
                dp[j]=0;
            }
        }
    }
    cout<<dp[w-1]<<endl;
    return  0;
}

Measured memory_bytes: 1280
#include<stdio.h>

int main(){
	int i,j,x,y,size,map[15][15]={0},noud=0,no=0;
	while(scanf("%d,%d,%d",&x,&y,&size)!=EOF){
		switch(size){
			case 3:
				map[x][y+2]++;
				map[x+2][y]++;
				map[x+2][y+4]++;
				map[x+4][y+2]++;
			case 2:
				map[x+1][y+1]++;
				map[x+1][y+3]++;
				map[x+3][y+1]++;
				map[x+3][y+3]++;
			case 1:
				map[x+1][y+2]++;
				map[x+2][y+1]++;
				map[x+2][y+2]++;
				map[x+3][y+2]++;
				map[x+2][y+3]++;
		}
	}
	for(i=0;i<10;i++){
		for(j=0;j<10;j++){
			if(map[i+2][j+2]==0)no++;
			if(map[i+2][j+2]>noud)noud=map[i+2][j+2];
		}
	}
	printf("%d\n%d\n",no,noud);
}

Measured memory_bytes: 0
def main():
    n=int(input())
    ary=[0]*100001
    ary[100]=1
    ary[101]=1
    ary[102]=1
    ary[103]=1
    ary[104]=1
    ary[105]=1

    for i in range(200,n+1):
        if ary[i-100]==1:
            ary[i]=1
        if ary[i-101]==1:
            ary[i]=1
        if ary[i-102]==1:
            ary[i]=1
        if ary[i-103]==1:
            ary[i]=1
        if ary[i-104]==1:
            ary[i]=1
        if ary[i-105]==1:
            ary[i]=1
    print(ary[n])
if __name__=='__main__':
    main()


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

using static Input;
using static Util;
class Program
{
    static int[] N;
    static List<int>[] T;
    static Tuple<int ,int>[] M;
    static void INPUT()
    {
        N = LineInt();
        T = new List<int>[N[0]];
        for (int i = 0; i < N[0]; i++)
            T[i] = new List<int>();
        M = new Tuple<int ,int>[N[1]];
        for (int i = 0; i < N[1]; i++)
        {
            var m = LineInt();
            T[m[0]-1].Add(m[1]);
            T[m[1]-1].Add(m[0]);
            M[i] = new Tuple<int, int>(m[0], m[1]);
        }
    }
    static void OUT()
    {
        var ans = 0;
        foreach(var m in M)
        {
            var b = new bool[N[0]];
            var que = new Queue<int>();
            b[m.Item1 - 1] = true;
            foreach (var t in T[m.Item1-1].Where(__ => __ != m.Item2).ToArray())
                que.Enqueue(t);

            var hashi = true;
            while (que.Any())
            {
                var aa = que.Dequeue();
                if (m.Item2 == aa)
                {
                    hashi = false;
                    break;
                }
                b[aa-1] = true;
                foreach (var tt in T[aa-1].Where(__ => !b[__ - 1]).ToArray())
                    que.Enqueue(tt);
            }

            if (hashi) ans++;
        }

        Console.WriteLine(ans);
    }
    static void Main(string[] args)
    {
#if DEBUG  
        TESTINPUT();
        INPUT();
#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
       // N = 1000003;
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{

}




Measured memory_bytes: 13652
#include <iostream>
#include <vector>
#include <numeric>//accumulate(v.begin(), v.end(), 0);
#include <algorithm>//sort(v.begin(),v.end());
#include <string>//
#include <cmath>
#include <iomanip> //setprecision(2)
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int t,x;
int main() {
        cin >> t >> x;
        cout << (double)t/x << endl;
        return 0;
}


Measured memory_bytes: 256
/*
.....   .   .   .   .
  .    . .   . .   . .
  .   .....   .   .....
  .  .     .  .  .     .
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>
   
using namespace std;
   
template<typename T> void uin(T &a, T b) {
    if (b < a) {
        a = b;
    }
}
   
template<typename T> void uax(T &a, T b) {
    if (b > a) {
        a = b;
    }
}



#define left left228
#define right right228
#define set set228

const int maxn = 200 * 1000 + 228;

int a[maxn];

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    map<int, int> cnt;
    vector<int> v;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        ++cnt[a[i]];
    }
    for (auto p : cnt) {
        v.push_back(p.first);
    }
    int res = 0;
    while (!v.empty()) {
        int kek = v.back();
        v.pop_back();
        for (int t = (1 << 30); t >= 1; t >>= 1) {
            int rest = t - kek;
            if (rest <= 0) break;
            if (kek == rest) {
                if (cnt[kek] >= 2) {
                    res += cnt[kek] / 2;
                    cnt[kek] %= 2;
                    break;
                }
            } else {
                if (cnt[rest]) {
                    int dd = min(cnt[kek], cnt[rest]);
                    res += dd;
                    cnt[kek] -= dd;
                    cnt[rest] -= dd;
                    break;
                }
            }
        }
    }
    cout << res << '\n';
    return 0;
}
  
  
  
  

Measured memory_bytes: 33908
class Node
  def initialize(val)
    @val = val
    @left = nil
    @right = nil
  end
  def insert(val)
    if val < @val
      if @left
        @left.insert(val)
      else
        @left = Node.new(val)
      end
    else
      if @right
        @right.insert(val)
      else
        @right = Node.new(val)
      end
    end
  end
  def print
    puts " #{inorder([]).join(" ")}"
    puts " #{preorder([]).join(" ")}"
  end
  def preorder(list)
    #root
    list << @val
    #left
    list = @left.preorder(list) if @left
    #right
    list = @right.preorder(list) if @right
    return list
  end
  def inorder(list)
    #left
    list = @left.inorder(list) if @left
    #root
    list << @val
    #right
    list = @right.inorder(list) if @right
    return list
  end
end

n = gets.to_i
tree = nil

n.times{
  command, num = gets.split
  case command;
  when "insert";
    if tree
      tree.insert(num.to_i)
    else
      tree = Node.new(num.to_i)
    end
  when "print";
    tree.print
  end
}

Measured memory_bytes: 63052
// C++ 14
#include <math.h>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <string>

#define ll long long
#define Int ll
#define loop(x, start, end) for(Int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)
#define span(a,x,y) a.begin()+x,a.begin()+y
#define span_all(a) a.begin(),a.end()
#define len(x) (x.size())
#define last(x) (*(x.end()-1))

using namespace std;

#define EPS 0.00000001
#define fequals(a,b) (fabs((a) - (b)) < EPS)

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (const Vector2 v) const { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (const Vector2 v) const { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (const double k) const { return Vector2(x * k, y * k); }
  Vector2 operator / (const double k) const { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 const v) { return x * v.x + y * v.y; }
  double cross (Vector2 const v) { return x * v.y - y * v.x; }
  
  bool parallel(Vector2 &other) {
    return fequals(fabs(dot(other)), length() * other.length());
  }
  
  bool orthogonal(Vector2 &other) {
    return fequals(0, dot(other));
  }
  
  bool operator < (const Vector2 &v) {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

#define MAX_N 101
#define MAX_Q 1001
Int N, Q;
Vector2 polygon[MAX_N];
Vector2 point;


Int contains(Vector2 &point) {
  bool in = false;
  loop(n,0,N) {
    Vector2 a = polygon[n] - point;
    Vector2 b = polygon[(n+1) % N] - point;
    if (fabs(a.cross(b)) < EPS && a.dot(b) < EPS) return 1;
    if (a.y > b.y) swap(a, b);
    if (a.y < EPS && b.y > EPS && a.cross(b) > EPS) in = !in;
  }
  
  return in ? 2 : 0;
}


void solve() {
}

void input() {
  cin >> N;
  loop(n,0,N) cin >> polygon[n];
  cin >> Q;
  while (cin >> point) {
    cout << contains(point) << endl;
  }
}

int main() {
  cout.precision(15);
  input();
  solve();
}


Measured memory_bytes: 3216
#include<string.h>

#define N_MAX 7
#define S_MAX 3001

typedef struct _tagNum{
	int num;
	int sums[S_MAX];
} Num;

Num line[N_MAX * N_MAX];

int main(void){
	while( 1 ){
		int h, i, j;
		int cnt = 0;
		int N, M, S;

		scanf("%d%d%d", &N, &M, &S);
		memset( line, 0, sizeof(line) );

		if( N == 0 && M == 0 && S == 0 ){
			break;
		}

		for(i = 0; i < N * N; i++){
			line[i].num = i + 1;
			if( i == 0 ){
				line[i].sums[i + 1] = 1;
			}else if( i > 0 ){
				for(j = 0; j <= S; j++){
					if( line[i - 1].sums[j] > 0 ){
						line[i].sums[ line[i].num + j] = line[i - 1].sums[j];
					}
				}
			}
		}

		for(h = 1; h < M + 1 - N * N; h++){
			for(i = 0; i < N * N; i++){
				int vnum = line[i].num + 1;
				if( i == 0 ){
					line[i].num++;
					line[i].sums[ vnum ]++;
				}else{
					line[i].num++;
					for(j = 0; j <= S; j++){
						if( j + vnum <= S ){
							line[i].sums[j + vnum ] += line[i - 1].sums[j];
							line[i].sums[j + vnum ] %= 100000;
						}
					}
				}
			}
		}

		printf("%d\n" , line[N * N - 1].sums[S]);
	}
	return 0;
}

Measured memory_bytes: 984