akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <string>

using namespace std;

int gcd(int a, int b)
{
    if (a < b)
        return gcd(b, a);

    int i;
    while (i = a % b)
    {
        a = b;
        b = i;
    }
    return b;
}

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

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

    vector<int> ls(n);
    ls[0] = as[0];
    for (int i = 1; i < n; i++)
    {
        ls[i] = gcd(ls[i - 1], as[i]);
    }

    vector<int> rs(n);
    rs[n - 1] = as[n - 1], as[n - 2];
    for (int i = n - 2; i >= 0; i--)
    {
        rs[i] = gcd(rs[i + 1], as[i]);
    }

    int res = 1;
    int temp;
    for (int i = 0; i < n; i++)
    {
        if (i == 0)
        {
            temp = rs[1];
            res = max(res, temp);
        }
        else if (i == n - 1)
        {
            temp = ls[n - 2];
            res = max(res, temp);
        }
        else
        {
            temp = gcd(ls[i - 1], rs[i + 1]);
            res = max(res, temp);
        };
    }
    cout << res << endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359;
#define inf (1 << 21);
#define mod 1000000007;

ll gcd(ll n, ll m) {
    if (m > n) {
        swap(n, m);
    }
    if (n % m == 0) {
        return m;
    }
    else {
        return gcd(m, n % m);
    }
}

ll lcm(ll n, ll m) {
    return (n * m) / gcd(n, m);
}

int main() {
    ll A, B, C, D; cin >> A >> B >> C >> D;
    ll minus = B - A + 1;
    ll L = lcm(C, D);
    ll Acd = (A - 1) / L, Bcd = B / L;
    ll cd = Bcd - Acd;
    ll Ac = (A - 1) / C, Bc = B / C;
    ll c = Bc - Ac;
    ll Ad = (A - 1) / D, Bd = B / D;
    ll d = Bd - Ad;
    ll ans = minus - c - d + cd;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def cal(ope,a,b):
    if ope=="+":
        x=a+b
    elif ope=="-":
        x=a-b
    elif ope=="*":
        x=a*b
    return x

lst=input().split()
stack=[]
for i in range(len(lst)):
    if lst[i]=="+" or lst[i]=="-" or lst[i]=="*": pass
    else:
        lst[i]=int(lst[i])
for i in range(len(lst)):
    if lst[i]=="+" or lst[i]=="-" or lst[i]=="*": 
        a=stack.pop()
        b=stack.pop()
        c=cal(lst[i],b,a)
        stack.append(c)
    else:
        stack.append(lst[i])
print(stack[0])


Measured memory_bytes: 5600
k=int(input())
ans=[1,2,3,4,5,6,7,8,9]
def r(a):
    if a%10==0:
        return a*10,a*10+1
    elif a%10==9:
        return a*10+8,a*10+9
    else:
        x=a*10+(a%10)
        return x-1,x,x+1
t=0
while len(ans)<k:
    ans.extend(r(ans[t]))
    t+=1
print(ans[k-1])

Measured memory_bytes: 46956
#include <bits/stdc++.h>
#define ll long long
#define MAX 500005
#define INF 0x3f3f3f3f
using namespace std;

template<typename T>
void read(T &n){
    n = 0;
    T f = 1;
    char c = getchar();
    while(!isdigit(c) && c != '-') c = getchar();
    if(c == '-') f = -1, c = getchar();
    while(isdigit(c)) n = n*10+c-'0', c = getchar();
    n *= f;
}
template<typename T>
void write(T n){
    if(n < 0) putchar('-'), n = -n;
    if(n > 9) write(n/10);
    putchar(n%10+'0');
}

int n, m, k;
int s[1005][15], a[15][1005], t[15];
vector<int> v;

int solve(){
    int res = 0;
    for(int i = 1; i <= m; i++){
        int flag = 0;
        for(int j = 1; j < v.size(); j++){
            if(s[i][v[j]]-s[i][v[j-1]] > k) return INF;
            t[j] += s[i][v[j]]-s[i][v[j-1]];
            if(t[j] > k) flag = 1;
        }
        if(flag){
            res++;
            for(int j = 1; j < v.size(); j++){
                t[j] = s[i][v[j]]-s[i][v[j-1]];
            }
        }
    }
    return res;
}

int main()
{
    cin >> n >> m >> k;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            scanf("%1d", &a[i][j]);
        }
    }
    for(int i = 1; i <= m; i++){
        for(int j = 1; j <= n; j++){
            s[i][j] = s[i][j-1]+a[j][i];
        }
    }
    int ans = INF;
    for(int i = 0; i < (1<<n-1); i++){
        v.clear();
        v.push_back(0);
        int cnt = 0;
        for(int j = 0; j < n; j++){
            if((i>>j)&1) v.push_back(j+1), cnt++;
        }
        v.push_back(n);
        for(int i = 1; i < v.size(); i++) t[i] = 0;
        cnt += solve();
        ans = min(ans, cnt);
    }
    cout << ans << endl;

    return 0;
}


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

int main(){
    long long int n,maxW;
    cin>>n>>maxW;
    pair<long long int,long long int> wv[n];
    for(long long int i=0;i<n;i++){
        cin >> wv[i].first >> wv[i].second;
    }
    long long int dp[n+1][maxW+1];
    memset(dp,0,sizeof dp);

    for(long long int i=1;i<=n;i++){
        for(long long int j=1;j<=maxW;j++){
            dp[i][j] = dp[i-1][j];
            if(j >= wv[i-1].first){
                dp[i][j] = max(dp[i][j],(dp[i-1][j-wv[i-1].first]+wv[i-1].second));
            }
        }
    }
    cout<<dp[n][maxW];
}

Measured memory_bytes: 82516
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int dish;
		int time = 0;
		int diff = 10;
		for(int i = 0; i < 5; i++) {
			dish = sc.nextInt();
			if(dish % 10 == 0) {
				time += dish;
			} else {
				if(diff > dish % 10) {
					diff = dish % 10;
				}
				time += dish + 10 - dish % 10;
			}
		}
		if(diff != 10) {
			time -= (10 - diff);
		}
		System.out.println(time);
	}

}


Measured memory_bytes: 21716
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>

using namespace std;

#define ll long long

void solve()
{
    ll N;
    cin >> N;

    if (N >= 100000)
    {
        cout << 90909 << endl;
    }
    else if (N >= 10000)
    {
        cout << N - 9999 + 900 + 9 << endl;
    }
    else if (N >= 1000)
    {
        cout << 909 << endl;
    }
    else if (N >= 100)
    {
        cout << N - 99 + 9 << endl;
    }
    else if (N >= 10)
    {
        cout << 9 << endl;
    }
    else
    {
        cout << N << endl;
    }

    return;
}

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


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

using namespace std;
typedef long long ll;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define each(i,mp) for(auto& i:mp)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  ll n,m;cin>>n>>m;
  ll h[n];rep(i,0,n)cin>>h[i];
  ll a[m],b[m];
  bool e[n];CLR(e,true);
  rep(i,0,m){
    ll a,b;cin>>a>>b;
    a--,b--;
    if(e[a]&&h[a]<=h[b])e[a]=false;
    if(e[b]&&h[b]<=h[a])e[b]=false;
  }
  ll ans=0;
  each(er,e){
    if(er)ans++;
  }
  out(ans);


  return 0;
}


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

int main() {
  int n;
  char str[n];
  cin >> n;
  cin >> str;
  int x = 0;
  int max = x;
  for (int i = 0; i < n; i++) {
    if ( str[i] == 'I' ) {
      x += 1;
      max = x > max ? x : max;
    }
    else if ( str[i] == 'D' ) {
      x -= 1;
    }
  }
  cout << max << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,x=0,a;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		scanf("%d",&a);
		x+=a;
	}
	if(n-x>=0)
	printf("%d\n",n-x);
	else
	printf("-1\n");
} 

Measured memory_bytes: 3816
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

#define _USE_MATH_DEFINES

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <unordered_map>
#include <stack>
#include <list>
#include <math.h>
#include <bitset>
#include <iterator>
#include <map>
#include <iomanip>
#include <functional>
#include <string>
#include <algorithm>
#include <queue>
#include <random>
#include <numeric>
#include <set>
#include <cassert>
#include <cmath>
#include <cinttypes>

using namespace std;

template<class T> ostream& operator<<(ostream& os, const vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) os << *i << (i == end(v) - 1 ? "" : " "); return os;
}
template<class T> istream& operator>>(istream& is, vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) is >> *i; return is;
}
template<class T> T read_val() { throw 1; }
template<> int read_val() { int tmp; scanf("%" PRId32, &tmp); return tmp; }
template<> long long read_val() { long long tmp; scanf("%" PRId64, &tmp); return tmp; }
auto read_int = read_val<int>; auto read_long = read_val<long long>;
template<class T> void scanf_vec(vector<T>& vec) { for (int i = 0; i < vec.size(); i++) vec[i] = read_val<T>(); }

#define MOD 1000000007
#define inf 2000000000
#define FWT_SIZE 2000000
#define pii pair<int,int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define sort_all(x) sort(all(x))
#define make_unique(x) (x).erase(unique(all(x)), (x).end())


int main() {

#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

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

	string s;
	cin >> s;
	vector<long long> vec(s.size() + 1, 0);
	for (int i = 0; i + 1 < vec.size();)
	{
		if (s[i] == '<')
		{
			vec[i + 1] = vec[i] + 1;
			i++;
		}
		else
		{
			int cnt = 0;
			for (int j = i; j < s.size(); j++)
			{
				if (s[j] == '>')
					cnt++;
				else
					break;
			}

			for (int j = i; j < (i + cnt); j++)
			{
				vec[i] = max(vec[i], (long long)cnt);
				cnt--;
				i++;
			}
		}
	}
	
	long long ans = 0;
	for (auto x : vec)
		ans += x;
	cout << ans;
	return 0;
}

Measured memory_bytes: 4764
import sys
input = sys.stdin.readline

def main():
    x1, y1, x2, y2 = map(int, input().split())
    q = int(input())
    if x2 - x1 == 0:# x = x1　の直線
        for i in range(q):
            xp, yp = map(int, input().split())
            print(xp + 2 * (x1 - xp), yp)
    else:
        m = (y2 - y1) / (x2 - x1)
        for i in range(q):
            xp, yp = map(int, input().split())
            yq = (2 * m * (xp - x1) + yp * (m * m - 1) + 2 * y1) / (1 + m * m)
            xq = xp - m * (yq - yp)
            print(xq, yq)

if __name__ == "__main__":
    main()


Measured memory_bytes: 5980
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
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,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int m;
string s;
vector<string> ss;

string reverse(string s1){
	string ret;
	for(int t=s1.size()-1;t>=0;t--){
		ret+=s1[t];
	}
	return ret;
}
int main(){	
	cin>>m;
	for(int i=0;i<m;i++){
		cin>>s;
		ss.clear();
		for(int i=1;i<s.size();i++){
			string s1=s.substr(0,i);
			string s2=s.substr(i,s.size()-i);
			ss.push_back(s1+s2);
			ss.push_back(s2+s1);
			ss.push_back(reverse(s1)+s2);
			ss.push_back(s2+reverse(s1));
			ss.push_back(s1+reverse(s2));
			ss.push_back(reverse(s2)+s1);
			ss.push_back(reverse(s1)+reverse(s2));
			ss.push_back(reverse(s2)+reverse(s1));
		}
		sort(ss.begin(),ss.end());
		ss.erase(unique(ss.begin(),ss.end()),ss.end());
		cout<<ss.size()<<endl;
	}
	return 0;
}


Measured memory_bytes: 3288
def main():
    N = int(input())
    A = list(map(int, input().split()))

    m = min(A)
    M = max(A)

    Result = 0
    for a in A:
        Result += (a-m) * (a-m)

    for i in range(m+1, M+1):
        Result_tmp = 0
        for a in A:
            Result_tmp += (a - i) * (a - i)
        Result = min(Result_tmp, Result)
    print(Result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main(void) {
    
    int a,b;
    cin>>a>>b;
    if(a>=13)fin(b);
    else if(a<=5)fin(0);
    else fin(b/2);
}


Measured memory_bytes: 256
n = input()
n_0 = int(n[-1])

if n_0==2 or n_0==4 or n_0==5 or n_0==7 or n_0==9:
  print("hon")
elif n_0==0 or n_0==1 or n_0==6 or n_0==8:
  print("pon")
elif n_0==3:
  print("bon")

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

void Main(){
    int n, k;
    cin >> n >> k;
    VI av(n);
    REP(i, n) cin >> av[i];
    REP(i, n-k) {
        if (av[i] < av[i+k]) {
            cout << "Yes" << en;
        } else {
            cout << "No" << en;
        }
    } 
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}


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

class Solve
{
	const int mod = 1000000007;
	static void Main(string[] args)
	{
	    string[] input = Console.ReadLine().Split();
		string a = input[0];
		string b = input[1];

		string ans = "H";
		if (a == "H")
		{
			if (b == "D")
			{
				ans = "D";
			}
		}
		else
		{
			if (b == "H")
			{
				ans = "D";

			}
		}

		Console.WriteLine(ans);

	}
}


Measured memory_bytes: 13140
n = int(input())
x = list(map(int, input().split()))
sorted_x = sorted(x)
mid_left = sorted_x[n//2-1]
mid_right = sorted_x[n//2]
for i in range(n):
    mid = mid_left if x[i] >= mid_right else mid_right
    print('{}'.format(mid))

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

const string T = "ACGT";

int main(){
  string s;
  cin >> s;
  int n = s.size();
  int cnt, ans = 0;
  rep(i,n){
    if (s[i] == 'A' || s[i] == 'T' || s[i] == 'C' || s[i] == 'G') {
      cnt++;
      ans = max(ans, cnt);
    }
    else cnt=0;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n, a, b = map(int, raw_input().split())
H = [int(raw_input()) for i in xrange(n)]

left = 0; right = 10**9+1
while left+1 < right:
    mid = (left + right) / 2
    cnt = 0
    for h in H:
        h -= mid * b
        if h > 0:
            cnt += (h + a-b - 1) / (a-b)
    if mid < cnt:
        left = mid
    else:
        right = mid
print right

Measured memory_bytes: 5764
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <cstdlib>
typedef long long ll;
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
 
using namespace std;
 
int main(){

    string s;
    cin >> s;

    int cnt =0 ,ans =0;
    for(int i=0;i<s.size();i++){
        if(cnt == 0){
            if(s[i] == 'T') ans++;
            else cnt--;
        }else if(cnt < 0){
            if(s[i] == 'T') cnt++;
            else cnt--;
        }else{
            if(s[i] == 'T'){cnt++;ans++;}
            else cnt--;
        }
    }
    cout << 2*ans;

}

Measured memory_bytes: 640
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}
void solve(long long N, long long P, std::vector<long long> A){
  ll e = 0;
  ll o = 0;
  ll ans = 0;
  rep(i,N) {
    if(A[i]%2)
      o++;
    else
      e++;
  }
  vector<vector<ll>> com(o+1, vector<ll>(o+1, 0));
  for(ll i=0; i<o+1; i++) {
    for(ll j=0; j<i+1; j++) {
      if(j==0) com[i][j] = 1;
      else if(j==i) com[i][j] = 1;
      else com[i][j] = com[i-1][j-1]+com[i-1][j];
    }
  }

  if(P==0) {
    for(ll i=0; i<=o; i+=2) {
      ans += com[o][i];
    }
    ans *= pow(2,e);
  } else {
    for(ll i=1; i<=o; i+=2)
      ans += com[o][i];
    ans *= pow(2,e);
  }
  std::cout << ans << std::endl;
}

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



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int N,K,d,A,ans=0;
  cin >> N >> K;
  int pos[N]={0};
  for(int i=0;i<K;i++){
    cin>> d;
    for(int j=0;j<d;j++){
      cin >> A;
      pos[A-1]=1;
    }
  }
  
  for(int i=0;i<N;i++){
    if(pos[i]==0)ans+=1;
  }
  
  cout << ans;
  }

Measured memory_bytes: 3640
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static int number;
	public static void main(String[] args) {
		while(read()){
			slove();
		}
	}
	static boolean read(){
		number = sc.nextInt();
		if(number == -1)
			return false;
		return true;
	}
	static void slove(){
		String four = Integer.toString(number, 4);
		System.out.println(four);
	}
}

Measured memory_bytes: 12000
#include<stdio.h>

long getLength(int N){
  if (N == 0) return 1;
  return 2*getLength(N-1)+3;
}
long getP(int N, long X){
  //printf("N X = %d %ld\n", N, X);
  if (N == 0 && X == 1) return 1;
  if (X <= 0 || getLength(N) < X) return 0;
  if (getLength(N) == X) return 2*getP(N-1, getLength(N-1))+1;
  if (getLength(N-1)+2 <= X) return getP(N-1, getLength(N-1))+1+getP(N-1, X-getLength(N-1)-2);
  return getP(N-1, X-1);
}
int main(){
  int N;
  long X;
  scanf("%d %ld", &N, &X);

  printf("%ld", getP(N, X));
  return 0;
}

Measured memory_bytes: 128
n = int(input())
dat_a = list(map(int, input().split()))
dat_aa = map(lambda x: x*2, dat_a)
dat_aa = list(dat_aa)
s_in = sum(dat_a)

#print(dat_aa)
m = -1
index = -1
for i in range(n):
    if dat_aa[i] > m:
        m = dat_aa[i]
        index = i
#print("max = {0} [{1}]". format(dat_aa[index], index))
res = [0] *n

for i in range(n):
    if i > 0:
        res[i] = dat_aa[i-1] - res[i-1]
    else:
        res[i] = dat_aa[n-1] - res[i]
s_out = sum(res)
d = s_in - s_out
#print("sin")
#print(s_in)
#print(s_out)
#print(d)
#print(res)
for i in range(n):
    if i % 2 == 0:
        res[i] += d
    else:
        res[i] -= d
res = list(map(str, res))
print(" ".join(res))


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

#define first  fs
#define second se
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)

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

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, char s = '\n') { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ") 
{ rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

int po(lint a) {
	for (int i = 1; ; ++i) {
		a /= 10;
		if (a == 0) return i;
	}
}

int F(lint a, lint b) {
	return max(po(a), po(b));
}

int main() {
	lint n = in();
	lint m = ceil(sqrt(n));

	int ans = inf;
	for (int i = 1; i <= m; ++i) {
		if (n % i) continue;

		chmin(ans, F(i, n / i));
	}

	print(ans);
}



Measured memory_bytes: 256
a,b,c = map(int, input().split())
n = 1
visited = set()
while True:
  if (n*a) % b in visited:
    print('NO')
    break
  if (n*a) % b == c:
    print('YES')
    break
  visited.add((n*a) % b)
  n += 1

Measured memory_bytes: 2940
#include <stdio.h>

int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	
	if (a > 0) printf("Positive\n");
	else if (b >= 0) printf("Zero\n");
	else if ((b - a) % 2 == 1) printf("Positive\n");
	else printf("Negative\n");
	fflush(stdout);
	return 0;
}

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

int main() {
    string N;
    cin >> N;
    int s=N.size();
    bool ans = false;
    rep(i,s){
        if(N.substr(i,1)=="7"){
            ans =true;
        }
    }
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3592
# sieve of Eratosthenes
N = 1000000
isprimer = [True for i in range(N)]
isprimer[0], isprimer[1] = False, False
for i in range(2, N):
	if not isprimer[i]:
		continue
	for j in range(i * 2, N, i):
		isprimer[j] = False

while True:
	try:
		num = eval(input())
		count = 0
		for i in range(2, num + 1):
			if isprimer[i]:
				count += 1
		print(count)
	except EOFError:
		break

Measured memory_bytes: 15148
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a=INT()
    print((round(a/2+0.1)/a))
if __name__ == '__main__':
    do()

Measured memory_bytes: 3060
#include<stdio.h>
int main(void){
  int i;
  int T=0;
  int S;
  char str[100];
  scanf("%s",str);
  for(i=0; str[i]!='\0'; i++){
    S=i;
  }
  for(int j=0; j<(S+1)/2; j++){
      if(str[j]!=str[S-j]){
        T=T+1;
      }
     }
  printf("%d",T);
 }

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

int main() {
    string s;
    cin >> s;
    s[3] = '8';
    cout << s << endl;
}

Measured memory_bytes: 256
n,d=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
count=0
su=0
for l in range(n-1):
    for i in range(l+1,n):
        for s in range(d):
            su+=(x[l][s]-x[i][s])**2
            
        if (su**0.5)%1==0:
            count+=1
            su=0
        else:
            su=0
print(count)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <typeinfo>
using namespace std;
using ll = long long;


int main() {

	int n, m, X, Y, z;
	cin >> n >> m >> X >> Y;

	vector<int> x(n),y(m);
	for (int i = 0; i < n; ++i)
		cin >> x[i];
	for (int i = 0; i < m; ++i)
		cin >> y[i];

	sort(x.begin(), x.end());
	sort(y.begin(), y.end());

	z = y[0];

	if (x[n-1] >= z)
		cout << "War" << endl;
	else if (X < z and z <= Y)
		cout << "No War" << endl;
	else
		cout << "War" << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
typedef vector<ll> vl;
#define rp(i, f, t) for (int i = f; i < t; i++)
#define pr(i, f, t) for (int i = t - 1; i >= f; i--)
#define ca(n, a) rp(ca_i, 0, n) cout << a[ca_i] << ((ca_i == n - 1) ? "\n" : " ")
#define za(n, a) rp(za_i, 0, n) a[za_i] = 0
#define be(a) a.begin(), a.end()
int main()
{
    string s;
    cin >> s;
    ll q;
    cin >> q;
    vector<string> fr, ba;
    ll nowrev = 0;
    rp(i, 0, q)
    {
        ll t;
        cin >> t;
        if (t == 1)
        {
            nowrev++;
        }
        else
        {
            ll f;
            string c;
            cin >> f >> c;
            if (f == 1)
            {
                if (nowrev % 2 == 0)
                {
                    fr.push_back(c);
                }
                else
                {
                    reverse(be(c));
                    ba.push_back(c);
                }
            }
            if (f == 2)
            {
                if (nowrev % 2 == 0)
                {
                    ba.push_back(c);
                }
                else
                {
                    reverse(be(c));
                    fr.push_back(c);
                }
            }
        }
    }
    if (nowrev % 2 == 0)
    {
        pr(i, 0, fr.size())
        {
            cout << fr[i];
        }
        cout << s;
        rp(i, 0, ba.size())
        {
            cout << ba[i];
        }
    }
    else
    {
        reverse(be(s));
        pr(i, 0, ba.size())
        {
            cout << ba[i];
        }
        cout << s;
        rp(i, 0, fr.size())
        {
            cout << fr[i];
        }
    }
    cout << endl;
}

Measured memory_bytes: 11760
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string.h>

using namespace std;

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

int main() {

	int N, M, D;
	char s[234][234];
	memset(s, '#', sizeof(s));

	scanf("%d %d %d", &N, &M, &D);

	REP(i, N) {
		scanf("%s", s[i]);
		s[i][M] = '#';
	}

	int c = 0;
	REP(i, N) {
		REP(j, M) {
			bool t = true, y = true;
			REP(k, D) {
				if (s[i + k][j] == '#') t = false;
				if (s[i][j + k] == '#') y = false;
			}
			if (t) c++;
			if (y) c++;
		}
	}

	printf("%d\n", c);

	return 0;
}

Measured memory_bytes: 2748
if __name__ == "__main__":
    S = input()
    if len(S) % 2 == 0:
        for i in range(0, len(S), 2):
            if S[i] == "h" and S[i+1] == "i":
                ret = "Yes"
            else:
                ret = "No"
                break
    else:
        ret = "No"
    print(ret)


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = 200005;
int p[N], ird[N], irr[N];

int find(int v){
	return (p[v] < 0)?v:(p[v] = find(p[v]));
}

void combine(int u, int v){
	u = find(u);
	v = find(v);
	if(u == v)return;
	if(p[u] > p[v])swap(p[u], p[v]);
	p[u] += p[v]; p[v] = u;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n, k, l;
	cin>>n>>k>>l;
	memset(p, -1, sizeof(p));
	for(int i = 0; i < k; i++){
		int u, v; cin>>u>>v;
		combine(u, v);
	}
	for(int i = 1; i <= n; i++){
		ird[i] = find(i);
	}
	memset(p, -1, sizeof(p));
	for(int i = 0; i < l; i++){
		int u, v; cin>>u>>v;
		combine(u, v);
	}
	for(int i = 1; i <= n; i++){
		irr[i] = find(i);
	}
	map<pair<int, int>, int> mp;
	for(int i = 1; i <= n; i++){
		mp[{irr[i], ird[i]}]++;
	}
	for(int i = 1; i <= n; i++){
		cout<<mp[{irr[i], ird[i]}]<<" ";
	}

	return 0;
}

Measured memory_bytes: 14464
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    int n;
    cin >> n;

    vector<ll> c(n), dp(n + 1, 1);
    vector<vector<ll>> s(200010, vector<ll>());

    for (int i = 0; i < n; i++)
    {
        cin >> c[i];
        c[i];
        s[c[i]].push_back(i);
    }

    for (int i = 0; i < n; i++)
    {
        int x = lower_bound(s[c[i]].begin(), s[c[i]].end(), i) - s[c[i]].begin();
        if (x > 0)
        {
            if (s[c[i]][x] - s[c[i]][x - 1] > 1)
            {
                dp[i + 1] = dp[i] + dp[s[c[i]][x - 1] + 1];
                dp[i + 1] %= MOD;
            }
            else
            {
                dp[i + 1] = dp[i];
                dp[i + 1] %= MOD;
            }
        }
        else
        {
            dp[i + 1] = dp[i];
            dp[i + 1] %= MOD;
        }
    }

    cout << dp[n] << endl;
}


Measured memory_bytes: 17176
cards = ['S 1', 'S 2', 'S 3', 'S 4', 'S 5', 'S 6', 'S 7', 'S 8', 'S 9', 'S 10', 'S 11', 'S 12', 'S 13', 'H 1', 'H 2', 'H 3', 'H 4', 'H 5', 'H 6', 'H 7', 'H 8', 'H 9', 'H 10', 'H 11', 'H 12', 'H 13', 'C 1', 'C 2', 'C 3', 'C 4', 'C 5', 'C 6', 'C 7', 'C 8', 'C 9', 'C 10', 'C 11', 'C 12', 'C 13', 'D 1', 'D 2', 'D 3', 'D 4', 'D 5', 'D 6', 'D 7', 'D 8', 'D 9', 'D 10', 'D 11', 'D 12', 'D 13']
gets.to_i.times do
  cards.delete(gets.chomp)
end
puts cards.join("\n") unless cards.size.zero?

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

int main(void)
{
	char n,i;
	short p,max=0;
	int ans=0;
	scanf("%hhd",&n);
	for (i=0;i<n;i++) {
		scanf("%hd",&p);
		ans += p;
		if (max < p) max = p;
	}
	ans -= max / 2;
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int n = s.length();
		int sum = 0;
		for(int i = 0 ; i < n ; i++) {
			if(s.charAt(i) != t.charAt(i))
					sum++;
		}

		System.out.println(sum);

	}
}



Measured memory_bytes: 41052
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

max = 0
sub_max = 0
for x in A:
    if max <= x:
        sub_max = max
        max = x
    elif sub_max <= x:
        sub_max = x

for x in A:
    if x == max:
        print(sub_max)
    else:
        print(max)


Measured memory_bytes: 12532
//g++ -std=c++14 test.cpp -o test.out
//問題URL
//https://atcoder.jp/contests/abc131/tasks/abc131_e
//この手の構築を安定して解くためには
//まず典型的なグラフたちに対して
//「最短経路長が 2 となる組数はどうなってるか」を観察する
//パス（一本の長いやつ）
//スターグラフ (ウニみたいなあれ)
//完全グラフ（全部繋がってるやつ）
//完全二部グラフ
//パスにちょっとヒゲを生やしたグラフ
//などなど。

//まず、頂点がN個ある時
//頂点同士の組の個数はN(N-1)/2
//さらに、N個の頂点から連結グラフ
//(少なくとも単独で点が存在しない状態)
//を作るためには
//N-1本の辺が必要

//頂点同士の組の個数はN*(N-1)/2で、
//このうち少なくともN-1組に関しては最短距離が
//1となる。
//よってこの時、最短距離が2となるような組の個数は
//最大でもN(N-1)/2 - (N-1) = (N-1)(N-2)/2個となる

//これを達成できるグラフにはスターがある
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6;
const LL mod = 1000000007ll;

int N,K;

int ans = -1;
vector<pair<int,int>> ans_edge;
 
void solve(){
	int mx = (N-1)*(N-2)/2;//最短距離が2となるような点の組の数の最大値
	if(mx<K){//これより大きくは絶対ならない
		return;
	}

	//ansにスターを構築
	for(int i=1;i<=N-1;i++){
		ans_edge.push_back(make_pair(N,i));
	}
	//スターの葉（外周の点）に対し辺を作って
	//最短距離が2となる組を潰していく
	int add = mx-K;//追加する辺の数（潰す組の数）

	//潰す辺の候補 スターの葉同士をつなぐ辺を列挙しておく
	vector<pair<int,int>> edge;
	for(int i=1;i<=N-1;i++){
		for(int j=1;j<i;j++){
			edge.push_back(make_pair(i,j));
		}
	}
	for(int i=0;i<add;i++) ans_edge.push_back(edge[i]);
	ans = ans_edge.size();
}
 
int main(){
	cin >> N >> K;
 
	solve();
 
	cout << ans << endl;
	for(int i=0;i<ans_edge.size();i++){
		cout << ans_edge[i].first << " " << ans_edge[i].second << endl;
	}
	return 0;
}

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

#define INF 1000000001

using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    int h[N];
    for(int i=0; i<N; i++){
        cin >> h[i];
    }
    sort(h, h+N);
    int ans = INF;
    for(int i=0; i<N-K+1; i++){
        int temp = h[i+K-1] - h[i];
        ans = min(temp, ans);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int a, b, c; cin >> a >> b >> c;
    int64_t k; cin >> k;
    
    int dif = a - b;
    if(k % 2 == 0) {
        cout << dif << "\n";
    } else {
        cout << -dif << "\n";
    }
}

Measured memory_bytes: 256
#include <iostream>

int main() {
  uint64_t l, r;
  std::cin >> l >> r;

  uint64_t result = 2019;
  if (((l % 2019) == 0) || ((r % 2019) == 0) || (r - l + 1 > 2019)) {
    result = 0;
  } else {
    for (size_t i = l; i + 1 <= r; ++i) {
      for (size_t j = i + 1; j <= r; ++j) {
        auto t = (i * j) % 2019;
        if (result > t) {
          result = t;
        }
      }
    }
  }
  std::cout << result << std::endl;

  return 0;
}

Measured memory_bytes: 256
n,cx=map(int,input().split())#city_num,default_location
x=list(map(int,input().split()))
x.sort()
"""
#1
#if cx<=x[0] or cx>=x[-1]:
a=abs(cx-x[0])
b=abs(cx-x[-1])

c=abs(x[0]-x[-1])
d=(min(a,b)+c)
print(d)
#elif x[0]<cx and cx<x[-1]:
"""
def gcd(cx,cy):
    if cy==0:
        return cx
    else:
        return gcd(cy,cx%cy)

d_l=[]
for l in x:
    d_l.append(abs(l-cx))
#print(d_l)
comp=d_l[0]

    
for i in range(0,len(d_l)):
    comp=gcd(d_l[i],comp)

print(comp)

    




Measured memory_bytes: 14252
#include <cstdio>
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define REP(i,a,b) for(int i=a;i<b;++i)
#define SIZE 1000002
#define MOD 1000000007

using namespace std;

void solve(){
	int n;
	ll ans=2LL;
	cin>>n;
	/*n-=2;
	if(n<0) ans=0LL;
	REP(i,0,n){
		ans=(ans*10)%MOD;
	}
*/
	cout<<(n==0)?1:0;

}

int main(){
	int t=1;
	//cin>>t;
	REP(tc,1,t+1){
	//	cout<<"Case #"<<tc<<": ";
		solve();
	}
} 

Measured memory_bytes: 3612
from collections import Counter
from collections import deque
N = int(input())
l = deque()

def solve(s, l):
    if len(s):
        if int(s) > N:
            l.pop()
            return

    for a in '357':
        ns = s + a
        l.append(ns)
        solve(ns, l)
    return l

solve('', l)
ans = 0
for e in l:
    c = Counter(e)
    flg = True
    for n in '357':
        if c[n] == 0:
            flg = False
            break
    if flg:
        ans += 1
print(ans)

Measured memory_bytes: 5332
# coding: utf-8
def main():
    n = int(input())
    A = list(map(int, input().split()))
    ave = sum(A) / 2
    total = 0
    
    b = 0
    a = 0
    
    for i in range(n):
        total += A[i]
        if total >= ave:
            b = sum(A[:i+1])
            a = sum(A[i+1:])
            b2 = sum(A[:i])
            a2 = sum(A[i:])
            
            break
    print(min(max(a,b)-min(a,b),max(a2,b2)-min(a2,b2)))
    


if __name__ == '__main__':
    main()


Measured memory_bytes: 26220
def main():
    n = int(input())
    ps = input().split(' ')
    base = [str(i) for i in range(1, n+1)]
    count = 0
    for i in range(0, n):
        if base[i] != ps[i]:
            count += 1
    if count == 2 or count == 0:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
s = int(input())
a = s
already = set()
already.add(a)
for i in range(10000000):
    if a % 2:
        a = 3 * a + 1
        if {a} <= already:
            print(i + 2)
            exit(0)
        already.add(a)
    else:
        a //= 2
        if {a} <= already:
            print(i + 2)
            exit(0)
        already.add(a)



Measured memory_bytes: 3064
S = gets.to_i
AS = gets.split.map(&:to_i)

if AS.all? { |a| a == AS[0] }
  puts(0)
  exit
end

costs = []
(-100..100).map do |n|
  t = 0
  AS.product([n]).each do |a, b|
    t += (a - b)**2
  end
  costs << t
end
puts(costs.min)

Measured memory_bytes: 2172
N = int(input())
h = list(map(int,input().split()))
H = [0]*N
for i in range(1,N):
    if i == 1:
        H[i] = abs(h[1]-h[0])
    else:
        H[i] = min(H[i-1]+abs(h[i]-h[i-1]),H[i-2]+abs(h[i]-h[i-2]))
print(H[N-1])

Measured memory_bytes: 13928
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
// #define int ll
#define pll pair<ll, ll> 
#define pdd pair<ld, ld> 
#define pb push_back
#define reset(x,v) memset(x,v,sizeof(x))
#define mod 998244353
using namespace std;

void dfs(vector<int> adj[], int sv, vector<bool> &vis){
	vis[sv] = true;
	for(int i = 0; i < adj[sv].size(); i++){
		if(!vis[adj[sv][i]]){
			dfs(adj, adj[sv][i], vis);
		}
	}
}
ll power(ll x, ll y){  
	if(x == 1 || y == 0)
		return 1;
    ll res = 1;   
    x = x % mod; 
    if (x == 0) 
		return 0;  
    while (y > 0){  
        if (y & 1)  
            res = (res * x) % mod;  
        y = y >> 1; 
        x = (x * x) % mod;  
    }  
    return res;  
} 

signed main(){
	FASTIO
	int d, t, s;
	cin >> d >> t >> s;
	if(d > s * t){
		cout << "No";
	}
	else{
		cout << "Yes";
	}

    return 0;
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  int bit = 0;
  int k;
  cin >> k;
  rep(i, k) {
    int b;
    cin >> b;
    bit |= (1<<b);
  }
  vint ans;
  int S = ((1<<n)-1)&~bit;
  for(int sub = S; ; sub = (sub-1)&S) {
    ans.push_back(sub|bit);
    if(!sub) break;
  }
  sort(all(ans));
  rep(i, ans.size()) {
    cout << ans[i] << ":";
    rep(j, n) if((ans[i]>>j)&1) cout << " " << j;
    cout << endl;
  }

  return 0;
}



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

#define mod 1000000007

#define rep(i, n) for(int i=0; i<n; ++i)

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;

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

int main(void){
	
	int N, K;
	
	cin >> N >> K;
	
	ll h[N], dp[100110];
	
	rep(i, N)
		cin >> h[i];
		
	rep(i, 100110)
		dp[i] = INF;
	
	dp[0] = 0;

	rep(i, N)
		rep(j, K)
			chmin(dp[i+j+1], dp[i] + abs(h[i] - h[i+j+1]));

	cout << dp[N-1] << endl;
	
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    while(getline(cin,s)&&s!="."){
        string c;
        for(int i=0;i<s.size();i++)if(s[i]==')'||s[i]=='('||s[i]=='['||s[i]==']')c+=s[i];
        int d=1;
        stack<char> w;
        for(int i=0;i<c.size();i++){
            if(w.empty()||c[i]=='['||c[i]=='(')w.push(c[i]);
            else if((c[i]==']'&&w.top()=='[')||(c[i]==')'&&w.top()=='('))w.pop();
            else break;
        }
        if(w.empty())cout<<"yes"<<endl;
        else fail:cout<<"no"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1180
#include <stdio.h>

void main(){
    char s[4];
    int first,second;
    int YM = 0,MY = 0;

    scanf("%s",s);

    first = (s[0]-48) * 10 + s[1]-48;
    second = (s[2]-48) * 10 + s[3]-48;

    if((first <= 12)&&(first >= 1)){
        MY = 1;
    }
    if((second <= 12)&&(second >= 1)){
        YM = 1;
    }

    if(MY == 1){
        if(YM == 1){
            printf("AMBIGUOUS");
        } else {
            printf("MMYY");
        }
    } else {
        if(YM == 1){
            printf("YYMM");
        } else {
            printf("NA");
        }
    }
}

Measured memory_bytes: 128
//Code by 27.
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<climits>
#include<cmath> 
#include<memory.h> 
#include<sstream>
#include<time.h>
using namespace std;
const unsigned long long BIGEST=1000000000000000+1000000000000000;
const long long BIGER=1000000000000000;
const int BIG=1000000000;
const long long MOD=19260817;
long long f[200005];
long long marx(long long a,long long b)
{
	if(a>b)return a;
	else return b;
}
int main()
{
	long long n,m;
	scanf("%I64d%I64d",&n,&m);
	long long t;
	for(long long i=1;i<=n;i++)
	{
		scanf("%I64d",&t);
		f[t]++;
	}
	vector<long long>vt;
	for(long long i=0;i<200005;i++)
	{
		if(f[i]!=0)
		{
			vt.push_back(f[i]);
		}
	}
	sort(vt.begin(),vt.end());
	long long s=0;
	long long l=vt.size()-m;
	for(long long i=0;i<marx(0,l);i++)
	{
		//cout<<vt[i]<<endl;
		s+=vt[i];
	}
	cout<<s;
	return 0;
}

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

#define INF ll_MAX

typedef long long ll;

using namespace std;

int main(void){
	int n;
	cin >> n;
	vector<int> h(n);
	int max = 0;
	int ans = 0;
	for(int i = 0;i < n;i++){
		cin >> h[i];
		if(max <= h[i]){
			max = h[i];
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}

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

namespace ABC135
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var p = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var count = 0;
            for(int i = 0; i < n; i++)
            {
                if (p[i] != i + 1)
                {
                    count++;
                }
            }
            if (count <= 2)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }

        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#define unordered_map __fast_unordered_map
template<class Key, class Value, class Hash = std::hash<Key>>
using unordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif


int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);

  int N;
  LL cost_right, cost_left;
  cin >> N >> cost_right >> cost_left;

  vector<int> nums(N + 2);
  for (int i = 1; i <= N; ++i) { cin >> nums[i]; }
  nums.back() = N + 1;

  N += 2;

  vector<LL> dp(N, 1e18);
  dp[0] = 0;

  for (int from = 0; from < N; ++from) {
    int min_occur = 1e9;
    LL cur_cost = 0;

    for (int to = from + 1; to < N; ++to) {
      if (nums[to] < nums[from]) {
        cur_cost += cost_left;
      } else if (nums[to] > min_occur) {
        cur_cost += cost_right;
      } else {
        mini(min_occur, nums[to]);
        mini(dp[to], dp[from] + cur_cost);
        cur_cost += cost_right;
      }
    }
  }

  cout << dp.back() << "\n";
}



Measured memory_bytes: 384
N, Q = map(int, input().split())
S = input()
cs = [0] * N
for i in range(1, N):
  if S[i] == 'C' and S[i - 1] == 'A':
    cs[i] = 1
for i in range(1, N):
  cs[i] += cs[i - 1]
for _ in range(Q):
  l, r = map(int, input().split())
  t = cs[r - 1]
  if l != 1:
    t -= cs[l - 2]
    if S[l - 1] == 'C' and S[l - 2] == 'A':
      t -= 1
  print(t)


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

int main() {
	// your code goes here
	long long n,W;
	cin >> n >> W;
	long long weight[n], values[n];
	long long dp[n+1][W+1];
	for(int i = 0; i < n; ++i) {
	    cin >> weight[i] >> values[i];
	}
	for (int i = 0; i <= n; i++) 
       { 
           for (int w = 0; w <= W; w++) 
           { 
               if (i==0 || w==0) 
                   dp[i][w] = 0; 
               else if (weight[i-1] <= w) 
                     dp[i][w] = max(values[i-1] + dp[i-1][w-weight[i-1]],  dp[i-1][w]); 
               else
                     dp[i][w] = dp[i-1][w]; 
           } 
       } 
	cout << dp[n][W] << endl;
}


Measured memory_bytes: 79104