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

using namespace std;

int h,n;

void solve(){
    int i,j;
    string str;
    cin >> h >> n;
    vector<int> a(n),b(n);
    for(i = 0;i < n;i++){
        cin >> a[i] >> b[i];
    }
    vector<int> dp(h+1,INT_MAX);
    dp[0] = 0;
    for(i = 0;i < h;i++){
        if(dp[i] == INT_MAX) continue;
        for(j = 0;j < n;j++){
            if(i+a[j] > h){
                dp[h] = min(dp[h],dp[i]+b[j]);
            }
            else{
                dp[i+a[j]] = min(dp[i+a[j]],dp[i]+b[j]);
            }
        }
    }
    long long ans = 0;
    cout << dp[h] << endl;
}

int main(){
    solve();
}


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

using namespace std;
#define INF 2000000000

int getMinNum(int[], int, int);

int main(){

  int n,m;
  scanf("%d%d",&n,&m);
  int data[m];
  for(int i=0;i<m;i++)
    scanf("%d",&data[i]);
  printf("%d\n",getMinNum(data,n,m));
  return 0;
}

int getMinNum(int c[],int n, int m)
{
  int t[n+1];
  for(int j=0;j<=n;j++)
    t[j]=INF;

  t[0]=0;

  for(int i=0;i<m;i++)
    for(int j=c[i];j<=n;j++)
      t[j]=min(t[j],t[j-c[i]]+1);

  return t[n];

}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
vector<long> divisor(long n) {
    vector<long> ret;
    for (long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
int main(){
long N, i, ans=0; cin >> N; vector<long> Q=divisor(N); long S=Q.size();
for(i=0; i<S; i++){
  long K=Q[i], T=N;
  if(K<2){ continue; }
  while(T%K==0){ T=T/K; if((T-1)%K==0){ ans++; break; } }
}
vector<long> R=divisor(N-1); long U=R.size();
ans=ans+U-1;
cout << ans << "\n";
}

Measured memory_bytes: 384
#include<stdio.h>
main(){
  int z=0;
  int a=0;
  int b=0;
  int c=0;
  int d=0;
  int e=0;
  int f=0;
  int g=0;
  int A[10]={0};
  for(z=0;z<10;z++){
    A[z]=z;
  }
  while(scanf("%d",&a)!=EOF){
    for(b=9;b>=0;b--){
      for(c=9;c>=0;c--){
	for(d=9;d>=0;d--){
	  for(e=9;e>=0;e--){
	    f=b+c+d+e;
	    if(f==a){
	      g=g+1;
	    }
	  }
	}
      }
    }
    printf("%d\n",g);
    f=0;
    g=0;
  }
  return 0;
}

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

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

  vector<int> vec(N);
  int j = 0, prev = 0;
  queue<int> q;
  for (int i = 0; i < N; i++) {
    int H;
    cin >> H;
    vec.at(i) = H;
    
    if (prev < H && i != (N - 1)) {
      q.push(i);
      j++;
    }
    
    prev = H;
  }

  int ans = 0;

  int i;
  while (!q.empty()) {
    i = q.front();

    int max = 0;
    if (vec.at(i) >= vec.at(i + 1)) {
      max++;
      for (int j = i + 1; j < (N - 1); j++) {
        if (vec.at(j) >= vec.at(j + 1)) {
          max++;
          continue;
        }
        break;
      }
    }
    
    if (ans < max) {
      ans = max;
    }
    
    q.pop();
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define MAX 25 * 1e13
#define N  200010

#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define EB(X) emplace_back(X)
#define REP(i,a) for(int i=0;i<(a);++i)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
#define VI vector<int>;
#define PI 3.14159265358979323846

using namespace std;
int MOD = 1000000007;


int gcd(int a,int b) {
  if( a % b == 0 ) return b;
  else return gcd(b,a % b);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x;
  cin >> x;
  int c = 360;
  int g = gcd(x,c);
  int ret = c * x / g;
  ret /= x;
  cout << ret << endl;


  return 0;
}



Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
using namespace std;


int main(){
	stack<int> a;
	int n;

	while (cin >> n) {
		if (n == 0) cout << a.top() << endl, a.pop();
		else a.push(n);
		
	}

	return 0;
}

Measured memory_bytes: 2996
import java.util.*

fun main(args: Array<String>) {
    val xx = mutableListOf<Int>()

    Scanner(System.`in`).use {
        val n = it.nextInt()
        val x = it.nextInt()
        for (i in 0 until n) {
            xx.add(Math.abs(it.nextInt() - x))
        }
    }

    while (1 < xx.size) {
        val i = if (xx[1] < xx[0]) {
            0
        } else {
            1
        }
        val r = xx[i] % xx[(i + 1) % 2]
        if (r == 0) {
            xx.removeAt(i)
        } else {
            xx[i] = r
        }
    }

    println(xx[0])
}


Measured memory_bytes: 55440
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x) memset(x , 0 , sizeof x);
#define sz(x) (int)x.size()
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
const int xx = 2e5;
const int Mod = 1e9 + 7;
const int inf = 1e18;
const int Maxn = 20010;
int a[10][10];
signed main(){
  ios::sync_with_stdio(false);cin.tie(0);

  int N;
  cin >> N;
  for(int i = 1; i <= N; i++) {
    string s = to_string(i);
    a[s[0] - '0'][i % 10]++;
  }
  int ans = 0;
  for(int i = 1; i < 10; i++) {
    for(int j = 1; j < 10; j++) {
      ans += a[i][j] * a[j][i];
    }
  }
  cout << ans << '\n';
}

Measured memory_bytes: 3684
S = list(input())
N = len(S)
n = [1]*len(S)
for i in range(N-2):
    if S[i] == "R":
        if S[i+1] == "R":
            n[i+2] += n[i]
            n[i] = 0
for i in range(N-2):
    if S[N-i-1] == "L":
        if S[N-i-2] == "L":
            n[N-i-3] += n[N-i-1]
            n[N-i-1] = 0
print(" ".join(str(s) for s in n))

Measured memory_bytes: 11180
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

const int MAX_V=1001;
struct edge{
  int from,to;
  string cost;
};
edge es[MAX_V];
string d[MAX_V];
int V,E;
string INF;
bool bellman_ford(int s,int g){
  for(int i=0;i<V;i++)d[i]=INF;
  d[s]="";
  int cnt=0;
  while(1){
    bool update=false;
    bool gupdate=false;
    for(int i=0;i<E;i++){
      edge &e=es[i];
      if(d[e.from]!=INF&&d[e.to]>e.cost+d[e.from]){
	d[e.to]=e.cost+d[e.from];
	update=true;
	if(e.to==g)gupdate=true;
      }
    }
    if(!update)break;
    cnt++;
    // S[ðXVµÂÃ¯éÌÂHª¶Ý
    if(cnt>=V&&gupdate)return false;
    else if(cnt>=8*V)return true;
  }
  return true;
}
int N,A,S,G;

int main(){
  for(int i=0;i<1000;i++)INF+='z';
  while(cin>>N>>A>>S>>G&&(N|A|S|G)){
    E=A;V=N;
    for(int i=0;i<A;i++){
      edge e;
      cin>>e.to>>e.from>>e.cost;
      es[i]=e;
    }
    bool res=bellman_ford(G,S);
    if(!res||d[S]==INF)cout<<"NO"<<endl;
    else cout<<d[S]<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 1568
#include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <cstdio>
#include <cctype>
#include <queue>
#include <complex>
#include <climits>

typedef long long ll;

int r[101][101] = {0};

using namespace std;

int main(void){
	int n;
	while(cin >> n){
		if(!n) break;
		for(int i=0; i<n; ++i){
			for(int j=0; j<n; ++j){
				cin >> r[i][j];
				r[i][n] += r[i][j];
				r[n][j] += r[i][j];
				r[n][n] += r[i][j];
			}
		}
		for(int i=0; i<=n; ++i){
			for(int j=0; j<=n; ++j){
				printf("%5d", r[i][j]);
				r[i][j] = 0;
			}
			cout << endl;
		}
	}


	return 0;
}

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


int main() {
    int a,b;
    cin >> a >> b;
    for(int i=1;i<1001;i++){
        if(floor(i*0.08) == a && floor(i*0.1) == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int s[10086];
int main()
{
	int n,t=0,k=0;
	cin>>n;
	if(n==0){cout<<0;return 0;}
	while(n!=0)
	{
		if(n%2==0)
		{s[t]=0;}
		else{s[t]=1;}
		t++;
		if(n%2==0) n/=-2;
		else if(n<0){n/=-2;n++;}
		else{n/=-2;}
	}
	for(int i=t-1;i>=0;i--)
	{cout<<s[i];}
	return 0;
}

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

int main(){
	int a;
	while(cin>>a){
		int b,sum;
		cin>>b;
		
		sum = a+b;
		int degit=1;
		while(1){
			if(sum/10==0){
				break;
			}
			sum = sum/10;
			degit++;
		}
		cout<<degit<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <iostream>

using namespace std;

int a[1000];

int main(void){
	int N;
	int min, max;
	cin >> N;
	for (int i=0; i<N; i++){
		cin >> a[i];
		if(i==0){
			min = a[i];
			max = a[i];
		}else{
			if(a[i]<min){
				min = a[i];
			}
			if(a[i]>max){
				max = a[i];
			}
		}
	}
	cout << max-min << endl;
	return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
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);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){

    int n, k;
    cin >> n >> k;


    ll cnt = 0ll;
    for(int i = 1; i <= n; ++i){
        int q = n/i;
        int r = n%i;
        cnt += q*(max(0, i-k)) + max(0, r-k+1);
    }

    if(k == 0) cnt -= n;
    ppp(cnt);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <climits>
#include <cstring>
using namespace std;

class P{
public:
  int x, y, level;
  P(){}
  P(int x, int y, int level) : x(x), y(y), level(level) {}

  bool operator<(const P &p)const{
    return level > p.level;
  }
};

int R;
int H[2], W[2];
int SX[2], SY[2];
int T[2][502][502];
vector<int> LEVEL[2], ROOM[2];

bool closed[502][502];

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

void solve_small(int h, int w, int sx, int sy, int t[502][502], vector<int> &level, vector<int> &room){
  priority_queue<P> open;
  memset(closed, 0, sizeof(closed));
  open.push(P(sx, sy, 1));

  int nowLevel = 1;
  int nowRoom = 0;

  while(!open.empty()){
    P p = open.top();
    open.pop();

    if(closed[p.y][p.x]){
      continue;
    }
    closed[p.y][p.x] = true;

    if(p.level > nowLevel){
      level.push_back(nowLevel);
      room.push_back(nowRoom);
      nowLevel = p.level;
    }

    nowRoom++;

    for(int i = 0; i < 4; i++){
      int nx = p.x + dx[i];
      int ny = p.y + dy[i];
      if(nx < 0 || w <= nx || ny < 0 || h <= ny) continue;
      if(closed[ny][nx]) continue;
      open.push(P(nx, ny, t[ny][nx]));
    }
  }

  level.push_back(nowLevel);
  room.push_back(nowRoom);
}

void solve(){
  for(int i = 0; i < 2; i++){
    solve_small(H[i], W[i], SX[i], SY[i], T[i], LEVEL[i], ROOM[i]);
  }

  int ans = INT_MAX;

  for(int i = 0; i < ROOM[0].size(); i++){
    if(ROOM[0][i] >= R){
      ans = min(ans, LEVEL[0][i]);
      continue;
    }

    int rem = R - ROOM[0][i];
    int pos = lower_bound(ROOM[1].begin(), ROOM[1].end(), rem) - ROOM[1].begin();
    if(pos == ROOM[1].size()) continue;

    ans = min(ans, LEVEL[0][i] + LEVEL[1][pos]);
  }

  cout << ans << endl;
}

int main(){
  while(cin >> R, R){
    for(int i = 0; i < 2; i++){
      LEVEL[i].clear();
      ROOM[i].clear();

      cin >> W[i] >> H[i] >> SX[i] >> SY[i];
      SX[i]--;
      SY[i]--;

      for(int j = 0; j < H[i]; j++){
        for(int k = 0; k < W[i]; k++){
          cin >> T[i][j][k];
        }
      }
    }

    solve();
  }
}

Measured memory_bytes: 6336
import java.util.*;
import java.io.PrintWriter;
public class Main{
	static ArrayList<Integer>[] map;
	static long[] dp;
	static int[] size;
	static long[] fact;
	static long[] inv;
	static long mod=1000000007;
	static int n;
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		combr();
		map=new ArrayList[n];
		dp=new long[n];
		size=new int[n];
		Arrays.fill(size,1);
		for(int i=0; i<n; i++){
			map[i]=new ArrayList<>();
		}
		for(int i=0; i<n-1; i++){
			int a=sc.nextInt()-1;
			int b=sc.nextInt()-1;
			map[a].add(b);
			map[b].add(a);
		}
		dfs1(0,0);
		dfs2(0,0);
		PrintWriter pw=new PrintWriter(System.out);
		for(int i=0; i<n; i++){
			pw.println(dp[i]);
		}
		pw.flush();
	}
	static void combr(){
		fact=new long[n+1];
		fact[0]=1;
		fact[1]=1;
		for(int i=2; i<=n; i++){
			fact[i]=(fact[i-1]*i)%mod;
		}
		inv=new long[n+1];
		inv[n]=pow(fact[n],mod-2);
		for(int i=n-1; i>=0; i--){
			inv[i]=(inv[i+1]*(i+1))%mod;
		}
	}
	static void dfs1(int now,int from){
		long re=1;
		for(int i:map[now]){
			if(i!=from){
				dfs1(i,now);
				size[now]+=size[i];
				re=re*dp[i]%mod;
				re=re*inv[size[i]]%mod;
			}
		}
		dp[now]=(re*fact[size[now]-1])%mod;
	}
	static void dfs2(int now,int from){
		for(int i:map[now]){
			if(i!=from){
				dp[i]=(dp[i]*((dp[now]*pow(dp[i],mod-2))%mod))%mod;
				dp[i]=dp[i]*fact[size[i]]%mod;
				dp[i]=dp[i]*fact[n-size[i]-1]%mod;
				dp[i]=dp[i]*inv[n-1]%mod;
				dp[i]=dp[i]*comb(n-1,n-size[i])%mod;
				dfs2(i,now);
			}
		}
	}
	static long pow(long p,long q){
		long res=1;
		while(q>0){
			if((q & 1)==1){
				res*=p;
				res%=mod;
			}
			q>>=1;
			p*=p;
			p%=mod;
		}
		return res;
	}
	static long comb(int t,int y){
		long re=1;
		re*=fact[t];
		re*=inv[y];
		re%=mod;
		re*=inv[t-y];
		return re%mod;
	}
}


Measured memory_bytes: 170380
class Union:
    def __init__(self, n):
        self.parents = [-1] * n
    
    def root(self, x):
        if self.parents[x] < 0:
            return x
        else:
            return self.root(self.parents[x])
    
    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

uni = Union(n)
for a, b in ab:
    a -= 1
    b -= 1
    uni.unite(a, b)
print(-min(uni.parents))

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

#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define reset(x, y) memset(x, y, sizeof(x))
#define BUG(x) cerr << #x << " = " << (x) << endl
#define BUGP(x) cout << #x << " = " << (x)._1 << ", " << (x)._2 << endl
using namespace std;

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

const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};
// Head

const int N = 212345;

int n, k;
int a[N];
int f[N];

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

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

//    for (int i = 0; i + k - 1 < n; ++i) {
//        for (int j = 0; j < n; ++j) b[j] = a[j];
//        sort(b + i, b + i + k);
//        for (int j = 0; j < n; ++j) cout << b[j] << ' ';
//        cout << endl;
//    }

    for (int i = 0; i < n;) {
        int r = i + 1;
        while (r < n && a[r] > a[r - 1]) ++r;
        for (int j = i; j < r; ++j) f[j] = r - 1;
        i = r;
    }

    int ans = 1;
    set<int> s;
    for (int i = 0; i < k; ++i) s.insert(a[i]);

    bool same = false;
    if (f[0] >= k - 1) same = true;

    for (int i = 1; i + k - 1 < n; ++i) {
        if (*s.begin() < a[i - 1] || *s.rbegin() > a[i + k - 1]) {
            if (f[i] < i + k - 1) ++ans;
            else if (!same) {
                same = true;
                ++ans;
            }
        }
        s.erase(a[i - 1]);
        s.insert(a[i + k - 1]);
    }

    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 11264
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (b>a) { 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 long long INF = 2LL << 60;
using ll = long long;
using P = pair<ll, ll>;

int main(int argc, char const *argv[]) {
    string s;
    cin >> s;
    if(s[1]=='R'){
        cout << "ABC" << endl;
    }else{
        cout << "ARC" << endl;
    }
    return 0;
}


Measured memory_bytes: 3620
def main():
    N = int(input())
    treedic = {}
    for i in range(1, N+1):
        treedic[i] = {}
    for i in range(N-1):
        a, b, c = map(int, input().split())
        treedic[a][b] = c
        treedic[b][a] = c

    Q, K = map(int, input().split())
    checked = set([K])
    length = [0]*(N+1)
    check = set([K])

    while len(checked) < N:
        nextcheck = set()
        for i in check:
            for j in treedic[i].keys():
                if j not in checked:
                    length[j] = length[i] + treedic[i][j]
                    checked.add(j)
                    nextcheck.add(j)
        check = nextcheck

    for i in range(Q):
        x, y = map(int, input().split())
        print(length[x] + length[y])


if __name__ == "__main__":
    main()


Measured memory_bytes: 73384
s = gets.chomp
vis = Array.new(26, false)
s.each_char { |c|
	vis[c.ord - 'a'.ord] = true
}
(0...26).each{ |i|
	if !vis[i]
		puts (i + 'a'.ord).chr
		exit(0)
	end
}
puts "None"


Measured memory_bytes: 1916
#include <stdio.h>
int main (){
    long long int x; 
    long long int total=1;
    
    scanf("%lld",&x);
    long long int A[x]; 
    for(int i=0;i<x;i++){
        scanf("%lld", &A[i]);
    }
    for(int j=0;j<x;j++){
        if(A[j] == 0){  
            printf("0");
            return 0;
        }
    }
    for(int k=0;k<x;k++){
        if(A[k]<=1000000000000000000/total){
            total = total*A[k];
 
        } else {
            printf("-1");
            return 0;
        }
    }
    printf("%lld", total);
    
    
return 0;
}

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

using namespace std;
#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
void reader(int& x) { int k, m = 0; x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; x = x * 10 + k - '0'; }if (m) x = -x; }
void writer(int x, char c) { int s = 0, m = 0; char f[10]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
void writerLn(int x) { writer(x, '\n'); }
#define rep(i,n)for(int i=0;i<n;i++)
vector<int>E[100000],que;
int u[200000], v[200000], r[200000], ans[200000], d[100000], cnt = 1;
char b[200000], ok[100000]{ 1 };

void bfs(int u) {
	que.emplace_back(u);
	while (!que.empty()) {
		int p = que.back(); que.pop_back();
		for (int v : E[p]) {
			if (d[v] > d[p] && !ok[v]) {
				ok[v] = 1; cnt++; que.emplace_back(v);
			}
		}
	}
}
int main() {
	int n, m, q; reader(n); reader(m); reader(q);
	rep(i, m) {
		reader(u[i]); reader(v[i]);
		u[i]--; v[i]--;
		E[u[i]].emplace_back(v[i]); E[v[i]].emplace_back(u[i]);
	}
	memset(d, -1, sizeof(d));
	d[0] = 0;
	deque<int>que;
	que.emplace_back(0);
	while (!que.empty()) {
		int p = que.front(); que.pop_front();
		for (int v : E[p]) {
			if (!~d[v]) {
				d[v] = d[p] + 1; que.emplace_back(v);
			}
		}
	}
	rep(i, m) {
		if (d[u[i]] > d[v[i]])swap(u[i], v[i]);
	}
	rep(i, n)E[i].clear();
	rep(i, q) {
		reader(r[i]); r[i]--;
		b[r[i]] = 1;
	}
	rep(i, m) {
		if (!b[i]) {
			if (d[v[i]] > d[u[i]]) {
				E[u[i]].emplace_back(v[i]);
			}
		}
	}
	bfs(0);
	for (int i = q - 1; i >= 0; i--) {
		ans[i] = n - cnt;
		if (d[v[r[i]]] > d[u[r[i]]] && !ok[v[r[i]]]) {
			E[u[r[i]]].emplace_back(v[r[i]]);
			if (ok[u[r[i]]]) {
				cnt++; ok[v[r[i]]] = 1;
				bfs(v[r[i]]);
			}
		}
	}
	rep(i, q)writerLn(ans[i]);
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
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 ll MOD = 1e9+7;

int main(){
    ll N;
    cin >> N;
    vector<ll> X(N);
    REP(i,N){
        ll x;
        cin >> x;
        X[i] = x;
    }

    ll ans = LLONG_MAX;
    REP(p,110){
        ll sum = 0;
        REP(i,N){
            ll x = X[i];
            sum += (p-x)*(p-x);
        }
        chmin(ans, sum);
    }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2")

const long long inf = 1000000000000000000;
//					     2147485794483647
int n;
long long a[100005];
long long ans = 1;

int main()
{
	ios::sync_with_stdio(false);
    cin >> n;
    bool fl = 0;
    for (int i = 1; i <= n; i++)
    {
    	cin >> a[i];
    	if (a[i] == 0) fl = 1;
	}
	if (fl)
	{
		cout << 0 << endl;
		return 0;
	}
	for (int i = 1; i <= n; i++)
	{
		if (a[i] <= inf / ans) ans *= a[i];
		else 
		{
			cout << -1 << endl;
			return 0;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4432
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int C = sc.nextInt();
		int[] b = new int[M];

		for (int i = 0; i < M; i++) {
			b[i] = sc.nextInt();
		}

		int cnt = 0;
		int[][] a = new int[N][M];
		for (int i = 0; i < N; i++) {
			int sum = 0;
			for (int j = 0; j < M; j++) {
				a[i][j] = sc.nextInt();
				sum += a[i][j] * b[j];
			}
			if (sum + C > 0) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}


Measured memory_bytes: 22224
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    boolean flag = true;
    
    while(flag){
      if(X==2){
      break;
      }
      for(int i=2; i<X; i++) {
        flag = false;
        if(X % i == 0){
          X++;
          flag = true;
          break;
        }
      }
    }
    System.out.println(X);
  }
}

Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define reps(i,n) for(int i=1;i<=(int)n;i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define MOD 1000000007
#define itn int
#define enld endl
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b){if(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

vector<pair<long long, long long>> prime_factorize(long long N) {
    vector<pair<long long, long long>> res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main(){
    string s;cin >> s;
    cout << s[0] << s[1] << s[2] << endl;
    return 0;
}

Measured memory_bytes: 3584
IDENTIFICATION DIVISION.
PROGRAM-ID. 161D.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 N    PIC 9(6).
01 TBL.
   03 X PIC 9(10) COMP OCCURS 100002.
01 I    PIC 9(06) COMP.
01 L    PIC 9(06) COMP.
01 S    PIC 9(09) COMP.
01 A    PIC 9(01) COMP.
01 OUT  PIC Z(9)9.
*>  
PROCEDURE DIVISION.
  ACCEPT N.
*>
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > 9
    MOVE I TO X(I)
  END-PERFORM.
*>
  MOVE 9 TO L.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > N OR L >= N
    DIVIDE X(I) BY 10 GIVING S REMAINDER A
    IF (A > 0) THEN
      ADD 1 TO L
      COMPUTE X(L) = X(I) * 10 + A - 1
    END-IF
*>
    ADD 1 TO L
    COMPUTE X(L) = X(I) * 10 + A
*>
    IF (A < 9) THEN
      ADD 1 TO L
      COMPUTE X(L) = X(I) * 10 + A + 1
    END-IF
  END-PERFORM.
*>
  MOVE X(N) TO OUT.
  DISPLAY FUNCTION TRIM(OUT).
*>
  STOP RUN.
 

Measured memory_bytes: 1532
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

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


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

typedef long long ll;

const int N = 100005;
int n, m, fa[N], c[N];
vector<int> g[N];
ll sumb[N], dp[N];

int find(int x) {
	return !fa[x] ? x : fa[x] = find(fa[x]);
}

int main() {
	scanf("%d%d", &n, &m);
	static int id[N], rk[N];
	for (int i = 1, a, b; i <= n; ++i) {
		scanf("%d%d", &a, &b);
		id[i] = i;
		sumb[i] = b;
		c[i] = max(a - b, 0);
	}
	for (int i = 1, u, v; i <= m; ++i) {
		scanf("%d%d", &u, &v);
		g[u].push_back(v), g[v].push_back(u);
	}
	sort(id + 1, id + 1 + n, [](int x, int y) { return c[x] < c[y]; });
	for (int i = 1; i <= n; ++i)
		rk[id[i]] = i;
	for (int i = 1; i <= n; ++i) {
		dp[id[i]] = c[id[i]];
		for (int v : g[id[i]]) {
			int j = find(v);
			if (rk[v] < i && j != id[i]) {
				fa[j] = id[i];
				sumb[id[i]] += sumb[j];
				dp[id[i]] = min(dp[id[i]], max(dp[j], c[id[i]] - sumb[j]));
			}
		}
	}
	printf("%lld\n", dp[id[n]] + sumb[id[n]]);
	return 0;
}


Measured memory_bytes: 9084
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main () {
  int n;
  cin >> n;
  
  long long a=1e9+7, ans1=1, ans2=1, ans3=1, ans;
  
  rep(i,n) {
    ans1 *= 10;
    ans1 %= a;
    ans2 *= 9;
    ans2 %= a;
    ans3 *= 8;
    ans3 %= a;
  }
  
  ans = (ans1 - ans2)%a;
  ans = (ans - ans2)%a;
  ans = (ans + ans3)%a;
  ans = (ans + a)%a;
  cout << ans << endl;
  //10^n-9^n-9^n+8^n
}


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

typedef long long ll;



int main()
{
	

    string s;
    cin>>s;
    string t1 = s;
    reverse(t1.begin(),t1.end());
    if(t1.compare(s) != 0)
    {
        cout<<"No"<<endl;
        return 0;
    }
    string t2 = s.substr(0,s.length()/2);
    string t3 = s.substr(s.length()/2+1);
    string t4 = t2;
    string t5 = t3;
    reverse(t2.begin(),t2.end());
    reverse(t3.begin(),t3.end());
    if(t2.compare(t4)==0 && t3.compare(t5)==0)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }

    return 0;
}

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

typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << '\n'; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << std::endl;
}

int main() {
    string s;
    cin >> s;
    if (s == "RRR") {
        print(3);
    } else if (s[1] == 'R' and (s[0] == 'R' or s[2] == 'R')) {
        print(2);
    } else if (s == "SSS") {
        print(0);
    } else {
        print(1);
    }
    return 0;
}


Measured memory_bytes: 3592
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int N;
  string s;
  cin >> N;
  cin >> s;

  int x = 0;
  int ans = 0;
  for (char c : s) {
    if (c == 'I') {
      ++x;
    } else {
      --x;
    }
    ans = max(ans, x);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
#define int long long
#define MOD 1e9+7
typedef pair<int,int> P;
typedef pair<int,P> PP;

struct edge{
  int v,l,e;
};

signed main(){
  while(1){
    int n,m,L;
    cin>>n>>m>>L;
    if(n+m+L==0)break;
    vector<vector<edge> > g(n);
    for(int i=0;i<m;i++){
	 int a,b,d,e;
	 cin>>a>>b>>d>>e;
	 a--,b--;
	 if(e==0)d=0;
	 g[a].pb({b,d,e});
	 g[b].pb({a,d,e});
    }
    int INF=1LL<<60;
    int d[101][101];
    fill_n(*d,101*101,INF);
    d[0][0]=0;
    priority_queue<PP,vector<PP>,greater<PP> > que;
    que.push(PP(0,P(0,0)));
    while(que.size()){
	 PP p=que.top();
	 que.pop();
	 int e=p.fi;
	 int l=p.se.fi;
	 int v=p.se.se;
	 if(e>d[v][l])continue;
	 for(int i=0;i<g[v].size();i++){
	   edge to=g[v][i];
	   if(d[to.v][l]>d[v][l]+to.e){
		d[to.v][l]=d[v][l]+to.e;
		que.push(PP(d[to.v][l],P(l,to.v)));
	   }
	   if(l+to.l>L)continue;
	   if(d[to.v][l+to.l]>d[v][l]){
		d[to.v][l+to.l]=d[v][l];
		que.push(PP(d[to.v][l+to.l],P(l+to.l,to.v)));
	   }
	 }
    }
    int mi=1LL<<60;
    for(int i=0;i<101;i++){
	 mi=min(mi,d[n-1][i]);
    }
    cout<<mi<<endl;
  }
  return 0;
}



Measured memory_bytes: 4412
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
const int mod = 1000000007;
const int max_n = 200005;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
   ll n;cin >> n;
   vl h(n);rep(i,n)cin >> h[i];
    ll ans=0;
    rep(i,n){
        while(h[i]>0){
            ans++;
            h[i]--;
            ll j=i;
            while(true){
                j++;
                if(j>=n||h[j]==0)break;
                h[j]--;
            }
        }
    }
    cout <<ans <<endl;
}

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

int main()
{
    int n, r;
    int max, min;

    cin >> n;

    cin >> r;                               //最初の数を入れる
    min = r;                                //最小値は最初の数
    max = -2000000000;                      //差の最大値は-20億で初期化

    for( int i = 0; i < n - 1; i++ )        //初めの数はもう入力しているので、n - 1
    {
        cin >> r;
        if( max < r - min )
            max = r - min;
        if( min > r )
            min = r;
    }
        

    cout << max << endl;

    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool prime(ll n) {
  if (n == 1) {
    return false;
  } else {
    for (ll i = 2; i <= (ll)pow(n, 0.5); i++) {
      if (n%i == 0) return false;
    }
  }
  return true;
}
ll RepeatSquaring(ll n, ll p, ll m) {
  if (p == 0) return 1;
  if (p%2 == 0) {
    ll t = RepeatSquaring(n, p/2, m);
    return (t*t)%m;
  }
  return (n*RepeatSquaring(n, p-1, m))%m;
}

struct edge {
  ll u, v, cost;
};

bool comp(const edge& e1, const edge& e2) {
  return e1.cost < e2.cost;
}

const ll MAX = 100000;
vector <edge> es(MAX);
vector <ll> par(MAX);
vector <ll> d(MAX, 0);
ll V, E;

void init(ll n) {
  rep(i, n) {
    par.at(i) = i;
  }
  return;
}
ll find(ll n) {
  if (n == par.at(n)) {
    return n;
  } else {
    return par.at(n) = find(par.at(n));
  }
}
void unite(ll n, ll m) {
  n = find(n);
  m = find(m);
  if (n == m) return;
  if (d.at(n) < d.at(m)) {
    par.at(n) = m;
  } else {
    par.at(m) = n;
    if (d.at(n) == d.at(m)) d.at(n)++;
  }
  return;
}
bool same(ll n, ll m) {
  return find(n) == find(m);
}

ll kruskal(ll V, ll E) {
  sort(es.begin(), es.begin()+E, comp);
  init(V);
  ll res = 0;
  rep(i, E) {
    edge e = es.at(i);
    if (!same(e.u, e.v)) {
      unite(e.u, e.v);
      res += e.cost;
    }
  }
  return res;
}

int main() {
  cin >> V >> E;
  rep(i, E) {
    cin >> es.at(i).u >> es.at(i).v >> es.at(i).cost;
  }
  cout << kruskal(V, E) << endl;
}


Measured memory_bytes: 6640
#include<bits/stdc++.h>
using namespace std;
#define rkc ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define rfl(i,a,b) for(ll i=a;i>b;i--)
#define pb push_back
#define mp make_pair
#define test ll t;cin>>t;while(t--)
#define lld long double
#define vpp vector<pair<ll,ll>>
#define ff first
#define ss second
const ll M = 1e9 + 7;
const double pi  =3.141592653589793238463;

ll dp[100005];
int main()
{
    rkc;
    ll n;
    cin>>n;
    ll a[n+1];
    fl(i,1,n+1)cin>>a[i];
    dp[1]=0;
    dp[2]=abs(a[2]-a[1]);
    fl(i,3,n+1)
    dp[i]=min(dp[i-1]+abs(a[i-1]-a[i]),dp[i-2]+abs(a[i-2]-a[i]));
    cout<<dp[n];
}

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

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        char input[6];
        cin >> input;
        int timeM = (input[0] - '0') * 600 + (input[1] - '0') * 60 + (input[3] - '0') * 10 + (input[4] - '0');
        double littleHand = 6 * (timeM % 60);
        double bigHand = 0.5 * timeM;
        double angle = fabs(littleHand - bigHand);
        if (angle < 30 || 330 < angle) {
            cout << "alert" << endl;
        } else if (90 <= angle && angle <= 270) {
            cout << "safe" << endl;
        } else {
            cout << "warning" << endl;
        }
    }
}

Measured memory_bytes: 0
n = int(input())
A = (map(int,list(input().split())))
tmp = 1
for i in A:
    tmp = tmp * i
    if tmp == 0:
        print(tmp)
        quit()
    if tmp > 10**18:
        if 0 in A:
            print(0)
            quit()
        tmp=-1
        print(tmp)
        quit()
    
print(tmp)

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

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll n, m, k, x;
	set < pair <ll, ll> > seta;
	vector < pair <ll, ll> > v;
	cin >> n >> m >> k;
	for (int i=1; i<=n; i++) {
		cin >> x;
		if (!seta.size()) seta.insert({x, i}); else seta.insert({x + (*seta.rbegin()).first, i});
	}
	for (int i=1; i<=m; i++) {
		cin >> x;
		if (!v.size()) v.push_back({x, i}); else v.push_back({x + v[v.size()-1].first, i});
	}
	ll ans = -2e18;
	for (auto it : seta) {
		ll val = it.first;
		ll need = k-val;
		if (need < 0) continue;
		if (need == 0) {
			ans = max(ans, it.second);
			continue;
		}
		ans = max(ans, it.second);
		ll l = 0, r = m-1, mid;
		while (l <= r) {
			mid = (l+r) / 2;
			if (v[mid].first + val == k) {
				ans = max(ans, it.second+v[mid].second);
				break;
			} else if (v[mid].first + val > k) r = mid - 1;
			else {
				l = mid+1;
				ans = max(ans, it.second+v[mid].second);
			}
		}
	}
	ll l = 0, r = m-1, mid;
		while (l <= r) {
			mid = (l+r) / 2;
			if (v[mid].first== k) {
				ans = max(ans, v[mid].second);
				break;
			} else if (v[mid].first > k) r = mid - 1;
			else {
				l = mid+1;
				ans = max(ans, v[mid].second);
			}
		}
	if (ans == -2e18) cout << 0; else cout << ans;
	return 0;
}

Measured memory_bytes: 19872
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int main() {
	int n, a[200010], b, c, rmin, ret; 
	cin >> n;
	cin >> b >> c;
	rmin = min(b, c) , ret = c - b;
	rep(i,n-2) {
		cin >> a[i];
		if(ret < a[i] - rmin) ret = a[i] - rmin;
		if(a[i] < rmin) rmin = a[i];
	}
	cout << ret << endl;
	return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

	ll A=in<ll>(),B=in<ll>(),Q=in<ll>();
	vector<ll> S(A),T(B);
	REP(i,A){
		S[i]=in<ll>();
	}
	REP(i,B){
		T[i]=in<ll>();
	}
	REP(i,Q){
		ll x = in<ll>();
		auto sp = lower_bound(ALL(S),x);
		auto tp = lower_bound(ALL(T),x);
		ll ls = sp==S.begin() ? -1e12 : *(sp-1);
		ll rs = sp==S.end() ? 1e12 : *sp;
		ll lt = tp==T.begin() ? -1e12 : *(tp-1);
		ll rt = tp==T.end() ? 1e12 : *tp;

		ll dist = 1e15;
		dist = min(dist,abs(x-ls)+abs(ls-lt));
		dist = min(dist,abs(x-ls)+abs(ls-rt));
		dist = min(dist,abs(x-rs)+abs(rs-lt));
		dist = min(dist,abs(x-rs)+abs(rs-rt));
		dist = min(dist,abs(x-lt)+abs(lt-ls));
		dist = min(dist,abs(x-lt)+abs(lt-rs));
		dist = min(dist,abs(x-rt)+abs(rt-ls));
		dist = min(dist,abs(x-rt)+abs(rt-rs));
		cout << dist << endl;
	}

	return 0;
}


Measured memory_bytes: 2944
using System;
using System.Linq;

public class AtCoder_153_C
{
    public static void Main()
    {
        //var exStdIn = new System.IO.StreamReader( "input.txt" );
        //System.Console.SetIn( exStdIn );

        int[] line1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        //int n = line1[0];
        int k = line1[1];

        long[] h = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).OrderBy(i => i).ToArray();

        long count = 0;
        for (int i = 0; i < h.Length - k; i++)
        {
            count += h[i];
        }

        Console.WriteLine(count);
    }
}


Measured memory_bytes: 40836
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define pr(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 200010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

ll N, M;
vector<ll> G[MAX];
ll dp[MAX];

ll dfs(ll s) {
    ll i;
    
    ll res=0;
    for(i=0; i<G[s].size(); i++) {
        if(dp[G[s][i]]!=-1) {
            res=max(res, dp[G[s][i]]+1);
        }else {
            res=max(res, dfs(G[s][i])+1);
        }
    }
    
    return dp[s]=res;
}


int main() {
    ll i;
    cin >> N >> M;
    memset(dp, -1, sizeof(dp));
    
    for(i=0; i<M; i++) {
        ll x, y;
        cin >> x >> y;
        x--; y--;
        G[x].push_back(y);
    }
    
    for(i=0; i<N; i++) {
        dfs(i);
    }
    
    ll ans=0;
    for(i=0; i<N; i++) {
        ans=max(ans, dp[i]);
    }
    pr(ans);
}













Measured memory_bytes: 12288
#include<stdio.h>
#include<string.h>
int main(){
  int i,j;
  char c[210],s[210]={};
  scanf("%s %s",s,c);
  for(i=0;s[i];i++);
  for(j=0;j<i;j++)s[i+j]=s[j];//printf("%s\n",s);
  printf("%s\n",strstr(s,c)!=NULL?"Yes":"No");
  return 0;
}
  


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>

using namespace std;

const int MAXN = 100100;
typedef long long LL;
const LL INF = 1e16;
char opt[MAXN];
int n,kind = 0;
LL val[MAXN],ans = -INF,sum[MAXN];

template<typename T>
void read(T &x)
{
	x = 0;
	char ch = getchar();
	while(ch < '0' || ch > '9') ch = getchar();
	while(ch >= '0' && ch <= '9')
		x = x * 10 + ch - '0',ch = getchar();
}

void init()
{
	LL t1 = val[1],t2 = 0,temp;
	for(int i = 1;i <= n-1;i++)
	{
		if(opt[i] == '+')
		{
			t1 += val[i+1];
			continue;
		} 
		int now = i+1;temp = -val[i+1];
		while(now < n && opt[now] == '+')
		{
			now++;
			temp -= val[now];
		}
	//	printf("%lld\n",t1+t2+temp+sum[n]-sum[now]);
		ans = max(ans,t1 + t2 + temp + sum[n] - sum[now]);
		t2 -= val[i+1];
	}
	ans = max(ans,t1+t2);
}

int main()
{
	//freopen("T2.in","r",stdin);
	read(n);
	for(int i = 1;i <= n;i++)
	{
		scanf("%lld",&val[i]);
		sum[i] = sum[i-1] + val[i];
		if(i != n) cin >> opt[i];
	}
	init();
	printf("%lld\n",ans);
	return 0;
}
/*
5
1 - 100 - 50 - 10 - 5
*/


Measured memory_bytes: 1920
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include <tuple>

using namespace std;
#define ll long long
#define ld long double
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define mkp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define stc(c) (int)(c-'a')
#define pb push_back
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll Inf = 3 * 1e18;
const int inf = 15 * 1e8;
ll read() {
	ll u, k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p = mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}
ll bitcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 60; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 2000000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}*/
//---------------------------------------------------
int n;
int p[2000];
vector<int>e[2000];
int b[2000];
int a[2000][5001];
bool l = 1;
int solve(int x) {
	fill(a[x], a[x] + 5001, inf);
	a[x][0] = 0;
	for (int g : e[x]) {
		int k = solve(g);
		for (int j = b[x]; j >= 0; j--) {
			int r = a[x][j];
			a[x][j] = inf;
			if (j + k <= b[x]) {
				a[x][j + k] = min(a[x][j + k], r + b[g]);
			}
			if (j + b[g] <= b[x]) {
				a[x][j + b[g]] = min(a[x][j + b[g]], r + k);
			}
		}
	}
	int sum = inf;
	for (int i = 0; i <= b[x]; i++) {
		sum = min(sum, a[x][i]);
	}
	if (sum == inf) l = 0;
	return sum;
}//return 自分じゃない色の数値の最小値
signed main() {
	cin >> n;
	for (int i = 2; i <= n; i++) {
		cin >> p[i];
		e[p[i]].push_back(i);
	}
	for (int i = 1; i <= n; i++) {
		cin >> b[i];
	}
	solve(1);
	if (!l) cout << "IM";
	cout << "POSSIBLE\n";
}

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

#define N_MAX 202

using namespace std;

int n;

int v[N_MAX];

int main()
{
    cin >> n;
    for(int i = 1; i <= 2 * n; i++)
        cin >> v[i];
    sort(v + 1, v + 2 * n + 1);
    int ans = 0;
    for(int i = 1; i <= n; i++)
        ans += v[i * 2 - 1];
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256