akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>  // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>     // bitset
#include <cctype>     // isupper, islower, isdigit, toupper, tolower
#include <cstdint>    // int64_t, int*_t
#include <cstdio>     // printf
#include <deque>      // deque
#include <iomanip>    // fixed, setprecision
#include <iostream>   // cout, endl, cin
#include <map>        // map
#include <queue>      // queue, priority_queue
#include <set>        // set
#include <stack>      // stack
#include <string>     // string, to_string, stoi
#include <tuple>      // tuple, make_tuple
#include <unordered_map>  // unordered_map
#include <unordered_set>  // unordered_set
#include <utility>        // pair, make_pair
#include <vector>         // vector
using namespace std;

int main() {
  int N, L, t, s = 0, mdiff = 20000, mt;
  cin >> N >> L;
  for (int i = 0; i < N; i++) {
    t = L + i;
    if (abs(t) < mdiff) {
      mdiff = abs(t);
      mt = t;
    }
    s += t;
  }
  cout << s - mt << endl;
}


Measured memory_bytes: 3072
#include<stdio.h> 
int main(void){
 int i,n;
 int number;
 long long int sum=0;
 int min=0; 
 int max=0;

scanf("%d",&n);

for(i=0;i<n;i++){ 
 scanf("%d",&number);

if(i==0){
 min = number;
 max = number;
 }
 if(number<min){
 min = number;
}
 if(number>max){
 max = number;
}

sum += number;
 }
 printf("%d %d %lld\n",min,max,sum);

return 0;
 }

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

int main(){
	int a;
	int b;
	//int output;
	cin >> a >> b ;

	int x = a * b;

	if (x % 2 == 1){
		cout << "Odd";
	}else{
		cout << "Even";
	}
	//cout << x / 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int X, Y;
    cin >> X >> Y;
    cout << X + Y / 2 << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

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

  string ans="No";
  if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) ans = "Yes";

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
// #define pie 3.141592653589793238
#define mod1 998244353
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long int li;
typedef unsigned long long int ull;
using namespace std;
bool sortbysec(const pair<li,li>&a,const pair<li,li>&b)
{
    return (a.second<b.second);
}
li mpow(li x,li y)
{
  li ans=1;
  while(y)
  {
    if(y%2!=0)
    ans=(ans%mod)*(x%mod)%mod;
    y/=2;
    x=((x%mod)*(x%mod))%mod;
  }
  return ans;
}
int main()
{
fast_io
li r;
long double pie =3.14;
cin>>r;
cout<<2*pie*r;
  return 0;
}


Measured memory_bytes: 3796
#include <cstdio>

using namespace std;

const int N = 109;

char s[N];
char t[N];

int main() {
  int n;
  scanf("%d%s%s", &n, s, t);
  for (int i = 0; i < 2 * n; ++i) {
    if (i % 2 == 0) {
      putchar(s[i / 2]);
    } else {
      putchar(t[i / 2]);
    }
  }
  putchar('\n');
}


Measured memory_bytes: 128
#include<stdio.h>

int main(void){
  int h[2], m[2], k;
  
  scanf("%d %d %d %d %d", &h[0], &m[0], &h[1], &m[1], &k);
  printf("%d", (h[1] - h[0]) * 60 + (m[1] - m[0]) - k);
  
  return 0;
}

Measured memory_bytes: 1728
#ABC143-D Triangles
from bisect import bisect_left, bisect_right
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        ans += max(bisect_right(L, L[i]+L[j]-1) - j - 1, 0)
        #print([i,j, 100, L[i],L[j], 100, bisect_right(L, L[i]+L[j]-1)-j-1])
print(ans)

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

using namespace std;

#define rep(loop, N) for (int loop = 0; loop < N; loop++)

struct Node {
	Node* parent = NULL;
	vector<Node*> child;
	long long value = 0;
};
struct Edge {
	int parent = 0;
	int child = 0;
	bool operator <(const Edge& right) const { return parent < right.parent; }
};
struct Tree {
	vector<Node> node;
	Tree(int, vector<Edge>);
};
Tree::Tree(int nodeNum, vector<Edge> edge) {
	node.resize(nodeNum);
	for (Edge& it : edge) {
		node[it.child].parent = &node[it.parent];
		node[it.parent].child.push_back(&node[it.child]);
	}
}

map<long long, int> factorization(long long N) {
	map<long long, int> re;
	while (true) {
		if (N % 2 == 0) {
			N /= 2;
			re[2]++;
			if (N == 1) break;
		}
		else {
			break;
		}
	}
	for (int loop = 3; (long long)loop * (long long)loop <= N; loop += 2) {
		if (N % loop == 0) {
			N /= loop;
			re[loop]++;
			loop -= 2;
			if (N == 1) break;
		}
	}
	if (N > 1) re[N]++;
	return re;
}

long long gcd(long long num1, long long num2) {
	return (num2 == 0 ? num1 : gcd(num2, num1 % num2));
}

struct Memo {
	long long fact = 0;
	long long fact_inv = 0;
	long long inv = 0;
};
class Combination1 {
private:
	long long m_module = 1000000007;
	vector<struct Memo> memo;
public:
	long long calculate(int, int);
	Combination1(int, long long);
};
long long Combination1::calculate(int n, int k) {
	return ((memo[n].fact * memo[k].fact_inv) % m_module * memo[n - k].fact_inv) % m_module;
}
Combination1::Combination1(int memo_max, long long module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - (memo[m_module % loop].inv * int(m_module / loop)) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

class Combination2 {
private:
	int size = 0;
	bool add(int);
public:
	vector<int> sequence;
	bool next_combination(void);
	Combination2(int, int);
};
bool Combination2::add(int index) {
	if (index == (int)sequence.size() - 1 && sequence[index] == size - 1
		|| index < (int)sequence.size() - 1 && sequence[index] == sequence[index + 1] - 1) {
		if (index == 0) {
			return false;
		}
		else {
			bool re = add(index - 1);
			sequence[index] = sequence[index - 1] + 1;
			return re;
		}
	}
	else {
		sequence[index]++;
		return true;
	}
}
bool Combination2::next_combination(void) {
	return (sequence.size() == 0) ? false : add(sequence.size() - 1);
}
Combination2::Combination2(int n, int r) {
	size = n;
	for (int loop = 0; loop < r; loop++) sequence.push_back(loop);
	return;
}

void A_Takahashikun_The_Strider(void) {

	int X; cin >> X;
	for (int answer = 1; answer <= 360; answer++) {
		if (X * answer % 360 == 0) {
			cout << answer << endl;
			break;
		}
	}
	return;
}

int main(void) {

	cout << fixed << setprecision(15);
	A_Takahashikun_The_Strider();
	return 0;
}


Measured memory_bytes: 3596
#include <stdio.h>          // printf(), scanf()
#include <string.h>         // memset()
#include <stdbool.h>

#define MAX_N 100000
#define MAX_F 100000

int s[MAX_N];
bool f[MAX_F];
int m = 0;

bool
search(int x)
{
	int l = 0, r = m - 1;
	while (l <= r)
	{
		int i = (l + r) / 2;
		if (x > s[i])
			l = i + 1;

		else if (x < s[i])
			r = i - 1;

		else
			return true;
	}

	return false;
}

int
main(int argc, char** argv)
{
	int n = 0;
	int q = 0;
	int u = 0;
	int v = 0;
	int i;

	memset(f, 0x00, sizeof(f));
	scanf("%d", &n);
	m = 0;
	for (i = 0; i < n; ++i)
	{
		scanf("%d", &u);
		if (u < MAX_F)
			f[u] = true;
		else
			s[m++] = u;
	}

	scanf("%d", &q);
	int count = 0;
	for (i = 0; i < q; ++i)
	{
		scanf("%d", &v);
		if (v < MAX_F)
		{
			if (f[v])
				count++;
		}
		else
		{
			if (search(v))
				count++;
		}
	}

	printf("%d\n", count);
	return 0;
}

Measured memory_bytes: 708
#include <bits/stdc++.h>
#include <string>
#include <stdio.h>
#include <cstdlib>

using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    for (int i = 0; i <= 1000; i++){
        c = c - b;
        if (c <= 0) {
            cout << "Yes";
            break;
        }
        a = a - d;
        if (a<= 0) {
            cout << "No";
            break;
        }
    }
 }


Measured memory_bytes: 3632
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<double, long long> pdl;

#define rep(i, n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 1000000007

struct node {
    int g1;
    int g2;
    int name;
} A[1<<20];

vector<int> g1[1<<20];
vector<int> g2[1<<20];
vector<bool> visited(1<<20, false);

void dfs1(int s, int f) {
    visited[s] = true;
    A[s].g1 = f;

    rep(i, g1[s].size()) {
        if(not visited[g1[s][i]]) {
            dfs1(g1[s][i], f);
        }
    }
}

void dfs2(int s, int f) {
    visited[s] = true;
    A[s].g2 = f;

    rep(i, g2[s].size()) {
        if(not visited[g2[s][i]]) {
            dfs2(g2[s][i], f);
        }
    }
}

vector<int> ans(1<<20, 0);

void solver(int i, int j) {
    int val = j-i+1;
    for(;i <= j;i++) {
        ans[A[i].name] = val;
    }
}

void solve(int i, int j) {
    int s=i;
    for(i++;i<=j;i++) {
        if(A[i].g2 != A[i-1].g2) {
            solver(s, i-1);
            s = i;
        }
    }
    solver(s, j);
}

int main() {
    int n,k,l,x,y;
    cin>>n>>k>>l;
    rep(i, k) {
        cin>>x>>y;
        g1[x].pb(y);
        g1[y].pb(x);
    }
    rep(i, l) {
        cin>>x>>y;
        g2[x].pb(y);
        g2[y].pb(x);
    }

    int f = 1;
    for(int i=1;i<=n;i++) {
        if(not visited[i]) {
            dfs1(i, f++);
        }
    }

    fill(visited.begin(), visited.end(), false);
    f = 1;
    for(int i=1;i<=n;i++) {
        if(not visited[i]) {
            dfs2(i, f++);
        }
        A[i].name = i;
    }

    auto comparator = [](const node& x, const node& y) {
        if(x.g1 == y.g1) return x.g2 < y.g2;
        return x.g1 < y.g1;
    };

    sort(A+1, A+n+1, comparator);
    //for(int i=1;i<=n;i++){
     //   cout<<A[i].g1<<" "<<A[i].g2<<" "<<A[i].name<<endl;
   // }

    int s = 1;
    for(int i=2;i<=n;i++) {
        if(A[i].g1 != A[i-1].g1) {
            solve(s, i-1);
            s = i;
        }
    }

    solve(s, n);
    rep(i, n) cout<<ans[i+1]<<" ";

    return 0;
}


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

int main() {
    int n, k, w[100010];
    cin >> n >> k;
    int ma = 0;
    for (int i = 0; i < n; ++i) {
        cin >> w[i];
        ma = max(ma, w[i]);
    }
    int ok = 1000000007, ng = ma - 1;
    while (ok > ng + 1) {
        int m = (ok + ng) / 2;
        int cnt = 0, rem = 0;
        for (int i = 0; i < n; ++i) {
            if (rem < w[i]) {
                ++cnt;
                rem = m - w[i];
            }
            else {
                rem -= w[i];
            }
        }
        if (cnt <= k) {
            ok = m;
        }
        else {
            ng = m;
        }
    }
    cout << ok << "\n";
    return 0;
}

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

// #define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

int main(){
  ll N; cin >> N ;
  vl a(N);
  ll s = 0;
  rep(i,N){
    cin >> a[i] ;
    s += a[i];
  }
  if(s%(N*(N+1)/2LL)!=0){
    cout << "NO" << endl;
    return 0;
  }
  ll k = s/(N*(N+1)/2LL);
  vl c(N);
  bool ok = true;
  ll dsum = 0;
  rep(i,N){
    c[i] = a[(i+1)%N] - a[i] - k;
    ok &= (c[i]%N==0 && c[i]<=0);
    dsum += c[i]/N;
  }
  dump(c);
  ok &= (dsum==-k);
  cout << (ok ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;




bool solve(){
	
	int n, q;
	cin>> n>> q;
	if(!(n|q)) return false;

	map<int,int> d;
	int ans, ans2=0;
	for(int i=0;i<n;i++){
		int m;
		cin>> m;
		for(int j=0;j<m;j++){
			int in;
			cin>> in;
			d[in]++;
			ans2 = max(ans2, d[in]);
		}
	}
	
	for(map<int, int>::iterator it = d.begin() ; it != d.end() ; it++){
		if((*it).second == ans2){
			ans = (*it).first;
			break;
		}
	}

	if(ans2 >= q){
		cout << ans<< endl;
	}else{
		cout<< 0<< endl;
	}
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	while(solve());

	return 0;
}

 

Measured memory_bytes: 1196
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define reads(s) string s; cin >> s;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;}
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define setprec cout << fixed << showpoint << setprecision(20);
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 998244353;
const ll N = 2e5 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll inv = (mod + 1)/2;
int dp[3001][3001] = {};

int power (int a, int b = mod - 2)
{
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	readb(n, s);
	readarr(a, n);
	
	int x = power(2, n);
	FOR (i, 0, n) dp[i][0] = x;
	
	FOR (i, 1, n)
	    FOR (j, 1, s)
	    {
	        dp[i][j] = dp[i - 1][j];
	        if (j >= a[i]) dp[i][j] = (dp[i][j] + dp[i - 1][j - a[i]]*inv) % mod;
	    }
	
	print(dp[n][s]);
	//printmat(dp, n, s);
}



















Measured memory_bytes: 73952
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n;
  while(true){
    scanf("%d", &n);
    if(n == 0) break;

    vector<int> v[n];
    REP(i,n){
      int m;
      scanf("%d", &m);
      REP(j,m){
        int tmp;
        scanf("%d", &tmp);
        v[i].push_back(tmp);
      }
    }

    int map_list[50][50] = {};
    REP(i,n){
      map_list[i][i] = 1;
    }

    bool make = false;
    REP(i,30){
      int day = i + 1;

      vector<int> w;
      REP(j,n){
        if(find(v[j].begin(), v[j].end(), day) != v[j].end()){
          w.pb(j);
        }
      }

      int len = w.size();
      REP(j,len){
        REP(k,len){
          if(j != k){
            REP(l,n){
              map_list[w[j]][l] = max(map_list[w[j]][l], map_list[w[k]][l]);
            }
          }
        }
      }

      REP(j,n){
        make = true;
        REP(k,n){
          if(map_list[j][k] == 0){
            make = false;
            break;
          }
        }
        if(make) break;
      }

      if(make){
        printf("%d\n", day);
        break;
      }
    }

    if(!make){
      printf("-1\n");
    }
  }
  return 0;
}




Measured memory_bytes: 3280
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
using namespace std;
using namespace __gnu_pbds;
using ll = int64_t;
using ld = long double;
using ull = uint64_t;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

ll a, b;

int main() {
  ios::sync_with_stdio(0);
  cout.precision(10);

  cin >> a >> b;
  ll x = 1;
  while(a > 0) {
    x *= 100;
    a--;
  }

  if (b != 100) {
    cout << x * b << endl;
  } else {
    cout << x * 101 << endl;
  }
}

Measured memory_bytes: 256
;;(declaim (optimize (speed 0) (safety 3) (debug 3)))
(declaim (optimize (speed 3) (safety 0) (debug 0)))

(defvar *a* (read))
(defvar *b* (string-trim " " (read-line)))
(defvar *b*100* (parse-integer (remove #\. *b*)))

(let ((p (* *a* *b*100*)))
  (princ (floor p 100)))


Measured memory_bytes: 24380
import java.util.*;

class Main {
        public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                while (true) {
                        int now = 1000 - sc.nextInt();
                        if (now == 1000) {
                                break;
                        }
                        int ans = 0;
                        for (int i = 2; i >= 0; i--) {
                                for (int j = 1; j >= 0; j--) {
                                        int coin = (int)(Math.pow(10, i) * (j * 4.0 + 1.0));
                                        ans += now / coin;
                                        now %= coin;
                                }
                        }
                        System.out.println(ans);
                }
        }
}

Measured memory_bytes: 26264
#include <iostream>
#include <set>
#include <cmath>
#include <tuple>
#include <vector>
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(){
	int n,now;
	std::cin >> n;
	int ans[100001] = {0};
	for ( int i = 1 ; i <= n ; i++ ) {
		std::cin >> ans[i];
	}
	int a=-1,cnt=0;
	now = ans[1];
	for ( int i = 0 ; i < n ; i++ ) {
		cnt ++;
		if(now==2){
			a = cnt;
			break;
		}
		now = ans[now];
	}
	std::cout << a << std::endl;
	return 0;
}


Measured memory_bytes: 640
x,n = map(int,input().split())
if n==0:
    print(x)
else:
    p = set(map(int,input().split()))

    for i in range(53):
        if not x-i in p:
            print(x-i)
            break
        if not x+i in p:
            print(x+i)
            break

Measured memory_bytes: 9176
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		while(true) {
			int n=in.nextInt();
			if(n==0)break;
			String W[]=new String[n];
			for(int i=0;i<n;i++)W[i]=in.next();
			
			int tanku[]= {5,7,5,7,7},i;
			for(i=0;i<n-4;i++) {
				boolean ck=true;
				int sum=0,j=i,k=0;
				while(true) {
					if(k==5)break;
					sum+=W[j].length();
					j++;
					if(sum>tanku[k]) {
						ck=false;
						break;
					}
					else if(sum==tanku[k]) {
						k++;
						sum=0;
					}
				}
				if(ck) break;
			}
			System.out.println(i+1);
		}
	}

}



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

using namespace std;

#define int long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end() å
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int N;
vector<int> w;

signed main()
{
    cin >> N;
    w.resize(N);
    rep(i, N)
    {
        cin >> w[i];
    }

    int ans = MOD;

    int sum = 0;

    rep(i, N)
    {
        sum += w[i];
    }

    int sum2 = 0;

    rep(i, N)
    {
        sum2 += w[i];
        ans = min(ans, abs(sum2 - (sum - sum2)));
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
    int i,n,m,ans=0;
    cin >> n >> m;
    vector<int> h(n),count(n,1),a(m),b(m);
    //int ans=n;
    for(i=0;i<n;i++){
        cin >> h.at(i);
    }
    for(i=0;i<m;i++){
        cin >> a.at(i) >> b.at(i);
        if(h.at(a.at(i)-1)==h.at(b.at(i)-1)){count.at(a.at(i)-1)=0;count.at(b.at(i)-1)=0;}
        else if(h.at(a.at(i)-1)>h.at(b.at(i)-1)){count.at(b.at(i)-1)=0;}
        else if(h.at(a.at(i)-1)<h.at(b.at(i)-1)){count.at(a.at(i)-1)=0;}
    }
    for(i=0;i<n;i++){
        ans += count.at(i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4844
#include <stdio.h>

int main(void){
  int n , T;
  scanf("%d %d",&n,&T);
  
  int c[n] , t[n];
  for(int i = 0;i < n;i ++){
    scanf("%d %d",&c[i],&t[i]);
  }
  
  int min = 1001;
  
  for(int i = 0;i < n;i ++){
    if(T >= t[i]){
      if(min > c[i]){
        min = c[i];
      }
    }
  }
    
    if(min == 1001){
      printf("TLE\n");
    }
    else{
      printf("%d",min);
    }
    
    return 0;
  }


Measured memory_bytes: 128
n, m = map(int, input().split())
x = [0] + list(map(int, input().split()))
e =  [tuple(map(int, input().split())) for i in range(m)]
e = sorted((w, u, v) for u, v, w in e)

p, r, bad = list(range(n + 1)), [0] * (n + 1), [0] * (n + 1)
wt = x[:]

def find(x):
    if p[x] != x:
        p[x] = find(p[x])
    return p[x]

def union(x, y, w):
    x, y = find(x), find(y)
    if r[x] < r[y]: x, y = y, x
    p[y] = x
    r[x] += r[x] == r[y]
    wt[x] += wt[y]
    bad[x] += bad[y]
    if wt[x] < w:
        bad[x] += 1
    else:
        bad[x] = 0

def add(x, w):
    x = find(x)
    if wt[x] < w:
        bad[x] += 1

for w, u, v in e:
    if find(u) == find(v):
        add(u, w)
    else:
        union(u, v, w)

ans = 0
for u in range(1, n + 1):
    if p[u] == u: ans += bad[u]

print(ans)


Measured memory_bytes: 35196
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt(); int y = sc.nextInt(); int z = sc.nextInt();
    System.out.println(z + " " + x + " " + y);
    sc.close();
  }
}

Measured memory_bytes: 23764
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);


struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 19;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

ld dp[3000][3000];
void solve() {
	int n; cin >> n;
	dp[0][0] = 1;
	rep(i, n) {
		ld p; cin >> p;
		rep(j, i + 1) {
			dp[i + 1][j + 1] += dp[i][j] * p;
			dp[i + 1][j] += dp[i][j] * (1 - p);
		}
	}
	ld ans = 0;
	rep(i, n + 1) {
		if (i > n - i)ans += dp[n][i];
	}
	cout << ans << "\n";
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(10);
	//init_f();
	//init();
	//int t; cin >> t;rep(i,t)
	solve();
	stop
		return 0;
}


Measured memory_bytes: 147200
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repv(i,a,b) for(ll i=b-1;i>=a;i--)
#define MAXN 300005
#define endl "\n"

ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;}

ll n,a,b,c,dp[100005][2];

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(ll i=1;i<=n;i++)
    {
        cin>>a>>b>>c;
        ll p=dp[i-1][1];
        ll q=dp[i-1][2];
        ll r=dp[i-1][3];
        dp[i][1]=a+max(q,r);
        dp[i][2]=b+max(p,r);
        dp[i][3]=c+max(p,q);
    }
    ll maxx=INT_MIN;
    for(ll i=1;i<=3;i++) maxx=max(maxx,dp[n][i]);
    cout<<maxx<<endl;
}

Measured memory_bytes: 1792
k = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
]

print(k[int(input())-1])

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

const int MAX_N = 200005;
int N;
std::map<int, int> xy, yx;
std::map<std::pair<int, int>, int> mm;
int ans[MAX_N];

void debug_print() {
  for (auto& kv : xy) {
    printf("(%d, %d) ", kv.first, kv.second);
  }
  printf("\n");
    for (auto& kv : yx) {
    printf("(%d, %d) ", kv.second, kv.first);
  }
  printf("\n");
}

int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    mm[{a, b}] = i;
    xy[a] = b;
    yx[b] = a;
  }

  while (xy.size()) {
    int count = 0;

    std::vector<std::pair<int, int>> found;
    auto first_y = xy.begin()->second;
    while (1) {
      auto y_st = yx.lower_bound(first_y);
      int prev_count = count;

      int furthest_x = y_st->second;
      for (auto y = y_st; y != yx.end(); ++y) {
        furthest_x = std::max(furthest_x, y->second);
        xy.erase(y->second);  // Erase X coord val.
        found.push_back({y->second, y->first});
        count++;
      }
      yx.erase(y_st, yx.end());  // Erase Y-range.
      if (count == prev_count) break;

      prev_count = count;
      auto x_en = xy.upper_bound(furthest_x);
      int lowest_y = xy.begin()->second;
      for (auto x = xy.begin(); x != x_en; ++x) {
        lowest_y = std::min(lowest_y, x->second);
        yx.erase(x->second);
        found.push_back({x->first, x->second});
        count++;
      }
      xy.erase(xy.begin(), x_en);
      first_y = lowest_y;
      if (count == prev_count) break;
    }
    for (auto p : found) {
      ans[mm[p]] = count;
    }
  }
  for (int i = 0; i < N; ++i) {
    printf("%d\n", ans[i]);
  }
}


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

namespace _001_FindingMissingCards
{

    class Program
    {
        static void Main()
        {
            Boolean cont = true;
            while (cont)
            {
                string sent = Console.ReadLine();
                if (sent == "-")
                {
                    cont = false;
                }else{
                    string skai = Console.ReadLine();
                    int m = Convert.ToInt32(skai);
                    for (int i = 0; i < m; i++)
                    {
                        string sSplitNumber = Console.ReadLine();
                        int splitNumber = Convert.ToInt32(sSplitNumber);
                        string a = sent.Substring(0, splitNumber);
                        string b = sent.Substring(splitNumber);
                        sent = b + a;
                    }
                    Console.WriteLine(sent);
                }
            }
        }
    }
}

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

int main()
{

    ll n,i,j,k,l,a,b,c,d,m,f1,f2,s,x;
    cin>>n;
    ll arr[n+10];
    a=INT_MIN;
    b=INT_MAX;
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
        if(arr[i]>a)
        {
            a=arr[i];
        }
        if(arr[i]<b)
        {
            b=arr[i];
        }
    }
    c=INT_MAX;
    for(i=b;i<=a;i++)
    {
        s=0;
        for(j=0;j<n;j++)
        {
            k=abs(arr[j]-i);
            s+=(k*k);
        }
        if(s<c){c=s;}
    }
    cout<<c<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define For(i, s, e) for(int i = s;i <= e;i++)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define cY cout<<"Yes";
#define cN cout<<"No";
#define cA(a) cout<<a;
const ll MOD = 1000000007;



int main() {
    string s;
    cin >> s;
    bool a=0,ac=0;
    rep(i,s.size()-1) {
        if(s[i] == 'A' && s[i+1] == 'C') ac = 1; 
    }
    if(ac) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
using namespace std;
int c[21],v[21];
int main()
{
	int st,top,n;
	scanf("%d",&n); top=1<<n;
	for(int i=0;i<n;i++)	scanf("%d",&v[i]);
	for(int i=0;i<n;i++)	scanf("%d",&c[i]);
	int ans=0;
	for(int st=1;st<top;st++)
	{
		int tmpv=0,tmpc=0;
		for(int i=0;i<n;i++)	if((st>>i)&1)
			tmpv+=v[i],tmpc+=c[i];
		ans=max(ans,tmpv-tmpc);
	}
	printf("%d\n",ans);
	
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    int X, Y, Z;
    io.read(X, Y, Z);
    cout << (X - Y - 2 * Z) / (Y + Z) + 1;
    return 0;
}

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

Measured memory_bytes: 256
import sys
from collections import deque  # 双方向キュー
from collections import defaultdict  # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー
from bisect import bisect_left, bisect_right  # 二分探索
#import numpy as np  # 1.8.2
#import scipy  # 0.13.3

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, K = i2nn()
    # ペアKの最大数 = comb(N, 2) = N * (N-1) / 2

    # ライングラフ: K = N - 2
    #   N = 5 のとき, ペア = [(0, 2), (1, 3), (2, 4)], K = 3
    # 完全グラフ: K = 0 （全ての頂点ペアが直結しており距離2未満である）
    #   N = 5 のとき, ペア = [], K = 0
    # スターグラフ: K = (N-1) * (N-2) / 2
    #   N = 5 のとき, ペア = [(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)], K = 6
    # 二分木グラフや二部グラフは省略
    # K最小は完全グラフ、K最大はスターグラフである

    # 問題1, 存在するか否か
    # 完全グラフの K = 0 を下回る場合、または
    # スターグラフの K = (N-1)*(N-2)/2 を上回る場合、存在しない
    # 前者は制約から自明、後者を判定すればよい
    # 引っかかったら print(-1) して return

    # 問題2, 存在する場合に1つ出力する
    # K = 0 のとき、完全グラフを出力すればよい
    # K = (N-1)*(N-2)/2 のとき、スターグラフを出力すればよい
    # 0 < K < (N-1)*(N-2)/2 のとき、0 から増やすより、(N-1)*(N-2)/2 から減らすほうが簡単
    #   N = 5, K = 6 のとき,
    #       ペア = [(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)]
    #       UV = [(0, 1), (0, 2), (0, 3), (0, 4)], M = 4
    #   N = 5, K = 5 のとき,
    #       ペア = [(1, 3), (1, 4), (2, 3), (2, 4), (3, 4)]
    #       UV = [(0, 1), (0, 2), (0, 3), (0, 4), (1, 2)], M = 5
    #   N = 5, K = 4 のとき,
    #       ペア = [(1, 4), (2, 3), (2, 4), (3, 4)]
    #       UV = [(0, 1), (0, 2), (0, 3), (0, 4), (1, 2), (1, 3)], M = 6
    #   ...
    #   N = 5, K = 0 のとき,
    #       ペア = []
    #       UV = [(0, 1), (0, 2), (0, 3), (0, 4), (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)], M = 10
    #   K=0 で最終的に完全グラフとなる

    NM = (N-1) * (N-2) / 2
    if K > NM:
        print(-1)
        return
    
    UV = [(1, i) for i in range(2, N+1)]
    for i in range(2, N):
        if K >= NM:
            break
        for j in range(i+1, N+1):
            if K >= NM:
                break
            UV.append((i, j))
            K += 1

    M = len(UV)
    print(M)
    for u, v in UV:
        print(u, v)

main()


Measured memory_bytes: 42736
#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<unordered_set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull; 
const ll mod = 998244353;
const ll N = 3 * 100000 + 5;
ll Mode(ll a, ll b){
	ll sum = 1;
	while (b) {
		if (b & 1) {
			sum = (sum * a) % mod;
			b--;
		}
		b /= 2;
		a = a * a % mod;
	}
	return sum;
}
//快速幂取模 

ll inv(ll a){
	return Mode(a, mod - 2);
}
//逆元 

ll jc[N];
void init() //预处理算阶乘
{
    jc[0] = 1;
    for(int i = 1; i < N; ++i)
    jc[i] = jc[i-1] * i % mod;
}
ll C(ll n, ll m){
    if(n<0||m>n)
        return 0;
    return ((jc[n] % mod) * ((inv(jc[m]) * inv(jc[n - m])) % mod)) % mod;
}//组合数 
int main(){
//	ios::sync_with_stdio(false);
//	ifstream cin("data.txt");
//	freopen("data.txt", "r", stdin);
	init();
	ll n, a, b, k;
	ll ans = 0;
	cin >> n >> a >> b >> k;
	if(k == 0){
		cout << 1 << endl;
		return 0;
	}
	for(ll i = 0; i <= n; i++){	
		if(!((k - a * i) % b)){
			ll t1 = i;
			ll t2 = ((k - a * i) / b); 
			if(t2 < 0)continue;
			ll cnt = C(n, t1);
			cnt %= mod;
			cnt *= C(n, t2);
			cnt %= mod; 
			ans += cnt;
			ans %= mod;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2688
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        if(b-a<=0){
            System.out.println("delicious");
        }else if(b-a>x){
            System.out.println("dangerous");
        }else{
            System.out.println("safe");
        }

    }

}


Measured memory_bytes: 21588
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 count = 0;
        while(n / k != 0){
            count++;
            n /= k;
        }
        System.out.println(count +1);
    }
}


Measured memory_bytes: 21844
<?php
list($N, $A, $B) = explode(" ", trim(fgets(STDIN)));

if ($A > $B || ($N == 1 && $A != $B)) {
    echo 0;
} else {
    echo(($B * ($N - 1) + $A) - ($A * ($N - 1) + $B) + 1);
}

Measured memory_bytes: 4856
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if (n%2) PRINT(2*n);
    else PRINT(n);
}


Measured memory_bytes: 256
// C - Flip,Flip, and Flip...... 300
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

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

    ll ans;
    if (N == 1 || M == 1) {
        if (N == 1 && M == 1) {
            ans = 1;
        } else {
            ans = max(N, M) - 2;
        }
    } else {
        ans = (N - 2) * (M - 2);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>


using namespace std;

int main()
{
	int a, b, c;
	int n = 0;
	cin >> a >> b >> c;
	for(int i = a; i <= b; ++i)
	{
		if(c%i == 0)
		{
			n++;
		}
	}
	cout << n << endl;
	return 0;
}


Measured memory_bytes: 3088
#include <stdio.h>

int main (void) {
    int N;

    scanf ("%d", &N);

    if (N >= 100) {
        N = N % 100;
    }
    if (N >= 10) {
        N = N % 10;
    }

    switch (N) {
        case 0:
        case 1:
        case 6:
        case 8: printf("pon\n");
                break;
        case 3: printf("bon\n");
                break;
        default: printf("hon\n");
    }

    return 0;
}

Measured memory_bytes: 1660
import sys
sys.setrecursionlimit(1000000)



# グラフ定義
class Edge:
    def __init__(self, f: int, t: int, cost: int):
        self._t = t
        self._cost = cost
        self._f = f

    @property
    def t(self):
        return self._t

    @property
    def f(self):
        return self._f

    @property
    def cost(self):
        return self._cost


INF = 1 << 28


# ここから本実装
def bellman_ford(n: int, edges, s: int):
    dist = [INF for _ in range(n)]
    dist[s] = 0

    for i in range(2 * n):
        for e in edges:

            if dist[e.t] > dist[e.f] + e.cost:
                dist[e.t] = dist[e.f] + e.cost
                if i >= n - 1:
                    return None

    return dist


def visitable_node(n, g, rg):

    vis = [False] * n

    def dfs(idx):
        vis[idx] = True
        for e in g[idx]:
            if not vis[e]:
                dfs(e)

    dfs(0)

    rvis = [False] * n

    def rdfs(idx):
        rvis[idx] = True
        for e in rg[idx]:
            if not rvis[e]:
                rdfs(e)

    rdfs(n - 1)

    return [vis[i] & rvis[i] for i in range(n)]


n, m, p = map(int, input().split())

edges = []
g = [[] for _ in range(n)]
rg = [[] for _ in range(n)]
for _ in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    edges.append(Edge(a, b, -c + p))
    g[a].append(b)
    rg[b].append(a)

visitable = visitable_node(n, g, rg)
updated = [e for e in edges if visitable[e.f] and visitable[e.t]]

dist = bellman_ford(n, updated, 0)

if dist:
    print(max(0, -dist[n - 1]))
else:
    print(-1)


Measured memory_bytes: 65240
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,n) for(int i=1; i<=(n); i++)

int main() {
    int a,b,c,ans;
    cin>>a>>b>>c;
    ans=a+b+c-max(a,max(b,c));
    cout<<ans;
    return 0;
}


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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long



int32_t main() {

    int n; cin >> n;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; ++i) cin >> a[i];
    for(int i = 0; i < n; ++i) cin >> b[i];

    priority_queue<int> extras;
    int needed = 0, ans = 0;
    for(int i = 0; i < n; ++i) {
        if(a[i] > b[i]) extras.push(a[i]-b[i]);
        else if(b[i] > a[i]) {
            ans++;
            needed += b[i]-a[i];
        }
    }

    while(needed > 0 && !extras.empty()) {
        int cur = extras.top();
        extras.pop();
        ans++;
        needed -= cur;
    }

    if(needed > 0) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
    
    return 0;
}


Measured memory_bytes: 2428
// The very basic /////////////////////////////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
#define ALL_H 1

// Print elements of containers using << operator /////////////////////////////
// pair
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {
  return s << "(" << p.first << ", " << p.second << ")";}
// vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  for (auto &elem : v) {
    s << elem;
    if (&elem != &v.back()) s << " ";
  }
  return s;
}
// 2 dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  for (auto &elem : vv) {
    s << elem;
    if (&elem != &vv.back()) s << endl;
  }
  return s;
}
// map
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
  s << "{" << endl;
  for (auto &elem: m) {
    s << " " << elem.first << " : " << elem.second << endl;
  }
  s << "}";
  return s;
}
//set
template<typename T> ostream& operator<<(ostream& s, const set<T>& m) {
  s << "{ ";
  for (auto &elem: m) {
    s << elem << " ";
  }
  s << "}";
  return s;
}

// Convenient macros //////////////////////////////////////////////////////////

// types
#define ll long long
#define ld long double
#define int ll
#define Pi pair<int, int>
#define Graph vector<vector<int>>
#define WeightGraph vector<vector<Pi>>

// other
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

#define MOD 1000000007
#define INF LLONG_MAX/100

// update max or min //////////////////////////////////////////////////////////

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; }

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

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


// Debug it by D(x) ///////////////////////////////////////////////////////////
#define DEBUG 0
#if DEBUG
#define D(x) x
#else
#define D(x)
#endif

///////////////////////////////////////////////////////////////////////////////
//                             Start Coding Here                             //
///////////////////////////////////////////////////////////////////////////////

signed main() {
  int H, W, N; cin  >> H >> W >> N;
  D(cout << N% max(H, W) << endl);
  if (N % max(H, W) == 0) {
    cout << N /max(H, W) << endl;
  } else {
    cout << N/ max(H, W) + 1 << endl;
  }
}


Measured memory_bytes: 256