akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...)
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll d, t, s; cin >> d >> t >> s;
    if (d <= t * s)cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>

using namespace std;

int main() {
	int n; cin >> n;
	map<string, int> uid;
	for (int i = 0; i < n; ++i) {
		string str; cin >> str;
		uid[str] = i;
	}
	int m; cin >> m;
	bool f = false;
	for (int i = 0; i < m; ++i) {
		string str; cin >> str;
		if (uid.find(str) != uid.end()) {
			if (!f) printf("Opened by %s\n", str.c_str());
			else printf("Closed by %s\n", str.c_str());
			f = !f;
		}
		else {
			printf("Unknown %s\n", str.c_str());
		}
	}
}

Measured memory_bytes: 1244
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5+10; 
const int INF = 2e9;
int dp[N],h[N];
void init(int n)
{
	for(int i=1;i<=n;i++)
	{
		dp[i] = INF;
	}
}
int main()
{
	int n;
	cin >> n;
	init(n);
	for(int i=1;i<=n;i++)
	{
		cin >> h[i];
	}
	dp[1]=0,dp[2]=abs(h[1]-h[2]);
	for(int i=3;i<=n;i++)
	{
		for(int j=1;j<=2;j++)
		{
			dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
		}
	}
	cout<<dp[n];
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long int ll;

using namespace std;
const double PI=3.14159265358979323846;

int main()
{
    long double A,B,C;
    cin >> A >> B;

    A = A*1.0;


    C = A*B;


    cout << (ll)C << endl;

    return 0;
}

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

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

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

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

// -------------------------------------------------------
ll N, M, X;
ll C[20];
ll A[20][20];

int main() {
  cin >> N >> M >> X;
  rep(i, 0, N) {
    cin >> C[i];
    rep(j, 0, M) { cin >> A[i][j]; }
  }

  ll ans = INF;
  for (int bit = 0; bit < (1 << N); ++bit) {
    ll cost = 0;
    vector<ll> aa(M, 0);
    for (int i = 0; i < N; ++i) {
      if (1 & (bit >> i)) {
        cost += C[i];
        for (int j = 0; j < M; ++j) {
          aa[j] += A[i][j];
        }
      }
    }
    bool can = true;
    for (int j = 0; j < M; ++j) {
      if (aa[j] < X) {
        can = false;
        break;
      }
    }
    if (can) {
      chmin(ans, cost);
    }
  }
  if (ans == INF) {
    cout << -1 << endl;
    return 0;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>

// 1 x 9
// 2 x 90
// 3 x 900
// ...

const int M = 1000000007;

int dk(int p) {
  if (p >= 100000000) return 9;
  else if (p >= 10000000) return 8;
  else if (p >= 1000000) return 7;
  else if (p >= 100000) return 6;
  else if (p >= 10000) return 5;
  else if (p >= 1000) return 4;
  else if (p >= 100) return 3;
  else if (p >= 10) return 2;
  return 1;
}

int powmod(int p) {
  if (p == 0) return 1;
  else if (p == 1) return 10;
  else if ((p & 1) == 1) return (10 * (long long)powmod(p - 1)) % M;
  const int x = powmod(p >> 1);
  return (x * (long long)x % M);
}

int main() {
  using namespace std;
  ios::sync_with_stdio(false);

  int S;
  cin >> S;

  // (1) Check when d(l) <= 7
  int i = 1, j = 1;
  int sum = 0, ans = 0;
  for (; i < 10000000; ++i) {
    for (; sum < S; ++j) {
      sum += dk(j);
    }
    if (sum == S) ++ans; // [i, j)
    sum -= dk(i);
  }
  ans %= M;

  // (2) Check when d(l) > 7
  const int S2 = (S >> 3);
  for (int i = 1; i <= S2; ++i) {
    if (S % i == 0) {
      ans = (ans + (9 * (long long)powmod(S / i - 1)) + M - (i - 1)) % M;
    } else {
      ans = (ans + 1) % M;
    }
  }

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll n,a[200000]={},ans=0,cnt=0,now1=0,now2=0;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a[i];
    cnt+=a[i];
  }
  int i=0;
  while(now1<cnt/2) {
    now1+=a[i];
    i++;
  }
  int j=n-1;
  while(now2<cnt/2) {
    now2+=a[j];
    j--;
  }
  cout << min(abs((cnt-now1)-now1),abs((cnt-now2)-now2)) << endl;
}

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

typedef long long ll;

int main() {
    string s;
    cin >> s;
    vector<ll> x(2019, 0);
    x[0] += 1;
    ll k = 0;
    ll p = 1;
    for (int i = 1; i <= s.size(); i++) {
        k += ((ll)(s[s.size() - i] - '0')) * p % 2019;
        k %= 2019;
        x[k % 2019] += 1;
        p *= 10;
        p %= 2019;
    }
    ll ans = 0;
    for (auto iter = x.begin(); iter != x.end(); iter++) {
        if (*iter > 0) {
            ans += (*iter) * (*iter - 1) / 2;
        }
    }
    cout << ans << endl;
}


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


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		if (n == 1) {
			pr.println(1);
		} else {
			int p2 = 2;
			while (p2 * 2 <= n) {
				p2 *= 2;
			}

			pr.println(p2);
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 23508
/**
     **author : _KMS_
     **created : 07-03-2020
**/
#include<bits/stdc++.h>
using namespace std;
const long long M =1e6,MOD=2e9;
typedef long long ll;
string p,q;
int tot;
int main() {
      
   ios::sync_with_stdio(false);
   cin.tie(0);
   int a,b;
   cin>>a>>b;
   if(a>b)swap(a,b);
   for(int i=a;i<=b;i++)
   {
         int j=i;
         p="";
         while(j>0)
         {
               p+=(j%10)+'0';
               j/=10;
         }
         q=p;
         reverse(p.begin(),p.end());
         if(p==q)tot++;
   }
   cout<<tot<<"\n";
  
   
   return 0;
}

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

#define fst first
#define snd second
#define ll long long
#define ld long double
#define pb push_back
#define emp emplace_back
#define pii pair<int, int>
#define usg unsigned
#define sg signed
#define mp make_pair

using namespace std;

void setIO(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

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

ll n;

int main(){
	setIO();
	string ans = "";
	cin >> n;
	while (n){
		ll x = n%26;
		if (x == 0) {ans += 'z'; n=(n/26)-1;}
		else {ans += ('a'+x-1); n/=26;}
	}
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
}

Measured memory_bytes: 3612
/*==========================================================================*/
/*
    AUTHOR:    BPZ
	CREATED:   10.09.2020 14:48:36

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int l, r, d;
  cin >> l >> r >> d;
  int cnt = 0;
 	int start = l / d;
 	if (l % d != 0) {
 		start++;
 	}
  for (int i = start; i * d <= r; i++) {
  	cnt++;
  }
  cout << cnt << '\n';
  return 0;
}


Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Console;

namespace ConsoleApplication1
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            Output(Solve(Input()));
        }

        static IEnumerable<int> Solve(IList<int> input)
        {
            var k = input[0];
            var x = input[1];
            var min = x - (k - 1);
            var max = x + (k - 1);
            var result = Enumerable.Range(min, max - min + 1);
            return result;
        }
            

        static IList<int> Input()
        {
            var input = ReadLine()
                .Split(' ')
                .Select(int.Parse)
                .ToList();

            return input;
        }

        static void Output<T>(T a)
        {
            WriteLine(a);
        }
        static void Output(IEnumerable<int> list)
        {
            var sw = new StreamWriter(OpenStandardOutput()) {AutoFlush = false};
            SetOut(sw);
            var result = string.Join(" ", list).Trim();
            WriteLine(result);

            Out.Flush();
        }
    }
}

Measured memory_bytes: 11348
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back

#define eb emplace_back
#define mod   1000000007
#define PI 2*acos(0.0)
#define all(r)(r).begin(),(r).end()
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define inf 1000000000000000000
#define N 2000
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};



//=============================================ASIFAZAD==============================================//

vi prime;
bitset<N> ck;
map<int, int> p_fact;

void seive()
{
    for(int i = 3; 1LL*i*i <= N; i+=2)
        if(ck[i] == 0)
            for(int j = i*i; j<= N; j+= 2*i)
                ck[j] = 1;
    prime.pb(2);
    for(int i = 3; i<= N; i+=2)
        if(!ck[i])
            prime.pb(i);
}

void prime_fact(int x)
{
    for(auto p: prime)
    {
        if(p*p>x)
            break;
        if(x%p == 0)
        {
            int pow = 0;
            while(x%p==0)
            {
                x/= p;
                pow++;
            }
            p_fact[p] = max(p_fact[p] , pow);
        }
    }
    if(x > 1)
        p_fact[x] = max(p_fact[x] , 1);
}

ll bigmod(ll x, ll p)
{
    ll res = 1;
    while(p)
    {
        if(p&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        p >>= 1;
    }
    return res;
}


int32_t main()
{
    io;
    seive();

//    for(auto x: prime)
//        cout<<x<<"\n";
//
//    dbg(bigmod(2, 5));

    int n;
    cin>>n;
    vll inp(n);
    ll lcm = 1;
    for(auto& i: inp)
    {
        cin>>i;
        prime_fact(i);
    }
    for(auto p: p_fact)
    {
        lcm = (lcm*bigmod(p.first, p.second))%mod;
//        dbg(p.first);
//        dbg(p.second);
    }
    ll ans = 0;
    for(int i = 0; i< n;i++)
        ans = (ans + lcm*bigmod(inp[i], mod - 2)%mod)%mod;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 4016
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<typename F>
auto recursive(F f){ return [f](auto... a){ return f(f,a...); }; }

const int MOD = 1e9 + 7;

int main(){
	
	int n;
	cin >> n;
	vector<vector<int>> to(n);
	rep(i,n-1){
		int x,y;
		cin >> x >> y;
		--x; --y;
		to[x].push_back(y);
		to[y].push_back(x);
	}
	
	vector<vector<ll>> dp(n, vector<ll>(2));
	
	auto dfs = recursive(
		[&](auto dfs, int v, bool isBlack, int parent=-1) -> ll{
			if(dp[v][isBlack] > 0) return dp[v][isBlack];
			ll res = 1;
			for(auto w : to[v]){
				if(w == parent) continue;
				
				ll tmp = 0;
				tmp = ( tmp + dfs(dfs, w, false, v) ) % MOD;
				if(!isBlack){
					tmp = ( tmp + dfs(dfs, w, true, v) ) % MOD;
				}
		
				res = ( res * tmp ) % MOD;
			}
	
			return dp[v][isBlack] = res;
		}
	);
	
	cout << ( dfs(0, true) + dfs(0, false) ) % MOD << endl;
	return 0;
}

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

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,a,i;
    cin>>n;
    queue<int> qq;
    stack<int> st;
    st.push(0);

    for(i=0;i<n;i++)
    {
       cin>>a;
       qq.push(a);
    }

    while(!qq.empty())
    {
       if(qq.front()==st.top()+1)
         st.push(qq.front());
       qq.pop();
    }
    if(st.size()==1)
    {
cout<<-1<<endl;return 0;

    }
    cout<<n+1-st.size()<<endl;

    return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <math.h>
#include <string.h>

using namespace std;

int main() {
    int n,m,c,b[21],a[21][21];
    cin>>n>>m>>c;
    for(int i=1;i<=m;i++){
        cin>>b[i];
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>a[i][j];
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        int sum=0;
        for(int j=1;j<=m;j++){
            sum=sum+a[i][j]*b[j];
        }
        if(sum+c>0){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
c = ','.join(input()).split(',')

ans = 0

ri = -1

if c.count('W') == 0:
    print(0)
    exit()

if c.count('R') == 0:
    print(0)
    exit()

for i in range(n):
    if c[i] == 'W':
        while c[ri] != 'R':
            ri -= 1
        
        if n < i-ri:
            break
        
        c[i], c[ri] = 'R', 'W'
        ans += 1
    
print(ans)

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

using namespace std;


#include <vector>
#include <list>
#include <cstring>
#include <cmath>
#define scan(x) scanf("%d", &x)
#define scanl(x) scanf("%lld", &x)
#define PI 3.14159265358979323846

void printarray(int* arr, int n){
	for(int i=0;i<n;i++){
		printf("%d ", arr[i]);
	}
	printf("\n");
}

void printvector(vector <int> A){
	for(auto i=A.begin();i!=A.end();i++){
		cout<<*i<<" ";
	}
	cout<<endl;
}

int main(){
	#define int long long int
	#ifndef ONLINE_JUDGE
    	freopen("D:/Programming/input.txt", "r", stdin);
    	freopen("D:/Programming/output.txt", "w", stdout);
	#endif

	int a,b,c,k,ans;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &k);
	if(k<=a)ans=k;
	else if(k<=(a+b))ans=a;
	else ans=a-(k-a-b);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3688
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   ll n, ctr = 1, ans = 0;
   string x;
   vector<string> s;
   cin >> n;
   for (int i = 0; i < n; i++)
   {
      cin >> x;
      s.push_back(x);
      sort(s[i].begin(), s[i].end());
   }
   sort(s.begin(), s.end());
   for (int j = 1; j < n; j++)
      if (s[j - 1] == s[j])
         ctr++;
      else
      {
         ans += ctr * (ctr - 1);
         ctr = 1;
      }

   ans += ctr * (ctr - 1);
   ans /= 2LL;
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 5748
# -*- coding: utf-8 -*-
# Input
list = []
for _ in range(4):
    list += [int(input())]

count = 0
for ii in range(list[0] + 1):
    for jj in range(list[1] + 1):
        for kk in range(list[2] + 1):
            count += list[3] == 500 * ii + 100 * jj + 50 * kk

print(count)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
const int INF = 1000000;

int main(){
	int N, p, q;
	cin >> N >> p >> q;
	int a[N], b[N], c[N], A[N];
	for(int i=0; i<N; i++){
		cin >> a[i] >> b[i] >> c[i];
		A[i] = q * a[i] - p * b[i];
	}
// dp[i][j] で、j-4000 を A[0] ～ A[i] でつくれるとき、最小予算
// つくれないとき、INF
// dp[i][4000]のときは，少なくとも一つ薬品を選ぶ
	int dp[N][8000];
	for(int i=0; i<8000; i++){
		if(i - 4000 == A[0]) dp[0][i] = c[0];
		else dp[0][i] = INF;
	}
	for(int i=1; i<N; i++){
		for(int j=0; j<8000; j++){
			if(j - A[i] == 4000){
				dp[i][j] = min(dp[i-1][j], c[i]);
			}else if(j - A[i] >= 0 && j - A[i] < 8000){
				dp[i][j] = min(dp[i-1][j], dp[i-1][j-A[i]] + c[i]);
			}else{
				dp[i][j] = dp[i-1][j];
			}
		}
	}
	if(dp[N-1][4000] == INF) cout << -1 << endl;
	else cout << dp[N-1][4000] << endl;
	return 0;
}


Measured memory_bytes: 1536
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int K = sc.nextInt();
		
		int ans = 0;
		
		for (int i = 0 ; i < N ; i++) {
			if(sc.nextInt() >= K) {
				ans++;
			}
		}
		
		System.out.println(ans);
	}

}


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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

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

LL mod = 1000000007;

LL factorial(LL n) {
  LL rep = 1;
  FOR (i, 1, int(n + 1)) {
    rep *= i;
    rep %= mod;
  }
  return rep;
}

int main(){
  LL n, m;

  scanf("%lld %lld",&n, &m);

  if (abs(n - m) > 1) {
    printf("0\n");
  } else if (abs(n - m) == 1) {
    printf("%lld\n",(factorial(n) * factorial(m)) % mod);
  } else {
    printf("%lld\n",(factorial(n) * factorial(m) * 2) % mod);
  }
}


Measured memory_bytes: 256
(let ((a (read))
    (b (read))
    (ans 0))
    (if (>= a b)
        (progn
            (incf ans a)
            (decf a)
        )
        (progn
            (incf ans b)
            (decf b)
        )
    )
    (if (>= a b)
        (progn
            (incf ans a)
            (decf a)
        )
        (progn
            (incf ans b)
            (decf b)
        )
    )
    (princ ans)
)

Measured memory_bytes: 24300
def main():
    N, K = map(int, input().split())
    h = [int(x) for x in input().split()]
    # memo = [None for i in range(N)]

    # def rec(n):
    #     if memo[n-1] == None:
    #         if n <= 1:
    #             memo[n-1] = 0
    #         elif n == 2:
    #             memo[n-1] = abs(h[0]-h[1])
    #         else:
    #             memo[n-1] = min(abs(h[n-1]-h[j-1]) + rec(j) for j in range(max(0,n-K),n))
    #     return memo[n-1]

    # print(rec(N))

    dp = [-1]*N
    dp[0] = 0
    dp[1] = abs(h[1]-h[0])

    for i in range(2,N):
        dp[i] = min(abs(h[i]-h[j]) + dp[j] for j in range(max(0,i-K),i))
    print(dp[N-1])

# if __name__ == "__main__":
main()

Measured memory_bytes: 13928
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
 
public class Main {
	private static FastScanner sc = new FastScanner();
	
	public static void main(String[] args) {
		int N = sc.nextInt();
		long allodd = 1;
		for(int i=0; i<N; i++) {
			int A = sc.nextInt();
			if(A%2 == 0) {
				allodd *= 2;
			}
		}
		System.out.println((long)Math.pow((long)3, N) - allodd);
	}
	
	static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}


Measured memory_bytes: 21332
#include <iostream>
#include <string>

using namespace std;

int main() {

  int n, m, ans = 0, isB = 0;
  string p;
  cin >> n >> m >> p;
  for(int i = 0;i < p.size();i++){
    if(p[i] == '-'){
      if(!(ans == n)){
        cout << "No";
        return 0;
      }
      ans = 0;
    }else if('0' <= p[i] && p[i] <= '9'){
      ans++;
    }else{
      cout << "No";
      return 0;
    }
  }
  if(ans == m){
    cout << "Yes";
  }else{
    cout << "No";
  }
  return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
#define For(n) for(int i=0;i<n;i++)
#define Forj(n) for(int j=0;j<n;j++)
#define pi 3.141592654
#define hell 1000000007
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define in1(n,c) c n;cin>>n
#define in2(a,b,c) c a,b;cin>>a>>b
#define ina(a,n,c) c a[n];rep(i,0,n)cin>>a[i]
#define ins(s) string s;cin>>s
#define mset(a,n) memset(a,n,sizeof a)
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define lbd lower_bound
#define ubd upper_bound
#define ll  long long
#define ull unsigned long long
#define ld long double
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define piii pair<pair<int,int>,int>
#define all(v) (v).begin(), (v).end()
#define sz(x) (ll)x.size()
#define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define line cout<<endl

int main ()
{
    in2(n,k,int);
    ina(a,n,int);
    int cnt=0;
    For(n)
    {
        if (a[i]>=k)
            cnt++;
    }
    outl(cnt);
}


Measured memory_bytes: 640
import itertools
import math
D, G = list(map(int, input().split(' ')))
p_list = list()
c_list = list()
for _ in range(D):
    p, c = list(map(int, input().split(' ')))
    p_list.append(p)
    c_list.append(c)
ans = sum(p_list)
pattern_list = itertools.product([0, 1], repeat=D)
for pattern in pattern_list:
    score = 0
    prob_num = 0
    # Solve all problems with bit `1`
    score += sum([bit * (100 * (index + 1) * p_list[index] + c_list[index]) for index, bit in enumerate(pattern)])
    prob_num += sum([bit * p_list[index] for index, bit in enumerate(pattern)])
    # Solve problems partially with bit `0'
    if score < G:
        for index in range(D - 1, -1, -1):
            if pattern[index] == 1:
                # skip because these cases are already counted
                continue
            required_num = math.ceil((G - score) / (100 * (index + 1)))
            sol_num = min([p_list[index] - 1, required_num])
            score += 100 * (index + 1) * sol_num
            prob_num += sol_num
            if score >= G:
                break
    # update answer
    if score >= G:
        ans = min([ans, prob_num])
print(ans)

Measured memory_bytes: 3316
from fractions import gcd

N = int(input())
A = list(map(int, input().split()))

gcd_from_left = [0] * (N + 1) 
gcd_from_right = [0] * (N + 1)
gcd_from_left[1] = A[0]
for i in range(2, N + 1):
    gcd_from_left[i] = gcd(A[i - 1], gcd_from_left[i - 1])
A = A[::-1]
gcd_from_right[1] = A[0]
for i in range(2, N + 1):
    gcd_from_right[i] = gcd(A[i - 1], gcd_from_right[i - 1])

ans = 0
for i in range(1, N + 1): # 抜かすやつのindex
    if i == 1:
        ans = max(ans, gcd_from_right[N - i])
    elif i == N:
        ans = max(ans, gcd_from_left[i - 1])
    else:
        ans = max(ans, gcd(gcd_from_left[i - 1], gcd_from_right[N - i]))
print(ans)

Measured memory_bytes: 16120
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<deque>
#include<bitset>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<ll,ll> P;
template<class T> inline bool chmax(T&a , T b){ if(a<b){ a=b; return true; } else{ return false; } }
template<class T> inline bool chmin(T&a , T b){ if(a>b){ a=b; return true; } else{ return false; } } 

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main(){
    int n;
    cin >> n;
    string s[n];
    rep(i,n) cin >> s[i];
    map<string,int> a;
    a["AC"] = 0;
    a["WA"] = 0;
    a["TLE"] = 0;
    a["RE"] = 0;
    rep(i,n){
        if(s[i]=="AC") a["AC"]++;
        if(s[i]=="WA") a["WA"]++;
        if(s[i]=="TLE") a["TLE"]++;
        if(s[i]=="RE") a["RE"]++;
    }

    cout << "AC x " << a["AC"] << endl;
    cout << "WA x " << a["WA"] << endl;
    cout << "TLE x " << a["TLE"] << endl;
    cout << "RE x " << a["RE"] << endl;

}

Measured memory_bytes: 6696
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    float arr[100];
    scanf("%d", &n);
    for(int i=0;i<n;i++) scanf("%f", &arr[i]);
    sort(arr,arr+n);
    float sum=0;
    sum+=((arr[0]+arr[1])/2);

    for(int i=2;i<n;i++)
    {

        sum=(sum+arr[i])/2;
    }
    cout<<sum;
}


Measured memory_bytes: 384
n, m = [0] * 2

def format_input(filename = None):
	global n, m
	if filename == None:
		n, m = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(0, 10**2)
		m = rng(max(0, 2-n), 10**1)

def get_answer():
	answer = m * (m - 1) // 2 + n * (n - 1) // 2
	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>

using namespace std;
using ll = long long;

ll fact[100010];

void init(ll p){
    fact[0] = 1;
    for(ll i=1;i<sizeof(fact)/sizeof(ll);i++){
        fact[i] = fact[i-1] * i % p;
    }
}

int main(void){
    int N, M;
    cin >> N >> M;

    ll n = min(N, M);
    ll m = max(N, M);

    if(!(n==m || n+1 == m)){
        cout << 0 << endl;
        return 0;
    }

    init(1000000007);
    ll ans = fact[n]*fact[m]%1000000007;
    if(n==m) ans = ans * 2 % 1000000007;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
//専用ライブラリ
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define PI acos(-1.0)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int cmp(P a,P b){
        if(a.fi!=b.fi)
        return a.fi>b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int x,y,z,k;
    cin>>x>>y>>z>>k;
    int xy=k;
    vector<ll>a(x);
    vector<ll>b(y);
    vector<ll>c(z);
    for(int i=0;i<x;i++)
        cin>>a[i];
    for(int i=0;i<y;i++)
        cin>>b[i];
    for(int i=0;i<z;i++)
        cin>>c[i];
    vector<ll>ans(k);
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    reverse(a.begin(),a.end());
    reverse(b.begin(),b.end());
    reverse(c.begin(),c.end());
   
    for(int i=0;i<x;i++)
        for(int j=0;j<y;j++)
            {
                    ans.push_back(a[i]+b[j]);
            }
    sort(ans.begin(),ans.end());
    reverse(ans.begin(),ans.end());
    vector<ll> aans(k);
    
    for(int i=0;i<k;i++)
        for(int j=0;j<z;j++)
        aans.push_back(ans[i]+c[j]);
    sort(aans.begin(),aans.end());
    reverse(aans.begin(),aans.end());
    
    for(int i=0;i<k;i++)
        cout<<aans[i]<<endl;
    return 0;
}


Measured memory_bytes: 35296
n = int(input())
l=list(map(int ,input().split()))
for i in range(n-1):
    if l[i+1]-l[i]>=0:
        continue
    elif l[i+1]-l[i]==-1:
        l[i+1]=l[i+1]+1
    else:
        print("No")
        exit()
print("Yes")   

Measured memory_bytes: 14396
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // long long64_t, long long*_t
#include <cstdio> // prlong longf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
using namespace std;
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int ta,ao;
  ta=a/d;
  if(ta*d!=a) ta++;
  ao=c/b;
  if(ta*b!=c) ao++;
  if(ta>=ao) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3620
import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int l=sc.nextInt();
		int k=l;
		int t=1;
		int count=1;
		ArrayList<String> ans=new ArrayList<>();
		while(l>1){
			if((l & 1)==1){
				k-=t;
				ans.add(count+" "+20+" "+k);
			}
			ans.add(count+" "+(count+1)+" "+t);
			count++;
			l>>=1;
			t*=2;
		}
		System.out.println(20+" "+(ans.size()+19));
		for(int i=0; i<19; i++){
			System.out.println((i+1)+" "+(i+2)+" "+0);
		}
		for(String s:ans){
			System.out.println(s);
		}
	}
}


Measured memory_bytes: 23252
//a
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int N, M;
    cin >> N >> M;
    int k[M];
    int s[M][10];
    rep(i, 0, M) {
        cin >> k[i];
        rep(j, 0, k[i]) cin >> s[i][j];
    }
    int p[M];
    rep(i, 0, M) cin >> p[i];
    int res = 0;
    for (int m = 0; m < (1<<N); m++) {
        bitset<10> sw(m);
        bool ok = true;
        rep(i, 0, M) {
            int on = 0;
            rep(j, 0, k[i]) {
                if (sw[s[i][j]-1]) on++;
            }
            if (on % 2 != p[i]) {
                ok = false;
                break;
            }
        }
        if (ok) res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <queue>
#include <vector>
#include <cstdlib>
#define mp make_pair
#define pb push_back
#define mem(i,a) memset(i,a,sizeof(i))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
const int DMAX=10000000+5;
const ll MOD=998244353;
template<class T> inline void read(T &x){
	x=0;
	T f=1,p=0;
	char ch=getchar();
	while(ch<'0' || ch>'9'){
		if(ch=='-'){
			f=-1;
		}
		ch=getchar();
	}
	while(ch<='9' && ch>='0'){
		x=x*10+(ch-'0');
		ch=getchar();
	}
	if(ch=='.'){
		ch=getchar();
		while(ch<='9' && ch>='0'){
			x=x*10+(ch-'0');
			ch=getchar();
			p++;
		}
	}
	x*=f;
}
ll ans=0;
string a,b;
int main(){
	cin>>a>>b;
	for(int i=0;i<a.size();i++){
		if(a[i]!=b[i]){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3856
#include <stdio.h>
#include <math.h>
#define M_PI 3.14159265358979323846

int main()
{
    double a, b, C;
    double S, L, h;
    scanf("%lf %lf %lf", &a, &b, &C);
    
    S = (a * b * sin(C / 180 * M_PI)) / 2;
    L = a + b + sqrt(a*a + b*b - 2*a*b*cos(C / 180 * M_PI));
    h = S * 2 / a;
    
    printf("%.8f\n%.8f\n%.8f\n", S, L, h);
    
    return 0;
}

Measured memory_bytes: 652
fn main() {
    let x = read();
    for i in 0..6000i64 {
        for j in 0..6000i64 {
            if -i.pow(5) - j.pow(5) == x {
                println!("{} {}", -i, j);
                exit(0);
            } else if i.pow(5) - (-j).pow(5) == x {
                println!("{} {}", i, -j);
                exit(0);
            } else if i.pow(5) - j.pow(5) == x {
                println!("{} {}", i, j);
                exit(0);
            }
        }
    }
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


Measured memory_bytes: 2152
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef  long long int ll;
typedef long double db;
#define pb push_back
#define mp make_pair
#define ub(v,val) upper_bound(v.begin(),v.end(),val)
#define np(str) next_permutation(str.begin(),str.end())
#define lb(v,val) lower_bound(v.begin(),v.end(),val)
#define sortv(vec) sort(vec.begin(),vec.end())
#define rev(p) reverse(p.begin(),p.end());
#define v vector
#define PI 3.1415926535
#define len length()
#define repc(i,s,e) for(ll i=s;i<e;i++)
#define fi first
#define se second
#define mset(a,val) memset(a,val,sizeof(a));
#define mt make_tuple
#define repr(i,n) for( i=n-1;i>=0;i--)
#define rep(i,n) for( i=0;i<n;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int M = 1e9 + 7;
ll INF = 1e10;

ll n, m;


int main() {
	// your code goes here
	IOS;

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll i, j, t, k, x, y, z,  N;
	cin >> n >> k;
	db a[n];
	rep(i, n) {
		cin >> a[i];
	}
	sort(a, a + n);
	ll l = 1, r = 1e9, mid, ans = -1;
	while (l <= r) {
		mid = (l + r) / 2;
		ll sum = 0;
		rep(i, n) {
			if (a[i] != mid)
				sum += a[i] / mid;
		}
		if (sum <= k) {
			r = mid - 1;
			ans = mid;
		}
		else
			l = mid + 1;
	}
	cout << ans;


	return 0;
}

Measured memory_bytes: 6844
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int dp[41][401][401];

int main(){
    int n,A,B;
    cin >> n >> A >> B;
    vector<int> a(n),b(n),c(n);
    rep(i,n) cin >> a[i] >> b[i] >> c[i];
    rep(i,41) rep(j,401) rep(k,401) dp[i][j][k]=INF;
    dp[0][0][0] = 0;
    rep(i,n){
        rep(j,401){
            rep(k,401){
                if(dp[i][j][k]==INF) continue;
                dp[i+1][j][k] = min(dp[i+1][j][k],dp[i][j][k]);
                dp[i+1][j+a[i]][k+b[i]] = min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k] + c[i]);
            }
        }
    }
    int ans = INF;
    for(int j=1;j<=400;j++) for(int k=1;k<=400;k++){
        if(j*A==k*B){
            ans = min(ans,dp[n][k][j]);
            //cout <<"yes" << endl;
        }
    }
    if(ans == INF) ans = -1;
    cout << ans << endl;
}

Measured memory_bytes: 25984
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
	int A,B,C,X,Y; cin>>A>>B>>C>>X>>Y;
	cout<<min(A*X+B*Y,min(2*C*max(X,Y),A*(X-min(X,Y))+B*(Y-min(X,Y))+2*C*min(X,Y)));
}

Measured memory_bytes: 256
s = int(input())
def foo(N, s):
  ls = [s]
  for i in range(N):
    a = ls[i]//2 if ls[i]%2==0 else (ls[i]*3+1)
    if a in ls:
      return i + 2
    else:
      ls.append(a)
  return False
print(foo(1000000, s))

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

int less(void const* pa, void const* pb) {
  int a = *(int*)pa;
  int b = *(int*)pb;
  if (a < b) return +1;
  if (a > b) return -1;
  return 0;
}

int main(void) {
  size_t n;
  scanf("%zu", &n);

  int a[n];
  for (size_t i = 0; i < n; ++i)
    scanf("%d", &a[i]);

  qsort(a, n, sizeof(int), less);
  for (size_t i = 1; i < n; ++i)
    if (a[i-1] == a[i]) return puts("NO"), 0;

  puts("YES");
}


Measured memory_bytes: 1788
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <vector>
using namespace std;

typedef long long ll;
ll n, m;

int main(){
	scanf("%lld%lld", &n, &m);
	ll sum = 0;
	if(n >= m / 2){
		printf("%lld\n", m / 2);
		return 0;
	}
	sum = n;
	m = m - 2 * n;
	sum += m / 4;
	printf("%lld\n", sum);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;

int64_t mod = 998244353 ;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}


vector<int> getprime(int n){
    vector<int> p(0) ;
    vector<bool> table(n+1,0) ;
    for (int i = 2; i <= n; i++)
    {
        if (table.at(i) == 0)
        {
            p.push_back(i) ;
            for (size_t j = 2; j < n/i ; j++)
            {
                table.at(i*j) = 1 ;
            }
            
        }
        
    }
    return p ;
}

int main(){
    int a,b,c ;
    cin >> a >> b >> c ;
    if (a == b)
    {
        cout << c << endl ;
    }else if (b == c)
    {
        cout << a << endl ;
    }else
    {
        cout << b << endl ;
    }
    
    
    
}

Measured memory_bytes: 3608
from collections import Counter
n=int(input())
S=list(map(int,input().split()))
number=Counter(S)
comb=0
stock={}
for i in list(number.values()):
  comb += i*(i-1)/2
for i in S:
  ans = int(comb - number[i]*(number[i]-1)/2 + (number[i]-1)*(number[i]-2)/2)
  print(ans)


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



int min(int a,int b,int c){
if(a<=b&&a<=c){return a;}
else if(b<=c&&b<=a){return b;}
else if(c<=b&&c<=a){return c;}
}



int main(void){
int n;
int difa=0,difb=0,difc=0;
char a[101],b[101],c[101];
scanf("%d",&n);
scanf("%s",a);
scanf("%s",b);
scanf("%s",c);

for(int i=0;a[i]!='\0';i++){
if(((a[i]!=b[i])&&(b[i]!=c[i])&&(a[i]!=c[i]))){difa=difa+2;}
else if((a[i]==b[i])&&(b[i]==c[i])&&(a[i]==c[i])){}
else{difa++;}
}
printf("%d",difa);


}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

std::vector<bool> visited;

void bfs(int now, std::vector<pair<int,int>> v, int dame){
	// きたとこが訪問済みなら終わり
	if (!visited[now]) {
		return;
	}
	visited[now] = false;
	for (size_t i = 0; i < v.size(); i++) {
		if (i != dame * 2 && i != dame * 2 + 1) {
			if (now == v[i].first) {
				bfs(v[i].second,v,dame);
			}
		}
	}
}


int main(int argc, char const *argv[]) {
	int N,M;
	std::cin >> N >> M;
	// 辺を双方向でいれる
	std::vector<pair<int,int>> v;
	// 辺の使用可能状況を格納
	std::vector<bool> boolv(M,true);
	// 入力
	for (size_t i = 0; i < M; i++) {
		int temp1,temp2;
		std::cin >> temp1 >> temp2;
		temp1--;
		temp2--;
		v.push_back(make_pair(temp1, temp2));
		v.push_back(make_pair(temp2, temp1));
	}

	visited.resize(N);

	int count = 0;
	// 各辺を使用不能にして行く
	for (size_t i = 0; i < M; i++) {
		for (size_t j = 0; j < visited.size(); j++) {
			visited[j] = true;
		}
		bfs(0,v,i);
		for (size_t j = 0; j < visited.size(); j++) {
			if (visited[j]) {
				count++;
				break;
			}
		}
	}

	std::cout << count << '\n';


	return 0;
}


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

namespace _0430_atcoder問題_04
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = Convert.ToInt32(input[0]);
            int b = Convert.ToInt32(input[1]);
            int c = 0;
            //余りを求める。0なら処理を実行
            if(b % a == 0)
            {
                c = b + a;
            }
            else
            {
                c = b - a;
            }
            Console.WriteLine(c);
        }
    }
}

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

using namespace std;

int N, K, XMAX, YMAX;

int dx[] = {0, 0, 0, 1, 1, -1, -1, 2, -2};
int dy[] = {0, 2, -2, 1, -1, 1, -1, 0, 0};

int imos[1002][2002];

int clip(int a, int mn, int mx) {
    return max(min(a, mx), mn);
}

int main(){
    cin >> N >> K;
    XMAX = 2 * K + 1;
    YMAX = K + 1;
    for (int i = 0; i < N; ++i) {
        int x, y;
        char c;
        cin >> x >> y >> c;
        x = x % (2 * K);
        y = y % (2 * K);
        if (y >= K) {
            y -= K;            
            if (x < K) {
                x += K;
            } else {
                x -= K;
            }
        }

        if (c == 'W') {
            if (x < K) {
                x += K;
            } else {
                x -= K;
            }
        }

        int lbx = x - (K - 1);
        int lby = y - (K - 1);
        int rtx = x + 1;
        int rty = y + 1;

        //cout << "---- " << x << "," << y << endl;
        for (int k = 0; k < 9; ++k) {
            int clbx = clip(lbx + dx[k] * K, 0, XMAX);
            int clby = clip(lby + dy[k] * K, 0, YMAX);
            int crtx = clip(rtx + dx[k] * K, 0, XMAX);
            int crty = clip(rty + dy[k] * K, 0, YMAX);

            //cout << clbx << "," << clby << " - " << crtx << "," << crty << endl;
            imos[clby][clbx]++;
            imos[crty][clbx]--;
            imos[clby][crtx]--;
            imos[crty][crtx]++;
        }

    }

    for (int oy = 0; oy <= YMAX; ++oy) {
        int sum = 0;
        for (int ox = 0; ox <= XMAX; ++ox) {
            sum += imos[oy][ox];
            imos[oy][ox] = sum;
        }
    }
    int ans = 0;
    for (int ox = 0; ox <= XMAX; ++ox) {
        int sum = 0;
        for (int oy = 0 ; oy <= YMAX; ++oy) {
            sum += imos[oy][ox];
            imos[oy][ox] = sum;
            if (ans < sum) {
                ans = sum;
            }
        }
    }

    //for (int oy = YMAX; oy >= 0; --oy) {
    //    for (int ox = 0; ox < XMAX; ++ox) {
    //        cout << imos[oy][ox] << " ";
    //    }
    //    cout << endl;
    //}
    cout << ans << endl;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
using namespace std;

int N;

int main(){
  ios_base::sync_with_stdio(false); 
  cin >> N;
  vector<int> v(N);
  int res = 0;
  int flag = 1;
  for(int i=0; i<N; ++i){
    cin >> v[i];
    if(v[i]%10 != 0)
      flag = 0;
  }
  if(!flag){
    sort(all(v), greater<int>());
    for(int i=0; i<N; ++i){
       res += v[i];
    } 
    while(res%10 == 0){
      for(int i=N-1; i>=0; --i)
        if(v[i]%10 != 0){
          res -= v[i];
          break;
        }
    } 
  }
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    print((100000000 - ni()) % 1000)
    return

solve()


Measured memory_bytes: 9120
#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(){
    VI n(4);
    rep(i,4)cin >> n.at(i);
    sort(n.begin(),n.end());
    bool a=true;
    if(n.at(0)!=1)a=false;
    else if(n.at(1)!=4)a=false;
    else if(n.at(2)!=7)a=false;
    else if(n.at(3)!=9)a=false;
    if(a)cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 3632
// Problem:
// 			B - Making Triangle
//
//
// Contest: AtCoder - AtCoder Beginner Contest 175
// URL: https://atcoder.jp/contests/abc175/tasks/abc175_b
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Muallif: Azimjon Mehmonali o'g'li

#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define int long long

typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define F first
#define S second
#define pb push_back
#define endl "\n"

#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SORT(a) sort(ALL(a))
#define rSORT(a) sort(rALL(a))
#define REV(a) reverse(ALL(a))
#define sqr(x) ((x) * (x))

//=========================================================
int recur_depth = 0;
#ifdef DEBUG
#define xtp(x)                                                           \
	{                                                                    \
		++recur_depth;                                                   \
		auto x_ = x;                                                     \
		--recur_depth;                                                   \
		cerr << string(recur_depth, '\t') << __func__ << ":" << __LINE__ \
			 << "\t" << #x << " = " << x_ << endl;                       \
	}
#else
#define xtp(x)
#endif
template <typename Ostream, typename Cont>
typename enable_if<is_same<Ostream, ostream>::value, Ostream&>::type operator<<(
	Ostream& os, const Cont& v) {
	os << "[";
	for (auto& x : v) {
		os << x << ", ";
	}
	return os << "]";
}
template <typename Ostream, typename... Ts>
Ostream& operator<<(Ostream& os, const pair<Ts...>& p) {
	return os << "{" << p.first << ", " << p.second << "}";
}
//=========================================================

#define TEZ                  \
	ios::sync_with_stdio(0); \
	cin.tie(0);

const long double PI = 3.1415926535897;
const int mod = 1000000007LL;
const int INF = 1e18;

signed main() {
	TEZ;

	int n;
	cin >> n;

	vi l(n);
	for (int& i : l)
		cin >> i;

	int jv = 0;
	for (int i = 0; i < n - 2; i++) {
		for (int j = i + 1; j < n - 1; j++) {
			if (l[i] == l[j]) continue;
			for (int k = j + 1; k < n; k++) {
				if (l[i] == l[k] || l[j] == l[k]) continue;
				jv += (l[i] + l[j] > l[k]) && (l[i] + l[k] > l[j])
					  && (l[k] + l[j] > l[i]);
			}
		}
	}

	cout << jv << endl;

	return 0;
}


Measured memory_bytes: 3656