akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
//const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

struct edge{/*重み付き,有向*/
	int to , cost;/*toは接続先*/
	edge(ll to_ ,ll cost_ = 1){ to=to_; cost=cost_; };/*全てのcost=1 <=> 無向グラフ*/
};

typedef vector<vector<edge> > AdjList;
AdjList graph;

typedef pair<int, int> P;

const int INF = 10000000;

vector<int> dist; 
vector<int> prever;

void dijkstra(int n, int s){
    dist = vector<int>(n,INF);
    prever = vector<int>(n,-1);
    dist[s] = 0;

    priority_queue<P, vector<P>, greater<P> > que;
    que.push(P(0,s));

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

int get_path(int t){ //頂点tへの最短路
    return prever[t];
}
ll n,m;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	std::cout<<std::fixed<<std::setprecision(30);
	cin>>n>>m;
	graph.resize(n);
	rep(i,m){
		int ia,ib;
		cin>>ia>>ib;
		ia--;ib--;
		graph[ia].pb(edge(ib,1));
		graph[ib].pb(edge(ia,1));
	}
	dijkstra(n,0);
	Vi v(n);
	rep(i,n-1){
		v[i+1] = prever[i+1]+1;
	}
	print("Yes");
	rep(i,n-1){
		print(v[i+1]);
	}
	return 0;
}

Measured memory_bytes: 13860
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define fi first
#define se second 
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define pp pair<ll,ll> 
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
const ll N = 1e5 + 5 ;
ll t = 1 ;
void solve() 
{
    ll n ;
    cin >> n ;
    vector<pp > v ;
    rep( i , 1 , n + 1 ){
        ll x ;
        cin >> x ;
        v.pb({x,i});
    }
    sort(all(v));
    for( auto i : v )
        cout << i.se << " " ;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
//    cin >> t ;
    while(t--){
        solve();
    }
    return 0 ;
}


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

int main(){
    
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    
    int total = 0;
    while(b <= a && total <= 2*k){
        b = b*2;
        total += 1;
    }
    
    while(c <= b && total <= 2*k){
        c = c*2;
        total += 1;
    }
    //cout << total << endl;
    if(total <= k){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    
    return 0;
    
    
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include <stack>
using namespace std;
#define ll long long
#define pb push_back
int main()
{
	int t1,a=0,t=0,w=0,r=0;
	cin>>t1;
	for(int i=0;i<t1;i++){
		string s;
		cin>>s;
		if(s[0]=='A') a++;
		else if(s[0]=='W') w++;
		else if(s[0]=='T') t++;
		else if(s[0]=='R') r++;
	}
	cout<<"AC x "<<a<<endl;
	cout<<"WA x "<<w<<endl;
	cout<<"TLE x "<<t<<endl;
	cout<<"RE x "<<r<<endl;
	
}

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

/*
 * E - Knapsack 1
 */
public class Main
{

public static void main( String[] args ) throws Exception
{
	final Scanner sc = new Scanner( System.in );//new FileInputStream( "1" ) );
	final int N = sc.nextInt();//総アイテム数
	final int W = sc.nextInt();//最大積載量

	final long[] wArray = new long[ N ];
	final long[] vArray = new long[ N ];

	for( int i = 0; i < N; ++i )
	{
		wArray[ i ] = sc.nextLong();
		vArray[ i ] = sc.nextLong();
	}

	final Map< Long, Long > weightValueMap = new HashMap<>( 1000 );
	//final Map< Long, List< Integer > > weightItemListMap = new HashMap<>( 1000 );// wをキー,それを構成するアイテムのiのリストを値とする

	for( int i = 0; i < N; ++i )
	{
		final long w = wArray[ i ];
		final long v = vArray[ i ];

		//キャッシュしているすべてのwに対して組み合わせを計算する

		Map< Long, Long > update = new HashMap<>();
		final Map< Long, List< Integer > > update2 = new HashMap<>();
		for( Map.Entry< Long, Long > entry : weightValueMap.entrySet() )
		{
			final long cachedWeight = entry.getKey();
			final long cachedValue = entry.getValue();
			final long newWeight = cachedWeight + w;
			final long newValue = cachedValue + v;
			if( newWeight <= W )
			{
				final boolean isBetter = isBetter( weightValueMap, newWeight, newValue );
				if( isBetter )
				{
					update.put( newWeight, newValue );
					/*
					List< Integer > itemList = weightItemListMap.get( newWeight );
					if( itemList == null )
					{
						itemList = new ArrayList<>();
						update2.put( newWeight, itemList );
					}
					itemList.addAll( weightItemListMap.get( cachedWeight ) );
					itemList.add( i );
					*/
				}
			}
		}

		weightValueMap.putAll( update );

		clean( weightValueMap );
		//weightItemListMap.putAll( update2 );

		//このアイテム単体について処理
		if( w <= W )
		{
			final boolean isBetter = isBetter( weightValueMap, w, v );
			if( isBetter )
			{
				weightValueMap.put( w, v );
				/*
				List< Integer > itemList = weightItemListMap.get( w );
				if( itemList == null )
				{
					itemList = new ArrayList<>();
					weightItemListMap.put( w, itemList );
				}
				itemList.add( i );
				*/
			}
		}

		weightValueMap.putAll( update );
	}

	//答えを求める
	long max = 0;
	for( Map.Entry< Long, Long > entry : weightValueMap.entrySet() )
	{
		final long v = entry.getValue();
		if( v > max )
		{
			max = v;
		}
	}
	p( max );
}

public static void clean( final Map< Long, Long > weightValueMap )
{
	//重さが高く、価値が低い情報を削除する
	final TreeSet< Long > weightSet = new TreeSet< Long >();
	weightSet.addAll( weightValueMap.keySet() );
	long maxValue = 0;
	for( Long weight : weightSet )
	{
		long value = weightValueMap.get( weight );
		if( value < maxValue )
		{
			weightValueMap.remove( weight );
		}
		else
		{
			maxValue = value;
		}
	}
}

public static boolean isBetter( final Map< Long, Long > weightValueMap, final long w, final long v )
{
	final Long cachedValue = weightValueMap.get( w );
	if( cachedValue == null || cachedValue < v )
	{
		return true;
	}
	else
	{
		return false;
	}
}

public static void p( Object o )
{
	System.out.println( o );
}

}

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

int main(){
  int n, m;  scanf("%d %d", &n, &m);
  m = n - 1 + m;
  int **graph, to[100005] = {0};
  graph = (int**)malloc(sizeof(int*)*(n+10));
  for(int i=0; i<n+10; i++)
    graph[i] = (int*)malloc(sizeof(int)*(m));
  while(m--){
    int a, b;  scanf("%d %d", &a, &b);
    graph[a][++graph[a][0]] = b;
    to[b]++;
  }

  int queue[100005], front = 0, rear = 0;
  for(int i=1; i<=n; i++)
    if(!to[i])  queue[rear++] = i;

  int topo[100005] = {0};
  while(front != rear){
    int now = queue[front++];
    topo[++topo[0]] = now;
    for(int i=1; i<=graph[now][0]; i++)
      if(--to[graph[now][i]] == 0)
	queue[rear++] = graph[now][i];
  }
  
  int ans[100005] = {0};
  for(int i=1; i<=topo[0]; i++)
    for(int j=1; j<=graph[topo[i]][0]; j++)
      ans[graph[topo[i]][j]] = topo[i];

  for(int i=1; i<=n; i++)
    printf("%d\n", ans[i]);

  return 0;
}


Measured memory_bytes: 480456
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String s = br.readLine();
            boolean flag = false;
            HashMap<String, String> hm = new HashMap<String, String>();
            for (int i = 0; i < s.length(); i++) {
                String tmp = s.substring(i, i + 1);
                if (hm.containsKey(tmp)) {
                    System.out.println("no");
                    flag = true;
                    break;
                } else {
                    hm.put(tmp, tmp);
                }
            }
            if (!flag) {
                System.out.println("yes");
            }
       } catch (IOException e) {
            e.printStackTrace();
       }
    }
}


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

int main() {
  int m, f, r;
  vector<char> grade(10000);
  int idx = 0;
  while(true) {
    int score = 0;
    cin >> m >> f >> r;
    if(m == -1 && f == -1 && r == -1) {
      grade.at(idx) = '0';
      break;
    }
    if(m == -1 || f == -1 || m + f < 30) grade.at(idx) = 'F';
    else if(80 <= m + f) grade.at(idx) = 'A';
    else if(65 <= m + f && m + f < 80) grade.at(idx) = 'B';
    else if( (50 <= m + f && m + f < 65) || 50 <= r) grade.at(idx) = 'C';
    else if(30 <= m + f && m + f < 50) grade.at(idx) = 'D';
    idx++;
  }
  idx = 0;
  while(grade.at(idx) != '0') {
    cout << grade.at(idx) << endl;
    idx++;
  }
}


Measured memory_bytes: 3100
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

typedef pair<int, int> P;
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define _1 first
#define _2 second
#define pb push_back
#define mod 1000000007LL
#define INF 105000000000

const int maxn = 1e5 + 10;



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

	int x, a, b;
	cin >> x >> a >> b;

	if (a >= b) Print("delicious");
	else if (b - a <= x) Print("safe");
	else Print("dangerous");

	return 0;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
#define pb(n,m) n.push_back(m)
#define pi(n,m) n.insert(n.begin(),m);
#define ee(n) n.erase(n.end()-1)
#define eb(n) n.erase(n.begin())
using namespace std;
//using bint=boost::multiprecision::cpp_int;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int n,m,c=0,d=0,ans=100000000,r=1; cin>>n>>m;
  rep(i,0,n) r*=2;
  vector<int> pro(n),sco(n);
  rep(i,0,n) cin>>pro[i]>>sco[i];
  rep(i,0,r){
    c=0; d=0; 
    int a=i,b=i;
    rep(i,0,n){
      if(a%2==1){
        c+=100*(i+1)*pro[i];
        c+=sco[i];
        d+=pro[i];
      }
      a/=2;
    }
    if(c>=m){ans=min(ans,d); continue;}
    rep(i,0,n){
      if(b%2==0){
        int x=m-c;
        if(x-100*(i+1)*(pro[i]-1)>0){b/=2; continue;}
        d+=(x+99)/(100*(i+1));
        ans=min(ans,d);
      }
      b/=2;
    }
  }
  co(ans);
  
  return 0;
}

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

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

using namespace std;

int main(){
  int a,b;
  cin>>a>>b;
  valarray<int> n = {a+b, a-b, a*b};
  
  cout<<n.max();
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 500000
int h;

void maxHeapify(int *a, int i) {
  int tmp, largest = 0;
  int left = 2*i;
  int l = left;
  int right = 2*i + 1;
  int r = right;

  //????????????????????????????????§???????????§????????????????????¶
  if (l <= h && a[l] > a[i]) largest = l;
  else largest = i;
  if (r <= h && a[r] > a[largest]) largest = r;

  if (largest != i) {
    tmp = a[i];
    a[i] = a[largest];
    a[largest] = tmp;
    maxHeapify(a, largest);
  }
}

void buildMaxHeap(int *a) {
  int i;
  for(i=h/2;i>=1;i--) {
    maxHeapify(a, i);
  }
}


int main(int argc, char const *argv[]) {
  /* code */
  int  a[MAX+1], i, n;
  scanf("%d", &h);
  for(i=1;i<=h;i++) {
    scanf("%d", &a[i]);
  }
  buildMaxHeap(a);
  for(i=1;i<=h;i++) {
    printf(" %d", a[i]);
  }
  printf("\n");


  return 0;
}

Measured memory_bytes: 3680
n = int(input())
a = [0] + list(map(int, input().split())) + [0]

nums = [0]*(n+1)
for i in range(1, n+2): nums[i-1] = abs(a[i] - a[i-1])

ans = sum(nums)
for i in range(1,n+1):
  print(ans - nums[i-1]-nums[i]+abs(a[i+1]-a[i-1]))

Measured memory_bytes: 20608
program prob2
    implicit none
    integer(8) :: n, t, a, ans, i, tmp
    integer(8), allocatable :: h(:)
    
    read(*,*) n
    read(*,*) t, a  
    allocate(h(n))
    
    read(*,*) h
    
    ans = 1
    tmp = abs(1000 * t - 6 * h(1) - 1000 * a)
    do i = 2, n
        if(tmp > abs(1000 * t - 6 * h(i) - 1000 * a)) then
            tmp = abs(1000 * t - 6 * h(i) - 1000 * a)
            ans = i
        end if
    end do 
    write(*,*) ans
    deallocate(h)    

    stop
contains
end program prob2

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

int64_t gcd(int64_t a, int64_t b) {
    if (a < b) {
        return gcd(b, a);
    }
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

int main() {
    int64_t a, b;
    cin >> a >> b;
    int64_t c = gcd(a, b);
    int64_t d = c;
    int64_t ans = 1;
    int64_t i = 2;
    while (i * i <= d) {
        if (c % i == 0) {
            while (c % i == 0) {
                c /= i;
            }
            ans++;
        }
        i++;
    }
    if (c > 1) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 504
#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define dash 12
#endif

// Loops --------------------------------------------------------------------

#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)

// Extra --------------------------------------------------------------------

#define ull                 unsigned long long int
#define ll                  long long int
#define ld                  long double
#define endl                '\n'
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()

// Template -----------------------------------------------------------------

// multiple input
template <typename T> 
inline void inp(T &any) {
    cin >> any;
}
template <typename T, typename... U> 
inline void inp(T &a, U &...b) {
    cin >> a; inp(b...);
}
// scan vector
template <typename T> 
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U> 
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second; 
    return in;
}

// Solve --------------------------------------------------------------------

void solve(ll &T)
{
    ll a,b,c,d;
    inp(a,b,c,d);

    ll ans = 0;
    if(a<d) {
        ans += a;
        d -= a;
        if(b<d) {
            d -= b;
            if(c<d) {
                ans -= c;
            }
            else {
                ans -= d;
            }
        }
    }
    else {
        ans += d;
    }
    std::cout<<ans<<"\n";
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    loop(Case,1,t+1)
    {
        d(Case);
        solve(Case);
    }
    return 0;
}

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

struct cmd{
  int line;
  string p;
  vector<string>v;
};
vector<cmd> A;
map<int,int> idx;
map<string,int> var;

bool isNum(const string &a){return isdigit(a[0]);}
int StoI(const string &a){
  int res=0;
  for(int i=0;i<a.size();i++)res=res*10+a[i]-'0';
  return res;
}

int ADD(string &a,string &b){
  int res=0;
  res+=var.count(a)? var[a]:StoI(a);
  res+=var.count(b)? var[b]:StoI(b);
  return res;
}

int SUB(string &a,string &b){
  int res=0;
  res+=var.count(a)? var[a]:StoI(a);
  res-=var.count(b)? var[b]:StoI(b);
  return res;
}

int SET(string &a){return var.count(a)? var[a]:StoI(a);}

bool start(){
  int pos = 0,cnt=0;
  while(1){
    if(pos==(int)A.size())return 1;
    if(cnt++>50000000) return 0;
    
    cmd &a = A[pos];
    string p = a.p;
    if(p=="HALT") return 1;
    
    if(p=="ADD") {
      int res=ADD(a.v[1],a.v[2]);
      if(res<0||res>=16) return 1;
      var[a.v[0]]=res;
    }
    else if(p=="SUB"){
      int res=SUB(a.v[1],a.v[2]);
      if(res<0||res>=16) return 1;
      var[a.v[0]]=res;
    }
    else if(p=="SET"){
      int res=SET(a.v[1]);
      if(res<0||res>=16) return 1;
      var[a.v[0]]=res;
    }
    else if(p=="IF"&&var[a.v[0]]){
      if(!idx.count(StoI(a.v[1])))return 1;
      pos = idx[StoI(a.v[1])]-1;
    }
    pos++;
  }
}


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

  A.resize(n);
  for(int i=0;i<n;i++){
    cin>>A[i].line>>A[i].p;
    idx[A[i].line]=i;
    if(A[i].p=="HALT");
    else if(A[i].p=="ADD"||A[i].p=="SUB")A[i].v.resize(3);
    else A[i].v.resize(2);
    
    for(int j=0;j<(int)A[i].v.size();j++) {
      cin>>A[i].v[j];
      if(!isNum(A[i].v[j]))var[A[i].v[j]] = 0;
    }
  }

  
  if(!start())cout<<"inf"<<endl;
  else
    for(map<string,int>::iterator it=var.begin();it!=var.end();it++)
      cout<<it->first<<"="<<it->second<<endl;
  
  return 0;
}

Measured memory_bytes: 3220
using System.Numerics;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = long.Parse(line[0]);
        var x = long.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, long.Parse);
        var b = new long[n + 1];
        b[1] = a[0];
        for (int i = 2; i <= n; i++)
            b[i] = b[i - 1] + a[i - 1];
        BigInteger res = getAns(b, n, x);
        Console.WriteLine(res);

    }
    public static BigInteger getAns(long[] b, long n, long x)
    {
        BigInteger ans = long.MaxValue;
        for (int i = 1; i <= n; i++)
        {
            BigInteger tsum = 0;
            var p = 0;
            var st = n;
            while (true)
            {
                if (st - i < 0) { tsum += (b[st] - b[0]) * getCo(p); break; }
                else tsum += (b[st] - b[st - i]) * getCo(p);
                st = st - i;
                p++;
            }
            tsum += (n + i) * x;
            ans =BigInteger.Min(ans, tsum);
        }
        return ans;
    }
    public static int getCo(int n) => n == 0 ? 5 : 5 + (n - 1) * 2;
}


Measured memory_bytes: 35292
#include <string.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
	char s[4];
	scanf("%s",s);
	int i,max=0,m=0;
	for(i=0;s[i];i++){
		if(s[i]=='R'||s[i]=='r')
			m++;
		else m=0;
		if(m>max)
			max=m;
	}
	printf("%d\n",max);
}

Measured memory_bytes: 2120
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const int INF=1e9;
int main(){
	int N,A;cin>>N>>A;
	int X[N];
	rep(i,0,N) cin>>X[i];
	long dp[N][N][2501]={};
	rep(i,0,N){
		rep(j,0,i+1) dp[i][0][X[j]]++;
		rep(j,1,i+1){
			rep(k,0,2501){
				if(i!=j) dp[i][j][k]+=dp[i-1][j][k];
                if(k>X[i]) dp[i][j][k]+=dp[i-1][j-1][k-X[i]];
			}
		}
	}
	long sum=0;
	rep(j,1,N+1){
		sum+=dp[N-1][j-1][j*A];
        //cout<<dp[N-1][j-1][j*A]<<endl;
	}cout<<sum<<endl;
}

Measured memory_bytes: 49152
#include <algorithm>
#include <iostream>
#include <vector>

#include <cstdlib>

using std::abs;
using std::cin;
using std::cout;
using std::endl;
using std::max;
using std::min;
using std::vector;

static vector<int> A;
static vector<long> accum;

// A[ [top, bot) ] の合計
static long
sum(int top, int bot)
{
  return accum[bot] - accum[top];
}

static void
fit(int &pos, int top, int bot)
{
  long lsum = sum(top, pos);
  long rsum = sum(pos, bot);
  long diff = abs(lsum - rsum);
  while (pos < bot - 1)
  {
    long new_lsum = sum(top, pos + 1);
    long new_rsum = sum(pos + 1, bot);
    long new_diff = abs(new_lsum - new_rsum);
    if (diff <= new_diff)
    {
      break;
    }
    diff = new_diff;
    pos++;
  }
}

int
main()
{
  int N;
  cin >> N;
  A.resize(N);
  accum.resize(N + 1);
  accum[0] = 0;
  {
    long total = 0;
    for (int i = 0; i < N; i++)
    {
      int val;
      cin >> val;
      A[i] = val;
      total += val;
      accum[i + 1] = total;
    }
  }
  int l = 1;
  int r = 3;
  long min_diff = -1;
  for (int c = 2; c < N - 1; c++)
  {
    fit(l, 0, c);
    fit(r, c, N);
    long P = sum(0, l);
    long Q = sum(l, c);
    long R = sum(c, r);
    long S = sum(r, N);
    long diff = max({P, Q, R, S}) - min({P, Q, R, S});
    min_diff = (min_diff == -1 ? diff : min(diff, min_diff));
  }
  cout << min_diff << endl;
  return 0;
}


Measured memory_bytes: 2560
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int N = scan.nextInt(), L = scan.nextInt();

        String[] S = new String[N];
        for (int i=0; i<N; i++) {
            S[i] = scan.next();
        }

        Arrays.sort(S);
        System.out.println(String.join("", S));
    }
}


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

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

    string s[h];

    for (int i = 0; i < h; i++) cin >> s[i];

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] != '#') {
                continue;
            }

            if (i - 1 >= 0 && s[i - 1][j] == '#') continue;
            if (i + 1 <  h && s[i + 1][j] == '#') continue;
            if (j - 1 >= 0 && s[i][j - 1] == '#') continue;
            if (j + 1 <  w && s[i][j + 1] == '#') continue;

            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int i=0; i<(n);i++)
typedef long long ll;

int main(){
    int n; cin >> n;
    string s; cin >> s;
    string t; cin >> t;
    string ans="";
    rep(i,n){
        ans += s[i];
        ans += t[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- Coding: utf-8 -*-
import numpy as np
S = raw_input()
first  = int(S[:2])
second = int(S[2:])

if first==0:
    if (second==0)|(second>=13):
        print "NA"
    else:
        print "YYMM"
elif (first>0) & (first<13):
    if (second > 0) & (second<13):
        print "AMBIGUOUS"
    else:
        print "MMYY"
else:
    if (second == 0)|(second>=13):
        print "NA"
    if (second>0) & (second<13):
        print "YYMM"


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

int main(){
    int n;
     cin >> n;
     vector<int> data(n);
     for(int i = 0; i < n; i++){
         cin >> data[i];
     }
     
     vector<int> arr(n,0);
     for(int i = 1; i < n; i++){
        if(data[i-1] >= data[i]){
            arr[i] = arr[i-1] + 1;
        }else{
            arr[i] = 0;
        }
     }
     
    cout << *max_element(arr.begin(), arr.end()); 
}

Measured memory_bytes: 1024
n = int(input())
l = [list(map(int,input().split())) for _ in range(n-1)]
ans = []
for i in range(len(l)):
    m = l[i][1]
    for j in range(i,len(l)):
        if m<l[j][1]:
            m = l[j][1]+l[j][0]
        elif m==l[j][1] or (m-l[j][1])%l[j][2]==0:
            m += l[j][0]
        else:
            next = l[j][2]-m%l[j][2]
            m += next+l[j][0]
    ans.append(m)
ans.append(0)
for i in ans:
    print(i)

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if(N==1) {
			System.out.println("Hello World");
		}else {
			int A = sc.nextInt();
			int B = sc.nextInt();
			System.out.println(A+B);
		}
		sc.close();
	}

}

Measured memory_bytes: 35684
package main
import "fmt"
func main(){
    // Your code here!
    var x, y, z int
    fmt.Scan(&x, &y, &z)
    var t int
    t = x
    x = y
    y = t
    
    t = x
    x = z
    z = t
    fmt.Println(x, y, z)
}


Measured memory_bytes: 512
#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<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
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 Per(i,sta,n) for(int i=n-1;i>=sta;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++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n;
ll d,a;
LP m[200010];

void solve(){
    cin >> n >> d >> a;
    rep(i,n){
        cin >> m[i].first >> m[i].second;
    }
    sort(m,m+n);
    set<LP> se;
    ll ans=(m[0].second-1)/a+1;
    ll k=((m[0].second-1)/a+1)*a;
    se.insert(LP(m[0].first+2*d,k));
    //cout << ans << endl;
    Rep(i,1,n){
        //cout << m[i].first << endl;
        while((*se.begin()).first<m[i].first){
            k-=(*se.begin()).second;
            se.erase(se.begin());
            if(se.empty()) break;
        }
        int num=0;
        if (m[i].second-k>0) num=((m[i].second-k-1)/a+1);
        ans+=num;
        se.insert(LP(m[i].first+2*d,a*num));
        //cout << k << " " << ans << endl;
        k+=a*num;
    }
    cout << ans << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

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

using namespace std;

int main()
{
    long long ans=0,a,b,n;
    cin >>n>>a>>b;
    long long q=n/(a+b),r=n%(a+b);
    ans=min(a,r)+q*a;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#if defined _MSC_VER //if using Visual Studio
#include "std_lib_facilities.h" //include this local header file
#include <queue>
#else
#include<bits/stdc++.h> //include this non portable headerfile 
using namespace std; //and the standard namespace
#endif
#pragma warning(disable:4996)//necessary if we want to use freopen() 

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vld = vector<ld>;
using pll = pair<ll, ll>;
using vpl = vector<pll>;

#define dx first
#define dy second
#define forx(n) for (ll x=1;x<=n;x++)
#define fory(n) for (ll y=1;y<=n;y++)
#define rall(v) (v).rbegin(),(v).rend()
#define all(v) (v).begin(),(v).end()
#define fork(n) for (ll k=0;k<n;k++)
#define forj(n) for (ll j=0;j<n;j++)
#define fori(n) for (ll i=0;i<n;i++)
#define in(t) ll t; cin >> t; while(t--)
#define fin(n) ll n; cin >> n; fori(n)
#define trav(v) for(auto &i:v)
#define pb(x) push_back(x)

template <class T>
void vb(vector<T>&v) {
	T a;
	cin >> a;
	v.pb(a);
}
int main() {
	ios::sync_with_stdio(false); cin.tie(0);
#if defined _MSC_VER 
	freopen("Text.txt", "r", stdin);//read all input form this local file 
#endif
	vll cost, dist;
	ll n,k;
	cin >> n>>k;
	fori(n) {
		vb(cost);
		dist.pb(1e9);
	}
	//trav(cost)cout << i << " ";

	dist[0] = 0;
	fori(cost.size() - 1) {
		forx(k) {
			if (i + x < cost.size()) {
				ll m= min(dist[i + x], dist[i] + abs(cost[i + x] - cost[i]));
				dist[i + x] = m;
			}
		}
	}
	//trav(dist)cout << i << " ";
	cout << dist[dist.size() - 1];
}

Measured memory_bytes: 2036
n, k = map(int, input().split())
a = [int(input()) for i in range(n)]
a.sort()
m = a[n - 1] - a[0]
for i in range(n - k + 1):
    if a[i + k - 1] - a[i] < m:
        m = a[i + k - 1] - a[i]
print(m)


Measured memory_bytes: 7384
#include<stdio.h>
int main(){
  int i;
  int a[25],n,o;
  for(;;){
    scanf("%d",&n);
    if(n==0)
      break;
    for(i=0;i<n;i++)
      scanf("%d",&a[i]);
    o=32;
    for(i=0;o;i++){
      if(o%5)
	o-=o%5-1;
      else
	o-=4;
      printf("%d\n",o);
      o-=a[i%n];
      if(o<0)
	o=0;
      printf("%d\n",o);
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;
ll dp[43][432][432];
int main() {
	ll N,Ma,Mb;
	cin>>N>>Ma>>Mb;
	rep(i,N+2)rep(j,410)rep(k,410){
		if(i == 0&&j == 0&&k == 0)dp[i][j][k] = 0;
		else dp[i][j][k] = INF;
	}
	rep(i,N){
		ll a,b,c;
		cin>>a>>b>>c;
		rep(j,410)rep(k,410){
		//i番目を選ぶとき
		dp[i+1][j+a][k+b] = min(dp[i+1][j+a][k+b], dp[i][j][k] + c);
		//i番目を選ばないとき
		dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k]);
		}
	}
	ll ans = INF;
	rep1(i,N+1)rep1(j,410)rep1(k,410){
		//j:k = Ma:Mbであり
		if(j*Mb == k*Ma){
/*			if(dp[i][j][k] != INF){
				cerr<<"i, j = "<<j<<", "<<k<<endl;
				cerr<<"dp[i][j][k] = "<<dp[i][j][k]<<endl;
			}*/
			ans = min(ans, dp[i][j][k]);
		}
	}
	if(ans == INF)ans = -1;
	cout<<ans<<endl;
}

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

int main() {
  int k, n, d(0);
  cin >> k >> n;
  int curr;
  cin >> curr;
  int start(curr + k), prev(curr);
  for (int i = 1; i < n; ++i) {
    cin >> curr;
    d = max(d, curr - prev);
    prev = curr;
  }
  d = max(d, start - curr);
  cout << k - d << '\n';
  return 0;
}

Measured memory_bytes: 256
const input=require("fs").readFileSync("/dev/stdin","utf8"),lines=input.trim().split("\n");let i=0,n=2,max=2;for(;line=lines.shift();){if(i%2==0){if([n,max]=line.split(" ").map(Number),0===n&&0===max)break}else{const i=line.split(" ").map(Number);let e=0;for(let t=0;t<n;t++)for(let l=0;l<n;l++){if(!i[t]||!i[l]||t===l)continue;const n=i[t]+i[l];n<=max&&n>e&&(e=n)}console.log(`${e||"NONE"}`)}i++}


Measured memory_bytes: 18268
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		String[] strs = str.split(" ");
		int a = Integer.parseInt(strs[0]);
		int b = Integer.parseInt(strs[1]);
		double C = 2 * Math.PI * (Integer.parseInt(strs[2])) / 360;

		double S, L, h;
		S = a * b * Math.sin(C) / 2;
		L = a + b + Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(C));
		h = 2 * S / a;

		System.out.println(S);
		System.out.println(L);
		System.out.println(h);
	}
}


Measured memory_bytes: 24584
/*
    AUTHOR:hruday pabbisetty
    NIT ROURKElA
*/
#include <bits/stdc++.h>
#include <tr1/unordered_map>
using namespace std;
using namespace std::tr1;
#define opt ios_base::sync_with_stdio(0)
#define lli long long int
#define ulli unsigned long long int
#define I int
#define S string
#define D double
#define rep(i,a,b) for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define in(n) scanf("%lld",&n)
#define in2(a,b) scanf("%lld %lld",&a,&b)
#define in3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define out(n) printf("%lld\n",n)
#define inu(a) scanf("%lld",&a)
#define outu(a) printf("%llu",a)
#define ins(s) scanf("%s",&s)
#define outs(s) printf("%s",s)
#define mod 1000000007
#define inf 100000000000000
typedef long long       ll;
typedef pair<lli,lli>  plli;
typedef vector<lli>     vlli;
typedef vector<ulli>    vulli;
typedef vector<ll>      vll;
typedef vector<string>  vs;
typedef vector<plli>     vplli;
#define MM(a,x)  memset(a,x,sizeof(a));
#define ALL(x)   (x).begin(), (x).end()
#define P(x)       cerr<<"{"#x<<" = "<<(x)<<"}"<<endl;
#define P2(x,y)       cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<"}"<<endl;
#define P3(x,y,z)  cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<"}"<<endl;
#define P4(x,y,z,w)cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<", "#w" = "<<(w)<<"}"<<endl;
#define PP(x,i)     cerr<<"{"#x"["<<i<<"] = "<<x[i]<<"}"<<endl;
#define TM(a,b)     cerr<<"{"#a" -> "#b": "<<1000*(b-a)/CLOCKS_PER_SEC<<"ms}\n";
#define UN(v)    sort(ALL(v)), v.resize(unique(ALL(v))-v.begin())
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define sz() size()
#define nl cout<<"\n"
#define MX1 100005
#define MX2 1000005
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
lli dx[]={0,0,-1,1,-1,-1,1,1};
lli dy[]={1,-1,0,0,1,-1,-1,1};
lli power(lli a,lli b)
    {
    lli value;
    if(b==0)
        {
        return 1;
    }
    else if(b%2==0)
        {
        value=power(a,b/2)%mod;
        return(value*value)%mod;
    }
    else
        {
        value=power(a,b/2)%mod;
        return ((a*value)%mod*(value))%mod;
    }
}
int main()
{
      /*  #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif*/
    opt;
    lli k,a,b;
    cin>>k>>a>>b;
    if(b>=a)
    {
        if(k>a)
        {
            cout<<-1;

        }
        else
        {
            cout<<1;
        }
        exit(0);
    }
    lli l=0,r=k/(a-b)+1,ans=-1;
    while(l<=r)
    {
        lli mid=(l+r)/2;
        if(a+(mid*(a-b))>=k)
        {
            ans=2*mid+1;
            r=mid-1;
        }
        else
        {
            l=mid+1;
        }
    }
    cout<<ans;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    int x = Integer.parseInt(str[2]);
    System.out.println(a<=x && x<=a+b?"YES":"NO");
  }
}

Measured memory_bytes: 32776
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_set>
#include <bitset>
#include <time.h>
#include <limits.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) (int)x.size()
#define sz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
typedef tuple<int, int, int> t3;

int N;
t3 p[1010];
ll dp[1010][10010];

int main() {
	scanf("%d", &N);
	for(int i=1;i<=N;i++) {
		int w, s, v; scanf("%d%d%d", &w, &s, &v);
		p[i] = t3(w, s, v);
	}
	sort(p+1, p+1+N, [](t3 a, t3 b) { return get<0>(a) + get<1>(a) < get<0>(b) + get<1>(b);} );
	rep(i, 1010) rep(j, 10010) dp[i][j] = -1e18;
	dp[0][0] = 0;
	for(int i=1;i<=N;i++) {
		int w, s, v;
		tie(w, s, v) = p[i];
		for(int j=0;j<=10001;j++) {
			dp[i][j] = max(dp[i][j], dp[i-1][j]);
			if(s >= j) dp[i][min(j+w, 10001)] = max(dp[i][min(j+w, 10001)], dp[i-1][j] + v);
		}
	}
	ll ans = -1e18;
	for(int i=0;i<=10001;i++) ans = max(ans, dp[N][i]);
	printf("%lld\n", ans);
	return 0;
}


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

int main()
{
   string str;
   cin>>str;
   for(int i=0;i<str.length();i++)
   {
      if(str[i] == ',')
         cout<<" ";
      else
         cout<<str[i];
   }
   
   return 0;
   
}

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

int main() {
	int H, W;

	cin >> H >> W;
	vector<string> S( H );
	for( int i = 0; i < H; i++ ) {
		cin >> S[i];
	}

	vector<vector<int>> L( H, vector<int>( W ) );
	vector<vector<int>> R( H, vector<int>( W ) );
	vector<vector<int>> U( H, vector<int>( W ) );
	vector<vector<int>> D( H, vector<int>( W ) );
	for( int i = 0; i < H; i++ ) {
		for( int j = 0; j < W; j++ ) {
			if( S[i][j] == '.' ) {
				if( j == 0 ) {
					L[i][j] = 1;
				}
				else {
					L[i][j] = L[i][j - 1] + 1;
				}
			}
		}
	}
	for( int i = 0; i < H; i++ ) {
		for( int j = W - 1; j >= 0; j-- ) {
			if( S[i][j] == '.' ) {
				if( j == W - 1 ) {
					R[i][j] = 1;
				}
				else {
					R[i][j] = R[i][j + 1] + 1;
				}
			}
		}
	}
	for( int i = 0; i < W; i++ ) {
		for( int j = 0; j < H; j++ ) {
			if( S[j][i] == '.' ) {
				if( j == 0 ) {
					U[j][i] = 1;
				}
				else {
					U[j][i] = U[j - 1][i] + 1;
				}
			}
		}
	}
	for( int i = 0; i < W; i++ ) {
		for( int j = H - 1; j >= 0; j-- ) {
			if( S[j][i] == '.' ) {
				if( j == H - 1 ) {
					D[j][i] = 1;
				}
				else {
					D[j][i] = D[j + 1][i] + 1;
				}
			}
		}
	}
	int ans = 0;
	for( int i = 0; i < H; i++ ) {
		for( int j = 0; j < W; j++ ) {
			ans = max( ans, L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3 );
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 69120
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
int n,k;
vector<int>o;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        o.push_back(a*60+b);
    }
    cin>>k;
    for(int i=0;i<k;i++){
        int a,b;
        cin>>a>>b;
        o.push_back(a*60+b);
    }
    sort(o.begin(),o.end());
    o.erase(unique(o.begin(),o.end()),o.end());
    for(int i=0;i<o.size();i++){
        printf("%d:%02d",o[i]/60,o[i]%60);
        if(i!=o.size()-1)printf(" ");
    }
    printf("\n");
}


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

using namespace std;
int main()
{
	int n, time, ans = 1000;
	bool flag = false;

	cin >> n >> time;
	int c[n], t[n];
	for(int i = 0; i < n; i++)
	{
		cin >> c[i] >> t[i];
		if(t[i] <= time)
		{
			ans = min(ans, c[i]);
			flag = true;
		}
	}
	if (flag == true)
	{
		cout << ans << endl;
	}
	else
	{
		cout << "TLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define int long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf INT_MAX
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int n;
int a[100010];
int ans;
bool flg;
signed main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]==0){
			flg=0;
			continue;
		}
		if(a[i]%2==0){
			ans+=a[i]/2;
		}else{
			if(flg)ans+=a[i]/2+1,flg=0;
			else ans+=a[i]/2,flg=1;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
int x, y;
ll modPow(ll n, int m) {
    if (m == 0) return 1;
    ll ret = modPow(n, m/2);
    ret = ret * ret % MOD;
    if (m % 2) ret = n * ret % MOD;
    return ret; 
}
ll comb(int n, int k){
    if (n - k < k) k = n - k;
    ll ret = 1;
    for (ll i = 1; i <= k; i++) {
        ret = ret * (n - i + 1) % MOD;
        ret = ret * modPow(i, MOD - 2) % MOD;
    }
    return ret;
}
int main() {
    cin >> x >> y;
    bool cannot = true;
    int elbow_x, elbow_y;
    for (int i = 0; i <= x; i += 2) {
        int j = i / 2;
        if ((x - i) * 2 == y - j) {
            cannot = false;
            elbow_x = i / 2, elbow_y = (y - j) / 2;
        }
    }
    if (cannot) {
        cout << 0 << endl;
        return 0;
    }
    cout << comb(elbow_x + elbow_y, elbow_x) << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
inline int read() 
{   
	int x=0,f=1;char c=getchar();  
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}   
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}   
	return x*f; 
}     
int n;
int main() 
{ 
	n=read();
	int k=n%1000;
	if(k==0)
		cout<<0<<endl;
	else cout<<1000-k<<endl;
	return 0;
} 

Measured memory_bytes: 3632
# coding:utf-8

import sys
# from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    b = SI()
    tmp = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}

    return tmp[b]


print(main())


Measured memory_bytes: 3060
n,m = map(int,input().split())
breaks = [0] * (n + 1)
for i in range(m):
    a = int(input())
    breaks[a] = 1

mod = (10**9)+7
dp = [0] * (n + 1)
dp[n] = 1
for i in reversed(range(n)):
    if(breaks[i] == 1):
        dp[i] = 0
        continue
    if(i == n - 1):
        dp[i] = dp[i+1]
    else:
        dp[i] = dp[i+1] + dp[i+2]
print(dp[0] % mod)

Measured memory_bytes: 460788
import java.util.ArrayList;
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	   int n=sc.nextInt();
	   int x=sc.nextInt();
	   int ar[]=new int[n];
	   for(int i=0;i<n;i++)
	   ar[i]=sc.nextInt();long count=0;
	   for(int i=0;i<n-1;i++)
	   {
	       int dif=ar[i]+ar[i+1]-x;
	       if(dif>0)
	       {
	           if(ar[i+1]>=dif)
	           {
	               ar[i+1]-=dif;
	           }
	           else{
	               ar[i+1]=0;
	               ar[i]-=(dif-ar[i+1]);
	           }
	           count+=dif;
	       }
	       else
	       continue;
	   }
	   System.out.println(count);}}
	   
	   
	   

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

using namespace std;

int n;
long double p[3010],f[3010];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		double temp;
		scanf("%lf",&temp);
		p[i]=(long double)temp;
	}
	f[0]=(long double)1.0;
	for(int i=1;i<=n;i++){
		for(int j=i;j;j--)
			f[j]=f[j-1]*p[i] + f[j]*((long double)1.0-p[i]);
		f[0]*=(long double)1.0-p[i];
	}
	long double sum=(long double)0.0;
	for(int i=(n+1)>>1;i<=n;i++)
		sum+=f[i];
	printf("%.15lf\n",(double)sum);

	return 0;
}

Measured memory_bytes: 384
#include<iostream>
    #include<vector>
    #include<math.h>
    #include<iomanip>
    using namespace std;
     
     
    int main(){
    	string s;
    	cin>>s;
    	int N=s.size();
     
    	long long ans=0;
     
    	for(int bit=0;bit<(1<<(N-1));bit++){
    		long long sum=0;
     
    		for(int j=0;j<N-1;j++){
    			sum *=10;
    			sum +=s.at(j)-'0';
     
    			if(bit &(1<<j)){
    				ans+=sum;
    				sum=0;
    			}
    		}
     
    		sum *= 10;
    		sum += s.back()-'0';
    		ans += sum;
    	}
    	cout << ans <<endl;
     
    	return 0;
     
    }

Measured memory_bytes: 3600
#!/usr/bin/env python3
import sys
import fractions

## 最小公倍数
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def solve(A: int, B: int, C: int, D: int):

    # n以下のCでもDでも割り切れない数を返す
    def counter(n):
        c_ct=n//C
        d_ct =n//D
        cd_ct=n//lcm(C,D)
        return n-c_ct-d_ct+cd_ct
    
    print(counter(B)-counter(A-1))

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    solve(A, B, C, D)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5204
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
#define fin(ans) cout << (ans) << endl
const int INF = 1<<30;
const ll MOD = 1000000007;

int main() {
    int N,X,Y;
    cin >> N >> X >> Y;
    X--,Y--;
    vll ans(N+1,0);
    rep(i,N)for(int j=i+1;j<N;j++){
        int d1 = j-i;
        int d2 = INF;
        if(i<=X&&Y<=j) d2 = X-i + j-Y + 1;
        else if(X<i&&Y<=j) d2 = i-X + j-Y + 1;
        else if(i<=X&&j<Y) d2 = X-i + Y-j + 1;
        else if(X<i&&j<Y) d2 = i-X + Y-j + 1;
        ans[min(d1,d2)]++;
    }
    for(int i=1;i<N;i++) cout << ans[i] << endl; 
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

char march[5]={'M','A','R','C','H'};

int main(){cout<<fixed<<setprecision(10);
		   int n;
           cin>>n;
           vll cnt(5,0);
           rep(i,0,n){
             string s;
             cin>>s;
             rep(j,0,5){
               if(s[0]==march[j]){
                 cnt[j]++;
               }
             }
           }
           ll ans=0;
           
           rep(i,0,3){
				rep(j,i+1,4){
                  rep(k,j+1,5){
                   ans+=cnt[i]*cnt[j]*cnt[k]; 
                  }
                }
           }
           cout<<ans<<endl;
           
}

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

#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,a,b)     for(int i=b;i>=a;i--)

int a,b;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
   
    cin>>a>>b;
    if(a+b<=9)
        cout<<a+b;
    else
        cout<<"error";
}




Measured memory_bytes: 256