akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

vector<string> split(const string &s, char c) {
	vector<string> v; stringstream ss(s); string x;
	while (getline(ss, x, c)) v.push_back(x);
	return v;
}
#define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }
void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

typedef long long ll;
const int MOD = 1000000007;

template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; }
template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; }
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

int main(int argc, char *argv[]) {
	ios_base::sync_with_stdio(false);

	int n; cin >> n;
	vector<int> a(n), b(n);
	REPU(i, 0, n) {
		cin >> a[i];
		b[i] = a[i];
	}
	sort(ALL(b));
	int pos = n / 2;
	REPU(i, 0, n) {
		int idx = lower_bound(ALL(b), a[i]) - b.begin() + 1;
		if (idx > pos) printf("%d\n", b[pos - 1]);
		else printf("%d\n", b[pos]);
	}

	return 0;
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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


const string YES = "Yes";
const string NO = "No";

void func(long long A, long long B, long long C, long long D){

    while(1){
        C-=B;

        if(C<=0){
            cout<<YES<<endl;
            return;
        }

        A-=D;
        if(A<=0){
            cout<<NO<<endl;
            return;
        }
    }

}

int main(){
    // cout << fixed << setprecision(5);

    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long D;
    scanf("%lld",&D);
    func(A, B, C, D);
    return 0;
}


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

int main()
{
  //vector<bool> close(1<<(5*5), false);
  vector<int> close((1<<(5*5))/32, 0);
  vector<int> cls(1000000);

  for (int n; scanf("%d", &n), !(n==0); ){

    vector<vector<int> > pats(33);
    vector<vector<int> > tmp(n, vector<int>(n, 0));

    for (int i=0; i<n; i++){
      for (int j=0; j<n; j++){
	for (int k=i; k<n; k++){
	  for (int l=j; l<n; l++){
	    for (int a=i; a<=k; a++)
	      for (int b=j; b<=l; b++)
		tmp[a][b]=1;
	    int bd=0;
	    for (int a=0; a<n; a++){
	      for (int b=0; b<n; b++){
		bd=(bd<<1)|tmp[a][b];
	      }
	    }
	    pats[__builtin_clz(bd)].push_back(bd);
	    for (int a=i; a<=k; a++)
	      for (int b=j; b<=l; b++)
		tmp[a][b]=0;
	  }
	}
      }
    }

    int bd=0;
    for (int i=0; i<n; i++){
      for (int j=0; j<n; j++){
	int t; scanf("%d", &t);
	bd=(bd<<1)|t;
      }
    }

    int cls_cnt=0, cls_cur=0;
    close[bd>>5]|=(1<<(bd&31));
    cls[cls_cnt++]=bd;
    for (;;){
      int dep=cls[cls_cur]>>25;
      int cbd=cls[cls_cur]&0x1ffffff;
      cls_cur++;
      const vector<int> &ps=pats[__builtin_clz(cbd)];
      int sz=ps.size();
      for (int i=0; i<sz; i++){
	int nbd=cbd^ps[i];
	if (nbd==0){
	  for (int i=0; i<=dep; i++)
	    printf("myon");
	  puts("");
	  goto _exit;
	}
	if (close[nbd>>5]&(1<<(nbd&31))) continue;
	close[nbd>>5]|=(1<<(nbd&31));
	cls[cls_cnt++]=((dep+1)<<25)|nbd;
      }
    }
  _exit:;
    for (int i=0; i<cls_cnt; i++)
      close[(cls[i]&0x1ffffff)>>5]=0;
    cls_cnt=0;
  }
  return 0;
}

Measured memory_bytes: 8924
/*
  Author - KISHAN TIWARI
  Dream bigger. Do bigger.
  Wake up with determination. Go to bed with satisfaction.
*/
//Sometimes later becomes never. Do it now.
#include<bits/stdc++.h>
using namespace std;
#define ll           long long
#define f(i,a,b)     for(ll i=a;i<b;i++)
#define mod          1000000007
#define fi           first
#define se           second
#define pa           pair <ll,ll>
#define mp           make_pair
#define pb           push_back
#define ve           vector<ll>
#define vep          vector< pa >
#define all(a)       a.begin(), a.end()
#define sz(x)        (ll)x.size()
#define c(t)         cout<<t<<"\n"
using namespace std;
void solve()
{  ll n;
cin>>n;
ll a[n];
f(i,0,n)
cin>>a[i];
ve v;
ll hj=0;
f(i,0,n-1)
{
    if(a[i]>a[i+1]&&hj==0)
        {v.pb(i);
         hj=2;
        }
    else if(a[i]>a[i+1]&&hj==2)
        {v.pb(i+1);
         hj=2;
        }
}
if(v.size()==0||v.size()==2)
    {  if(v.size()==0)
        cout<<"YES\n";
       else
       { ll g=0;
           swap(a[v[0]],a[v[1]]);
           f(i,0,n-1)
           {
               if(a[i]>a[i+1])
                g=2;
               break;
           }
           if(g==0)
            cout<<"YES\n";
           else
             cout<<"NO\n";
       }
    }
else
    cout<<"NO\n";
}
int main()
{
    ios::sync_with_stdio(true);
   //freopen ("input.txt","r",stdin);
   //freopen ("output.txt","w",stdout);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    //cin>>t;
    while(t--)
    {

        solve();
    }
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <math.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
    ll h, w, a, b;
    cin >> h >> w >> a >> b ;
    REP(i, b){
        REP(j, a) cout << "0";
        REP(j, w-a) cout << "1";
        cout << "\n";
    }
    REP(i, h-b){
        REP(j, a) cout << "1";
        REP(j, w-a) cout << "0";
        cout << "\n";
    }
    return 0;
}


Measured memory_bytes: 1280
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;

public class Main {

	/* several useful subroutines */
	private static BufferedReader brStdin = new BufferedReader(new InputStreamReader(System.in));
	private static String[] readBuf = null;
	private static int readPtr = 0;
	private static String getString() throws IOException {
		while ( readBuf == null || readPtr >= readBuf.length ) {
			readBuf = brStdin.readLine().split(" ");
			readPtr = 0;
		}
		return readBuf[readPtr++];
	}
	private static int getInt() throws IOException {
		return Integer.parseInt(getString());
	}
	private static long getLong() throws IOException {
		return Long.parseLong(getString());
	}
	private static BigDecimal getBD() throws IOException {
		return new BigDecimal(getString());
	}
	@SuppressWarnings("unused")
	private static String[] getStringArray(int size) throws IOException {
		String stringArray[] = new String[size];
		for (int i = 0; i < stringArray.length; i++) {
			stringArray[i] = getString();
		}
		return stringArray;
	}
	@SuppressWarnings("unused")
	private static int[] getIntArray(int size) throws IOException {
		int intArray[] = new int[size];
		for (int i = 0; i < intArray.length; i++) {
			intArray[i] = getInt();
		}
		return intArray;
	}
	@SuppressWarnings("unused")
	private static long[] getLongArray(int size) throws IOException {
		long longArray[] = new long[size];
		for (int i = 0; i < longArray.length; i++) {
			longArray[i] = getLong();
		}
		return longArray;
	}
	@SuppressWarnings("unused")
	private static BigDecimal[] getBDArray(int size) throws IOException {
		BigDecimal bdArray[] = new BigDecimal[size];
		for (int i = 0; i < bdArray.length; i++) {
			bdArray[i] = getBD();
		}
		return bdArray;
	}
	@SuppressWarnings("unused")
	private static long calculateLCM(long a, long b) throws IOException {
		if ( a  < b ) {
			long t = a;
			a = b;
			b = t;
		}
		while ( b > 0 ) {
			long t = b;
			b = a % b;
			a = t;
		}
		return a;
	}

	
	/* main routine */
	
	public static void main(String args[]) throws IOException {
		int n = getInt();
		double x[] = new double[n];
		double y[] = new double[n];
		for ( int i = 0 ; i<n ; i++ ) {
			x[i] = getBD().doubleValue(); 
			y[i] = getBD().doubleValue(); 
		}

		double sum = 0D;
		for ( int i = 0 ; i < n ; i++ ) {
			for ( int j = 0 ; j < n ; j++ ) {
				if ( i < j ) {
					sum += Math.sqrt( (x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]) );
				}
			}
		}

		System.out.println( sum * 2D / (double)n );
	}
}


Measured memory_bytes: 23380
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#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 n,m;
    cin>>n>>m;
    vector<pair<ll,ll>> v(n);
    rep(i,n){
        int a,b;
        cin>>a>>b;
        v[i]=mp(a,b);
    }
    rep(i,n)v[i].first=m-v[i].first;
    Rort(v);
    int pos=0;
    ll ans=0;
    priority_queue<int> pq;
    for(int day=n;day>=0;day--){
        while(pos<n&&v[pos].first>=day){
            pq.push(v[pos].second);
            pos++;
        }
        // cout<<pos<<endl;
        if(!pq.empty()){
            int to=pq.top();
            ans+=to;
            pq.pop();
        }
    }
    fin(ans);

}


Measured memory_bytes: 2428
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		int N = nextInt();
      int output = 1;
      while(output <= N){
        output *= 2;
      }
      myout(output / 2);
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 32960
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <set>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> Q;
const ll mod = 1000000007;
const ll INF = 1000000000000000;
vector<P> vec[200010], peo[200010];
ll bit[100010], num;
ll par[100010], sz[100010];
ll n, k, a, b, kai[100010], ans;
vector<ll> road[100010];
bool flag[100010], res;

struct edge { ll to, cost; };
ll V;
vector<edge> G[300010];
ll d[300010];

ll root(int x) { // �f�[�^x��������؂̍����ċA�œ���Froot(x) = {x�̖؂̍�}
	if (par[x] == x) return x;
	return par[x] = root(par[x]);
}

void unite(int x, int y) { // x��y�̖؂𕹍�
	int rx = root(x); //x�̍���rx
	int ry = root(y); //y�̍���ry
	if (rx == ry) return; //x��y�̍�������(=�����؂ɂ���)���͂��̂܂�
	par[rx] = ry; //x��y�̍��������łȂ�(=�����؂ɂȂ�)���Fx�̍�rx��y�̍�ry�ɂ���
}

bool same(int x, int y) { // 2�̃f�[�^x, y��������؂������Ȃ�true��Ԃ�
	int rx = root(x);
	int ry = root(y);
	return rx == ry;
}

void dijkstra(ll s)
{
	priority_queue<P, vector<P>, greater<P>> que;
	for (int i = 0; i <= 300010; i++)
	{
		d[i] = INF;
	}
	d[s] = 0;
	que.push(P(0, s));

	while (!que.empty())
	{
		P p = que.top(); que.pop();
		ll v = p.second;
		if (d[v] < p.first) continue;
		for (ll i = 0; i < G[v].size(); i++)
		{
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost)
			{
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

ll sum(ll i)
{
	ll s = 0;
	while (i > 0)
	{
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add(ll i, ll x)
{
	while (i <= num)
	{
		bit[i] += x;
		i += i & -i;
	}
}

ll po(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2)
	{
		return po(x, y - 1) * x % mod;
	}
	else
	{
		ll yyy = po(x, y / 2);
		return yyy * yyy % mod;
	}
}

ll div(ll x)
{
	return po(x, mod - 2);
}

void dfs(ll x)
{
	flag[x] = true;
	(ans *= kai[k - 2] * div(kai[k - 2 - (road[x].size() - 1)]) % mod) %= mod;
	for (int i = 0; i < road[x].size(); i++)
	{
		if (flag[road[x][i]]) continue;
		dfs(road[x][i]);
	}
}

int main(void)
{
	cin >> n >> k;
	kai[0] = 1;
	res = true;
	for (int i = 1; i <= k; i++)
	{
		kai[i] = kai[i - 1] * i % mod;
	}
	for (int i = 1; i < n; i++)
	{
		cin >> a >> b;
		road[a].push_back(b);
		road[b].push_back(a);
	}
	for (int i = 1; i <= n; i++)
	{
		if (road[i].size() + 1 > k)
		{
			res = false;
		}
	}
	if (!res)
	{
		cout << 0 << endl;
		return 0;
	}
	flag[1] = true;
	ans = kai[k] * div(kai[k - (road[1].size() + 1)]) % mod;
	for (int i = 0; i < road[1].size(); i++)
	{
		dfs(road[1][i]);
	}
	cout << ans << endl;
	int www;
	cin >> www;
}


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

int Max(vector<int> x){
  int a=x.size();
  for(int i=0;i<a-1;i++){
    x.at(i+1)=max(x.at(i),x.at(i+1));
  }
  return x.at(a-1);
}


int main() {
  //cout<<1<<min(8,9);
  long long a,m,ans;
  cin>>a;
  vector<int> A(a);
  for(int i=0;i<a;i++){
    cin>>A.at(i);
  }
  cout<<Max(A)<<" ";
  m=Max(A)+1;
  int x=m-1;
  for(int i=0;i<a;i++){
    if(max(A.at(i),x/2)-min(A.at(i),x/2)<m&&A.at(i)!=x){
      ans=A.at(i);
      m=max(A.at(i),x/2)-min(A.at(i),x/2);
    }
  }
  cout<<ans;

      
}


Measured memory_bytes: 1024
#include<stdio.h>

int main(){
    int count = 0;
    char s[4], t[4];
    scanf("%s", s);
    scanf("%s", t);
    for(int i=0; i<3; i++){
        if(s[i] == t[i]){
            count++;
        }
    }
    printf("%d", count);

    return 0;
}

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

int main() {
	int N,K ; cin>>N>>K;
	if((N-1) % (K-1) == 0)
	cout << (N-1)/(K-1) << endl;
	else
	cout << (N-1)/(K-1) + 1 << endl;
}

Measured memory_bytes: 256
N = int(input())
oddCount = 0
mo4Count = 0
for i in map(int, input().split()):
  if i % 2 == 1:
    oddCount += 1
  elif i % 4 == 0:
    mo4Count += 1
if oddCount - N % 2 <= mo4Count:
  print('Yes')
else:
  print('No')


Measured memory_bytes: 11096
min(a,b){return a<b?a:b;}
N,M,L,Q;
D[301][301];
i,j,k;
a,b,c;
main()
{
	scanf("%d%d%d",&N,&M,&L);
	for(i=0;i<N;i++)for(j=0;j<N;j++)D[i][j]=1000000001;
	for(i=0;i<M;i++)
	{
		scanf("%d%d%d",&a,&b,&c);
		--a;
		--b;
		D[a][b]=D[b][a]=c;
	}
	for(k=0;k<N;k++)for(i=0;i<N;i++)for(j=0;j<N;j++)
		D[i][j]=min(D[i][j],D[i][k]+D[k][j]);
	for(i=0;i<N;i++)for(j=0;j<N;j++)
	{
		D[i][j]=D[i][j]>L?1000000000:1;
	}
	for(k=0;k<N;k++)for(i=0;i<N;i++)for(j=0;j<N;j++)
		D[i][j]=min(D[i][j],D[i][k]+D[k][j]);
	scanf("%d",&Q);
	for(i=0;i<Q;i++)
	{
		scanf("%d%d",&a,&b);
		--a;
		--b;
		printf("%d\n",D[a][b]<1000000000?D[a][b]-1:-1);
	}
}

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

namespace Contest
{
    class Scanner
    {
        private string[] line = new string[0];
        private int index = 0;
        public string Next()
        {
            if (line.Length <= index)
            {
                line = Console.ReadLine().Split(' ');
                index = 0;
            }
            var res = line[index];
            index++;
            return res;
        }
        public int NextInt()
        {
            return int.Parse(Next());
        }
        public long NextLong()
        {
            return long.Parse(Next());
        }
        public string[] Array()
        {
            line = Console.ReadLine().Split(' ');
            index = line.Length;
            return line;
        }
        public int[] IntArray()
        {
            return Array().Select(int.Parse).ToArray();
        }
        public long[] LongArray()
        {
            return Array().Select(long.Parse).ToArray();
        }
    }

    class Program
    {
        private string S;
        private void Scan()
        {
            var sc = new Scanner();
            S = sc.Next();
        }

        public void Solve()
        {
            Scan();
            int cnt = 0;
            for (int i = 0; i < 3; i++)
            {
                cnt += S[i] - '0';
            }
            Console.WriteLine(cnt);
        }


        static void Main(string[] args)
        {
            new Program().Solve();
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  ll N,H;
  cin >> N >> H;
  vP p(N),q(N);
  rep(i,N){
    cin >> p[i].first >> p[i].second;//pについてはたくさん・域
    q[i].second=p[i].first;
    q[i].first=p[i].second;//qについては一回、たくさん
  }
  sort(p.begin(),p.end());
  reverse(p.begin(),p.end());
  sort(q.begin(),q.end());
  reverse(q.begin(),q.end());
  bool B=true;
  ll i=0;
  ll ans=0;
  ll d=0;
  while(p[0].first<q[i].first&&H>0){
    H-=q[i].first;
    i++;
    ans++;
  }
  if(H>0){
    ans+=(H-1)/p[0].first+1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 233;
int main()
{
	ll h,n,sum=0;cin>>h>>n;
	for(int i=1;i<=n;i++){
		int x;cin>>x;
		sum += x;
	}
	if(sum>=h)puts("Yes");
	else puts("No");
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main() {
    string ss; cin >> ss;
    int a[10];
    //cout << (char)97 << endl;
    //cout << ss << endl;
    for (int i = 0; ss[i]; i++) {
        a[i] = ss[i] - '0';
    }
    /*for (int i = 0; i < ss.length(); i++) {
        cout << a[i];
    }*/
    //cout << endl;
    int n = (int)ss.length();
    int ans = a[n-3]*100 + a[n-2]*10 + a[n-1];
    //cout << "ans " << ans << endl;
    for (int i = 1; i < n - 2; i++) {
        int b = a[n - 1 - i] + a[n - 1 - i - 1] * 10 + a[n - 1 - i -2] * 100;
        if (fabs(ans - 753) > fabs(b - 753) ) ans = b;
    }
    cout << fabs(ans - 753) << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(){
  int N;
  int a,b,c;
  cin >> N;
  a = N%10;
  b = (N/10)%10;
  c = N/100;
  if (a==7 || b==7 || c==7){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <string>
 
using namespace std;
 
int ABC_168_A()
{
 
    string n;
    cin >> n;
    
    reverse(n.begin(), n.end());
 
    if ((n[0] == '2') || (n[0] == '4') || (n[0] == '5') || (n[0] == '7') || (n[0] == '9'))cout << "hon";
    else if ((n[0] == '0') || (n[0] == '1') || (n[0] == '6') || (n[0] == '8'))cout << "pon";
    else cout << "bon";
 
    return 0;
 
}
 
int main()
{
    ABC_168_A();
 
    return 0;
}

Measured memory_bytes: 3592
package main

import (
	"fmt"
	"sort"
)

func main (){
	var n, c, k int
	fmt.Scan(&n, &c, &k)

	t := make([]int, n)
	for i := 0; i <n ;i++ {
		fmt.Scan(&t[i])
	}
	sort.Ints(t)

	start := t[0]
	passenger:= 1
	ans := 1
	for i:= 1; i < n; i++ {
		if start + k < t[i] ||  passenger == c {
			ans++
			start = t[i]
			passenger = 1
			continue
		}
		passenger++
	}

	fmt.Println(ans)

}


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

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


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

int main() {
    int n;
    cin >> n;
    vi a(n);
    rep(i,n) scanf("%d", &a[i]);

    int ggg = a[0];
    rep(i,n-1) ggg = __gcd(ggg, a[i+1]);
    if(ggg != 1){
        puts("not coprime");
        return 0;
    }

    //エラトステネスの篩
    int P_MAX = 1000005;
    vi pmn(P_MAX);     //smallest prime number that can divide i(pmn[i] == i -> i is prime number)
    for(int i = 1; i < P_MAX; i++)
        if(i%2 == 0) pmn[i] = 2;
        else pmn[i] = i;
    for(int i = 3; i*i < P_MAX; i += 2){
        if(pmn[i] == i){
            for(int j = 3*i; j < P_MAX; j += 2*i)
                if(pmn[j] == j) pmn[j] = i; 
        }
    }

    vi cnt(P_MAX,0);
    rep(i,n){
        while(a[i] != 1){
            int apmn = pmn[a[i]];
            if(cnt[apmn]){
                puts("setwise coprime");
                return 0;
            }
            cnt[apmn]++;
            while(a[i]%apmn == 0) a[i] /= apmn;
        }
    }
    puts("pairwise coprime");
}


Measured memory_bytes: 14904
#include<bits/stdc++.h>
using namespace std;
int a[1200],tot,n,ans[1200];
int solve(){
	for(int i=tot;i>=1;i--){
		if(a[i]==i){
			ans[tot]=i;
			for(int j=i;j<tot;j++)a[j]=a[j+1];
			return 0;
		}
	}
	printf("-1\n");
	exit(0);
}
int main(){
	scanf("%d",&n);
	tot=n;
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	while(tot){
		solve();
		tot--;
	}
	for(int i=1;i<=n;i++)printf("%d\n",ans[i]);
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

vector<int> G[1000000];
vector<pair<int, int> > bridge;
vector<int> articulation;
int ord[1000000], low[1000000];
bool vis[1000000];

void dfs(int v, int p, int &k)
{
	vis[v] = true;
	
	ord[v] = k++;
	low[v] = ord[v];
	
	bool isArticulation = false;
	int ct = 0;
	
	for (int i = 0; i < G[v].size(); i++){
		if (!vis[G[v][i]]){
			ct++;
			dfs(G[v][i], v, k);
			low[v] = min(low[v], low[G[v][i]]);
			if (~p && ord[v] <= low[G[v][i]]) isArticulation = true;
			if (ord[v] < low[G[v][i]]) bridge.push_back(make_pair(min(v, G[v][i]), max(v, G[v][i])));
		}
		else if (G[v][i] != p){
			low[v] = min(low[v], ord[G[v][i]]);
		}
	}
	
	if (p == -1 && ct > 1) isArticulation = true;
	if (isArticulation) articulation.push_back(v);
}

int main()
{
	int n, m;
	
	scanf("%d %d", &n, &m);
	
	for (int i = 0; i < m; i++){
		int x, y;
		scanf("%d %d", &x, &y);
		G[--x].push_back(--y);
		G[y].push_back(x);
	}
	
	int k = 0;
	for (int i = 0; i < n; i++){
		if (!vis[i]) dfs(i, -1, k);
	}
	
	sort(bridge.begin(), bridge.end());
	sort(articulation.begin(), articulation.end());
	
	cout << bridge.size() << endl;
	
	return (0);
}

Measured memory_bytes: 26368
n = int(input())
a = {}
print(0)
a1 = input()
a.setdefault(0, a1)
a.setdefault(n, a1)
if a1 == "Vacant":
    pass
else:
    start = 0
    end = n
    for i in range(19):
        question = start + (end - start) // 2
        print(question)
        answer = input()
        a.setdefault(question, answer)
        if answer == "Vacant":
            break
        if (question - start) % 2 == 0 and a[start] == a[question]:
            start = question
        if (question - start) % 2 == 0 and a[start] != a[question]:
            end = question
        if (question - start) % 2 == 1 and a[start] == a[question]:
            end = question
        if (question - start) % 2 == 1 and a[start] != a[question]:
            start = question

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
signed main()
{
    int n;
    cin>>n;
    int a[n+1],b[n];
    for(int i=0;i<n+1;i++)
        cin>>a[i];
    
    for(int i=0;i<n;i++)
        cin>>b[i];
    
    int ans=0;
    for(int i=0;i<n;i++)
    {
        int mn=min(a[i],b[i]);
        ans+=mn;
        a[i]-=mn;
        b[i]-=mn;
        mn=min(b[i],a[i+1]);
        ans+=mn;
        a[i+1]-=mn;
    }
    cout<<ans<<endl;
    
    
    
}

Measured memory_bytes: 1792
import java.util.Scanner;
import java.util.regex.Pattern;

public class Main {

	/** 条件に満たす文字の正規表現 */
	private static final Pattern PATTERN = Pattern.compile("^(dream|dreamer|erase|eraser)+$");

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.next();
			System.out.println(PATTERN.matcher(s).matches() ? "YES" : "NO");
		}
	}
}


Measured memory_bytes: 50196
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define ll long long
using  namespace std;
template <class T>
inline void read(T &x)
{
   x=0; char c=getchar(); int f=1;
   while(!isdigit(c)){if(c=='-')f=-1; c=getchar();}
   while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
ll Pow(ll x,ll y)
{
	ll res=1;
	while(y)
	{
		if(y&1) res*=x;
		x*=x; y>>=1;
	}
	return res;
}
int main()
{
	ll n,p; read(n),read(p);
	ll ans=1;
	for(int i=2;i*(ll)i<=p;i++)
	if(p%i==0)
	{
		int cnt=0;
		while(p%i==0) p/=i,cnt++;
		if(cnt>=n) ans*=Pow(i,cnt/n);
	}
	if(p>1&&n==1) ans*=p;
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 256
/*
 * 2415.cc: Sashimi
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 4000;

typedef long long ll;

const ll LINF = 1LL << 60;

/* typedef */

/* global variables */

ll wis[MAX_N], wsums[MAX_N + 1], dp[MAX_N][MAX_N + 1];
int ks[MAX_N][MAX_N + 1];

/* subroutines */

/* main */

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

  wsums[0] = 0;
  for (int i = 0; i < n; i++) {
    cin >> wis[i];
    wsums[i + 1] = wsums[i] + wis[i];
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= n; j++) dp[i][j] = LINF, ks[i][j] = -1;
    dp[i][i + 1] = 0;
    ks[i][i + 1] = i;
  }

  for (int l = 2; l <= n; l++)
    for (int i = 0, j = l; j <= n; i++, j++) {
      ll mind = LINF;
      ll wsum = wsums[j] - wsums[i];
      int mink = -1;
      for (int k = ks[i][j - 1]; k <= ks[i + 1][j]; k++) {
	ll d = dp[i][k] + dp[k][j] + wsum;
	if (mind > d) mind = d, mink = k;
      }
      dp[i][j] = mind;
      ks[i][j] = mink;
    }

  printf("%lld\n", dp[0][n]);
  return 0;
}

Measured memory_bytes: 188764
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

ans = sum(B)
for i in range(N-1):
    if A[i+1] == A[i] + 1:
        ans += C[A[i]-1]
print(ans)

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,k;
  cin >>n>>k;
  int i=0;
  int l=1;
  while(true){
    if(l > n) break;
    i++;
    l *= k;
  }

  cout << i << endl;

  return 0;
}


Measured memory_bytes: 888
#! env python
# -*- coding: utf-8 -*-

from collections import defaultdict
import sys, heapq, bisect, math, itertools, string, queue, datetime

# atcoder.main
# Date: 2020/06/20
# Filename: main 
# Author: acto_mini

sys.setrecursionlimit(10 ** 8)
INF = float('inf')

D, G = map(int, input().split())
ans = INF
PC = [list(map(int, input().split())) for i in range(D)]

for bit in range(1 << D):
    count = 0
    sum = 0
    left_over = set(range(1, D + 1))

    for i in range(D):
        if bit & (1 << i):
            sum += PC[i][0] * (i + 1) * 100 + PC[i][1]
            count += PC[i][0]
            left_over.discard(i + 1)

    if sum < G:
        use = max(left_over)
        n = min(PC[use - 1][0], -(-(G - sum) // (use * 100)))
        count += n
        sum += n * use * 100

    if sum >= G:
        ans = min(ans, count)

print(ans)


Measured memory_bytes: 76364
def solve(n,a):
    if n == 0:
        return print("Yes")
    elif n>=500:
        n = n - 500*(n//500)
        return solve(n,a)
    elif n > a:
        return print("No")
    else:
        return print("Yes")

if __name__ == "__main__":
    n = int(input())
    a = int(input())
    solve(n,a)


Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define int long long int
#define hell (int)(1e9+7)
#define inf 1000000000000

using namespace std;

void solve(){
    int n,k;
    cin>>n>>k;
    k=min(k,n);
    vector <int> a(n);
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(begin(a),end(a));
    int ans=accumulate(begin(a),begin(a)+n-k,(int)0);
    cout<<ans;
}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t,c;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>

int main(){

  int a,b,n,st;

  //load a,b 
  scanf("%d %d",&a,&b);
  //sort
  if(a<b){
    st=a;
    a=b;
    b=st;
  }

  //algorithm
  while(1){
    n=a%b;
    if(n==0){
      printf("%d\n",b);
      break;
    }
    else{
      st=b;
      b=n;
      a=st;
      continue;
    }


  }


  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <utility>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    for (int i=0; i<n; i++) cin>>a[i];
    sort(a, a+n);
    cout<<a[n-1]-a[0]<<endl;
    return 0;
}


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

const int N = 300001;
int n, m, tot = 0, q;
int head[N], Next[N], ver[N], num[N];
int ans[N][20] = {};
struct edge{
	int x, y, z;
}a[N];

vector <int> vis[N];

void dfs(int x,int y,int z) {
	if (y == -1) return;
	if (ans[x][y]) return;
	ans[x][y] = z;
	for (int i=0;i<vis[x].size();++i) dfs(vis[x][i], y-1, z);
}

int main() {
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++) {
		int x, y;
		scanf("%d%d",&x,&y);
		vis[x].push_back(y);
		vis[y].push_back(x);
	}
	for (int i=1;i<=n;i++) vis[i].push_back(i);
	scanf("%d",&q);
	for (int i=1;i<=q;i++) {
		int x, y, z;
		scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].z);
	}
	for (int i=q;i;--i) dfs(a[i].x, a[i].y, a[i].z);
	for (int i=1;i<=n;i++) printf("%d\n",ans[i][0]);
	return 0;
}

Measured memory_bytes: 22520
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>

#define ll long long
#define ull unsigned long long
#define mod 1000000007

using namespace std;

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

    int n;
    int* h;
    cin >> n;
    h = new int[n];
    for(int i = 0; i < n; ++i) cin >> h[i];

    int ans = 0;
    int x = 0;
    int currentH = h[n-1];
    for(int i = n-2; i >= 0; --i){
        if(h[i] >= currentH){
            ++x;
        }else{
            ans = max(ans, x);
            x = 0;
        }
        currentH = h[i];
    }
    ans = max(ans, x);

    cout << ans << "\n";
}


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

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

int main(){
  int D;
  cin>>D;
  if(D==25)
    cout<<"Christmas";
  else if(D==24)
    cout<<"Christmas Eve";
  else if(D==23)
    cout<<"Christmas Eve Eve";
  else
    cout<<"Christmas Eve Eve Eve";



  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
int L,b[50],bt,n,x[90],y[90],z[90],m,now;
int main(){
	scanf("%d",&L);
	while (L){
		b[++bt]=L&1;
		L>>=1;
	}
	n=1;now=1;
	fd(i,bt-1,1){
		now<<=1;
		fo(j,1,m) z[j]<<=1;
		x[++m]=++n;y[m]=n-1;z[m]=0;
		x[++m]=n;y[m]=n-1;z[m]=1;
		if (b[i]){
			x[++m]=n;y[m]=1;z[m]=now;
			now^=1;
		}
	}
	printf("%d %d\n",n,m);
	fo(i,1,m) printf("%d %d %d\n",n-x[i]+1,n-y[i]+1,z[i]);
	return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-

def main():
    n = int(input())
    a = list(map(int, input().split()))

    dis = 0
    bef = 0
    for b in a:
        dis += abs(bef - b)
        bef = b
    dis += abs(bef)
    for i in range(n):
        m = 0 if i == 0 else a[i-1]
        l = 0 if i == len(a) - 1 else a[i+1]
        print(dis - (abs(m - a[i]) + abs(a[i] - l) - abs(m - l)))

if __name__ == '__main__':
    main()


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

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

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}


map<int, int> prime_factor(int n)
{
  map<int, int> res;
  for (int i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      ++res[i];
      n /= i;
    }
  }
  if (n != 1)
    res[n] = 1;
  return res;
}

long long mod_pow(long long x, long long n){
	if(n == 0) return 1;
	long long res = mod_pow(x*x % MOD, n / 2);
	if(n & 1) res = res*x % MOD;
	return res;
}

long long mod_inv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 参考
// https://atcoder.jp/contests/abc152/submissions/9607026

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n; cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i];
  
  map<int,int> pf;
  rep(i,n){
    map<int,int> tmp=prime_factor(a[i]);
    for(auto j: tmp){
      pf[j.first]=max(pf[j.first],j.second);
    }
  }
  ll l=1;
  for(auto i: pf){
    l=l*mod_pow(i.first,i.second)%MOD;
  }
  int ans=0;
  rep(i,n){
    ans+=l*mod_inv(a[i],MOD)%MOD;
    ans%=MOD;
  }
  
  cout<<ans<<endl;
  
}

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

using namespace std;

static const int INF = 1e9 + 7;

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

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

template<typename T>
T gcd(T x, T y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	int n, h, w;
	cin >> n;
	cin >> h;
	cin >> w;
	int ans = 0;
	for (int i = 0; i + h <= n; i++) {
		for (int j = 0; j + w <= n; j++) {
			ans++;
		}
	}
	cout << ans << "\n";
}

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


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int asm[] = new int [3];
    asm[0] = a + b;
    asm[1] = a - b;
    asm[2] = a * b;
    Arrays.sort(asm);
    System.out.println(asm[2]);
  }
}

Measured memory_bytes: 21716
main::IO()
main = do
    _ <- getLine
    n <- map read . words <$> getLine
    let evenlist = filter even n
    putStrLn $ if check evenlist then "APPROVED" else "DENIED"

check :: [Int] -> Bool
check (x:xs) = if (mod x 3 ==0) || (mod x 5 ==0)
    then check xs
    else False
check [] = True

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

int main(){
    int a,b,c,num;
    int i=1;
    cin >> a >> b >> c;
    while(true){
        num = (a*i) % b;
        if(num == c){
            cout << "YES" << endl;
            break;
        }
        if(i>=2 && num==(a%b)){
            cout << "NO" << endl;
            break;
        }
        ++i;
    }      

    return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
typedef long long ll;
ll n,m;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m;
    ll ans=n*m/2;
    if(n==1 ||m==1){
        cout<<1<<endl;
        return 0;
    }
    if(n&1 && m&1){
        ans++;

    } 
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

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

int main() {
    int x;
    cin >> x;
    if(x < 1000) cout << "ABC" << endl;
    else cout << "ABD" << endl;
}



Measured memory_bytes: 256
s=str(input())
ans=0
if s==s[::-1] and s[:(len(s)-1)//2]==s[(len(s)-1)//2-1::-1] and s[(len(s)+3)//2-1:]==s[:(len(s)+3)//2-2:-1]:
    ans+=1
print("NYoe s"[ans::2])

Measured memory_bytes: 9088
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
#define mp make_pair
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;
using Ki = vector<vector<int>>;
using Vi = vector<int>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    int n;
    cin>>n;
    vector<pair<string,P>> x(n);
    rep(i,n){
        cin>>x[i].fs>>x[i].sc.fs;
        x[i].sc.sc=i+1;
    }
    sort(all(x));
    vector<vector<P>> a(100);
    int c=0;
    a[0].pb(P(x[0].sc));
    Rep(i,1,n){
        if(x[i-1].fs==x[i].fs){

        }
        else{
            c++;
        }
        a[c].pb(P(x[i].sc));
        // cout<<a[c].fs<<" "<<a[c].sc<<endl;
    }
    c++;
    rep(i,c){
        sort(rall(a[i]));
        for(int j=0;j<a[i].size();j++){
            cout<<a[i][j].sc<<endl;
        }
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

int main()
{
    ll n, m, k;
    cin >> n >> m >> k;
    VL a(n), b(m);
    VL sa(n + 1, 0), sb(m + 1, 0);
    rep(i, n)
    {
        cin >> a[i];
        sa[i + 1] = sa[i] + a[i];
    }
    rep(i, m)
    {
        cin >> b[i];
        sb[i + 1] = sb[i] + b[i];
    }
    ll ans = 0;
    rep(i, n + 1)
    {
        if (sa[i] > k)
        {
            continue;
        }
        ll cur = i;
        cur += upper_bound(ALL(sb), k - sa[i]) - sb.begin() - 1;
        //cerr << i << " " << cur << endl;
        chmax(ans, cur);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9540
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-10
#define PB push_back
#define fi first
#define se second
#define ll long long 
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
typedef pair<double,double> Pdd;
double check_p(double A,double B,double C,double D){
    return (-B+sqrt(D))/(2*A);
}
double check_m(double A,double B,double C,double D){
    return (-B-sqrt(D))/(2*A);
}
int main(){
    int n;
    while(scanf("%d",&n),n){
        vector < Pdd > circle;
        vector < double > R;
        rep(i,n){
            double a,b,r;
            scanf("%lf%lf%lf",&a,&b,&r);
            circle.PB(Pdd(a,b));
            R.PB(r);
        }
        int m;
        scanf("%d",&m);
        rep(i,m){
            double tx,ty,sx,sy;
            scanf("%lf%lf%lf%lf",&tx,&ty,&sx,&sy);
            double m,d;
            double a,b,r;
            bool isstraight = false;
            m = (sy-ty)/(sx-tx);
            d = sy - m*sx;
            if(sx == tx){
                isstraight = true;
            }
            bool flg = false;
            rep(j,n){
                a = circle[j].fi;
                b = circle[j].se;
                r = R[j];
                double A,B,C;
                A = m*m+1;
                B = (-2.0*a+2.0*m*d-2.0*m*b);
                C = a*a+b*b+d*d-2.0*b*d-r*r;
                if(isstraight){
                    if(fabs(a-sx) <= r){
                        flg = true;
                        break;
                    }
                }
                else if(!(B*B-4.0*A*C < EPS)){
                    if(min(sx,tx)-check_p(A,B,C,B*B-4.0*A*C) < EPS  && check_p(A,B,C,B*B-4.0*A*C)-max(sx,tx) < EPS ){
                        flg = true;
                        break;
                    }
                    if(min(sx,tx)-check_m(A,B,C,B*B-4.0*A*C) < EPS && check_m(A,B,C,B*B-4.0*A*C)-max(sx,tx) < EPS){  
                        flg = true;
                        break;  
                    }
                }
            }
            if(flg)puts("Safe");
            else puts("Danger");
        }
    }
    return 0;
}

Measured memory_bytes: 1232
A[1000][1000],I[1000],u[999];i,j;d;F=2;main(N){for(scanf("%d",&N);i<N;++i)for(j=0;j<N-1;)scanf("%d",A[j++]+i);for(;F&2;)for(++d,F=1,i=N;i--;)u[i]<d&&(j=A[I[i]][i]-1)>=0&&u[F&=2,j]<d&&A[I[j]][j]==i+1&&++I[u[i]=u[j]=d,++I[i],F=2,j];printf("%d",F*d-1);}

Measured memory_bytes: 4096