akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main{

    void solve(){
        long a, n, m;
        Scanner sc = new Scanner(System.in);
        a = sc.nextLong();
        n = sc.nextLong();
        m = sc.nextLong();
        int cnt = 0;
        for ( int y = 1; y <= 72; y++ ){
            long x = 1;
            for ( int t = 1; t <= n; t++ ){
                x *= (y+a);
            }
            if (x <= m && val(x) == y) cnt++;
        }

        System.out.println(cnt);
    }

    long val(long x){
        long  sum = 0;
        while(x > 0){
            sum += x%10;
            x /= 10;
        }
        return sum;
    }

    public static void main(String[] args){ new Main().solve(); }
}



Measured memory_bytes: 26400
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long A,B,K;
  cin >> A >> B >> K;
  if (K >= A + B) {
    cout << 0 << " " << 0 << endl;
  }
  else if (K > A && K < A + B) {
    cout << 0 << " " << A + B - K << endl;
  }
  else if (K <= A) {
    cout << A - K << " " << B << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
//typedef long long LL;
using namespace std;

int main(){
    int n;
    int tmp;
    int score = 0;
    vector<int> a;
    vector<int> b;
    vector<int> c;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> tmp;
        a.push_back(tmp);
    }
    for(int i=0; i<n; i++){
        cin >> tmp;
        b.push_back(tmp);
    }
    for(int i=0; i<n-1; i++){
        cin >> tmp;
        c.push_back(tmp);
    }
    for(int i=0; i<n; i++){
        score += b[a[i]-1];
        if(i!=0 && a[i]==a[i-1]+1){
            score += c[a[i-1]-1];
        }
    }
    cout << score << endl;
}

Measured memory_bytes: 256
H, W, K = map(int, input().split())
c = [list(input()) for _ in range(H)]

ans = 0
for y_bit in range(2**H):
    for x_bit in range(2**W):
        cnt = 0
        for y in range(H):
            for x in range(W):
                if (y_bit >> y) & 1:
                    continue
                if (x_bit >> x) & 1:
                    continue

                if c[y][x] == '#':
                    cnt += 1
        if cnt == K:
            ans += 1

print(ans)

Measured memory_bytes: 9216
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#ifndef U_L_LONG
typedef unsigned long long ULLONG;
#endif
#ifndef L_LONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T& a) {
	//	usage:  tp_abs<type name>(a);
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
template <class _T> static _T tp_gcd(_T first, _T second)
{
	_T num1 = first, num2 = second;
	_T remainder = 0, common = 0;

	if (!num1) return num2;
	if (!num2) return num1;

	while (!common) {
		remainder = num1 % num2;

		if (remainder == 0) {
			common = num2;
		}
		else {
			num1 = num2;
			num2 = remainder;
		}
	}
	return(common);
}
template <class _T> static _T tp_lcm(_T first, _T second) {
	_T gcd = tp_gcd<_T>(first, second);
	return first * second / gcd;
}


static void ABC103C_ModuleSummation();

#if 1
int main()
{
	ABC103C_ModuleSummation();
	fflush(stdout);
	return 0;
}
#endif

static void ABC103C_ModuleSummation()
{
	int N;
	get1int(N);

	auto seq = new LLONG[N];
	LLONG fn = 0;
	for (int i = 0; i < N; i++) {
		get1int(seq[i]);
		fn += seq[i] - 1;
	}
	printf("%lld\n", fn);

	delete[] seq;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve(){
	long long int i, j, k, p, q, r, x, y, u, v, n, m,d;
	long long int c=0;
	cin>>n>>d;
	for(i=0;i<n;i++){
		cin>>x>>y;
		u=ceil(sqrt(x*x+y*y));
		//cout<<u<<endl;
		if(u<=d){
			c++;
		}
	}
cout<<c<<endl;

}

int main() {
	ios_base::sync_with_stdio(0);
	int i,t=1;
	//cin>>t;
	for(i=1;i<=t;i++){
		solve();
	}
	return 0;
}

int mpow(int base, int exp) {
	base %= mod;
	int result = 1;
	while (exp > 0) {
		if (exp & 1) result = ((ll)result * base) % mod;
		base = ((ll)base * base) % mod;
		exp >>= 1;
	}
	return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}




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

int powInt(int a, int b) {
    int ans = 1;
    for (int i = 0; i < b; ++i) ans *= a;
    return ans;
}

int main() {
    int n, m;
    cin >> n >> m;
    int ans = powInt(10, n - 1);
    if (n == 1) ans = 0;
    vector<pair<int, char>> constraint(m);
    for (int i = 0; i < m; ++i) cin >> constraint[i].first >> constraint[i].second;
    bool flag;
    for (int j = ans; j < powInt(10, n); ++j) {
        string s = to_string(j);
        flag = true;
        for (pair<int, char> k : constraint) {
            if (s[k.first - 1] != k.second) {
                flag = false;
                break;
            }
        }
        if (flag) {
            cout << j << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 256
import sys
A, B = map(int, input().split())
S = input()

nums = [str(i) for i in range(10)]
for i in range(A):
    if S[i] not in nums:
        print("No")
        sys.exit()
if S[A] != "-":
    print("No")
    sys.exit()
for i in range(A+1, A+1+B):
    if S[i] not in nums:
        print("No")
        sys.exit()
print("Yes")

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

int main(){
  int n;
  cin>>n;
  if(400<=n && n<600) cout<<8<<endl;
  if(600<=n && n<800) cout<<7<<endl;
  if(800<=n && n<1000) cout<<6<<endl;
  if(1000<=n && n<1200) cout<<5<<endl;
  if(1200<=n && n<1400) cout<<4<<endl;
  if(1400<=n && n<1600) cout<<3<<endl;
  if(1600<=n && n<1800) cout<<2<<endl;
  if(1800<=n && n<2000) cout<<1<<endl;
}



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

int main() {
    
    int D, N;
    cin >> D >> N;
    
    for(int i=1; ; i++)
    {
        int f = 0, x = i;
        
        while(x % 100 == 0)
            x /= 100, f++;
        
        if(f == D)
            N--;
        
        if(N == 0)
        {
            cout << i << "\n";
            return 0;
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=1000000007;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };

int n;
ll x,y,z; //3,5,7のそれぞれの数
ll ans = 0;
set<int> st;
void dfs(ll a,ll x,ll y,ll z){
	
	if(a>1e9) return;
	if(x>=1 && y>=1 && z>=1) st.insert(a);
	dfs(a*10 + 3,x+1,y,z);
	dfs(a*10 + 5,x,y+1,z);
	dfs(a*10 + 7,x,y,z+1);

}


int main() {
	cin>>n;
	
	if(n<357){
		cout<<ans<<endl;
		return 0;
	}

	st.clear();

	dfs(3,1,0,0); //3が最高桁数の数字のもの
	dfs(5,0,1,0); //5が最高桁数の数字のもの
	dfs(7,0,0,1); //7が最高桁数の数字のもの

	for(auto iter=st.begin();iter != st.end();++iter){
		if(*iter > n) break;
		else ans++; 
	}

	cout<<ans<<endl;
}

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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 1e5+5;

int mod = 2019;

int main()
{

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ll l , r , c = 5000 , c2=5000 , tmp , ans = 1e18;
    cin >> l >> r;
    for(int i=l; i<=r; i++)
    {
        c--;
        if (!c) break;
        c2=5000;
        for(int j=i+1; j<=r; j++)
        {
            c2--;
            if (!c2) break;
            tmp = 1ll*i*j;
            ans = min(ans , tmp%mod);
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
/*
 * cpp_filepath
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }


void solve() {
  int x; cin >> x;
  if (x < 1200) cout << "ABC" << endl;
  else cout << "ARC" << endl;
}


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

typedef std::pair<int, int> ipair;
#define pb push_back
#define ff first
#define ss second
#define fr(i, j, k) for (int i = j; i < k; i++)
#define int long long
#define ld long double
#define cnt_ones(x) __builtin_popcount(x)
#define all(x) x.begin(), x.end()
#define mp make_pair
#define mod 1000000007

template<class T> ostream& operator <<(ostream &out,vector<T> &A){for(auto x:A) out<<x<<" ";return out;}
template <class T1,class T2>T1 powr(T1 a,T2 b){T1 res = 1;fr(i,1,b+1)res = res*a;return res;}
#define IOS  std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int32_t main(){
  int n,m;
  cin>>n>>m;
  //vector<vector<char> >arr(n,vector<char> (m));
  char arr[n][m];
  fr(i,0,n) fr(j,0,m) cin>>arr[i][j];
  //vector<vector<int> >dp(n,vector<int> (m,-1));
  int dp[n][m];
  fr(i,0,n) fr(j,0,m) dp[i][j]=0;
  dp[n-1][m-1] = 1;
  
  for(int i=m-2;i>=0;i--){
  if(arr[n-1][i+1] == '.' and arr[n-1][i] == '.')
  dp[n-1][i] = dp[n-1][i+1];
  else
  dp[n-1][i] = 0;
  }

  for(int i=n-2;i>=0;i--){
  if(arr[i+1][m-1] == '.' and arr[i][m-1] == '.')
  dp[i][m-1] = dp[i+1][m-1];
  else
  dp[i][m-1] = 0;
  }

  for(int i=n-2;i>=0;i--)
  for(int j=m-2;j>=0;j--)
  if(arr[i][j] == '.')
  dp[i][j] = ((arr[i+1][j]=='.') ? dp[i+1][j] : 0)%mod + ((arr[i][j+1]=='.') ? dp[i][j+1] : 0)%mod;
  cout<<dp[0][0]%mod<<endl;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int cnt = 0;
    string s, a;
    cin >> s;
    a = s;
    reverse(a.begin(), a.end());
    int len = s.size();
    for(int i = 0 ; i < len ; i++)
    {
        if(s[i] != a[i])
        {
            cnt++;
        }
    }
    cout << cnt / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
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; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n;
  cin >> n;
  ll res = 0;
  rrep(i,n){
    if(i%3==0||i%5==0)continue;
    res += i;
  }
  cout << res << endl;
}

Measured memory_bytes: 3168
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <unordered_map>

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vector<T>>;

#define REP(i, s, e) for (ll i = s; i < e; ++i)

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

    int N; cin >> N;
    N %= 10;

    string unit = "";
    switch (N)
    {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            unit = "hon";
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            unit = "pon";
            break;
        case 3:
            unit = "bon";
            break;
    }

    cout << unit << endl;

    return 0;
}


Measured memory_bytes: 3652
s = int(input())
a = [0] * 100000
a[0] = s

sum = 0
flag = 0
for i in range(100000):
    if a[i] % 2 == 0:
        a[i+1] = a[i] // 2
    else:
        a[i+1] = 3 * a[i] + 1
    sum += 1
    if a[i] in a[:i]:
        print(sum)
        exit()


Measured memory_bytes: 3828
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		String n = kb.next();
		char x = n.charAt(n.length()-1);
		if (x=='2' || x=='4' || x=='5' || x=='7' || x=='9') {
			System.out.println("hon");
		} else if (x=='0' || x=='1' || x=='6' || x=='8') {
			System.out.println("pon");
		} else {
			System.out.println("bon");
		}
		
		kb.close();
	}

}


Measured memory_bytes: 26784
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

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

int main(){
    ll n; cin >> n;
    vector<ll> lis(5);
    REP(i, 0, 5){cin >> lis[i];}
    sort(ALL(lis));
    ll k = lis[0];
    if(n % k == 0){
        cout << n/k + 4 << endl;
    }else{
        cout << n/k+ 5 << endl;
    }
}

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

int main()
{
    int N, X;
    vector<int> M;
    cin >> N;
    cin >> X;
    for (int i = 0; i < N; ++i)
    {
        int m;
        cin >> m;
        M.push_back(m);
    }
    int sum, min, count;
    sum = accumulate(M.begin(), M.end(), 0);
    min = *min_element(M.begin(), M.end());
    X -= sum;
    count = X / min;
    cout << count + N << endl;
}

Measured memory_bytes: 3556
#include <iostream>
#include <cfenv>
#include <algorithm>
#include <cmath>

using namespace std;

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

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for (ll i = (begin); i < (end); i++)
#define REP(i, n) FOR(i, 0, n)
#define IFOR(i, begin, end) for (ll i = (begin)-1; i >= (end); i--)
#define IREP(i, n) IFOR(i, n, 0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(), greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v)                                                              \
  cout << #v << "=(" << v[0];                                                  \
  FOR(i_debug, 1, v.size()) { cout << "," << v[i_debug]; }                     \
  cout << ")" << endl;
#define mdebug(m)                                                              \
  cout << #m << "=" << endl;                                                   \
  REP(i_debug, m.size()) {                                                     \
    REP(j_debug, m[i_debug].size()) { cout << m[i_debug][j_debug] << ","; }    \
    cout << endl;                                                              \
  }
#define Lower_bound(v, x)                                                      \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x)                                                      \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define ld long double
// #define f first
// #define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;

template <typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) {
  REP(i, a.size()) {
    cin >> a[i];
    a[i]--;
  }
}

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

  vec A(N);
  REP(i, N) { cin >> A[i]; }

  vec B(0);
  vec C(0);

  REP(i, N) {
    B.pb(i - A[i]);
    C.pb(-i - A[i]);
  }

  ll ans = 0;
  // vdebug(C);
  SORT(C);
  SORT(B);
  REP(i, N) { ans += Upper_bound(C, -B[i]) - Lower_bound(C, -B[i]); }

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

Measured memory_bytes: 8208
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,a,b,c,ans=1e18;
  cin >> n >> a >> b >> c;
  int x[n];
  for(int i=0;i<n;i++){
    cin >> x[i];
  }
  for(int i=0;i<pow(4,n);i++){
    long long tmp=i,cnt=0;
    vector<long long> A,B,C;
    while(cnt<n){
      if(tmp%4==0){
        A.push_back(x[cnt]);
      }else if(tmp%4==1){
        B.push_back(x[cnt]);
      }else if(tmp%4==2){
        C.push_back(x[cnt]);
      }
      tmp/=4;
      cnt++;
    }
    if(A.size()==0 or B.size()==0 or C.size()==0)continue;

    long long aa=(A.size()-1)*10, asum=0;
    for(size_t j=0;j<A.size();j++){
      asum+=A[j];
    }
    aa+=abs(a-asum);

    long long bb=(B.size()-1)*10, bsum=0;
    for(size_t j=0;j<B.size();j++){
      bsum+=B[j];
    }

    bb+=abs(b-bsum);
    long long cc=(C.size()-1)*10, csum=0;
    for(size_t j=0;j<C.size();j++){
      csum+=C[j];
    }

    cc+=abs(c-csum);
    ans=min(ans, aa+bb+cc);
  }
  cout << ans << endl;
  return 0;
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

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


long long int n,cnt=0,ans=0,a,b,c,d,cmp[4],cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>a>>b>>c;
      if(a%2==0||b%2==0||c%2==0)Cout(0);
      else{
        cmp[0]=a;cmp[1]=b;cmp[2]=c;
        sort(cmp,cmp+3);
        Cout(cmp[0]*cmp[1]);
      }
     

       
return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define mp make_pair
#define ff first
#define ss second

using namespace std;
using vi=vector<int>;
using pii=pair<int, int>;
using ull=unsigned long long;

typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    
	int n;
	int sum = 0;
	int prev;
	cin >> n;
	vi b(n);
	vi a(n+1);


	for (int i=1; i<=n-1; i++)
		cin >> b[i];

	a[1] = a[2] = b[1];

	for (int i = 2; i <= n-1; i++)
	{
		a[i] = min(a[i], b[i]);
		a[i+1] = max(b[i], a[i]);
	}

	long ans = accumulate(a.begin(), a.end(), 0L);
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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

























int main(){
    ll n, m;
    cin >> n >> m;
    vector<vector<ll>> v(m);
    REP(i, m){
        ll k;
        cin >> k;
        v[i].resize(k);
        REP(j, k){
            cin >> v[i][j];
            v[i][j]--;
        }
    }
    vector<ll> p(m);
    REP(i, m){
        cin >> p[i];
    }
    
    ll ans = 0;
    REP(i, (1 << n)){
        vector<ll> f(n);
        REP(j, n){
            if(i & (1 << j)){
                f[j] = true;
            }
        }
        bool ok = true;
        REP(j, m){
            ll cnt = 0;
            REP(k, v[j].size()){
                if(f[v[j][k]]) cnt++;
            }
            if(cnt % 2 != p[j]){
                ok = false;
                break;
            }
        }
        if(ok) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;
using P  = pair<int,int>;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    ll n;
    cin >> n;
    
    ll x, m;
    cin >> x >> m;
    ll y = x;
    ll ans = 0;
    set<ll> a;
    a.insert(y);
    while(!a.count(y*y%m)){
        a.insert(y*y%m);
        y = y*y%m;
    }
    int root = y*y%m;
    
    y = x;
    int hige = 0;
    ll count = 0;
    while(y!=root && count<n){
        ans += y;
        count++;
        y = y*y %m;
        hige++;
    }
    
    if(count==n){
        cout << ans << endl;
        return 0;
    }
    
    int loop = (int)a.size() - hige;
    
    vector<ll> lnum(loop);
    for(int i=0; i<loop; i++){
        lnum[i] = y;
        y = y*y%m;
    }
    
    n -= hige;
    ll c = n / loop;
    ll b = n % loop;
    
    for(int i=0; i<loop; i++){
        ans += c*lnum[i];
        if(i<b) ans += lnum[i];
    }
    
    cout << ans << endl;
    
    return 0;
}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair

#define NEWLINE         cerr << "\n";
#define HOISE           cerr << "hoise " << __LINE__ << "\n"
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << "\n"
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)

typedef long long ll;
typedef pair<int, int > pii;
typedef pair<ll, ll> pll;

const int INF = 1e9 + 23;
const ll INFL = 2e18 + 23;

int32_t main()
{
    FASTIO;

    int a, b, c, k;
    cin >> a >> b >> c >> k;
    while(a >= b and k){
        b *= 2;
        k--;
    }
    while(b >= c and k){
        c *= 2;
        k--;
    }

    bool ok = false;
    if(b>a and c>b) ok = true;
    if(ok) cout << "Yes";
    else cout << "No";

    return 0;
}	

Measured memory_bytes: 3648
A, B, C, X, Y = map(int, input().split())

min_sum = A*X + B*Y
for c in range(0, 100000+1):
    sum = 2*C*c
    if X - c > 0:
        sum += A * (X - c)
    if Y - c > 0:
        sum += B * (Y - c)
    if sum < min_sum:
        min_sum = sum
print(min_sum)

Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	ll a = in(), b = in(), k = in();
	ll ans, cnt = 0;
	for (ll i = min(a, b); cnt < k; --i) {
		if (a %i == 0 && b % i == 0) {
			++cnt;
			ans = i;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ll long long
#define ld long double
//#define int ll
#define INF INT_MAX/10
#define MOD 1000000007

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

int Input[100100];

int main() {
  string S, T; cin >> S >> T;
  map<char, set<int>> X, Y;
  rep(i, S.size()) {
    X[S[i]].insert(T[i]);
    Y[T[i]].insert(S[i]);
  }
  for (auto p: X) {
    if (p.second.size() > 1) {
      cout << "No" << endl;
      return 0;
    }
  }

  for (auto p: Y) {
    if (p.second.size() > 1) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

int main(){
	int l, m, n, sum, month;
	
	while(cin >> l, l){
		sum = month = 0;
		for(int i = 1; i <= 12; ++i){
			cin >> m >> n;
			sum += (m - n);
			
			if(sum >= l && month == 0) month = i;
		}
		
		if(month)cout << month << endl;
		else cout << "NA" << endl;
	}
	
	return 0;
}

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


class dice {
public:
	dice(int* a) {
		set(a[0], a[1], a[2], a[3], a[4], a[5]);
	}
	dice(int& a, int& b, int& c, int& d, int &e, int& f) {
		set(a, b, c, d, e, f);
	}
	void turn(int n) {
		if (n < 4)
		{
			turndice(n);
			return;
		}
		switch (n)
		{
		case 'N':
			turndice(0);
			break;
		case 'E':
			turndice(1);
			break;
		case 'S':
			turndice(2);
			break;
		case 'W':
			turndice(3);
			break;
		}

	}

	void turn(const char* str)
	{
		for (size_t i = 0; str[i] != '\0' ; i++)
		{
			turn(str[i]);
		}
	}

	int getcurrent(int n = 0) { return label[n]; }

public:
	int topfronttoright(const int & top, const int & front) {
		char n3[] = { "NES" };
		const char ne[][3] = { "N","N","N","E","EE" };

		for (size_t i = 0; i < 6; i++)
		{
			if (top == getcurrent())
				for (size_t j = 0; j < 4; j++)
				{
					if (front == getcurrent(1))
					{		
						return  getcurrent(2);
					}
					turn(n3);
				}
			turn(ne[i]);
		}

		return 0;
	}

	bool cmper(dice b) {
		char n3[] = { "NES" };
		const char ne[][3] = { "N","N","N","E","EE" };

		for (size_t i = 0; i < 6; i++)
		{
			if (b.getcurrent() == getcurrent())
				for (size_t j = 0; j < 4; j++)
				{
					if (b.getcurrent(1) == getcurrent(1) &&
						b.getcurrent(2) == getcurrent(2) &&
						b.getcurrent(3) == getcurrent(3) &&
						b.getcurrent(4) == getcurrent(4) &&
						b.getcurrent(5) == getcurrent(5) )
					{
						return  true;
					}
					turn(n3);
				}
			turn(ne[i]);
		}

		return false;
	}

private:

	int label[6];

	void set(int& a, int& b, int& c, int& d, int &e, int& f) {
		label[0] = a; 
		label[1] = b; 
		label[2] = c; 
		label[3] = d; 
		label[4] = e; 
		label[5] = f; 
	}
	void turndice(int n)
	{
		int m = (n > 1) ? n - 2 : n + 2;
		int f[] = { 1, 3, 4, 2 };
		int tmp;

		tmp = label[0];
		label[0] = label[f[n]];
		label[f[n]] = label[5];
		label[5] = label[f[m]];
		label[f[m]] = tmp;
	}

};

#define C

#ifdef C
int main(void)
{
	int labela[6];
	int labelb[6];
	for (auto &a :labela)
		cin >> a;
	for (auto &b : labelb)
		cin >> b;

	dice a(labela), b(labelb);

	a.topfronttoright(6, 2);

	if (a.cmper(b))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;



	return 0;
}
#endif // C

Measured memory_bytes: 3136
#include <stdio.h>

int main(void){
    char input[3];
    scanf("%s",input);
    int flag=0;
    int i,count=0;
    int max=0;

    for(i=0;i<3;i++){
        if(input[i] == 'R'){
            flag=1;
        }else{
            flag=0;
            if(max < count) max = count;
            count=0;
        }
        if(flag==1){
            count++;
        }
    }
    if(max < count) max = count;
    printf("%d",max);
    return 0;
}

Measured memory_bytes: 1732
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = []
cnt = 0

for i in range (N):
  A.append(list(map(int, input().split())))
  
  
for a in range (N):
  tl = 0
  for b in range (M):
    tl += A[a][b]*B[b]
    
  if tl + C > 0:
    cnt += 1
    
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
//F6編譯，右上三角形執行，ctrl+c強制停止執行  F5開啟exe
#define ll long long
#define maxn 300005
#define mod 1000000007
using namespace std;

typedef pair<int, int> P;

int h, w;
int a[100][100], b[100][100];
bool used[81][81][80 * 80 * 2 + 5];
int ans;

void dfs(int x, int y, int diff)
{
    if (used[x][y][diff])
        return;
    used[x][y][diff] = 1;
    //cout << x << " " << y << " " << diff << endl;
    if (x == h && y == w)
    {
        ans = min(ans, abs(diff + a[x][y] - b[x][y]));
        ans = min(ans, abs(diff + b[x][y] - a[x][y]));
        return;
    }
    if (y < w)
    {
        dfs(x, y + 1, abs(diff + a[x][y] - b[x][y]));
        dfs(x, y + 1, abs(diff + b[x][y] - a[x][y]));
    }
    if (x < h)
    {
        dfs(x + 1, y, abs(diff + a[x][y] - b[x][y]));
        dfs(x + 1, y, abs(diff + b[x][y] - a[x][y]));
    }
}

int main()
{
    cin >> h >> w;
    for (int i = 1; i <= h; i++)
        for (int j = 1; j <= w; j++)
            cin >> a[i][j];

    for (int i = 1; i <= h; i++)
        for (int j = 1; j <= w; j++)
            cin >> b[i][j];

    ans = INT_MAX;
    dfs(1, 1, 0);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 80896
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

   int n;
   cin >> n;
   vector<int> a(n);
   rep(i, 0, n - 1) {
      cin >> a[i];
      a[i]--;
   }
   vector<int> b(n);
   rep(i, 0, n-1) b[a[i]]++;
   rep(i, 0, n) cout << b[i] << endl;
   return 0;
}

Measured memory_bytes: 4784
#include <iostream>

using namespace std;


void call(int n){
  int i = 1;
 CHECK_NUM:
  int x = i;
  if ( x % 3 == 0 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
 INCLUDE3:
  if ( x % 10 == 3 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
  x /= 10;
  if ( x ) goto INCLUDE3;
 END_CHECK_NUM:
  if ( ++i <= n ) goto CHECK_NUM;

  cout << endl;
}
int main() {
	int n; cin >> n;
	call(n);
}



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

typedef long double LD;
typedef long long ll;
typedef map<int,int> mii;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

#define pb              push_back
#define mp              make_pair
#define F               first
#define S               second
#define mod             1000000007
#define INF             2147483647
#define endl            "\n"
#define FasterIO        ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0) ;
#define precision(a)    cout << fixed << setprecision(a)
#define bug(a,b)        cout<<a<<"\t"<<b<<"\n";
#define Case(a,b)       cout<<"Case "<<a<<": "<<b<<"\n";
#define reset(a,b)      memset(a,b,sizeof(a));
#define For(x,n)        for(int i=x; i<n; i++)

const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

int strtoint(string str){
    stringstream ss(str);
    int x = 0;
    ss >> x ;
    return x ;
}
string intostr(int x){
    stringstream ss;
    ss << x;
    string str = ss.str();
    return str;
}
void rem(string &s, const string &c) {
	auto pos = s.find(c);
	if (pos == string::npos) {
		cout << -1 << endl;
		exit(0);
	}
	s.erase(0, pos + 1);
}
void println (int n){
    cout<<n<<"\n";
}
void printvec(vector <int> &a){
    for (int i=0;i<a.size();i++){
        cout<<a[i]<<" ";
    }
    cout<<"\n";
}

void printgraph(vector <int> g[],int e){
    for (int i=0;i<e;i++){
        cout<<i<<" --> ";
        for (int j=0;j<g[i].size();j++){
            cout<<g[i][j]<<" ";
        }
        cout<<"\n";
    }
}

void printmap (map <int,int> &mymap){
    for (auto itr = mymap.begin(); itr != mymap.end(); ++itr) {
        cout << '\t' << itr->first
             << '\t' << itr->second << '\n';
    }
    cout << "\n";
}



void solve(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll arr[4];
    arr[0]=a,arr[1]=b,arr[2]=c,arr[3]=d;
    ll ans = -1000000000000000000;
    for (int i=0;i<2;i++){
        for (int j=2;j<4;j++){
            if (arr[i]*arr[j]>ans && i!=j){
                ans = arr[i]*arr[j];
            }
        }
    }
    cout<<ans<<endl;

}


int main(){
    //FasterIO;

    solve();
    return 0;
}


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

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

    for (int i = a; i <= min(a + k - 1, b); i++) {
        cout << i << endl;
    }

    for (int i = max(b - k + 1, a + k); i <= b; i++) {
        cout << i << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <set>
#include <cstdio>
#include <cstring>
#include <cmath>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#define f first
#define s second
#define mp make_pair

inline int getInt(){ int s; scanf("%d", &s); return s; }

using namespace std;

int l[256];
int cnt[256];

int main(){
  while(int n = getInt()){
    REP(i,n) l[i] = getInt();

    pair<int, pair<int, int> > ans;
    double ansval = 1e20;

    REP(s,16) REP(a,16) REP(c,16){
      memset(cnt, 0, sizeof(cnt));

      int r = s;
      REP(i,n){
	r = (r * a + c) % 256;
	cnt[(l[i] + r) % 256]++;
      }

      double h = 0.0;

      REP(i,256) if(cnt[i]){
	double tmp = (double)cnt[i] / n;
	h += - tmp * log(tmp);
      }

      if(h + 1e-10 < ansval){
	ans = mp(s, mp(a, c));
	ansval = h;
      }
    }

    printf("%d %d %d\n", ans.f, ans.s.f, ans.s.s);
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] B = new int[N+1];
		int X = 0;
		for(int i = 0; i < N; i++)
			B[sc.nextInt()] += 1;
		Arrays.sort(B);
		for(int i = N; i >= N - K + 1; i--)
			X += B[i];
		System.out.println(N-X);

	}

}

Measured memory_bytes: 65112
def main():
    from bisect import bisect_left
    import sys

    input = sys.stdin.readline
    inf = (10 ** 10) * 2 + 10

    a, b, q = map(int, input().split())

    s = [-inf] + [int(input()) for _ in range(a)] + [inf]
    # s.sort()

    t = [-inf] + [int(input()) for _ in range(b)] + [inf]
    # t.sort()

    for _ in range(q):
        x = int(input())

        si = bisect_left(s, x) - 1
        ti = bisect_left(t, x) - 1

        ret = inf
        for sx in s[si:si + 2]:
            for tx in t[ti:ti + 2]:
                ret = min(ret, min(abs(x - sx), abs(x - tx)) + abs(sx - tx))
        print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 12816
#include <stdio.h>
#include <stdlib.h>
//TLE
/*int compare_int(const void *a, const void *b) {
  int c = *(int*)a;
  int d = *(int*)b;
  if (c & (1<<31)) {
    if (d & (1<<31)) {
      return d-c;
    } else {
      return -1;
    }
  } else {
    if (d & (1<<31)) {
      return 1;
    } else {
      return d-c;
    }
  }
}*/
int compare_long(const void *a, const void *b) {
  if (*(long int*)b - *(long int*)a > 0) {
    return 1;
  } else {
    return -1;
  }
}
int main() {
  int x, y, z, l;
  scanf("%d %d %d %d", &x, &y, &z, &l);
  long int a[x], b[y], c[z];
  for (int i = 0; i < x; i++) {
    scanf("%ld", a+i);
  }
  for (int i = 0; i < y; i++) {
    scanf("%ld", b+i);
  }
  for (int i = 0; i < z; i++) {
    scanf("%ld", c+i);
  }

  qsort(a, x, sizeof(long int), compare_long);
  /*for (int i = 0; i < x; i++) {
    printf("%ld\n", *(a+i));
  }*/
  qsort(b, y, sizeof(long int), compare_long);
  qsort(c, z, sizeof(long int), compare_long);
  if (x>l) x = l;
  if (y>l) y = l;
  if (z>l) z = l;
  int w = x*y;
  if (w>l) w = l;
  long int p[x*y], q[w*z];
  for (int i = 0; i < x; i++) {
    for (int j = 0; j < y; j++) {
      p[y*i + j] = a[i] + b[j];
    }
  }
  qsort(p, x*y, sizeof(long int), compare_long);
  for (int i = 0; i < w; i++) {
    for (int j = 0; j < z; j++) {
      q[z*i + j] = p[i] + c[j];
    }
  }
  qsort(q, w*z, sizeof(long int), compare_long);
  for (int i = 0; i < l; i++) {
    printf("%ld\n", q[i]);
  }
  return 0;
}


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

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

    vector<int> sn, en;
    for( int i = 0; i < M; ++i ){
        int c, d;
        cin >> c >> d;
        if( c == 1 ) sn.push_back(d);
        else if( d == N ) en.push_back(c);
    }


    sort(sn.begin(), sn.end());
    sort(en.begin(), en.end());


    int s_size = sn.size(), e_size = en.size();
    for( int i = 0, j = 0; i < s_size; ++i, j=j==0?0:j-1 ){
        for( ; j < e_size; ++j ){
            if( sn[i] < en[j] ) break;
            if( sn[i] == en[j] ){
                cout << "POSSIBLE" << endl;
                return 0;
            }
        }
    }


    cout << "IMPOSSIBLE" << endl;


    return 0;
}


Measured memory_bytes: 1276
#include<stdio.h>
double line(double x1, double y1, double x2, double y2, double x, double y)
{
	return (x1-x2)*(y-y1)+(y1-y2)*(x1-x);
}
int line_cross(double x1, double y1, double x2, double y2, double xa, double ya, double xb, double yb)
{
	return line(x1, y1, x2, y2, xa, ya) * line(x1, y1, x2, y2, xb, yb) <= 0;
}
int is_inner_triangle(double x1, double y1, double x2, double y2, double x3, double y3, double x, double y)
{
	double xg = (x1+x2+x3)/3;
	double yg = (y1+y2+y3)/3;
	return
		!line_cross(x1, y1, x2, y2, xg, yg, x, y) &&
		!line_cross(x2, y2, x3, y3, xg, yg, x, y) &&
		!line_cross(x3, y3, x1, y1, xg, yg, x, y);
}
int main()
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)>0) {
		puts(is_inner_triangle(x1, y1, x2, y2, x3, y3, xp, yp) ? "YES" : "NO");
	}
	return 0;
}

Measured memory_bytes: 0
N, M = list(map(int, input().split()))
H_list = list(map(int, input().split()))

road_list = []
for _ in range(N):
    road_list.append([])
    
for i in range(M):
    a, b = list(map(int, input().split()))
    
    H_a, H_b = [H_list[a - 1], H_list[b - 1]]
    
    if H_a <= H_b:
        road_list[a - 1].append(b)

    if H_b <= H_a:
        road_list[b - 1].append(a)

ans = 0
for road in road_list:
    if len(road) == 0:
        ans += 1
print(ans)

Measured memory_bytes: 25156
import java.util.*;
public class Main{
	//static HashSet<Long> dic = new HashSet<>();
	public static void main(String[] argv){
		run();
	}

	static void run(){
	
		Scanner scan = new Scanner(System.in);
		long n = scan.nextLong();
		System.out.println(dfs(n, 0));
	}
	static int dfs(long n, long s){
		if(s>n){
			return 0;
		} else {
			int count = 0;
			String ss = String.valueOf(s);
			if(ss.contains("3") && ss.contains("5") &&ss.contains("7"))
				count++;
			count += dfs(n, s*10+3) + dfs(n, s*10+5) + dfs(n, s*10+7); 
			return count;
		}
	}
}

Measured memory_bytes: 27604
N = int(input())

if 400 <= N <= 599:
    print(8)
elif 600<= N <=799:
    print(7)
elif 800<= N <=999:
    print(6)
elif 1000<= N <=1199:
    print(5)
elif 1200<= N <=1399:
    print(4)
elif 1400<= N <=1599:
    print(3)
elif 1600<= N <=1799:
    print(2)
elif 1800<= N <=1999:
    print(1)

Measured memory_bytes: 9124
#include<iostream>

using namespace std;
int n = 1000;
int t = 1000;
int c[10010], ta[10010];

int main(){
  int conclusion = 1010;
  cin >> n >> t;
  for(int i = 0; i < n; ++i){
    cin >> c[i] >> ta[i];
    if(ta[i] <= t){
      if(c[i] <= conclusion){
        conclusion = c[i];
      }
    }
  }
  if(conclusion >= 1010){
    cout << "TLE" << endl;
  }
  else{
    cout << conclusion << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        int ab = a + b;
        int bc = b + c;
        int ca = c + a;

        System.out.println(Math.min(ca, Math.min(ab, bc)));



    }


}

Measured memory_bytes: 22228
N, K = map(int, input().split())
h = list(map(int, input().split()))

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

def chmin(a, b):
    if a > b:
        return b
    else:
        return a
        
for i in range(2, N):
    for j in range(1, K + 1):
        dp[i] = chmin(dp[i], dp[i - j] + abs(h[i] - h[i - j]))

print(dp[-1])

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

using namespace std;

const int N=1e6+3;

#define pb push_back
#define all(x) (x).begin(),(x).end()
typedef long long ll;

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

const int inf=1e9;

int n,m,a[N],b[N],k,q,u,v,x,y,tc,c,l,r,ans,sz[N];

char s[N];

pair<int,int> p[N];

int main(){
	int n;
	scanf("%d",&n);
	while(1){
		bool ok=true;
		for(int i=2;(ll)i*i<=n;i++){
			if (n%i==0){
				ok=false;
				break;
			}
		}
		if (ok)
			return !printf("%d\n",n);
		n++;
	}
}


Measured memory_bytes: 256
n, y = map(int, input().split())
res10000, res5000, res1000 = -1, -1, -1
for a in range(n+1):
  if res10000 != -1:
    break
  for b in range(n-a+1):
    c = n - a - b
    total = 10000*a + 5000*b + 1000*c
    if total == y:
      res10000, res5000, res1000 = a, b, c
    if res10000 != -1:
      break
print(str(res10000) + " " + str(res5000) + " " + str(res1000))

Measured memory_bytes: 3064
n, m = [int(i) for i in input().split()]
es = [[int(j) for j in input().split()] for i in range(m)]

x = [float('-inf')] * (n+1)
x[1] = 0

for i in range(n):
    for a, b, c in es:
        x[b] = max(x[b], x[a]+c)

prevxn = x[n]
for a, b, c in es:
        x[b] = max(x[b], x[a]+c)

if prevxn != x[n]:
    print('inf')
else:
    print(x[n])

Measured memory_bytes: 3444
A,B,C,X,Y = list(map(int, input().split()))

ans = 0
for i in range(1, max(X,Y)+1):
    x = 1
    y = 1
    if X <= 0: x = 0
    if Y <= 0: y = 0
    ab_price = A * x + B * y
    c_price = C * 2

    if ab_price >= c_price:
        ans += C * 2
    else:
        _x = 0
        if x > 0:
          _x = 1
        _y = 0
        if y > 0:
          _y = 1
        ans += A * _x + B * _y
    X -= 1
    Y -= 1
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
#define maxn 100000

typedef struct nameandtime {
	char name[10+2];
	int time; 
}RW;

RW Q[maxn];
int head, tail;

void enqueue(RW x) {
	Q[tail] = x;
	tail = (tail + 1) % maxn;
}

RW dequeue() {
	RW x = Q[head];
	head = (head + 1) % maxn;
	return x;
}

int min(int a, int b) {
	return a < b ? a : b;
}

int main() {
	int q, t = 0, n;
	RW u;
	scanf("%d %d", &n, &q);
	for( int i = 1; i <= n; i++) {
		scanf("%s", Q[i].name);
		scanf("%d", &Q[i].time);
	}
	head = 1 ; tail = n + 1;
	while ( head != tail ) {
		u = dequeue();
		int c = min(q, u.time);
		u.time -= c;
		t += c;
		if( u.time > 0) enqueue(u);
		else printf("%s %d\n", u.name, t);
	}
}


Measured memory_bytes: 4304