akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
typedef long long int ll;
typedef long double ld;
using namespace std;


ll L = -1, R = -1;
vll update(vll a, vll b){
  a[0] = max(a[0], b[0]), a[1] = min(a[1], b[1]);
  return a;
}
ll get_range(vll a){
  return max((ll)0, a[1]-a[0]+1);
}
int main(int argc, char const *argv[]) {
  ll n, a, b, li, ri, len=0;std::cin >> n;
  vvl q = vv(n, 2, 0, ll);
  vll l{0, 10000000000}, r{10000000000, 0};
  for(int i=0;i<n;i++){
    std::cin >> a >> b;
    q[i] = vll{a, b};
    if(l[0]<a||(l[0]==a&&l[1]>b)) l = vll{a, b}, li = i;
    if(r[0]>b||(r[0]==b&&l[1]<a)) r = vll{b, a}, ri = i;
  }
  L = l[0], R = r[0];
  for(int i=0;i<n;i++) if(i!=ri&&i!=li) len = max(q[i][1]-q[i][0]+1,len);
  ll ans = max((ll)0, r[0]-l[0]+1) + len;
  sort(q.begin(), q.end(), [](vll &a, vll &b){
    if(max(a[1]-L, (ll)0)!=max(b[1]-L, (ll)0)) return max(a[1]-L, (ll)0) < max(b[1]-L, (ll)0);
    return max(R-a[0], (ll)0) > max(R-b[0], (ll)0);
  });
  vvl s = vv(n, 2, 0, ll);
  vvl t = vv(n, 2, 0, ll);
  s[0] = q[0], t[n-1] = q[n-1];
  for(int i=1;i<n;i++)    s[i] = update(s[i-1], q[i]);
  for(int i=n-2;i>=0;i--) t[i] = update(t[i+1], q[i]);
  for(int i=1;i<n;i++) ans = max(ans, get_range(s[i-1])+get_range(t[i]));
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int n=s.size();
	int m=1<<(n-1);
	long long ans=0;
	for(int i=0;i<m;i++)
	{
		long long t=s[0]-'0';
		for(int j=0;j<n;j++)
		{
			if(j==n-1||i&1<<j)
			{
				ans+=t;
				t=0;
				if(j==n-1)  break;
			}
			t*=10;
			t+=s[j+1]-'0';
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main()
{
	int i,N,count2=0,count4=0,countodd=0;
	cin>>N;
	long long ara[N];
	for(i=0;i<N;i++){
		cin>>ara[i];
	}
	for(i=0;i<N;i++){
		if(ara[i]%2==0&&ara[i]%4!=0){
			count2++;
		}
		if(ara[i]%4==0){
			count4++;
		}
		if(ara[i]%2!=0){
			countodd++;
		}
	}
	if(count2+count4==N){
		cout<<"Yes";
		return 0;
	}
	if(count4>=countodd&&count2>=2){
		cout<<"Yes";
		return 0;
	}
	else{
		if(count4>=N/2){
			cout<<"Yes";
		}
		else{
			cout<<"No";
		}
	}
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include<string>
#include <set>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
	long long N;
	cin >> N;
	long long result = 0;
	
	for(long long i = 1;i<=N;i++){
		if(i % 3 != 0 && i % 5 != 0){
			result += i;
		}
		
	}
	
	std::cout << result << endl; 	
	return 0;
	
}


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

string str[100000];
int main() 
{
    int a,b;
    cin >> a >> b;
    if(a > 0 && a < 10 && b > 0 && b < 10)
    {
        cout << a * b << endl;
    }
    else
    {
        cout << -1 << endl;
    }
    //cin >> a;
    return 0;
}

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

int main() {
  int a,b,m,amin=10000000,bmin=10000000,ans;
  cin >> a >> b >> m;
  vector<int> aa(a);
  vector<int> bb(b);
  vector<int> x(m);
  vector<int> y(m);
  vector<int> c(m);
  for(int i=0;i<a;i++) cin >> aa.at(i);
  for(int i=0;i<b;i++) cin >> bb.at(i);
  for(int i=0;i<m;i++) cin >> x.at(i) >> y.at(i) >> c.at(i);
  for(int i=0;i<a;i++) if(aa.at(i)<amin) amin=aa.at(i);
  for(int i=0;i<b;i++) if(bb.at(i)<bmin) bmin=bb.at(i);
  ans=amin+bmin;
  for(int i=0;i<m;i++) {
    int p=aa.at(x.at(i)-1)+bb.at(y.at(i)-1)-c.at(i);
    if(p<ans) ans=p;
  };
  cout << ans << endl;
}

Measured memory_bytes: 2176
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	string s;
	int n = 0;

	cin >> s;

	for (int i = 0; i < s.length(); i++) {
		if (s[i] == '+') {
			n++;
		}
		else {
			n--;
		}
	}

	cout << n << endl;

	return 0;
}

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

int main() {
  string S; ll K;
  cin >> S >> K;

  char ans;
  for (ll i = 0; i < K; i++) {
    ans = '1';
    if (S[i] != '1') {
      ans = S[i];
      break;
    }
  }

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


Measured memory_bytes: 256
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	a, b := nextInt(), nextInt()
	if a+b == 15 {
		puts("+")
	} else if a*b == 15 {
		puts("*")
	} else {
		puts("x")
	}
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

struct Int {
	ll x;
	Int(ll x) : x(x) {}
	Int operator +(Int y) {
		return Int(this->x + y.x);
	}
	Int operator -(Int y) {
		return Int(this->x - y.x);
	}
	Int operator *(Int y) {
		return Int(this->x * y.x);
	}
	Int operator /(Int y) {
		if (y.x == 0) return Int(1);
		return Int(this->x / y.x);
	}
	Int operator %(Int y) {
		if (y.x == 0) return Int(1);
		return Int(this->x % y.x);
	}
	Int operator ^(Int y) {
		return Int(this->x ^ y.x);
	}
	bool operator ==(Int y) {
		return this->x == y.x;
	}
	bool operator !=(Int y) {
		return !(*this == y);
	}
	bool operator <(Int y) {
		return this->x < y.x;
	}
};

Int f(Int x) {
	return (((x < x ? Int(1) : x) + (Int(1) - Int(2))) == Int(1) ? (Int(1) - (Int(1) * (Int(1) - (Int(1) * Int(3))))) : (((((Int(1) - (Int(1) * Int(3))) == ((Int(1) + Int(1)) < x ? (x - Int(2)) : Int(1)) ? (Int(2) * (Int(2) / Int(4))) : (x == ((Int(1) + Int(1)) < x ? (x - Int(2)) : Int(1)) ? x : ((x % (Int(4) ^ (Int(5) ^ x))) ^ ((x % (Int(4) ^ (Int(5) ^ ((((x % (Int(4) ^ (Int(5) ^ x))) ^ ((x % (Int(4) ^ (Int(5) ^ x))) % ((x - (Int(1) - Int(2))) ^ (Int(5) ^ x)))) % (Int(4) ^ (Int(5) ^ x))) * (Int(2) / (Int(3) / Int(4))))))) % ((x - (Int(1) - Int(2))) ^ (Int(5) ^ x)))))) / (Int(3) / (Int(3) % Int(5)))) * ((x - (Int(1) * Int(2))) / (Int(3) / Int(4)))) / (((Int(1) * (Int(1) * Int(3))) / ((x - (Int(1) * (Int(1) - (Int(1) * Int(3))))) % Int(4))) % ((Int(1) - (Int(1) * (Int(1) - (Int(1) * Int(3))))) * (Int(2) * Int(3))))));
}

int main() {
	ll a, b; cin >> a >> b;
	if (a == 0) cout << f(Int(b)).x << endl;
	else {
		cout << (f(Int(a - 1)) ^ f(Int(b))).x << endl;
	}
	return 0;
}

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

int main(void){
    int n;
    scanf("%d",&n);
    int array[n];
    for(int i = 0;i < n;i++)scanf("%d",&array[i]);

    for(int i = 0;i < n;i++){
        if(!(array[i] % 2))if(array[i] % 3 && array[i] % 5){
            puts("DENIED");
            return 0;
        }
    }
    puts("APPROVED");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include<limits.h>
using namespace  std;
typedef long long int ll;
typedef long double ld;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define fi first
#define se second
#define rsz(a,n) a.resize(n)
#define test(t) ll t;cin>>t;while(t--)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define fillv(a,k) memset(a,k,sizeof(a))
#define filla(a,k,n) memset(a,k,sizeof(a[0])*n)
#define leadzero(a) __builtin_clz(a) //count leading zeros
#define trailzero(a) __builtin_ctz(a) //count trailing zeros
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln cout<<"\n"
#define sp cout<<" "
#define spaceprint(a,i,s,n) {forsn(i,s,n) { cout<<a[i]; sp;}}
#define lineprint(a,i,s,n) {forsn(i,s,n) {cout<<a[i]; ln;}}
#define maxe(a) *max_element(a.begin(),a.end())
#define maxi(a) max_element(a.begin(),a.end())-a.begin()
#define mine(a) *min_element(a.begin(),a.end())
#define mini(a) min_element(a.begin(),a.end())-a.begin()
#define all(c) c.begin(),c.end()
#define trav(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element)  (find(all(container),element) != container.end())// check the presence of element
//copy(from_begin, from_end, to_begin); copy function
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<string> vs;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM = 1e5+5, MOD = 1e9+7;
#define sumv(v) accumulate(all(v),ll(0))
#define productv(v) accumulate(all(v), ll(1), multiplies< ll >())
int main()
{
	ll n,W;
	cin>>n>>W;
	ll w[n+1], v[n+1];
	for(ll i =1;i<=n;i++)
	{
		cin>>w[i]>>v[i];
	}

	ll dp[n+1][W+1];
	for(ll i=0;i<=n;i++)
		for(ll j=0;j<=W;j++)
			dp[i][j]=0;

	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=W;j++)
		{
			if(j>=w[i])
			{
				dp[i][j] = max(dp[i-1][j-w[i]]+v[i], dp[i-1][j]);
				// cout<<(dp[i][j]);
			}

			else
				dp[i][j] = dp[i-1][j];
		}
	}
	cout<<dp[n][W]<<endl;

}

Measured memory_bytes: 79104
#include <iostream>
#include <iomanip>
#include <queue>
#include <deque>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <bitset>

#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x, y) memset(x, y, sizeof(x))
#define pb push_back
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

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 (a > b) {
      a = b;
      return 1;
   }
   return 0;
}

using namespace std;
using ll = long long;

const int kInf = 2e9;
const ll kLInf = 2e18;

int gcd (int a, int b) {
   return b ? gcd(b, a % b) : a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int N;

int main()
{
   cout << fixed << setprecision(10);
   cin >> N;
   cout << (N%2 ? N/2 : N/2-1) << endl;
   return 0;
}



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

import javax.print.attribute.HashAttributeSet;


public class Main {


	public static void main(String[] args) throws Exception{
		BufferedReader  jk =  new BufferedReader(new InputStreamReader( System.in))  ; 
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)) ; 
		StringTokenizer ana = new StringTokenizer(jk.readLine()) ;
		int n = Integer.parseInt(ana.nextToken()) ; 
		           
		int a[] = new int[n] ; 	int b[] = new int[n] ;  int c[] = new int[n] ;
	
		for(int i=0 ; i<n ;i++)
		{
			ana = new StringTokenizer(jk.readLine()) ;
			a[i] = Integer.parseInt(ana.nextToken()) ;  b[i] = Integer.parseInt(ana.nextToken()) ;  c[i] = Integer.parseInt(ana.nextToken()) ; 
		}
		int dp[][]= new int[n][3] ;
	    dp[0][0]= a[0] ; dp[0][1]=b[0] ; dp[0][2]=c[0] ; 
	    for(int i=1 ; i<n ;i++)
	    {
	    	dp[i][0] =Integer.max(dp[i-1][2], dp[i-1][1])+a[i] ; 
	    	dp[i][1] =Integer.max(dp[i-1][2], dp[i-1][0])+b[i] ; 
	    	dp[i][2] =Integer.max(dp[i-1][0], dp[i-1][1])+c[i] ; 
	    }
		
	    out.println(Integer.max(Integer.max(dp[n-1][0], dp[n-1][1]),dp[n-1][2]));















		out.flush();
	}
}



Measured memory_bytes: 46700
#include <iostream>

using namespace std;

int main(){
	int i,n,m,a;
	bool c[100010];
	cin >> n >> m;
	for(i=0;i<n;i++){
		c[i] = true;
	}
	
	for(i=0;i<2*m;i++){
		cin >> a ;
		a--;
		if(c[a]){
			c[a] = false;
		}else{
			c[a] = true;
		}
	}
	
	for(i=0;i<n;i++){
		if(!c[i]){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int dp[100005];
int main(int argc, char** argv) {
	int n,m;
	cin >> n >> m;
	for(int i=1;i<=100000;i++) dp[i]=m+1;
	for(int i=1;i<=n;i++)
	{
		int w,v;
		cin >> w >> v;
		for(int j=100000-v;j>=0;j--)
			dp[j+v]=min(dp[j+v],dp[j]+w);
	}
	for(int i=100000;i>=0;i--)
	{
		if(dp[i]<=m)
		{
			cout << i;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
    for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
    for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}

int main(){
    int n,m;
    int i,j,k;
    int a,b,c;
    cin>>a>>b>>c;
    if(a<=c && c<=b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//Write From this Line

int main()
{
	string s;
	cin >> s;
	cout << s.substr(0,(s.size() - 8)) << endl;
}


Measured memory_bytes: 256
//***Faithless is he that says farewell when the road darkens***

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"

typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

ll a[102];
int main(){
	ll x,n;
	cin>>x>>n;
	forn(i,n){
		ll b;
		cin>>b;
		a[b]=1;
	}
	ll p=x,q=x;
	while(a[p]!=0) p--;
	while(a[q]!=0) q++;
	if((x-p)<=(q-x)) cout<<p;
	else cout<<q;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;

int main() {
    int h, w; cin >> h >> w;
    vector<vector<char>> s(h+2, vector<char>(w+2));
    rep(i, h+2) {
        rep(j, w+2) {
            if(i == 0 || i == h+1 || j == 0 || j == w+1) s[i][j] = '.';
            else {
                cin >> s[i][j];
            }
        }
    }
    Rep(i, 1, h+1) {
        Rep(j, 1, w+1) {
            if(s[i][j] == '#' && s[i-1][j] != '#' && s[i+1][j] != '#' && s[i][j-1] != '#' && s[i][j+1] != '#') {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

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

int main()
{
    int n, h, w;
    cin >> n >> h >> w;

    int ans = 0;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;

        ans += a >= h && b >= w;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int df(int s,int p,map<int,vector<int> >a, int d,int N){
//  cout<<s<<","<<p<<","<<((1<<(N))-1)<<d<<endl;
  if (d==N-1) return (s==(1<<(N))-1)?1:0;
  int ret=0;
  for(auto itr = a[p].begin(); itr != a[p].end(); ++itr) {
    ret+=df(s^(1<<(*itr-1)),*itr,a,d+1,N);
  }
  return ret;
}
int main(){
  int N,M;
  cin>>N>>M;
  map<int,vector<int> >a;
  for(int i=0;i<M;i++){
    int t,s;
    cin>>t>>s;
    a[t].push_back(s);
    a[s].push_back(t);
  }
  cout<<df(1,1,a,0,N)<<endl;
  return 0;
}


Measured memory_bytes: 380
//om namah shivaay
//faith over fear
//no one wants to die,yet death is the destination we all share 

#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long 
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main(){
   ll n,s=0;
   cin>>n;
   for1(i,n){
       if(i%3==0) continue;
       if(i%5==0) continue;
       s+=i;
   }
   cout<<s;
}

Measured memory_bytes: 3628
#!/usr/bin/env python3
from typing import *

YES = 'Yes'
NO = 'No'

# def solve(D: int, T: int, S: int) -> str:
def solve(D, T, S):
    return YES if D <= T*S else NO
    

def main():
    D, T, S = map(int, input().split())
    a = solve(D, T, S)
    print(a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 10196
#include<stdio.h>

int main(){
	int day,month,cnt;

	scanf("%d %d",&month,&day);
	while(1){
		if(month==0)break;
		switch(month){
			case 1:
			case 4:
			case 7:
				cnt=day%7;
				break;
			case 2:
			case 8:
				cnt=(day+3)%7;
				break;
			case 3:
			case 11:
				cnt=(day+4)%7;
				break;
			case 5:
				cnt=(day+2)%7;
				break;
			case 6:
				cnt=(day+5)%7;
				break;
			case 9:
			case 12:
				cnt=(day+6)%7;
				break;
			case 10:
				cnt=(day+1)%7;
				break;
		}
		
		switch(cnt){
			case 0:
				printf("Wednesday\n");
				break;
			case 1:
				printf("Thursday\n");
				break;
			case 2:
				printf("Friday\n");
				break;
			case 3:
				printf("Saturday\n");
				break;
			case 4:
				printf("Sunday\n");
				break;
			case 5:
				printf("Monday\n");
				break;
			case 6:
				printf("Tuesday\n");
				break;
		}
		scanf("%d %d",&month,&day);
	}
	return 0;
}

Measured memory_bytes: 584
data = input().split()
n = int(data[0])
m = int(data[1])


a = input().split()
for i in range(n):
	a[i] = int(a[i])


sumvote = sum(a)

line = sumvote/(4*m)

c = 0

for i in range(n):
	if a[i]>=line:
		c+=1



if c>=m:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <deque>
#include <queue>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <iomanip>
#include <utility>
#include <functional>
using namespace std;
#define ll long long
#define ull unsigned ll
/*Fast I/O goes here*/
const double EPS = 1e-8;
const ll PR = 19260817;
const ll inv2 = 500000004;
const ll inv3 = 333333336;
string s;
string t, rt;
int a[100005];
int n, m;
int main() {
	cin>>s;n=s.length();
	t="";
	for(int i=0; i<n; i++) {
		if(s[i]!='x')
			t+=s[i];
	}m=t.length();
	rt=t;reverse(rt.begin(), rt.end());
	if(rt!=t) {
		puts("-1");return 0;
	}
	int i, j;
	for(i=0, j=0; i<m; i++, j++) {
		while(j<n&&s[j]!=t[i]) a[i]++, j++;
	}
	while(j<n) a[m]++, j++;
	m++;
	//for(int i=0; i<m; i++)printf("%d\n", a[i]);
	int ans=0;
	for(i=0; i<m/2; i++) {
		ans+=max(a[i], a[m-i-1])-min(a[i], a[m-i-1]);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 768
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        aa: [i64;n+1],
        bb: [i64;n]
    }
    let before = aa.iter().sum::<i64>();
    let mut aa = aa;
    for i in 0..n {
        let a = aa[i];
        let mut b = bb[i];
        aa[i] = std::cmp::max(aa[i]-b, 0);
        b -= a - aa[i];
        aa[i+1] = std::cmp::max(aa[i+1]-b, 0);
    }
    println!("{:?}", before - aa.iter().sum::<i64>());
}


Measured memory_bytes: 10232
def f(a, d)
  m = a.to_s.chars.map(&:to_i)
  (m&d).size > 0
end

N, K=gets.split.map(&:to_i)
D=gets.split.map(&:to_i)

a = N

while true
  break if !f(a,D)
  a+=1
end

puts a

Measured memory_bytes: 1916
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <map>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define pb(a) push_back(a)
#define MAX(a, b) ((a < b)?b:a)
#define MIN(a, b) ((a > b)?b:a)
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;

template<typename T> void cinpb(vector<T>& x) { T n; cin >> n; x.push_back(n); }
ull gcd(ull a, ull b) { return b ? gcd(b, a%b) : a; }
ull lcm(ull m, ull n) {	return ((0 == m) || (0 == n)) ? 0 : ((m / gcd(m, n)) * n); }
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

void yesno(bool f) { cout << (f ? "Yes" : "No") << endl; }

//

int main()
{
	int N, M, C;

	cin >> N >> M >> C;
	vector<int>B;
	int count = 0;

	rep(i, M)
	{
		cinpb(B);
	}

	rep(n, N)
	{
		int sum = 0;
		rep(i, M)
		{
			int A;
			cin >> A;
			sum += A * B[i];
		}
		if ( sum + C > 0 ) count++;
	}

	cout << count << endl;

	return 0;
}


Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, A, *X = map(int, read().split())

    X = [x - A for x in X]

    neg = pos = 0
    for x in X:
        if x > 0:
            pos += x
        else:
            neg += x

    M = pos - neg
    base = -neg

    dp = [[0] * (M + 1) for _ in range(N + 1)]
    dp[0][base] = 1

    for i in range(N):
        for s in range(M + 1):
            dp[i + 1][s] = dp[i][s]
            if 0 <= s - X[i] <= M:
                dp[i + 1][s] += dp[i][s - X[i]]

    print(dp[N][base] - 1)
    return


if __name__ == '__main__':
    main()


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

using namespace std;
typedef pair<int,int> pii;

string grid[405];
int H,W;
int xi[] = {1,0,-1,0};
int yi[] = {0,1,0,-1};
bool visited[405][405];
pii solve(int x, int y){
	visited[x][y] = true;
	int d=0,h=0;
	if(grid[x][y]=='.'){
		d++;
		for(int i=0;i<4;i++){
			int nx = x+xi[i], ny = y+yi[i];
			if(nx>=0 and ny>=0 and nx<H and ny<W and !visited[nx][ny] and grid[nx][ny]=='#'){
				pii p = solve(nx,ny);
				d+=p.first;
				h+=p.second;
			}
		}
	}else{
		h++;
		for(int i=0;i<4;i++){
			int nx = x+xi[i], ny = y+yi[i];
			if(nx>=0 and ny>=0 and nx<H and ny<W and !visited[nx][ny] and grid[nx][ny]=='.'){
				pii p = solve(nx,ny);
				d+=p.first;
				h+=p.second;			
			}
		}

	}
	return pii(d,h);
}

int main(){
	long long ans=0;
	cin >> H >> W;
	for(int i=0;i<H;i++)
		cin >> grid[i];
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(!visited[i][j]){
				pii p = solve(i,j);
				ans += (long long)p.first * p.second;
			}
		}
	}
	cout << ans;

}

Measured memory_bytes: 15616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=2e5+5,mod=1e9+7;
ll power(ll n,ll p){
    ll ans = 1;
    while(p){
        if(p&1)ans=(ans*n)%mod;
        p>>=1;
        n=(n*n)%mod;
    }
    return ans;
}
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n;cin>>n;
    map<ll,ll> mp;
    for(ll i=0,x;i<n;i++)cin>>x,mp[x]++;
    if(n&1){
        if(mp[0]!=1)return cout<<"0" , 0;
        mp.erase(0);

        ll val=n-1;
        for(;val>0;val-=2){
            if(mp[val]!=2)return cout<<"0" , 0;
            mp.erase(val);
        }

        if(!mp.empty())return cout<<"0" , 0;
        cout<<power(2,n/2);
    }
    else{
        for(ll i=1;i<n;i+=2){
            if(mp[i]!=2)return cout<<"0" , 0;
            mp.erase(i);
        }

        if(!mp.empty())return cout<<"0" , 0;
        cout<<power(2,n/2);
    }
}


Measured memory_bytes: 4224
import Data.Int
import Data.Char
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM
import Control.Monad

mulMod :: Int64 -> Int64 -> Int64
mulMod a b = a * b `rem` (10^9 + 7)

main :: IO ()
main = do
  n <- readLn :: IO Int -- 1 <= n <= 100000
  s <- getLine -- length s == n
  let vec = V.create $ do
        vec <- VM.replicate 26 1
        forM_ s $ \c -> do
          VM.modify vec (+ 1) (ord c - ord 'a')
        return vec
  print $ (V.foldl' mulMod 1 vec - 1) `mod` (10^9 + 7)


Measured memory_bytes: 4476
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>
ll modex(ll a, ll b)
{
    ll ans = 1;
    for(; b > 0; b >>= 1, a = (a * a) % mod)
        if(b & 1)
            ans = (ans * a) % mod;
    return ans;
}
ll inv(vll a)
{
    ordered_set s;
    ll ans = 0;
    map <ll, ll> m;
    for(auto x : a)
    {
        s.insert(mp(x, ++m[x]));
        ans += (s.size() - s.order_of_key(mp(x, m[x])) - 1);
    }
    return ans;
}
int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll n, k, i;
    cin >> n >> k;
    vll a(n);
    for(i = 0; i < n; i++)
        cin >> a[i];
    ll v = inv(a) % mod;
    v = ((v * (k + 1)) % mod * k) % mod;
    reverse(all(a));
    ll v1 = inv(a);
    v1 = ((v1 * (k - 1)) % mod * k) % mod;
    v = (v + v1) % mod;
    v = (v * modex(2, mod - 2)) % mod;
    cout << v << endl;
    return 0;
}

Measured memory_bytes: 512
# Your code here!
a, op, b = gets.split(' ')

if op == '+' then
    puts a.to_i + b.to_i
elsif op == '-' then
    puts a.to_i - b.to_i
elsif op == '*' then
    puts a.to_i * b.to_i
elsif op == '/' then
    puts a.to_i / b.to_i
end

Measured memory_bytes: 1788
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
ll a[10050];
int main()
{
    ll i,j,k,n;
    scanf("%lld",&n);
    for(i=1;i<=100;i++)
        for(j=1;j<=100;j++)
           for(k=1;k<=100;k++)
    {
        ll h=i*i+j*j+k*k+i*j+i*k+j*k;
        if(h<=10005)
           a[h]++;
    }
    for(i=1;i<=n;i++)
        printf("%lld\n",a[i]);
    return 0;
}


Measured memory_bytes: 3896
import java.util.Scanner;

public class Main {

    static final long MOD = 1000000007;
    
    static int H, W, K;
    static long[][] dp = new long[110][10];
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        H = sc.nextInt();
        W = sc.nextInt();
        K = sc.nextInt() - 1;
        dp[0][0] = 1;
        for(int h=1; h<=H; ++h) {
            for(int w=0; w<W; ++w) {
                int[] kuji = new int[W-1];
                //mannaka
                if(w < W-1) kuji[w] = -1;
                if(w-1 >= 0) kuji[w-1] = -1;
                dp[h][w] += (kumi(kuji, 0) * dp[h-1][w]) % MOD;
                dp[h][w] %= MOD;
                //left
                if(w > 0) {
                    kuji = new int[W-1];
                    kuji[w-1] = 2;
                    dp[h][w] += (kumi(kuji, 0) * dp[h-1][w-1]) % MOD;
                    dp[h][w] %= MOD;
                }
                if(w < W-1) {
                    kuji = new int[W-1];
                    kuji[w] = 2;
                    dp[h][w] += (kumi(kuji, 0) * dp[h-1][w+1]) % MOD;
                    dp[h][w] %= MOD;
                }
            }
        }
        System.out.println(dp[H][K]);
    }
    
    static long kumi(int[] kuji, int n) {
        if(n == W-1) {
            for(int i=0; i<kuji.length-1; ++i) {
                if(kuji[i] > 0 && kuji[i+1] > 0) {
                    return 0;
                }
            }
            return 1;
        }
        long pos = 0;
        if(kuji[n] > 1) pos = kumi(kuji, n+1);
        else if(kuji[n] == 0) {
            kuji[n] = 1;
            pos = kumi(kuji, n+1);
            kuji[n] = 0;
        }
        long neg = 0;
        if(kuji[n] < 2) neg = kumi(kuji, n+1);
        return (neg + pos) % MOD;
    }
}


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

namespace _0159
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {
                int n = RInt();
                if (n == 0) break;

                Dictionary<int, double> persons = new Dictionary<int, double>();
                for (int i = 0 ; i < n ; i++)
                {
                    int[] items = RIntAr();
                    persons.Add(items[0], GetBMIDiff(items[1], items[2]));
                }
                Console.WriteLine(persons.OrderBy(x => x.Value).ThenBy(x => x.Key).First().Key);
            }
        }

        public static double GetBMIDiff(int h, int w)
        {
            return Math.Abs(22 - w / (h * 0.01) / (h * 0.01));
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;
typedef vector<int>				V;
typedef vector<V>				VV;

template<typename T>string join(const v(T)&v)
{stringstream s;REP(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define MAX 		40010

const ll LINF = (ll)1e18+7;		//
const int INF = 1e9+7;			//2,147,483,647 (Max int)
const ll MOD = 1e9+7;
// テンプレ終了
//====================================================================//




//
int main(){
	string s;cin>>s;

	REP(i,s.size()){
		if(i%2==0){
			if(s[i]=='L'){
				puts("No");
				return 0;
			}
		}else{
			if(s[i]=='R'){
				puts("No");
				return 0;
			}
		}
	}
	puts("Yes");

	return 0;
}




Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int n,i,j,v,count = 0;
    int a[100];

    cin >> n;

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

    for(i = 0;i < n - 1;i++){
        for(j = n - 1;j > i;j--){
            if(a[j] < a[j - 1]){
                count++;
                v = a[j];
                a[j] = a[j - 1];
                a[j - 1] = v;
            }
        }
    }

    for(i = 0;i < n - 1;i++){
        cout << a[i] << ' ';
    }
    cout << a[i] << endl << count << endl;
    
    return 0;
}

Measured memory_bytes: 1164
import java.util.*;

class Main{
	public static void main(String[] A){
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		char[]c=s.next().toCharArray();
		int[]l=new int[26],r=new int[26];
		int v=0;
		for(char i:c)
			++r[i-'a'];
		for(char i:c) {
			--r[i-'a'];
			++l[i-'a'];
			int k=0;
			for(int j=0;j<26;++j)
				if(r[j]>0&&l[j]>0)
					++k;
			v=Math.max(v,k);
		}
		System.out.println(v);
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int r;
  cin>>r;
  string ans;
  if(r < 1200) {
    ans = "ABC";
  } else if(r < 2800) {
    ans = "ARC";
  } else {
    ans = "AGC";
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
N, P = map(int, input().split())
S = input()

XX = 0
if P == 2:
    for i in range(N):
        if int(S[i]) % 2 == 0:
            XX += i + 1
    print(XX)
elif P == 5:
    for i in range(N):
        if int(S[i]) % 5 == 0:
            XX += i + 1
    print(XX)
else:
    base = 1
    X = [0 for i in range(N)]
    X[-1] = int(S[-1])
    for i in range(N, 0, -1):
        X[i-1] = (base * int(S[i-1])) % P
        base *= 10
        base %= P
    for i in range(1, N):
        X[i] += X[i-1]
        X[i] %= P
    D = {i: 0 for i in range(P)}
    D[0] = 1
    for i in range(N):
        D[X[i]] += 1
    XX = 0
    for i in D:
        XX += (D[i] * (D[i] - 1)) // 2
    print(XX)

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

int main(void)
{
  int h, n, sum = 0, input = 0;
  cin >> h >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> input;
    sum += input;
  }
  if (sum >= h)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int MOD=1e9+7;
ll fact[200001];
ll ifact[200001];

ll mult(ll a, ll b)
{
	return (a*b)%MOD;
}

ll modpow(ll a, ll b)
{
	ll r=1;
	while(b)
	{
		if(b&1) r=(r*a)%MOD;
		a=(a*a)%MOD;
		b>>=1;
	}
	return r;
}

ll inv(ll a)
{
	return modpow(a,MOD-2);
}

map<int,int> dsu[200001];
int par[200001];

int rt(int u)
{
	if(par[u]<0) return u;
	return (par[u]=rt(par[u]));
}

void merge(int u, int v)
{
	u=rt(u);v=rt(v);
	if(u==v) return ;
	if(dsu[u].size()<dsu[v].size()) swap(u,v);
	for(mit it = dsu[v].begin();it!=dsu[v].end();it++)
	{
		dsu[u][it->fi]+=it->se;
	}
	par[v]=u;
	//par[u]=-1;
}

ll solve(int x)
{
	if(x!=rt(x)) return 1;
	ll tot = 0;
	ll ans = 1;
	for(mit it = dsu[x].begin();it!=dsu[x].end();it++)
	{
		//cerr<<it->fi<<' '<<it->se<<'\n';
		tot+=it->se;
		ans=(ans*ifact[it->se])%MOD;
	}
	ans=mult(ans,fact[tot]);
	return ans;
}

vector<ii> adj[200001];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	fact[0]=1;ifact[0]=1;
	for(int i=1;i<=200000;i++)
	{
		fact[i]=mult(fact[i-1],i);
		ifact[i]=inv(fact[i]);
	}
	memset(par,-1,sizeof(par));
	int n; cin>>n;
	ll a,b;cin>>a>>b;
	vector<pair<ii,int> > vec;
	for(int i=0;i<n;i++)
	{
		int x,y;
		cin>>x>>y;
		x--;
		adj[x].pb(mp(y,i));
		vec.pb(mp(mp(y,x),i));
		dsu[i][x]++;
	}
	sort(vec.begin(),vec.end());
	for(int i=0;i<n;i++)
	{
		sort(adj[i].begin(),adj[i].end());
		for(int j=1;j<adj[i].size();j++)
		{
			if(adj[i][0].fi+adj[i][j].fi<=a)
			{
				//cerr<<adj[i][0].se<<' '<<adj[i][j].se<<'\n';
				merge(adj[i][0].se,adj[i][j].se);
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		if(vec[0].fi.se!=vec[i].fi.se&&vec[0].fi.fi+vec[i].fi.fi<=b)
		{
			//cerr<<vec[0].se<<' '<<vec[i].se<<'\n';
			merge(vec[0].se,vec[i].se);
		}
	}
	int ptr=0;
	while(ptr<n&&vec[0].fi.se==vec[ptr].fi.se) ptr++;
	if(ptr<n)
	{
		for(int i=0;i<n;i++)
		{
			if(vec[ptr].fi.se!=vec[i].fi.se&&vec[ptr].fi.fi+vec[i].fi.fi<=b)
			{
				//cerr<<vec[ptr].se<<' '<<vec[i].se<<'\n';
				merge(vec[ptr].se,vec[i].se);
			}
		}
	}
	ll ans = 1;
	for(int i=0;i<n;i++)
	{
		ans=mult(ans,solve(i));
	}
	cout<<ans<<'\n';
}	


Measured memory_bytes: 45100
#include<iostream>
#include<vector>
#include <algorithm>
using namespace std;
int main() {
	int A, B, K;
	cin >> A >> B >> K;

	for (int i = min(A, B);i >= 1;i--) {
		if (A % i == 0 && B % i == 0) {
			K--;
			if (K == 0) {
				cout << i << endl;
			}
		}
	}
}

Measured memory_bytes: 256
mod = 10**9 + 7

n = int(input())
s = input()
cs = list(s)
cnts = {}
for c in cs:
  if c in cnts:
    cnts[c] += 1
  else:
    cnts[c] = 1

ans = 1
for key in cnts:
  ans = (ans * (cnts[key]+1)) % mod
ans -= 1
print(ans)


Measured memory_bytes: 3956
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  string s;
  cin >> s;
  sort(ALL(s));
  if(s == "abc") cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N; cin>>N;
  vi A(N);
  rep(i,0,N){
    int X; cin>>X;
    A[X]++;
  }
  int ans=0;
  if(N%2==0){
    bool flag=1;
    rep(i,0,N/2){
      if(A[i*2+1]!=2){
        flag=0;
        break;
      }
    }
    if(flag){
      ans=1;
      rep(i,0,N/2){
        ans*=2;
        ans%=MOD;
      }
    }
  }
  else{
    if(A[0]==1){
      bool flag=1;
      REP(i,1,N/2){
        if(A[i*2]!=2){
          flag=0;
          break;
        }
      }
      if(flag){
        ans=1;
        rep(i,0,N/2){
          ans*=2;
          ans%=MOD;
        }
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
A = []
for i in range(5):
    a = int(input())
    A.append(a)
min_mod = 10
mod_list = []
for a in A:
    if a % 10 == 0:
        min_mod = min(min_mod, 10)
    else:
        min_mod = min(min_mod, a % 10)
    mod_list.append(a % 10)
for i,m in enumerate(mod_list):
    if m == min_mod:
        break
ans = 0
for j in range(5):
    if j == i:
        continue
    ans += (A[j] // 10) * 10 + 10 * ((A[j] % 10) > 0)
ans += A[i]
print(ans)

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

#define MAX_NUM (1000000000 + 7)

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

u64 dec_dig(u64 num) {
  u64 res = 0;
  while (num > 0) {
    num /= 10;
    ++res;
  }
  return res;
}

u64 gcd(u64 a, u64 b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }

  return b ? gcd(b, a % b) : a;
}

int main() {
  cout << setprecision(18);
  u64 N, M;
  cin >> N >> M;
  vector<u64> A(M);
  ArrayInput(A);
  i32 res = N;
  for (u32 i = 0; i < M; ++i) {
    res -= A[i];
  }
  if (res < 0) {
    cout << -1 << endl;
  } else {
    cout << res << endl;
  }
}

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

int main()
{
    int N;
    string X;
    int i;

    cin >> N;
    vector<int> t(N);
    vector<string> s(N);
    for(i = 0; i < N; i++) {
        cin >> s[i] >> t[i];
    }
    cin >> X;

    for(i = 0; i < N; i++) {
        if(s[i] == X) {
            i += 1;
            break;
        }
    }
    int sum = 0;
    for( ; i < N; i++) {
        sum += t[i];
    }

    cout << sum << endl;

    return 0;
}

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

int main(void){
		int n,x,i = 1;
		cin >> n ;

		while(i <= n){
				x = i;
				if( x % 3 == 0){
						cout << " " << i;
				}else while(x > 1){
						if(x % 10 == 3 ){
								cout << " " << i;
                                                               break;
						}
						x /= 10;
				}	
				i++;
		}
		cout << endl;
		return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream> 
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <cassert>
using namespace std;

#define assert_range(x,a,b) assert((a) <= (x) and (x) <= (b))
using ll = long long;
const int INF = 1e9;

int main() {
    ios_base::sync_with_stdio(0);
    int n; 
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    vector<int> dp(n);
    for (int i = 1; i < n; ++i) {
        dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
        if (i-2 >= 0) {
            dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
        }
    }
    cout << dp[n-1] << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define maxn 500005
using namespace std;
typedef long long ll;
int vis[maxn];
int q[maxn];
char s[maxn];
int n;
int tot;
int deg[maxn],ans[maxn];
int head[maxn],to[maxn],nex[maxn];
void add(int x,int y)
{
	to[++tot]=y; nex[tot]=head[x]; head[x]=tot;
}
int main()
{
	scanf("%s",s+1);
	int len=strlen(s+1);
	for(int i=1;i<=len;i++)
	{
		if(s[i]=='<')
			add(i,i+1),deg[i+1]++;
		else
			add(i+1,i),deg[i]++;
	}
	memset(ans,-1,sizeof(ans));
	n=len+1;
	int hd=0,tl=-1;
	for(int i=1;i<=n;i++)
	if(deg[i]==0)
	{
		vis[i]=1;
		q[++tl]=i;
		ans[i]=0;
	}
	ll res=0;
	while(hd<=tl)
	{
		int now=q[hd]; hd++;
		for(int i=head[now];i;i=nex[i])
		{
			ans[to[i]]=max(ans[to[i]],ans[now]+1);
			q[++tl]=to[i];
		}
	}
	for(int i=1;i<=n;i++)
	res+=ans[i];
	printf("%lld\n",res);
}

Measured memory_bytes: 14464