akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#define WTF 11

using namespace std;

int n;
int q;
int v[1<<18], w[1<<18];
vector<pair<int, int>> dp[1<<WTF];

int fxxk(int x, vector<pair<int, int>>& brute_force) {
  if (x < (1 << WTF)) {
    return x;
  }
  int l = brute_force.size();
  for (int i = 0; i < l; i++) {
    brute_force.push_back({brute_force[i].first + w[x], brute_force[i].second + v[x]});
  }
  return fxxk(x/2, brute_force);
}

void solve(int u) {
    if (!dp[u].empty()) {
      return;
    }
    if (dp[u/2].empty()) {
      solve(u/2);
    }
    vector<pair<int, int>> wtf1, wtf2;
    for (pair<int, int> pii: dp[u/2]) {
      int ww = pii.first;
      int vv = pii.second;
      wtf1.push_back(pii);
      wtf2.push_back({ww + w[u], vv + v[u]});
    }
    auto it1 = wtf1.begin();
    auto it2 = wtf2.begin();
    while (true) {
      if (it1 == wtf1.end() && it2 == wtf2.end()) {
        break;
      } else if (it1 == wtf1.end()) {
        dp[u].push_back(*it2);
        ++it2;
      } else if (it2 == wtf2.end()) {
        dp[u].push_back(*it1);
        ++it1;
      } else if (*it1 < *it2) {
        dp[u].push_back(*it1);
        ++it1;
      } else {
        dp[u].push_back(*it2);
        ++it2;
      }
    }
    for (int i = 1; i < dp[u].size(); i++) {
      if (dp[u][i].second < dp[u][i-1].second) {
        dp[u][i].second = dp[u][i-1].second;
      }
    }
}

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &v[i], &w[i]);
  }
  dp[1].push_back({0, 0});
  dp[1].push_back({w[1], v[1]});
  for (int i = 1; i <= n && i < (1 << WTF); i++) {
    solve(i);
  }
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int u, l;
    scanf("%d %d", &u, &l);
    if (u < (1 << WTF)) {
      auto it = lower_bound(dp[u].begin(), dp[u].end(), make_pair(l+1, 0));
      if (it == dp[u].begin()) {
        printf("0\n");
      } else {
        printf("%d\n", (--it) -> second);
      }
    } else {
      vector<pair<int, int>> brute_force;
      brute_force.push_back({0, 0});
      brute_force.push_back({w[u], v[u]});
      int k = fxxk(u/2, brute_force);
      sort(brute_force.begin(), brute_force.end(), [] (auto x, auto y) {
        if (x.first == y.first) {
          return y.second < x.second;
        } else {
          return x.first < y.first;
        }
      });
      for (int j = 1; j < brute_force.size(); j++) {
        if (brute_force[j].second < brute_force[j-1].second) {
          brute_force[j].second = brute_force[j-1].second;
        }
      }
      auto it1 = dp[k].rbegin();
      auto it2 = brute_force.begin();
      int ans = 0;
      while(it1 != dp[k].rend() && it2 != brute_force.end()) {
        if (it1 -> first + it2 -> first > l) {
          ++it1;
        } else {
          ans = max(ans, it1 -> second + it2 -> second);
          ++it2;
        }
      }
      printf("%d\n", ans);
    }
  }
}


Measured memory_bytes: 27032
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		scan.close();
		char[] sc=s.toCharArray();
		char[] c= {'a','b','c'};
		int cnt[]= {0,0,0};
		for(int i=0;i<s.length();i++) {
			for(int j=0;j<s.length();j++) {
				if(sc[i]==c[j]) {
					cnt[j]++;
				}
			}
		}
		int check=1;
		for(int i=0;i<s.length();i++)if(cnt[i]!=1) check=0;
		System.out.println((check==1)? "Yes":"No");
	}
}

Measured memory_bytes: 21972
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
    int n;
    vector<int> a;
    cin>>n;
    a.resize(n);
    for(int i=0;i<n;++i)cin>>a[i];
    vector<int> :: iterator it = a.begin();
    int ans = 0;
    for(int i=1;i<=n;++i)
    {
        while(it != a.end() && *it != i)
        {
            it++;
        }
        if(it == a.end())
        {
            break;
        }
        ans++;
        it++;
    }
    if(ans == 0 )cout<<-1<<endl;
    else cout<<n-ans<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

ll power(ll x, ll y, ll m) 
{
	ll res = 1;
	x %= m;
	while(y) {
		if(y & 1) res = (res * x) % m;
		y >>= 1;
		x = (x * x) % m;
	}
	return res;
}
int work(int res)
{
	int cnt = 0;
	while(res) {
		int x = __builtin_popcount(res);
		res %= x;
		++cnt;
	}
	return cnt;
}
int main()
{
	boost;
	int n, i;
	string s;
	cin >> n;
	cin >> s;
	
	int cnt = 0;
	for(char c : s)
	cnt += (c == '1');
	
	if(cnt == 0) {
		fo(i, 0, n)
		cout << 1 << '\n';
		return 0;
	}
	
	ll pre1[n], suf1[n];
	// Add 1 part
	
	fo(i, 0, n)
	pre1[i] = ((i ? pre1[i - 1] : 0) + (s[i] == '1' ? power(2, n - 1 - i, cnt + 1) : 0)) % (cnt + 1);
	
	for(i = n - 1; i >= 0; i--) 
	suf1[i] = ((i + 1 < n ? suf1[i + 1] : 0) + (s[i] == '1' ? power(2, n - 1 - i, cnt + 1) : 0)) % (cnt + 1);
	
	ll pre2[n], suf2[n];
	// Sub 1 part
	
	if(cnt > 1) {
		fo(i, 0, n)
		pre2[i] = ((i ? pre2[i - 1] : 0) + (s[i] == '1' ? power(2, n - 1 - i, cnt - 1) : 0)) % (cnt - 1);
		
		for(i = n - 1; i >= 0; i--) 
		suf2[i] = ((i + 1 < n ? suf2[i + 1] : 0) + (s[i] == '1' ? power(2, n - 1 - i, cnt - 1) : 0)) % (cnt - 1);
	}

	fo(i, 0, n) {
		int ans = 0;
		if(s[i] == '1') {
			if(cnt == 1) ans = 0;
			else {
				ll res = ((i ? pre2[i - 1] : 0) + (i + 1 < n ? suf2[i + 1] : 0)) % (cnt - 1);
				ans = 1 + work(res);
			}
		}
		else {
			ll res = ((i ? pre1[i - 1] : 0) + (i + 1 < n ? suf1[i + 1] : 0)) % (cnt + 1);
			res = (res + power(2, n - 1 - i, cnt + 1)) % (cnt + 1);
			ans = 1 + work(res);
		}
		cout << ans << '\n';
	}
}


Measured memory_bytes: 9976
/*input
1000000
*/
#include "bits/stdc++.h"
#define ll long long
using namespace std;
int main()
{
	int n;
	cin>>n;
	ll ans=0;
	for(ll i=1;i<=n;i++)
	{
		if((i%3!=0)&&(i%5!=0))
		{
			ans+=i;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <math.h>
#include <algorithm>
#define ll long long int
#define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n)

using namespace std;

int main()
{
    int minute[5], min_rem_val = 9, min_rem = 0, ans = 0;
    REP(i,5){
        cin >> minute[i];
        if(minute[i] % 10 < min_rem_val && minute[i] % 10 != 0){
            min_rem_val = minute[i] % 10;
            min_rem = i;
        }
    }

    REP(i,5){
        if(i == min_rem || minute[i] % 10 == 0){
            ans += minute[i];
        }else{
            ans += minute[i] + (10 - minute[i] % 10);
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h> 
#include<iostream> 
#include<string.h>
#include<cstring>
#include<string>
#include<math.h>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
#define cuttime ios::sync_with_stdio(false)
#define swap(x, y) x ^= y, y ^= x, x^= y
#define INF 0x3f3f3f3f
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define scan1(x) scanf("%d",&x)
#define scan2(x,y) scanf("%d%d",&x,&y)
#define scan3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define scanll1(x) scanf("%lld",&x)
#define scanll2(x,y) scanf("%lld%lld",&x,&y)
#define scanll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define lowbit(x) (x&(-x))
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N=2e5+20;
const int MAX=10000007;
inline int read() {
    char c=getchar();int x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0',c=getchar();}
    return x*f;
}

inline void out(int x) {   
	if(x>9) out(x/10);   
	putchar(x%10+'0'); 
} 
char s[20];
int main(){
	cin>>s+1;
	int len=strlen(s+1);
	for(int i=1;i<=len;++i){
		if(s[i]=='7'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007

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

    vector<int>a(n);
    rep(i,n){
        cin>>a[i];
    }
    sort(a.begin(),a.end());

    int ans=0,sum=0;
    rep(i,n-1){
        sum+=a[i];
        if(sum<=x){
            ans++;
        }
        else {
            break;
        }
    }
    if(x-sum==a[n-1]){
        ans++;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
#include<vector>
#include<utility>
#include<algorithm>
#include<ctype.h>
using namespace std;


int main() {
	int ans = 0;
	string s;
	cin >> s;
	if (s.size()%2==0) {
		for (int i = 0; i < s.size()/2;i++) {
			if (s[i]!=s[s.size()-1-i]) {
				ans++;
			}
		}
	}
	else {
		for (int i = 0; i < (s.size()-1) / 2; i++) {
			if (s[i] != s[s.size() - 1 - i]) {
				ans++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll dp[100005];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll N,K,i,j;
    cin>>N>>K;
    ll a[N];
    for(i=0;i<N;i++) cin>>a[i];
    dp[0]=0;
    for(i=1;i<=K;i++)
    {
        for(j=0;j<N;j++)
        {
            if(i>=a[j]&&!dp[i-a[j]]) dp[i]=1;
        }
    }
   // for(i=0;i<=20;i++) cout<<dp[i]<<" ";
    if(dp[K]==1) cout<<"First"<<endl; else cout<<"Second"<<endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unrolled-loops")
using namespace std;
/*---------------------Define--------------------*/
#define inp "TestCode.inp"
#define out "TestCode.out"
#define pi acos(-1)
#define endl '\n'
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ll long long
#define hash OoOoO
#define y1 MustDefeatjakin
/*-----------------------------------------------*/
const long long mod=998244353;
const long long mod2=1e9+9;
const long long INF=1e15;
const long long oo=1e18+7;
int test=1;
void db();
/*-----------------------------------------------*/
void Varvalian()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    ifstream *fi = new ifstream (inp);
    ofstream *fo = new ofstream (out);
    if(*fi)
    {
        cin.rdbuf( fi->rdbuf() );
        cout.rdbuf( fo->rdbuf() );
    }

}
/*-------------------Global----------------------*/
int n;
pair<string,ll> a[55];
string s;
/*------------------Functions--------------------*/

/*-----------------------------------------------*/

void In()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i].X>>a[i].Y;
    cin>>s;
}

void Init()
{

}

void Solve()
{
    In();
    Init();

    ll x = 0;
    bool flag = 0;
    for(int i=1;i<=n;i++)
    {
        if(flag)
            x += a[i].Y;
        if(s == a[i].X)
            flag = 1;
    }

    cout<<x;

}

void db()
{

}

int32_t main()
{
    Varvalian();

    //cin>>test;while(test--)
    Solve();
}


Measured memory_bytes: 256
def examA():
    X = I()
    X -= 400
    ans = 8 - X//200
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examA()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 10536
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VRSORT(v) sort(v.begin(), v.end(),greater<long long int>());
#define INF 999999999
#define MOD 1000000007
#define M_PI 3.14159265358979323846
#define ALL(X) (X).begin(),(X).end()

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0};
int dy[]={0, 1, 0, -1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }
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; }

int N,M;
vector<ll> A,B,C;

void input(){
  fast_io();
  #ifdef __LOCAL
    fs::path p = __FILE__;
    fs::path input,output;
    input = output = p.parent_path();
    input += string("/input/") + string(p.stem()) + string(".txt");
    output += string("/output/") + string(p.stem()) + string(".txt");
    freopen(input.c_str(), "r", stdin);
    freopen(output.c_str(), "w", stdout);
  #endif
  cin >> N >> M;
  A = fetch_vec<ll>(N);
  for (int i = 0; i < M; i++)
  {
    ll b,c;
    cin >> b >> c;
    B.push_back(b);
    C.push_back(c);
  }
}

int solve(){
  ll ans=0;
  priority_queue<pll> pque;
  for (int i = 0; i < N; i++)
  {
    pque.push({A[i],1});
  }
  for (int i = 0; i < M; i++)
  {
    pque.push({C[i],B[i]});
  }
  ll a,x;
  int i=0;
  while(i<N)
  {
    tie(a,x) = pque.top();
    pque.pop();
    ans += (i+x<N) ? a*x : a*(N-i);
    i+=x;
  }
  cout << ans << endl;
  return 0;
}

int main()
{
  input();
  solve();
  return 0;
}


Measured memory_bytes: 8808
n,m = map(int,input().split())
par = []
for i in range(n):
    par.append(i)  #初期親
rank = [1 for i in range(n)] #初期ランク
cut = []
def find(n): #親検索andランク短縮
    global cut
    if par[n] == n:
        for i in range(len(cut)):
            par[cut[i]] = n
        cut = []
        return n
    else:
        cut.append(n)
        find(par[n])
        return find(par[n])
def shorten(n): # 根に直接接続する
    global cut
    if par[n] == n:
        for i in range(len(cut)):
            par[cut[i]] = n
        cut = []
    else:
        cut.append(n)
        shorten(par[n])
def unite(a,b): #グループ併合
    x = find(a)
    y = find(b) #根っこ同士をくっつける
    if x == y: 
        return    #既に同一ユニオンなら何もしない
    if rank[x] < rank[y]:
        par[x] = y 
    elif rank[x] == rank[y]:
        par[y] = x
        rank[x] += 1
    else:
        par[y] = x
def judge(a,b):
    return par[a] == par[b]
for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    unite(a,b)
for i in range(n):
    shorten(i)
import collections
c = collections.Counter(par)
ans = 0
for i in range(n):
    ans = max(ans,c[i])
print(ans)

Measured memory_bytes: 97548
// Code for B - Making Triangle
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define FOR(i,x,y) for(ll i=x;i<(ll)(y);i++)

#define MOD 1000000007
#define mod(x) ( (x) % MOD + MOD ) % MOD

#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T, typename U> void view(const std::map<T, U>& m){ for(const auto& e : m){ std::cout << e.first << "=>" << e.second << " "; } std::cout << std::endl; }

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

  vector<int> L(N);
  REP(i, N) {
    cin >> L[i];
  }

  int total=0;
  REP(i, N-2) {
    FOR(j, i+1, N-1) {
      FOR(k, j+1, N) {
        if (L[i] == L[j]) {
          continue;
        }

        if (L[j] == L[k]) {
          continue;
        }

        if (L[i] == L[k]) {
          continue;
        }


        if ( L[i] + L[j] <= L[k] ) {
          continue;
        }

        if ( L[j] + L[k] <= L[i] ) {
          continue;
        }

        if ( L[k] + L[i] <= L[j] ) {
          continue;
        }

        // cout << i << ","<< j << ","<< k << endl;
        total++;
      }
    }
  }

  cout << total << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << a * b / 2;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
 
using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;
 
 
 
int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	string o,e,ans;
	cin >>o >>e;
	
	rep(i,sz(o)){
		ans +=o[i];
		if(i<sz(e)) ans +=e[i];
	}
	cout <<ans <<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <stack>
using namespace std;
#define Pair pair<int,int>

int N,M;
int ab[50][50];
Pair ij[50];


bool i_to_j(int i, int j){
	stack<int> s;
	int now;
	int visit[50] = {};
	s.push(i);
	while(!(s.empty())){
		now = s.top();
		s.pop();
		visit[now] = 1;
		if(now==j){
			return true;
		}
		for(int k=0; k<N; k++){
			if(visit[k]==0 && ab[now][k]==1){
				s.push(k);
			}
		}
	}
	return false;
}


bool link(){
	for(int i=0;i<N;i++){
		for(int j=i+1;j<N;j++){
			if(!(i_to_j(i,j))) return false;
		}
	}
	return true;
}

int solve(){
	int ans=0;
	for(int i=0;i<M;i++){
		ab[ij[i].first][ij[i].second] = 0;
		ab[ij[i].second][ij[i].first] = 0;
		if(!(link())) ans++;
		ab[ij[i].first][ij[i].second] = 1;
		ab[ij[i].second][ij[i].first] = 1;
	}
	cout << ans << endl;
	return 0;
}

int main(){
	cin >> N >> M;
	int a,b;
	for(int i=0;i<M;i++){
		cin >> a >> b;
		ij[i] = {a-1,b-1};
		ab[a-1][b-1] = 1;
		ab[b-1][a-1] = 1;
	}
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 9 * 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

int main() {
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    while(true) {
        C -= B;
        if(C <= 0) {
            cout << "Yes" << endl;
            break;
        }
        A -= D;
        if(A <= 0) {
            cout << "No" << endl;
            break;
        }
    }
}

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

void solve(long long N, std::vector<long long> p) {
    ll ans = 0;
    rep(i, N - 1) {
        if (p[i] == i + 1) {
            swap(p[i], p[i + 1]);
            ans++;
        }
    }
    if (p[N - 1] == N) {
        swap(p[N - 1], p[N - 2]);
        ans++;
    }
    cout << ans << endl;
}

int main() {
    long long N;
    scanf("%lld", &N);
    std::vector<long long> p(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &p[i]);
    }
    solve(N, std::move(p));
    return 0;
}


Measured memory_bytes: 4060
#include <stdio.h>

double factorial(double);

int main()
{
    double n;
    
    scanf("%lf", &n);
    printf("%.0lf\n", factorial(n));
    
    return 0;
}

double factorial(double n)
{
    if (n <= 0) {
        return 1;
    } else {
        return n * factorial(n - 1);
    }
}

Measured memory_bytes: 0
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))

using lint = long long;
using pii = pair< int, int >;

template< typename T > using Vec = vector< T >;

template< typename T > bool in_range(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool in_range(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }

template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }

int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double EPS = 1e-9;
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//



int main() {
	lint N;
	cin >> N;
	for_(y,1,3501) for_(z,1,3501) {
		lint x = (lint)y * z * N;
		lint div = (lint)y * z * 4 - N * (y + z);
		if (div > 0 && x % div == 0 && x / div > 0) {
			cout << x / div << " " << y << " " << z << endl;
			return 0;
		}
	}
}
//--------------8---------------->> coding space <<-----------------8-------------//

Measured memory_bytes: 256
n, m = map(int, input().split())
inf = 10 ** 15
edges = [[] for _ in range(n)]
for _ in range(m):
    l, r, c = map(int, input().split())
    edges[l-1].append((r-1, c))
for i in range(n-1):
    edges[i+1].append((i, 0))

from heapq import heappop, heappush
d = [inf for _ in range(n)]
def dijkstra(s):
    que = []
    d[s] = 0
    heappush(que, (0, s))

    while len(que):
        dist, node = heappop(que)

        if d[node] < dist:
            continue
        for to, cost in edges[node]:
            if d[to] > dist + cost:
                d[to] = dist + cost
                heappush(que, (d[to], to))

dijkstra(0)

print(d[n-1] if d[n-1] != inf else -1)

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

const int maxn = 1e5+5;
int H[maxn];
int ans[maxn];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int N; cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    ans[0] = 0;
    int res = 0;
    for (int i = 1; i < N; i++) {
        if (H[i] <= H[i-1]) {
            ans[i] = ans[i-1] + 1;
        }
        else {
            ans[i] = 0;
        }
        res = max(res,ans[i]);
    }
    cout << res << '\n';
}



Measured memory_bytes: 1024
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashMap<String, Integer> blueCards = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String tmpString = sc.next();
            if (blueCards.containsKey(tmpString)) {
                blueCards.put(tmpString, blueCards.get(tmpString)+1);
            } else {
                blueCards.put(tmpString, 1);
            }
        }

        int m = sc.nextInt();
        HashMap<String, Integer> redCards = new HashMap<>();
        for (int i = 0; i < m; i++) {
            String tmpString = sc.next();
            if (redCards.containsKey(tmpString)) {
                redCards.put(tmpString, redCards.get(tmpString) + 1);
            } else {
                redCards.put(tmpString, 1);
            }
        }

        int coin = 0;
        for (Map.Entry<String, Integer> entry: blueCards.entrySet()) {
            int tmpCoin = entry.getValue();
            if (redCards.containsKey(entry.getKey())) {
                tmpCoin -= redCards.get(entry.getKey());
            }

            if (coin < tmpCoin) coin = tmpCoin;
        }

        System.out.println(coin);
    }
}


Measured memory_bytes: 25428
#include <bits/stdc++.h>
using namespace std;
int w, h, cnt;
int vx[] = {0, 1, 0, -1};
int vy[] = {1, 0, -1, 0};
char field[20][20];
void solve(int x, int y){
    ++cnt;
    field[y][x] = '#';
    for(int i = 0; i < 4; ++i){
        int nx = x + vx[i];
        int ny = y + vy[i];
        if(nx >= 0 && nx < w && ny >= 0 && ny < h && field[ny][nx] == '.')
            solve(nx, ny);
    }
}
int main(){
    int sx, sy;
    while(cin >> w >> h){

        if(!(w || h)) break;
        for(int i = 0; i < h; ++i){
            for(int j = 0; j < w; ++j){
                cin >> field[i][j];
                if(field[i][j] == '@'){
                    sx = j;
                    sy = i;
                }
            }
        }
        cnt = 0;

        solve(sx, sy);
        cout << cnt << endl;
    }
}

Measured memory_bytes: 1168
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#define print(n) std::cout << n << std::endl
#define print_no_indention(n) std::cout << n
using namespace std;


int main() {
    int h,n;
    //h = 10;
    //n = 3;
    cin >> h >> n;
    int sum = 0;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a.at(i);
        sum += a.at(i);
    }
    if(sum >= h)print("Yes");
    else print("No");

}

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

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    vector<ll> h(n);
    rep(i, n) cin >> h[i];

    ll l = 0, r = 1e9;
    while (r - l > 1ll) {
        ll mid = (r + l) / 2;
        ll cnt = 0;
        rep(i, n) {
            if (mid * b >= h[i]) continue;
            ll need = (h[i] - b * mid + a - b - 1) / (a - b);
            cnt += need;
        }
        if (cnt <= mid) {
            r = mid;
        } else {
            l = mid;
        }
    }
    cout << r << endl;
}

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

int main() {
  int N,x=1,a;
  cin >> N; 
  vector<int> S(N);

  for(int i=0 ; i < N ; i++) cin >> S.at(i);
 
  a=S.at(0);

  while(a!=2 && x-1 < N) {
      	x++;
  		a=S.at(a-1);
  }

  if(x>N) cout << "-1" << endl;
  else cout  << x  <<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define MIN -1000000
using namespace std;
typedef long long ll;
typedef pair <int,int> pii;
const int max_N=1e5+10;
vector<int> fives;
vector <pii> G[max_N],rg[max_N];
bool isprime[55600];
ll ans=0;
bool sestand(const pii& a,const pii& b)
{
  return a.second<b.second;
}

int main()
{
  int n,m,predel=-1;
  cin >> n >> m;
  vector<pii> islands;
  for(int i=0;i<m;i++)
    {
      int a,b;
      cin >> a >> b;
      islands.push_back(pii(a,b));
    }
  sort(islands.begin(),islands.end(),sestand);
  for(int i=0;i<m;i++)
    {
      if(predel==-1)
	{
	  predel=islands[i].second;
	  ans++;
	}
      else
	{
	  if(predel>islands[i].first)
	    {
	      continue;
	    }
	  else
	    {
	      predel=islands[i].second;
	      ans++;
	    }
	}
    }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6136
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    ll n; cin >> n;
    ll ans = 0;
    for (int i=1; i<n; i++) {
        ans += (n-1) / i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3648
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U> bool chmax(T &a, U b) { if (a <= b) {a = b; return 1;} return 0; }
template <class T, class U>  bool chmin(T &a, U b) { if (a > b) { a = b; return 1; } return 0; }
template <typename T>  ostream &operator<<(ostream &os, vector<T> &v) { os << "{"; rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); } os << "}"; return os; }

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)

int main() {
    ll x=0,y=0,z=0,n,h,m,k,w,ans=0,sum=0,Max=-1,Min=1e9+1;
    bool ok = true;
    string s,t,u;
    cin >> x >> y >> z >> k;
    if(x>0){ 
      if (x < k) { ans += x;
        k -= x;
      } 
      else{
        ans += k;
        k = 0;
      }
    }
    if(k==0){
      pri(ans);
      return 0;
    }

    if(y>0){
      k -= y;
    }
    if(k==0){
      pri(ans);
      return 0;
    }

    ans -= k;
    pri(ans);
    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    long long n,d,x;
    cin >> n >> d >> x;
    vector<long long> vec(n);
    rep(i,n){
        cin >> vec.at(i);
    }
    rep(i,d){
        rep(j,n){
            if(i%vec.at(j)==0)x++;
        }
    }
    cout << x << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair
 
int main(){
  CIN(n);VC1(n,a,b);
  V v(n,0);//確定
  if(a[n-1]!=b[0])EN(0);
  v[0]=a[0];v[n-1]=b[n-1];
  FOR(i,1,n)if(a[i-1]!=a[i])v[i]=a[i];
  REP(i,n-1)if(b[i]!=b[i+1]){if(v[i]&&v[i]!=b[i])EN(0);v[i]=b[i];}
  REP(i,n)if(v[i]&&(v[i]>a[i])||v[i]>b[i])EN(0);
  //VECCOUT(v);
  ll ans = 1;
  REP(i,n){
    if(v[i])continue;
    ans*=min(a[i],b[i]);
    ans%=MOD;
  }
  COUT(ans);
  return 0;
}

Measured memory_bytes: 2560
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] strArr;
		int n, arr[];

		n = Integer.parseInt(br.readLine());
		boolean result = true;

		Dice[] diceArr = new Dice[n];

		for(int i = 0;i < n;i++){
			strArr = br.readLine().split(" ");
			arr = new int[6];
			for(int j = 0;j < 6;j++){
				arr[j] = Integer.parseInt(strArr[j]);
			}
			diceArr[i] = new Dice(arr[0], arr[1], arr[2], arr[3], arr[4], arr[5]);
		}

		Loop:for(int i = 0;i < n;i++){
			for(int j = i + 1;j < n;j++){
				if(diceArr[i].equals(diceArr[j])){
					result = false;
					break Loop;
				}
			}
		}

		if(result)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}

class Dice {
	int[] num;

	{
		num = new int[6];
	}

	Dice(int a, int b, int c, int d, int e, int f) {
		super();
		num[0] = a;
		num[1] = b;
		num[2] = c;
		num[3] = d;
		num[4] = e;
		num[5] = f;
	}

	public int getTop() {
		return new Integer(num[0]);
	}

	public int getFront() {
		return new Integer(num[1]);
	}

	public int getRight() {
		return new Integer(num[2]);
	}

	public int getIndex(int n) {
		for (int i = 0; i < num.length; i++) {
			if (n == num[i])
				return i;
		}
		return -1;
	}

	void roll(String s) {
		for (int i = 0; i < s.length(); i++) {
			roll(s.charAt(i));
		}
	}

	void roll(char c) {
		int[] temp = new int[6];
		switch (c) {
		case 'N':
			temp[0] = num[1];
			temp[1] = num[5];
			temp[2] = num[2];
			temp[3] = num[3];
			temp[4] = num[0];
			temp[5] = num[4];
			break;
		case 'W':
			temp[0] = num[2];
			temp[1] = num[1];
			temp[2] = num[5];
			temp[3] = num[0];
			temp[4] = num[4];
			temp[5] = num[3];
			break;
		case 'E':
			temp[0] = num[3];
			temp[1] = num[1];
			temp[2] = num[0];
			temp[3] = num[5];
			temp[4] = num[4];
			temp[5] = num[2];
			break;
		case 'S':
			temp[0] = num[4];
			temp[1] = num[0];
			temp[2] = num[2];
			temp[3] = num[3];
			temp[4] = num[5];
			temp[5] = num[1];
			break;
		default:
		}
		num = temp;
	}

	void top(int index) {
		switch (index) {
		case 0:
			return;
		case 1:
			roll("N");
			return;
		case 2:
			roll("W");
			return;
		case 3:
			roll("E");
			return;
		case 4:
			roll("S");
			return;
		case 5:
			roll("NN");
			return;
		}
	}

	void turn() {
		roll("ESW");
	}


	@Override
	public boolean equals(Object obj) {
		Dice dice = (Dice)obj;
		int[] pips = this.num.clone();

		boolean isEqual = false;
		L1:for (int pip : pips) {
			this.top(this.getIndex(pip));
			int index = dice.getIndex(this.getTop());
			if (index == -1) {
				continue;
			} else {
				dice.top(index);
				for (int i = 0; i < 4; i++) {
					dice.turn();
					if (Arrays.equals(this.num, dice.num)) {
						isEqual = true;
						break L1;
					}
				}
			}
		}
		return isEqual;
	}

}

Measured memory_bytes: 36264
use proconio::{fastout, input};
use std::collections::BinaryHeap;

#[fastout]
fn main() {
    input! {
        n:usize,
        m:usize,
        s: i64,
        e: [(usize, usize, i64, i64); m],
        c: [(i64, i64); n],
    }

    let layer: usize = 51 * 150;
    let vs = layer * n as usize;
    let mut dist: Vec<i64> = vec![i64::max_value(); vs];
    let s: usize = s.min((layer - 1) as i64) as usize;

    let get_vertex_id = |v: usize, s: usize| -> usize { v * layer + s };
    // (edge id)
    let mut g: Vec<Vec<usize>> = vec![vec![]; vs];
    for i in 0..m {
        let u = e[i].0;
        let v = e[i].1;
        g[u - 1].push(i);
        g[v - 1].push(i);
    }

    let mut ans: Vec<i64> = vec![i64::max_value(); n];

    let mut q: BinaryHeap<(i64, usize)> = BinaryHeap::new();
    dist[get_vertex_id(0, s)] = 0;
    q.push((0, get_vertex_id(0, s)));
    while q.len() > 0 {
        let (d, w) = q.pop().unwrap();
        let d = -d;
        if dist[w] != d {
            continue;
        }
        let v = w / layer;
        let s = w % layer;
        let s = s as i64;
        ans[v] = ans[v].min(d);
        for i in g[v].iter() {
            let i = *i;
            let u = (e[i].0 - 1) ^ (e[i].1 - 1) ^ v;
            let (a, b) = (e[i].2, e[i].3);
            if a > s {
                continue;
            }
            let d_ = d + b;
            let s_ = s - a;
            let u = get_vertex_id(u, s_ as usize);
            if dist[u] > d_ {
                dist[u] = d_;
                q.push((-d_, u));
            }
        }
        {
            let s_ = s + c[v].0;
            let d_ = d + c[v].1;
            if s_ < layer as i64 {
                let u = get_vertex_id(v, s_ as usize);
                if dist[u] > d_ {
                    dist[u] = d_;
                    q.push((-d_, u));
                }
            }
        }
    }

    for i in 1..n {
        println!("{}", ans[i]);
    }
}


Measured memory_bytes: 17480
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> v(m);
  rep(i, m) {
    int k;
    cin >> k;
    v[i].resize(k);
    rep(j, k) {
      cin >> v[i][j];
      v[i][j]--;
    }
  }
  vector<int> p(m);
  rep(i, m) cin >> p[i];

  int ans = 0;

  for (int i = 0; i < (1 << n); i++) {
    bool flag = true;
    rep(j, m) {
      int count = 0;
      for (int sw : v[j]) {
        if ((i >> sw) & 1) count++;
      }
      if (count % 2 != p[j]) flag = false;
    }
    if (flag) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
 
int N;
int x[10], y[10];
 
double dist(int i, int j) {
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx * dx + dy * dy, 0.5);
}
 
void solve() {
    cin >> N;
    for(int i = 1; i <= N; i++) cin >> x[i] >> y[i];
    double ans = 0.0;
    for(int i = 1; i <= N; i++) {
        for(int j = i + 1; j <= N; j++) ans += dist(i, j) * 2 / N;
    }
    cout << fixed << setprecision(10) << ans << endl;
    return;
}
 
int main() {
    solve();
    return 0;
}

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

signed main(){
    int K,N;
    cin >> K >> N;
    
    int A[N+1];
    for(int i=0;i<N;i++){
        cin >> A[i];
        
    }
    
    A[N] = A[0]+K;
    int tmp = 0;
    for(int i=1;i<=N;i++){
        tmp = max(tmp,A[i]-A[i-1]);
    }
    
    cout << A[N] - A[0] - tmp << endl;
    return 0;
}



Measured memory_bytes: 1792
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace AtCoderCS
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nm = IntArray();
            int D = nm[0];
            int N = nm[1];

            List<int> tlist = new List<int>();
            for (int i = 0; i < D; i++)
            {
                int tmp = Int();
                tlist.Add(tmp);
            }
            List<int[]> abclist = new List<int[]>();
            for (int i = 0; i < N; i++)
            {
                int[] tmp = IntArray();
                abclist.Add(tmp);
            }

            int maxsum = 0;
            int minsum = 0;
            int maxbefore = 0;
            int minbefore = 0;
            {
                int t = tlist[0];
                int min = 999999;
                int max = -1;
                foreach (int[] abc in abclist)
                {
                    if (abc[0] <= t && t <= abc[1])
                    {
                        min = min < abc[2] ? min : abc[2];
                        max = max > abc[2] ? max : abc[2];
                    }
                }
                maxbefore = max;
                minbefore = min;
            }

            for (int i =1; i<tlist.Count; i++)
            {
                int t = tlist[i];
                int min = 999999;
                int max = -1;
                foreach (int[] abc in abclist)
                {
                    if (abc[0] <= t && t <= abc[1])
                    {
                        min = min < abc[2] ? min : abc[2];
                        max = max > abc[2] ? max : abc[2];
                    }
                }
                int kouhomax1 = maxsum + Math.Abs(max - maxbefore);
                int kouhomax2 = minsum + Math.Abs(max - minbefore);
                int kouhomin1 = maxsum + Math.Abs(min - maxbefore);
                int kouhomin2 = minsum + Math.Abs(min - minbefore);
                maxsum = Math.Max(kouhomax1, kouhomax2);
                minsum = Math.Max(kouhomin1, kouhomin2);
                maxbefore = max;
                minbefore = min;
            }
            int ans = Math.Max(maxsum, minsum);
            Console.Out.WriteLine(ans);

        }

         static int Int()
         {
             return int.Parse(Console.ReadLine());
         }

         static int[] IntArray()
         {
             return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
         }


         static int[] IntArraySlash()
         {
             return Console.ReadLine().Split('/').Select(x => int.Parse(x)).ToArray();
         }

    }
}

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

int main() {
  int a,b,c;
  
  cin >> a >> b >> c;

  vector<int> ame={a,b,c};
  
  sort(ame.begin(),ame.end());
  
  if(ame.at(2)==ame.at(1)+ame.at(0))
    cout << "Yes" ;
  else
    cout << "No";
  
  
  
}

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

int main(){
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;

  if (x - r < 0 || x + r > W) {
    cout << "No" << endl;
    return 0;
  }
  if (y - r < 0 || y + r > H) {
    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 1160
S=map(int, raw_input())
ans = 10000
for i in range(len(S)-2):
  if abs(S[i] * 100 + S[i+1]*10 + S[i+2] -753) < ans:
    ans = abs(S[i] * 100 + S[i+1]*10 + S[i+2] -753)
print ans



Measured memory_bytes: 2568
//Author : Ayush Jain

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

#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define fi first
#define se second
#define PI acos(-1.0)
const int N=1e5 + 5;
const int M=1e5 + 5;

ull pw[67];
void pre()
{
	pw[0]=1;
	for(int i=1;i<64;i++) pw[i]=2*pw[i-1];
}

int main()
{
	ios_base::sync_with_stdio(false);
	pre();
	int n,a,b;
	cin>>n>>a>>b;
	if((b-a)%2==0) cout<<"Alice\n";
	else cout<<"Borys\n";	
	
		
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }


int main(){
  int n, k;
  cin >> n >> k;
  int ans = k;
  REP(i,n-1) ans *= (k-1);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
from math import cos,sin,pi
a,b,h,m=map(int,input().split())
c=h/12*2*pi+m/12/60*2*pi
d=m/60*2*pi
x1=a*cos(c)
y1=a*sin(c)
x2=b*cos(d)
y2=b*sin(d)
print(((x1-x2)**2+(y1-y2)**2)**.5)

Measured memory_bytes: 62712
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
#include <cmath>
#define abs std::abs
#define minf std::min
#define maxf std::max
typedef long long ll;
typedef long double ld;

char a[5], b[5];
ll r;

int main() {
    scanf("%s %s", a, b);
    int logb = strlen(b);
    int loga = strlen(a);
    
    ll pot = 1;
    for(int i = logb-1; i >= 0; --i) {
        r += (pot * (b[i] - '0'));
        pot*=10;
    }
    for(int i = loga-1; i >= 0; --i) {
        r += (pot * (a[i] - '0'));
        pot*=10;
    }
    
    ll sqrtr = sqrt(r);
    if(sqrtr * sqrtr == r)
        printf("Yes\n");
    else
        printf("No\n");
    
    return 0;
}


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


int main() {
    int n; scanf("%d",&n);
    int a[4]={0, 0, 0, 0};
    for(int i=1;i<=n;i++){
        string s; cin >> s;
        if(s=="AC")a[0]+=1;
        else if(s=="WA")a[1]+=1;
        else if(s=="TLE")a[2]+=1;
        else if(s=="RE")a[3]+=1;
    }  
    printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d", a[0], a[1], a[2], a[3]);
    return 0;
}

Measured memory_bytes: 3776