akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>  // ver2.1.7
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define Pii pair<int,int>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int, vector<int>, greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vout(a) rep(Z,0,a.size()-1)cout<<a[Z]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lW,0,a.size()){Vout(a[lW]);}
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}

signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int h,w;
  cin >> h >> w;
  vector<string> a(h);
  rep(i,0,h) cin >> a[i];
  
  vector<Vi> yoko(h,Vi(w)),tate(h,Vi(w));
  //VVout(a);
  int s,g,now = 0;
  
  rep(i,0,h){
    s=0;
    rep(j,0,w){
      if(a[i][j]=='.') now++;
      if(a[i][j]=='#') {
        rep(k,s,j) yoko[i][k]=now;
        now = 0;
        s = j+1;
      }
      if(j==w-1 && now > 0){
        rep(k,s,j+1) yoko[i][k]=now;
        now = 0;
        s = j+1;
      }
    }
  }
  
  now = 0;
  
  rep(j,0,w){
    s=0;
    rep(i,0,h){
      if(a[i][j]=='.') now++;
      if(a[i][j]=='#') {
        rep(k,s,i) tate[k][j]=now;
        now = 0;
        s = i+1;
      }
      if(i==h-1 && now > 0){
        rep(k,s,i+1) tate[k][j]=now;
        now = 0;
        s = i+1;
      }
    }
  }
  
  //VVout(tate);
  
  int ans = 0;
  rep(i,0,h){
    rep(j,0,w){
      ans = max(ans,yoko[i][j]+tate[i][j]);
    }
  }
  ans--;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 67200
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define fr front()
#define tp top()
typedef long long int ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <pii, int> ppi;
typedef pair <int, pii> pip;
#define iofast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define iofile freopen("input.txt","r",stdin),freopen("output.txt","w",stdout)
const ll LLINF = 1e18;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1);
const int SIZE = 100005;

int main (){
	
	int a, b, c;
	
	scanf("%d %d %d", &a, &b, &c);
	int iter=0;
	if(a%2==1 || b%2==1 || c%2==1){
		printf("0\n");
		return 0;
	}
	while(iter<1e8){
		int aa=a/2;
		int bb=b/2;
		int cc=c/2;
		a=bb+cc;
		b=aa+cc;
		c=aa+bb;
		iter++;
		if(a%2==1 || b%2==1 || c%2==1){
			break;
		}
	}
	if(iter<1e8){
		printf("%d\n", iter);
	} else {
		printf("-1\n");
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;

int main() {
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;

	string ans;
	ans.clear();

	for (int i = 0;i < n;i++) {
		ans += s[i];
		ans += t[i];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3564
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
                Out.Flush();
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var N = IO.RInt;
            var ans = int.MaxValue;
            for (int A = 1; A < N; A++)
            {
                int _A = A;
                int _B = N - A;

                int kA = 0;
                while (_A > 0)
                {
                    kA += _A % 10;
                    _A /= 10;
                }
                int kB = 0;
                while (_B > 0)
                {
                    kB += _B % 10;
                    _B /= 10;
                }
                ans = Min(ans, kA + kB);
            }
            WriteLine(ans);
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 17592
using System;
using System.Linq;

namespace ITP1_6_D
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var n = int.Parse(input[0]);
            var m = int.Parse(input[1]);

            var a = new int[n][];
            for(int i = 0; i < n; i++)
            {
                a[i] = Console.ReadLine().Split(' ')
                    .Select(s => int.Parse(s))
                    .ToArray();
            }

            var b = new int[m];
            for(int i = 0; i < m; i++)
            {
                b[i] = int.Parse(Console.ReadLine());
            }

            for(int i = 0; i < n; i++)
            {
                var c = 0;
                for(int j = 0; j < m; j++)
                {
                    c += a[i][j] * b[j];
                }
                Console.WriteLine(c);
            }
        }
    }
}

Measured memory_bytes: 9740
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFLL = LLONG_MAX / 3;
const double eps = (1e-9);

vector<int> createEratos(int n)
{
  vector<int> isprime(n+1, 1);
  isprime[0] = 0;
  isprime[1] = 0;

  for (int i = 2; i * i <= n; i++) {
    if (isprime[i]) {
      int j = i + i;
      while (j <= n) {
        isprime[j] = 0;
        j = j + i;
      }
    }
  }
  return isprime;
}

// 階乗の素因数分解
vector<int> factfact(int n)
{
  vector<int> prime = createEratos(n);

  for (int i = 2; i <= n; i++) {
    if (prime[i]) {
      prime[i] = 0;
      for (int j = i; j <= n; j *= i) {
        prime[i] += n/j;
      }
    }
  }
  return prime;
}

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

  ll n; cin >> n;
  auto factors = factfact(n);
  int o74 = 0;
  int o24 = 0;
  int o14 = 0;
  int o4 = 0;
  int o2 = 0;
  for (auto& v : factors) {
    if (v >= 74) o74++;
    if (v >= 24) o24++;
    if (v >= 14) o14++;
    if (v >= 4) o4++;
    if (v >= 2) o2++;
  }

  ll ans = 0;
  ans += o74;
  ans += o24 * (o2-1);
  ans += o14 * (o4-1);
  ans += (o4 * (o4-1) * (o2-2)) / 2;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
#include <functional>
 
using namespace std;
typedef long long ll;
const ll INF = 1e18;

# define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define all(x) (x).begin(), (x).end()
# define pb push_back
 
ll N, M;

bool isPalindrome(string s) {
  string t = s;
  reverse(t.begin(), t.end()); // t をひっくり返す
  return s == t; // 比較する
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    bool ans = true;
    if (!isPalindrome(s)) {
        ans = false;
    }
    string leftSub = s.substr(0, s.size()/2);
    if (!isPalindrome(leftSub)) {
        ans = false;
    }
    
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  char S;
  cin >> S;
  if (97 <= S && S <= 122) {
    cout << "a" << endl;
  } else {
    cout << "A" << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
def resolve():
	h,w=map(int,input().split())
	s=[input() for i in range(h)]
	kekka='Yes'
	for i in range(h):
		for j in range(w):
			if s[i][j]=='#':
				ans=0
				if j==0:
					ans+=s[i][1]=='#'
				elif j==w-1:
					ans+=s[i][-2]=='#'
				else:
					ans+=s[i][j-1]=='#' 
					ans+=s[i][j+1]=='#'
					
				if i==0:
					ans+=s[1][j]=='#'
				elif i==h-1:
					ans+=s[-2][j]=='#'
				else:
					ans+=s[i-1][j]=='#' 
					ans+=s[i+1][j]=='#'
				if ans==0:
					kekka='No'
					break
		else:
			continue
		break
	print(kekka)
resolve()

Measured memory_bytes: 39024
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;
struct juice
{long money;
long number;
}a[100000];
bool cmp(juice a,juice b)
{
    return a.money<b.money;
}
int main()
{long long n,m,sum=0,sum2=0;
cin>>n>>m;
for(int i=0;i<n;i++)
cin>>a[i].money>>a[i].number;
sort(a,a+n,cmp);
for(int i=0;;i++)
{if((sum+a[i].number)<m) {sum2=sum2+a[i].number*a[i].money;sum=sum+a[i].number;}
else if((sum+a[i].number)>=m) {sum2=sum2+(m-sum)*a[i].money;break;}
}
cout<<sum2;
return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k; cin >> n >> k;
  vector<int> A(n); rep(i, n) cin >> A[i];
  map<int, int> mp;
  rep(i, n) mp[A[i]]++;
  vector<int> v;
  for(auto ele: mp) v.push_back(ele.second);
  sort(all(v), greater<int>());
  if(v.size() <= k) cout << 0 << endk;
  else {
    int ans = 0;
    for(int i=k; i<=v.size(); i++) ans += v[i];
    cout << ans << endk;
  }
  return 0;
}


Measured memory_bytes: 14288
//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
//これは、頭が悪く競プロが世界で一番できないHIR180が
//IOI2014日本代表になるまでのN日間の記録である。
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 500000000
#define f first
#define s second
#define rep(i,x) for(int i=0;i<x;i++)
int d[3005];
vector<P>edge[3005];
int main()
{
	srand((unsigned int)time(NULL));
		int n,m,k;
		scanf("%d%d%d",&n,&m,&k);
		for(int i=0;i<m;i++)
		{
			int a,b,c; scanf("%d%d%d",&a,&b,&c);
			edge[a].pb(mp(b,c));
			edge[b].pb(mp(a,c));
		}
		fill(d+1,d+n+1,INF);
		priority_queue<P,vector<P>,greater<P> >que;
		for(int i=0;i<k;i++)
		{
			int x; scanf("%d",&x);
			d[x]=0;
			que.push(mp(d[x],x));
		}
		while(!que.empty())
		{
			P p=que.top(); que.pop();
			if(p.f!=d[p.s]) continue;
			for(int i=0;i<edge[p.s].size();i++)
			{
				if(p.f+edge[p.s][i].s<d[edge[p.s][i].f])
				{
					d[edge[p.s][i].f]=p.f+edge[p.s][i].s;
					que.push(mp(d[edge[p.s][i].f],edge[p.s][i].f));
				}
			}
		}
		int ret=0;
		for(int i=1;i<=n;i++)
		{
			for(int j=0;j<edge[i].size();j++)
			{
				ret=max(ret,d[i]+d[edge[i][j].f]+edge[i][j].s);
			}
		}
		printf("%d\n",(ret+1)/2);
}

Measured memory_bytes: 4164
#include "bits/stdc++.h"

#define rep(i, a) for (int i = 0; i < (int)a; ++i)
#define REP(i, a, b) for (int i = (a); i < (int)b; ++i)

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

void Main() {
  int n, k;
  cin >> n >> k;
  if ((n-1)*(n-2)/2 < k) {
    cout << -1 << endl;
    return;
  }

  int now = (n-1)*(n-2)/2;
  vector<P> pass;
  REP(i, 1, n) pass.emplace_back(0, i);
  REP(i, 1, n-1) {
    if (now == k) break;
    REP(j, i+1, n) {
      if (now == k) break;
      pass.emplace_back(i, j);
      now--;
    }
  }
  cout << pass.size() << endl;
  for(P p : pass) cout << p.first + 1 << " " << p.second + 1 << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


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

public class AtCoderC
{
    private static double w;
    private static double h;
    private static double x;
    private static double y;

    static void Main()
    {
        {
            string line = Console.ReadLine();
            var words = line.Split(' ');
            w = double.Parse(words[0]);
            h = double.Parse(words[1]);
            x = double.Parse(words[2]);
            y = double.Parse(words[3]);
        }

        bool hasManyAnswer = (x == w / 2) && (y == h / 2);
        double answer = w * h / 2d;
        Console.WriteLine(answer + " " + (hasManyAnswer ? "1" : "0"));
    }
}

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

using namespace std;

int main(void){
	unsigned short N;
	scanf("%d", &N);

	float ans;

	if(N % 2 == 0)
		ans = float((N/2))/N;
	else
	{
		ans = float((N/2)+1)/N;
	}
	

	printf("%f\n",ans);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>
#include <bitset>

#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVL vector<vector<ll>>
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define PAIR pair<ll,ll>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;
constexpr ll MOD = 1000000007;
using std::cout;
using std::endl;
using std::cin;
using std::sort;
using std::pair;
using std::string;
using std::stack;
using std::queue;
using std::vector;
using std::list;
using std::map;
using std::unordered_map;
using std::multimap;
using std::unordered_multimap;
using std::set;
using std::unordered_set;
using std::multiset;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll pow(ll a, ll b) {
	ll ans = 1;
	while (b > 0) {
		if (b % 2 == 1) {
			ans *= a;
			ans %= MOD;
		}
		b /= 2;
		a *= a;
		a %= MOD;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a - b < b) { return comb(a, a - b); }
	static unordered_map<ll, ll> memo;

	ll c = 1;
	FOR(i, a - b + 1, a + 1) {
		c *= i;
		c %= MOD;
	}
	if (memo.find(b) == memo.end()) {
		ll k = 1;
		FOR(i, 2, b + 1) {
			k *= i;
			k %= MOD;
		}
		memo[b] = pow(k, MOD - 2);
	}
	c *= memo[b];
	return c % MOD;
}
multiset<ll> prime_decomposition(ll n) {
	ll i = 2;
	multiset<ll> table{};
	while (i * i <= n) {
		while (n % i == 0) {
			n /= i;
			table.emplace(i);
		}
		++i;
	}
	if (n > 1) {
		table.emplace(n);
		return table;
	}
	return table;
}
/*
-- bit --
REP(i, (1 << n)) {
	REP(j, n) {
		cout << (1 & (i >> j));
	}
	cout << endl;
}
*/

ll dsum(ll a) {
	ll s = 0;
	while (a != 0) {
		s += a % 10;
		a /= 10;
	}
	return s;
}

int main() {
	VL v(3);
	REP(i, 3) { cin >> v[i]; }

	ll ans = 0;
	while (v[0] != v[1] || v[1] != v[2]) {
		sort(ALL(v));
		if (v[0] + 1 < v[1]) {
			v[0] += 2;
		} else {
			++v[0];
			++v[1];
		}
		++ans;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long int a,b,c,d;

long long int gcd (long long int x, long long int y){
    if (x%y == 0 || y%x == 0){
        return min(x,y);
    }else{
        //printf ("%lld %lld %lld\n",x,y,gcd(max(x,y)%min(x,y),min(x,y)));
        return gcd(max(x,y)%min(x,y),min(x,y));
    }
}

long long int lcm (long long int x, long long int y){
    return x*y/gcd(x,y);
}

long long int solve(long long int n, long long int x, long long int y){
    /*if (gcd(x,y) == 1){
        printf ("%lld %lld %lld\n",n,x,y);
        return (n - (n/x) - (n/y) + (n/(x*y)));
    }else{
        return solve(n/gcd(x,y),x/gcd(x,y),y/gcd(x,y));
    }*/

    return (n - (n/x) - (n/y) + n/lcm(x,y));
}

int main(){
    scanf ("%lld %lld %lld %lld",&a,&b,&c,&d);
    printf ("%lld",solve(b,c,d)-solve(a-1,c,d));
}


Measured memory_bytes: 384
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();	//軒数
		int M = sc.nextInt();	//ほしい本数
		long[] a = new long[N];
		long[] b = new long[N];


		Map<Long, Long> tMap = new TreeMap<Long, Long>();
		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			if(tMap.containsKey((a[i]))) {
				tMap.put((a[i]), tMap.get(a[i]) + b[i]);
			} else {
				tMap.put(a[i], b[i]);
			}
		}

		long ans = 0;
		for(Map.Entry<Long, Long> entry : tMap.entrySet()) {
			long buy = Math.min(M, entry.getValue());

			ans += buy * entry.getKey();

			M -= buy;
		}

		System.out.println(ans);

		sc.close();
	}
}

Measured memory_bytes: 98056
#dfs(bfsと同じ)

from collections import deque

n,m=map(int,input().split())
edge=[]
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    edge.append((a,b))

#dfs(基準)
#隣接リスト
G=[[] for _ in range(n)]
for i in range(m):
    a,b=edge[i]
    G[a].append(b)
    G[b].append(a)

base=0
dist=[0]*n
for i in range(n):
    if dist[i]==0:
        base+=1
        #dfs
        dist[i]=1
        s=deque()
        s.append(i)
        while s:
            now=s.pop()
            for next in G[now]:
                if dist[next]>0:
                    continue
                s.append(next)
                dist[next]=1


ans=0

for i in range(m):
    #隣接リスト
    G=[[] for _ in range(n)]
    for j in range(m):
        if j!=i:
            a,b=edge[j]
            G[a].append(b)
            G[b].append(a)
    
    #dfs
    temp=0
    dist=[0]*n
    for j in range(n):
        #print(i,j,temp,dist,G)
        if dist[j]==0:
            temp+=1
            #dfs
            dist[j]=1
            s=deque()
            s.append(j)
            while s:
                now=s.pop()
                for next in G[now]:
                    if dist[next]>0:
                        continue
                    s.append(next)
                    dist[next]=1
    if temp>base:
        ans+=1

print(ans)


#0-1
#| |
#2--


    

Measured memory_bytes: 9424
// 27
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fors(_, x, n, s) \
  for (int _ = x; _ < n; _ += s)
#define forn(_, x, n) fors(_, x, n, 1)
#define rep(_, n) forn(_, 0, n)
#define forrs(_, x, n, s) \
  for (int _ = x; _ > n; _ -= s)
#define forrn(_, x, n) forrs(_, x, n, 1)
#define rrep(_, n) forrn(_, n - 1, -1)
#define fi first
#define se second
#define pb push_back
#define pairii pair<int, int>
#define all(x) x.begin(), x.end()
#define len(x) int(x.size())
#define lli __int128_t
#define li long long int
#define ld long double
#ifdef LOCAL
#define debug(e)                             \
  cerr << "\033[48;5;196m\033[38;5;15m" << e \
       << "\033[0m";
#else
#define debug(e)
#endif
// 4
template <class A, class B>
ostream &operator<<(ostream &o, const pair<A, B> &p) {
  return o << "(" << p.fi << " " << p.se << ")";
}
// 8
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v) {
  rep(i, (int)v.size()) o << setw(7) << left << v[i];
  return o << endl;
}
// 5
template <class A, class B>
ostream &operator<<(ostream &o, const map<A, B> &m) {
  for (auto &kv : m) o << kv;
  return o;
}
// 3
void _main(int tc) {
  string s;
  rep(i, 3) {
    cin >> s;
    if (i == 1) {
      cout << "A" << s[0] << "C" << endl;
    }
  }
}
// 7
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0), exit(0);
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

Measured memory_bytes: 256
#include "iostream"
using namespace std;

void Merge(int A[], int left, int mid, int right) {
	int n1 = mid - left;
	int n2 = right - mid;
	int L[1000];
	int R[1000];
	for (int i = 0; i < n1; i++) {
		L[i] = A[left + i];
	}
	for (int i = 0; i < n2; i++) {
		R[i] = A[mid + i];
	}

	L[n1] = 40000000;
	R[n2] = 40000000;
	int i = 0;
	int j = 0;
	for (int k = left; k < right; k++) {
		if (L[i] <= R[j]) {
			A[k] = L[i];
			i = i + 1;
		}
		else {
			A[k] = R[j];
			j = j + 1;
		}
	}

	return;


}

void MergeSort(int A[], int left, int right) {
	int mid = 0;
	if (left + 1 < right) {
		mid = (left + right) / 2;
	}
	if (left >= mid) {
		return;
	}
	MergeSort(A, left, mid);
	MergeSort(A, mid, right);
	Merge(A, left, mid, right);

}

int main()
{
	while (1) {
		int human = 0;           ///??????????????°
		int ba = 0;              ///??´?????????????????°
		int turn = 0;            ///??????
		int menber[100] = { 0 }; ///??????????????????
		char c[100] = { 0 };     ///????????????
		cin >> human;
		if (human == 0) {
			break;
		}
		for (int i = 0; i < 100; i++) {
			cin >> c[i];
		}
		for (int i = 0; i < 100; i++) {
			if (c[i] == 'S') {
				ba += menber[turn]+1;
				menber[turn] = 0;
			}
			if (c[i] == 'M') {
				menber[turn]+=1;
			}
			if (c[i] == 'L') {
				menber[turn] += 1 + ba;
				ba = 0;
			}
			turn++;
			if (turn == human)
				turn = 0;
		}
		MergeSort(menber, 0, human);
		for (int i = 0; i < human ; i++) {
			cout << menber[i] << " ";
		}
		cout << ba << endl;
	}
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  int l, r;
  int sum = 0;
  for(int i = 0; i < N; i++) {
    cin >> l >> r;
    sum += r - l + 1;
  }
  
  cout << sum << endl;
}
    

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

typedef long long ll;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n;
    cin >> n;
    vector<double> p(n);
    vector<vector<double>> dp(n+1,vector<double>(n+1,0.0));
    dp[0][0] = 1.0;
    for (int i = 0;i < n;++i) cin >> p[i];
    for (int i = 0;i < n;++i) for (int j = 0;j <= i;++j) {
        dp[i+1][j] += dp[i][j]*(1-p[i]);
        dp[i+1][j+1] += dp[i][j]*p[i];
    }
    double ans = 0.0;
    for (int i = (n+1)/2;i <= n;++i) ans += dp[n][i];
    cout << setprecision(12) << ans << endl;
    return 0;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int V;
const int MAX_V=40;
vector<int> G[MAX_V];
bool used[MAX_V];
int ord[MAX_V];
int cnt[MAX_V];		//cnt[v] = the num of selected verticies connected with v;
//typedef long long ll;
//set<ll> done;

int ans,power[40],m[40];
string name[40];
vector<string> names[40];

void dfs(int it){
	if(it==V){
//		ll x=0;
//		rep(i,V) if(used[i]) x|=(1LL<<i);
//		if(done.find(x)!=done.end()) return;
//		done.insert(x);
		if(!used[0]) return;
		int sum=0;
		rep(i,V) if(used[i]) sum+=power[i];
		chmax(ans,sum);
		return;
	}
	int v=ord[it];
	if(used[v]||cnt[v]){
		dfs(it+1);
		return;
	}
	//use v
	used[v]=1;
	for(int u:G[v]) cnt[u]++;
	dfs(it+1);
	used[v]=0;
	for(int u:G[v]) cnt[u]--;

	for(int u:G[v]) if(cnt[u]==0&&!used[u]){
		used[u]=1;
		for(int w:G[u]) cnt[w]++;
		dfs(it+1);
		used[u]=0;
		for(int w:G[u]) cnt[w]--;
	}
}
void enum_ind(int N){
	V=N;
	typedef pair<int,int> P;
	vector<P> tmp;
	rep(i,N) tmp.pb(P(G[i].size(),i));
	sort(all(tmp));
	rep(i,N) ord[i]=tmp[i].sc;
	rep(i,N) used[i]=0,cnt[i]=0;
//	done.clear();
	dfs(0);
}
int main(){
	while(true){
		int N;
		cin>>N;
		if(N==0) break;
		rep(i,N) names[i].clear();
		rep(i,N) G[i].clear();
		ans=0;
		rep(i,N){
			cin>>name[i]>>power[i]>>m[i];
			rep(j,m[i]){
				string st;
				cin>>st;
				names[i].pb(st);
			}
		}
		rep(i,N){
			rep(j,m[i]){
				rep(k,N){
					if(name[k]==names[i][j]) G[i].pb(k);
				}
			}
		}
		enum_ind(N);
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1372
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
#define MOD 1000000007

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;}
template<class T> inline T gcd(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T lcm(T a,T b){return a*b/gcd(a,b);}

const int INF=1e9;
const double eps=0.0000000001;

int main(){
  ll n,sum=0;
  ll d[1000000]={0};
  cin >> n;
  ll a[1000000];
  FOR(i,n){
    cin >> a[i];
    sum+=a[i];
  }
  d[0]=0;
  for(int i=1;i<n+1;i++){
    d[i]=d[i-1]+a[i-1];
  }
  ll ans=1000000000000000;
  for(int i=1;i<n;i++){
    chmin(ans,abs(sum-d[i]*2));
    
  }

  cout << ans << endl;

}


Measured memory_bytes: 11520
#include <stdio.h>

int main() {
    
    int a = 0;
    int b = 0;
    
    scanf("%d %d", &a, &b);
    
    if(a < b){
        printf("a < b\n");
    }
    else if(a > b){
        printf("a > b\n");
    }
    else {
        printf("a == b\n");
    }
   
    return 0;
}

Measured memory_bytes: 580
S = input()
T = input()

lens = len(S)
lent = len(T)

ans = lent

for i in range(lens - lent + 1):
  count = 0
  for j in range(lent):
    if S[i+j] != T[j]:
      count = count + 1

  if count < ans:
    ans = count
    
print(ans)


Measured memory_bytes: 9112
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0;i < n;i++)cin >> a[i];
	sort(a.begin(),a.end());

	//a[i]がどのa[j]を持ってきても割り切れないなら数え上げ.

	map<int,int> cnt;
	int mx = a[n-1];

	map<int,bool> is_used;
	for(int i = 0;i < n;i++){
		cnt[a[i]]++;
		if(is_used[a[i]] == false && cnt[a[i]] == 1){
			for(int j = 2*a[i];j <= mx;j += a[i]){
				is_used[j] = true;
			}
		}
	}


	int ans = 0;
	for(int i = 0;i < n;i++){
		if(is_used[a[i]] == false && cnt[a[i]] == 1){
			ans++;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 57920
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    
    int l = sc.nextInt();
    int r = sc.nextInt();
    int d = sc.nextInt();
    
    int index;
    int cnt = 0;
    
    for(index = l; index % d != 0; index++){};
    
    for(int i = index; i <= r; i += d){
      cnt++;
    }
    
    System.out.println(cnt);
  }
}

Measured memory_bytes: 35592
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> pairs(n);
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    pairs[i] = make_pair(a, b);
  }
  sort(pairs.begin(), pairs.end());
  long int sum = 0, drk = 0, p = 0;
  while (drk < m) {
    sum += pairs[p].first;
    pairs[p].second--;
    drk++;
    if (pairs[p].second == 0) {
      p++;
    }
  }
  cout << sum << endl;
  return 0;
}

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

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N;
	cin >> N;

	vector<int> num;

	for (int count6 = 6; count6 <= N; count6 *= 6)
	{
		num.push_back(count6);
	}

	for (int count9 = 9; count9 <= N; count9 *= 9)
	{
		num.push_back(count9);
	}

	vector<int> dp(N + 1, INF32);

	for (int i = 0; i <= N; i++)
	{
		dp[i] = i;
	}
	for (int i = 0; i < num.size(); i++)
	{
		for (int j = 0; j <= N - num[i]; j++)
		{
			dp[j + num[i]] = min(dp[j + num[i]], dp[j] + 1);
		}
	}
	cout << dp[N] << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 640
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main()
{
    ll n,i,j,cc=0;
    cin>>n;
    ll ara[n];for(i=0;i<n;i++)cin>>ara[i];
    for(i=1;i<n-1;i++){
        if(ara[i]>ara[i-1] && ara[i]<ara[i+1])cc++;
        else if(ara[i]<ara[i-1] && ara[i]>ara[i+1])cc++;
    }
    cout<<cc<<endl;
return 0;
}


Measured memory_bytes: 4992
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#define ld long double
using namespace std;

const int MaxN = 1e5 + 10;
const int MOD = 1e9 + 7;
const int INF = 1e9;

pair < double, double > p[MaxN];
pair < double, char > all[MaxN];
int n, k;

bool can(ld rad) {
  int res = 1;
  for (int i = 1; i <= n && res < k; ++i) {
    int c = 1, sz = 0;
    for (int j = 1; j <= n; ++j) {
      if (i == j) {
        continue;
      }
      ld d = hypot(p[i].first - p[j].first, p[i].second - p[j].second);
      if (d / 2 > rad) {
        continue;
      }
      pair < ld, ld > v = make_pair((p[j].first - p[i].first) / d, (p[j].second - p[i].second) / d);
      ld l1 = d / 2;
      ld l2 = sqrt(rad * rad - l1 * l1);
      l1 /= rad;
      l2 /= rad;
      pair < ld, ld > p1 = make_pair(v.first * l1 + v.second * l2, v.second * l1 - v.first * l2);
      pair < ld, ld > p2 = make_pair(v.first * l1 - v.second * l2, v.second * l1 + v.first * l2);
      ld ang1 = atan2(p1.second, p1.first);
      ld ang2 = atan2(p2.second, p2.first);
      if (ang1 > ang2) {
        c++;
      }
      all[sz++] = make_pair(ang1, 1);
      all[sz++] = make_pair(ang2 + 1e-10, -1);
    }
    sort(all, all + sz);
    for (int j = 0; j < sz; ++j) {
      c += all[j].second;
      if (res < c) {
        res = c;
      }
    }
  }
  return res >= k;
}

int main() {
//  freopen("input.txt", "r", stdin);
  cin >> n ;
  k = n;
  for (int i = 1; i <= n; ++i) {
    cin >> p[i].first >> p[i].second;
  }
  random_shuffle(p + 1, p + n + 1);
  ld l = 0, r = 2e3;
  for (int it = 0; it < 50; ++it) {
    double m = (l + r) / 2;
    if (can(m)) {
      r = m;
    } else {
      l = m;
    }
  }
  cout.precision(10);
  cout << fixed << (l + r) / 2.0 << '\n';
  return 0;
}

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

using namespace std;

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define INF 1000000000
#define pb push_back
#define mk make_pair

#define flu(i, s, e) for(int i = s; i < e; i++)
#define fld(i, s, e) for(int i = s; i >= e; i--)


int main(){
	fast;

	// freopen("input.txt", "r", stdin);
	// freopen("myoutput.txt", "w", stdout);

	int n; scanf("%d", &n);
	n %= 10;
	if(n == 0 || n == 1 || n == 6 || n == 8) printf("pon\n");
	else if(n == 3) printf("bon\n");
	else printf("hon\n");

	return 0;
}

Measured memory_bytes: 3764
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<string>
#include<queue>
#include<utility>
#include<vector>
#include<map>
#include<functional>
#include<math.h>
#include<algorithm>
typedef long long ll;
using namespace std;
// cin >> ;
//cout << << endl;
int main(){
  int a,b,c,e,f,g,k;
  int d[5];
  string s,t;
  bool miria =true;
  cin >> d[0] >> d[1] >> d[2] >> d[3] >> d[4] >> k;

  for(int i=0;i<5;i++){
    for(int j=i;j<5;j++){
      int tmp = d[j] - d[i];
      if(tmp>k){
        miria = false;
        break;
      }
    }
  }
  printf("%s\n",miria==true ? "Yay!" :":(");
  return 0;
}


Measured memory_bytes: 888
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
ans = 0
l = []
r = []
for i,j in enumerate(A):
    l.append(i+j)
    r.append(i-j)

b = Counter(r)
for i in l:
    ans += b.get(i,0)
print(ans)

Measured memory_bytes: 50652
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <iomanip>
using namespace std;

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

long long int solve(long long int n, long long int c, long long int d) {
  long long int c1 = n / c;
  long long int c2 = n / d;
  long long int gc = gcd(c, d);
  long long int lcm = c * d / gc;
  long long int c3 = n / lcm;
  return n - c1 - c2 + c3;
}

int main() {
  long long int a, b, c, d = 0;
  cin >> a >> b >> c >> d;

  cout << solve(b, c, d) - solve(a-1, c, d) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int main(void){
	int H=0,W=0,allmain=1000000000,main=0,near=0;
	cin>>H>>W;
	int A[H][W]={0};
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++)
		{
			cin>>A[i][j];
		}
	}
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			for(int k=0;k<H;k++){
				for(int c=0;c<W;c++)
				{
					near=min(abs(c-j),abs(k-i));
					main+=near*A[k][c];
				}
			}
			allmain=min(allmain,main);
			main=0;
		}
	}
	cout<<allmain<<endl;
	return 0;
}


Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.HashMap;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    Scanner in = new Scanner(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    DGoodGrid solver = new DGoodGrid();
    solver.solve(1, in, out);
    out.close();
  }

  static class DGoodGrid {

    public void solve(int testNumber, Scanner in, PrintWriter out) {
      // i+jの同値類に分けておいて,色と数をカウントしておく.
      // あとはコストを各色の組(c_0, c_1, c_2)について考えればいいよねっ☆
      // と思ったけど各グリッドについてやっていたらTLEしそう.個数を持っておけば間に合わん？30個しかないやん
      // そり！
      int n = in.nextInt();
      int c = in.nextInt();
      int[][] dif = new int[c + 1][c + 1];
      HashMap<Integer, Integer>[] hm = new HashMap[3];
      hm[0] = new HashMap<>();
      hm[1] = new HashMap<>();
      hm[2] = new HashMap<>();
      int minCost = Integer.MAX_VALUE;

      for (int i = 1; i <= c; i++) {
        for (int j = 1; j <= c; j++) {
          dif[i][j] = in.nextInt();
        }
      }

      for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
          int color = in.nextInt();
          if (hm[(i + j) % 3].containsKey(color)) {
            // 既に存在するので書換
            hm[(i + j) % 3].replace(color, hm[(i + j) % 3].get(color) + 1);
          } else {
            hm[(i + j) % 3].put(color, 1);
          }
        }
      }

      for (int i = 1; i <= c; i++) {
        for (int j = 1; j <= c; j++) {
          for (int k = 1; k <= c; k++) {
            if (i == j || j == k || k == i) {
              continue;
            } else {
              // 書換がいる.
              int tmpCost = 0;
              for (int l = 1; l <= c; l++) {
                if (hm[0].containsKey(l)) {
                  tmpCost += hm[0].get(l) * dif[l][i];
                }
                if (hm[1].containsKey(l)) {
                  tmpCost += hm[1].get(l) * dif[l][j];
                }
                if (hm[2].containsKey(l)) {
                  tmpCost += hm[2].get(l) * dif[l][k];
                }
              }
              minCost = Math.min(minCost, tmpCost);
            }
          }
        }
      }

      out.println(minCost);

    }

  }
}



Measured memory_bytes: 85852
import sys
N = int(input())
A = list(map(int, list(input().split())))
E = []
for i in range(N):
    if A[i]%2 == 0:
        E.append(A[i])
if len(E) == 0:
    print('APPROVED')
else:
    for j in range(len(E)):
        if E[j]%3 != 0 and E[j]%5 != 0:
            print('DENIED')
            sys.exit()
    print('APPROVED')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, K;
    cin >> N >> K;
    vector<int> vec(N);
    int count=0;
    for(int i=0; i<N; i++){
        cin >> vec.at(i);
        if(vec.at(i) >= K) count++;
    }
    cout << count << endl;


}

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

int main(){
    //input
    long long N;
    cin >> N;
    vector<pair<long long,long long> > start;
    vector<pair<long long,long long> > goal;
    long long X,L;
    long long i,j;
    for(i=0; i<N; i++){
        cin >> X >> L;
        start.push_back(make_pair(X-L,i));
        goal.push_back(make_pair(X+L,i));
    }

    //calc
    sort(start.begin(),start.end());
    sort(goal.begin(),goal.end());
    bool usable[N];
    fill(usable,usable+N,1);
    long long ans=0;
    long long j_sta=0;
    for(i=0; i<N; i++){
        if(usable[goal[i].second]){
            ans++;
            usable[goal[i].second]=0;
            for(j=j_sta; j<start.size(); j++){
                if(start[j].first<goal[i].first){
                    usable[start[j].second]=0;
                }else{
                    break;
                }
            }
            j_sta=j;
        }
    }

    //answer
    cout << ans << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 3932
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>

using namespace std;

int A[100000];
long long B[100000];
bool stand_bit(int N, int pos){
    if((((N >> (29 - pos)) & 1) == 0)){
        return false;
    }
    return true;
}
bool valid(int cond, int K, int same_till){
    for(int i = 0; i < same_till; i++){
        if(!stand_bit(K, i) && stand_bit(cond, i)){
            return false;
        }
    }
    if(same_till < 30){
        return !stand_bit(cond, same_till);
    } 
    return true;
}

int main(){
    int N;
    int K;
    cin >> N >> K;
    for(int i = 0; i < N; i++){
        cin >> A[i] >> B[i];
    }

    long long ans = 0;
    bool stated = false;
    for(int i = 0; i < 31; i++){
        if((i == 30 || (K >> (29 - i)) & 1) == 1){
            long long tmp_ans = 0;
            for(int j = 0; j < N; j++){
                if(valid(A[j], K, i)){
                    tmp_ans += B[j];
                }
            }
            ans = max(ans, tmp_ans);
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    if (a == b && b == c){
        cout << "No";
    }
    else if (a != b && b != c && a != c){
        cout << "No";
    }
    else cout << "Yes";
}

Measured memory_bytes: 256
def createFacArr(n, mod):
    '''
    二項係数計算用の配列の作成

    Parameters
    n : int
        配列のサイズ
    mod : int
        あまり

    Returns
    fac : list
        階乗のリスト
    finv : list
        modの逆元のリスト
    ivn : list
    '''
    fac = [0] * n
    finv = [0] * n
    inv = [0] * n
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, n):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i] * (mod // i) % mod
        finv[i] = finv[i-1] * inv[i] % mod
    return fac, finv

def comb(n ,k, mod, fac, finv):
    '''
    二項係数の計算

    Parameters
    n : int
        元集合
    k : int
        元集合から選択する数
    mod : int
        あまり
    fac : list
        階乗のリスト
    finv : list
        逆元のリスト
    
    Returns
    c : int
        nCkの組み合わせの数
    '''
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod
MOD = 10 ** 9 + 7
fac, finv =  createFacArr(10**7, MOD)

r1, c1, r2, c2 = map(int, input().split())

ans = 0
for r in range(r1,r2+1):
    ans += comb(r+c2+1,c2, MOD, fac, finv)-comb(r+c1, c1-1,MOD, fac, finv)
    ans %= MOD
print(ans)


Measured memory_bytes: 268824
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

ll n;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    vll fib(n + 1, 1);
    for (ll i = 2; i <= n; i++) fib[i] = fib[i - 2] + fib[i - 1];
    cout << fib[n] << '\n';
    return 0;
}



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

#define M 1000000/* your task*/
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)) ; }

int find(char str[]){
	long key, i, h;
	
	key = getKey(str);
	
	for ( i = 0;; i++){
		h = (h1(key)+i*h2(key))%M;
		if( strcmp(H[h],str) == 0 ) return 1;
		else if ( strlen(H[h]) == 0 ) return 0;
	}
	
	return 0;
}

int insert(char str[]){
	long long key, i, h;
	
	key = getKey(str);
	
	for ( i = 0; ; i++ ){
		h = (h1(key)+i*h2(key))%M;
		if( strcmp(H[h],str) == 0 ) return 1;
		else if ( strlen(H[h]) == 0 ){
			strcpy(H[h], str);
			return 0;
		}
  }
  
  	return 0;	
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}


Measured memory_bytes: 15440
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
ll n,store[200050];
ll ans=0,cons=1000000007,sum=0;
signed main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>store[i];
		store[i]=store[i]%cons;sum+=(store[i]);
	}
	for(int i=0;i<n;i++){
		sum-=store[i];ll summ=(sum%cons);
		ll nw=(((summ)*store[i])%cons);
		ans=((ans+nw)%cons);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5108