akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, ll> P;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

struct edge{
	int v,pass,time;
	ll cost;
	bool operator<(const edge &rhs) const {
		return cost < rhs.cost;
	}
	bool operator>(const edge &rhs) const {
		return cost > rhs.cost;
	}
};

ll dist[2][225][225],dp[1111][225];
int z[1111];

int main(void){
	int n,m,i,j,k,u,v,r;
	ll t,ans;
	char w;
	while(true){
		fill(dist[0][0],dist[2][0],INFLL);
		fill(dp[0],dp[1111],INFLL);
		ans = INFLL;
		cin >> n >> m;
		if(!n){
			break;
		}
		for(i=0; i<n; ++i){
			dist[0][i][i] = 0ll;
			dist[1][i][i] = 0ll;
		}
		for(i=0; i<m; ++i){
			cin >> u >> v >> t >> w;
			--u; --v; k = ((w=='S')?1:0);
			dist[k][u][v] = min(dist[k][u][v],t);
			dist[k][v][u] = min(dist[k][v][u],t);
		}
		for(k=0; k<n; ++k){
			for(i=0; i<n; ++i){
				for(j=0; j<n; ++j){
					dist[0][i][j] = min(dist[0][i][j],dist[0][i][k]+dist[0][k][j]);
					dist[1][i][j] = min(dist[1][i][j],dist[1][i][k]+dist[1][k][j]);
				}
			}
		}
		cin >> r;
		for(i=0; i<r; ++i){
			cin >> z[i]; --z[i];
		}
		dp[0][z[0]] = 0ll;
		for(i=1; i<r; ++i){
			for(j=0; j<n; ++j){
				dp[i][j] = min(dp[i][j],dp[i-1][j]+dist[0][z[i-1]][z[i]]);
				for(k=0; k<n; ++k){
					dp[i][k] = min(dp[i][k],dp[i-1][j]+dist[0][z[i-1]][j]+dist[1][j][k]+dist[0][k][z[i]]);
				}
			}
		}
		for(i=0; i<n; ++i){
			ans = min(ans,dp[r-1][i]);
		}
		cout << ans << endl;
	}
	return 0;
}



Measured memory_bytes: 5820
def solve():
    N = int(input())
    S = input()

    def rolling_hash(s, mod, base = 37):
        l = len(s)
        h = [0]*(l + 1)
        v = 0
        for i in range(l):
            h[i+1] = v = (v * base + ord(s[i])) % mod
        pw = [1]*(l + 1)
        v = 1
        for i in range(l):
            pw[i+1] = v = v * base % mod
        return h, pw

    def chk(S, mod, D = [0]*N):
        h, pw = rolling_hash(S, mod)
        left = 0; right = N//2+1
        while left+1 < right:
            l = mid = (left + right) >> 1
            p = pw[l]
            for i in range(min(l, N-2*l+1)):
                D[i] = (h[l+i] - h[i]*p) % mod
            s = set()
            ok = 0
            for i in range(l, N-l+1):
                s.add(D[i-l])
                D[i] = v = (h[l+i] - h[i]*p) % mod
                if v in s:
                    ok = 1
                    break
            if ok:
                left = mid
            else:
                right = mid
        return left

    res1 = chk(S, 10**9 + 9)
    res2 = chk(S, 10**9 + 7)
    res3 = chk(S, 1004535809)
    print(min(res1, res2, res3))
solve()

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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 200001
#define int ll
int N;
int32_t main(){
	fast;
	cin>>N;
	if (N >= 30) cout<<"Yes";
	else cout<<"No";
}


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

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		
		long n = sc.nextLong();
		int x = sc.nextInt(), m = sc.nextInt();
		
		int j = x, c = 1;
		long sum = j;
		TreeMap<Integer, Integer> map = new TreeMap<>();
		map.put(j, c++);
		while(true) {
			j = (int)((1l * j * j) % m);
			if(map.containsKey(j))
				break;
			map.put(j, c++);
			sum += j;
		}
		c--;
		
		int diff = map.get(j) - 1;
		c -= diff;
		long ans = 0;
		int z = x;
		while(diff-->0) {
			if(n == 0)
				break;
			n--;
			ans += z;
			z = (int)((1l * z * z) % m);
		}
		
		sum -= ans;
		
		long q = 1l * n / c;
		int rem = (int)(n % c);
		
		ans += 1l * q * sum;
		if(rem > 0) {
			ans += j;
			for(int i = 0; i < rem - 1; i++) {
				j = (int)((1l * j * j) % m);
				ans += j;
			}
		}
		
		pw.println(ans);
		pw.flush();
	}

	public static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();
			return array;
		}

		public Integer[] nextIntegerArray(int n) throws IOException {
			Integer[] array = new Integer[n];
			for (int i = 0; i < n; i++)
				array[i] = new Integer(nextInt());
			return array;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();
			return array;
		}

		public double[] nextDoubleArray(int n) throws IOException {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();
			return array;
		}

		public static int[] shuffle(int[] a) {
			int n = a.length;
			Random rand = new Random();
			for (int i = 0; i < n; i++) {
				int tmpIdx = rand.nextInt(n);
				int tmp = a[i];
				a[i] = a[tmpIdx];
				a[tmpIdx] = tmp;
			}
			return a;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}


Measured memory_bytes: 39280
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

public class Program
{

	public void Proc()
	{
        System.Text.StringBuilder ans = new System.Text.StringBuilder();
        while(true) {
            string inpt = Reader.ReadLine();
            if(inpt == null) {
                break;
            }
            int[] size = inpt.Split(' ').Select(a => int.Parse(a)).ToArray();
            if(size.Count(a=>a<1)>=2) {
                break;
            }
            ans.AppendLine(GetAns(size[0], size[1]));
        }

        Console.Write(ans.ToString());
    
    }

    private string GetAns(int h, int w) {
        System.Text.StringBuilder tmp = new System.Text.StringBuilder();
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                tmp.Append((i+j)%2==0?"#":".");
            }
            tmp.AppendLine(string.Empty);
		}
        return tmp.ToString();
    }


    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"



2 2
3 3
0 0


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}

Measured memory_bytes: 9764
let scan_int () = Scanf.scanf " %d" (fun x -> x)
let print_array a = 
  let _ = Array.iter (Printf.printf "%d ") a in print_newline()

module Graph :
  sig
    type graph
    type edge = int * int * int
    val init : int -> graph
    val get_size : graph -> int
    val get_edge: graph -> int -> edge list
    val add_edge: graph -> int -> int -> int -> unit
    val add_biedge: graph -> int -> int -> int -> unit
    val dfs_tree: graph -> int -> int -> (edge -> unit) -> unit
    val dfs_rec: graph -> int -> bool array -> (edge -> unit) -> unit
    val dfs: graph -> (edge -> unit) -> unit
  end =
  struct
    type edge = int * int * int (* from, to, dist *)
    type graph = {v: int; e: (edge list) array}
    let init _n = {v = _n; e = Array.make _n []}
    let get_size g = g.v
    let get_edge g u = g.e.(u)
    let add_edge g u v d = g.e.(u) <- (u, v, d) :: g.e.(u)
    let add_biedge g u v d = let _ = add_edge g u v d in add_edge g v u d
    let rec dfs_tree g curr prev func =
      let transit curr prev edge =
        let _, next, _ = edge in
        if next = prev then ()
        else let _ = func edge in dfs_tree g next curr func in
      List.iter (transit curr prev) g.e.(curr)
    let rec dfs_rec g curr visited func =
      let _ = visited.(curr) <- true in
      let transit curr visited edge =
        let _, next, _ = edge in
        if visited.(next) then ()
        else let _ = func edge in dfs_rec g next visited func in
      List.iter (transit curr visited) g.e.(curr)
    let dfs g func = 
      let visited = Array.make g.v false in
      for i = 0 to g.v - 1 do (if visited.(i) = false then dfs_rec g i visited func) done
  end


let make_graph g n =
  for i = 0 to n-2 do
    let a = scan_int() and b = scan_int() in
    Graph.add_biedge g (a-1) (b-1) 1
  done

let input_query q value =
  for i = 0 to q-1 do
    let p = scan_int() and x = scan_int() in
    value.(p-1) <- value.(p-1) + x
  done

let propagate value edge = let u, v, d = edge in value.(v) <- value.(u) + value.(v)


let () =
  let n = scan_int() and q = scan_int() in
  let g = Graph.init n in
  let _ = make_graph g n in
  let value = Array.make n 0 in
  let _ = input_query q value in
  let _ = Graph.dfs_tree g 0 n (propagate value) in
  print_array value

Measured memory_bytes: 60284
import java.util.*;
import java.util.Scanner;

public class Main {
 public static void main (String[ ] args) {
  Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  int d = sc.nextInt();
  int s = 0;

  if (a * b > c * d) {
   s = a * b;
  } else {
   s = c * d;
  }

  System.out.println(s);
 }
}


Measured memory_bytes: 10188
#include <iostream>

using namespace std;

const int K[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main(int argc, char const *argv[])
{
    int a;
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    cin >> a;
    cout << K[--a];
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;

int main() {
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    if(a[0] == 0) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1;
    rep(i, n) {
        if((ll)pow(10, 18) / ans < a[i]) {
            cout << -1 << endl;
            return 0;
        }
        ans *= a[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 4028
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG




int main() {
  ll A, B, C;
  cin >> A >> B >> C;
  //vector<ll> a(N);
  //vector<vector<int>> data(3, vector<int>(4));

  if(A==B && A==C ){
    cout << "No" << endl;
    return 0;
  }
  if(A!=B && A!=C && B!=C){
    cout << "No" << endl;
    return 0;
  }
  
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// __uint128_t
const ll MOD = 2019;




int main(){
    string S; cin >> S;
    if(S[1] == S[2]){
        if(S[1] == S[0] || S[1] == S[3]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    else cout << "No" << endl;

}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int B[] = new int[N - 1];
		for(int i = 0; i < N - 1; i++) {
			B[i] = sc.nextInt();
		}
		
		int ans = 0;
		ans += B[0];
		for(int i = 0; i < N - 2; i++) {
			ans += Math.min(B[i], B[i + 1]);
		}
		ans += B[N - 2];
		System.out.println(ans);
	}
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

int solve(int n, vector<int> a, vector<int> b){
    int res = n;
    for(int i = 0; i <= n / a[0]; i++){
        for(int j = 0; j <= n / a[1]; j++){
            int r = n - i * a[0] - j * a[1];
            if(r < 0) break;
            int k = r / a[2];
            r %= a[2];
            int tmp = i * b[0] + j * b[1] + k * b[2] + r;
            res = max(res, tmp);
        }
    }
    return res;
}

int solve2(int n, vector<int> a, vector<int> b){
    int res = n;
    for(int i = 0; i <= n / a[0]; i++){
        int r = n - i * a[0];
        if(r < 0) break;
        int j = r / a[1];
        r %= a[1];
        int tmp = i * b[0] + j * b[1] + r;
        res = max(res, tmp);
    }
    return res;
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, a[3], b[3];
    cin >> n;
    rep(i, 0, 3) cin >> a[i];
    rep(i, 0, 3) cin >> b[i];
    vector<P> d(3);
    rep(i, 0, 3) d[i] = {b[i] - a[i], i};
    sort(d.rbegin(), d.rend());
    vector<int> aa, bb;
    rep(i, 0, 3){
        aa.push_back(a[d[i].second]);
        bb.push_back(b[d[i].second]);
    }
    int m = solve(n, aa, bb);

    reverse(aa.begin(), aa.end());
    reverse(bb.begin(), bb.end());
    int ans;
    if(n == m){
        ans = solve(n, bb, aa);
    }else{
        ans = solve2(m, bb, aa);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;int n,x,a,i,b;int main(){for(cin>>n>>x;n>i;i++){cin>>a;b+=(a%2==1?1:0);}cout << (long long)(b==0?x==0?pow(2,n):0:pow(2,n-1)) << endl;}

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

int main(){
  ll n,m;
  cin >>n >>m;
  ll a[m],b[m],c[1000000]={};
  map<ll,ll>mp;
  string ans="IMPOSSIBLE";
  rep(i,m){
    cin >> a[i] >> b[i];
    if(b[i]==n)mp[a[i]]=1;
  }
  rep(i,m){
    if(mp.find(b[i])!=mp.end()&&a[i]==1)ans="POSSIBLE";
  }
  cout << ans << endl;
}


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

using namespace std;


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

int cnt = 1;

if (n>1)
{
   for (int i = 0; i < n-1; ++i)
{
    if (s[i]!=s[i+1])
    {
       cnt++;
    }
    else continue;
}
 
}

cout << cnt;
return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
template <class T>
using vec = vector<T>;
template <class T>
using mat = vector<vector<T>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n, q;
    cin >> n;
    vec<int> s(n);
    rep(i, n) cin >> s[i];
    cin >> q;
    vec<int> t(q);
    rep(i, q) cin >> t[i];

    int res = 0;

    rep(i, q) {
        if (lower_bound(all(s), t[i]) != upper_bound(all(s), t[i])) res++;
    }

    std::cout << res << endl;
    return 0;
}


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

int main(){
    string S;
    cin >> S;
    int n = S.length();
    bool ans = true;
    for(int i = 0; i < (n-1)/2; i++){
        if (S[i] != S[n-1-i]) ans = false;
    }
    for(int i = 0; i < (n-1)/2; i++){
        if (S[i] != S[(n-1)/2 -1 - i])ans = false;
        if (S[i+(n+1)/2] != S[n-1-i]) ans = false;
    }
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>

using namespace std;

static const int MAX = 10000;
static const int INFTY = (1<<20);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
vector<pair<int, int> > adj[MAX];

void dijkstra() {
    priority_queue<pair<int, int> > PQ;
    int color[MAX];
    int d[MAX];
    
    for(int i=0; i<n; i++) {
        d[i] = INFTY;
        color[i] = WHITE;
    }
    
    d[0] = 0;
    PQ.push(make_pair(0, 0));
    color[0] = GRAY;
    
    while(!PQ.empty()) {
        pair<int, int> f = PQ.top(); PQ.pop();
        int u = f.second;
        color[u] = BLACK;
        
        if(d[u] < f.first*(-1)) continue;
        
        for(int j=0; j<adj[u].size(); j++) {
            int v = adj[u][j].first;
            if(color[v] == BLACK) continue;
            if(d[v] > d[u] + adj[u][j].second) {
                d[v] = d[u] + adj[u][j].second;
                PQ.push(make_pair(d[v] * (-1), v));
                color[v] = GRAY;
            }
        }
    }
    
    for(int i=0; i<n; i++) {
        cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
    }
}

int main() {
    int k, u, v, c;
    
    cin >> n;
    for(int i=0; i<n; i++) {
        cin >> u >> k;
        for(int j=0; j<k; j++) {
            cin >> v >> c;
            adj[u].push_back(make_pair(v, c));
        }
    }
    
    dijkstra();
    
    return 0;
}


Measured memory_bytes: 8092
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt(), M = in.nextInt(), Q = in.nextInt();
        int[][] map = new int[N+1][N+1];
        for (int i = 0; i < M; i++) {
            map[in.nextInt()][in.nextInt()]++;
        }
        for (int i = 0; i <= N; i++) {
            for (int j = 1; j <= N; j++) {
                map[i][j] += map[i][j-1];
            }
        }
        for (int i = 0; i < Q; i++) {
            int a = in.nextInt(), b = in.nextInt();
            if(b < a) {
                int tmp = a; a = b; b = tmp;
            }
            int ans = 0;
            for (int k = a; k <= b; k++) {
                ans += map[k][b] - map[k][a - 1];
            }
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 155176
# coding: utf-8
import numpy as np


def solve(*args: str) -> str:
    n = int(args[0])
    P = list(map(int, args[1].split()))
    X = list(map(int, args[2].split()))
    T = [[] for _ in range(n)]
    for i, p in enumerate(P):
        T[p-1].append(i+1)

    seq = []
    stack = [0]
    while stack:
        i = stack.pop()
        seq.append(i)
        for c in T[i]:
            stack.append(c)

    ret = 'POSSIBLE'
    inf = 2**32-1
    Y = [0]*n
    for i in seq[::-1]:
        prev = np.full(X[i]+1, inf, np.int64)
        prev[0] = 0
        for c in T[i]:
            cur = np.full(X[i]+1, inf, np.int64)
            x, y = X[c], Y[c]
            cur = np.minimum(
                np.concatenate((cur[:x], y+prev[:-x if 0 < x else len(prev)])),
                np.concatenate((cur[:y], x+prev[:-y if 0 < y else len(prev)]))
            )
            prev = np.copy(cur)

        y = np.min(prev)
        if y < inf:
            Y[i] = y
        else:
            ret = 'IMPOSSIBLE'
            break

    return ret


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 12660
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<set>
using namespace std;

struct init{
	init(){
		cin.tie(0); ios::sync_with_stdio(false);
	}
}________init;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
typedef vector<VVV> VVVV;

typedef long long LL;
#define rep(i,n) for (auto i = 0; i < n;i++)
#define range(it,v) for (auto& it : v)
inline bool inner(int l, int v, int r){
	return (l <= v&&v <= r);
}

int main() {
#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	int  N, x, y;
	while (cin >> N >> x >> y) {
		VV dp(301, V(601,-114514));
		dp[0][300] = 0;
		rep(i, N){
			auto nxt = dp;
			int a, b, c, d;
			cin >> a >> b >> c >> d;
			//choose (a,b)
			{
				rep(sa, 301 - a)
					rep(sb, 601 - b){
						nxt[sa + a][sb + b] = max(nxt[sa + a][sb + b], dp[sa][sb]);
					}
			}
			//choose (c,d)
			{
				rep(sa, 301)
					rep(sb, 601 - c){
						int sc = 600 - sb;
						nxt[sa][sc - c] = max(nxt[sa][sc - c], dp[sa][sc]+d);
					}
			}
			swap(dp, nxt);
		}
		int res = 0;
		rep(i,301)rep(j, 601)
		if (i<=x&&j-300>=-y){
				res = max(res, dp[i][j]);
			}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 4452
#include <stdio.h>
#include <math.h>
typedef long long ll;

int main(void) {
  ll i, j, k, n, m = 1e9, a, b;
  printf("0 0 ");
  scanf("%lld", &n);
  a = (n + m - 1) / m;
  b = (n + a - 1) / a;
  printf("%lld %lld 1 %lld", a, a * b - n, b);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
     int A=0;

    string str;
    cin >> str;
    for (int i=0;i<4;i++){
        
    
       if (str.at(i)=='+'){
           A++;
       }else{
           A--;
       }
    }
    cout << A << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;

class UnionFind {
public:
  vector<long long int> parent;
  vector<long long int> sizes;
  UnionFind(long long int n) : parent(n), sizes(n, 1) {
    for(long long int i=0; i<n; i++) parent[i] = i;
  }
  long long int find(long long int x) {
    if (x == parent[x]) return x;
    return parent[x] = find(parent[x]);
  }
  void unite(long long int x, long long int y) {
    x = find(x);
    y = find(y);
    if(x == y) return;
    if(sizes[x] < sizes[y]) swap(x, y);
    parent[y] = x;
    sizes[x] += sizes[y];
  }
  bool same(long long int x, long long int y) { return find(x) == find(y); }
  long long int size(long long int x) { return sizes[find(x)]; }
};

int main() {
  long long int n, m; cin >> n >> m;
  vector<int> a(m);
  vector<int> b(m);
  for(int i=0; i<m; i++){
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
  }
  // cerr << endl;

  UnionFind uf(n);
  vector<long long int> c(m+1, n*(n-1)/2);
  for(int i=m-1; i>=0; i--) {
    if (!uf.same(a[i], b[i])) {
      c[i] = c[i+1] - (uf.size(a[i]) * uf.size(b[i]));
      uf.unite(a[i], b[i]);
    } else {
      c[i] = c[i+1];
    }
  }
  for(int i=1; i<=m; i++) {
    cout << c[i] << endl;
  }

  return 0;
}






//EOF


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

#define mp make_pair
#define pb push_back
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define FILE_IO(x) freopen((string(x) + ".in").c_str(), "r", stdin); freopen((string(x) + ".out").c_str(), "w", stdout)
#define f first
#define s second
#define x1 x1qwer
#define y1 y1qwer
#define foreach(it, v) for (auto it : v)
#define rep(it, n) for (int it = 0; it < n; ++it)
#define forin(it, l, r) for (int it = l; it < r; ++it)
#define all(x) x.begin(), x.end()

// #define FAST_ALLOCATOR_MEMORY 250000000
 
#ifdef FAST_ALLOCATOR_MEMORY
int allocator_pos = 0;
char allocator_memory[(int)FAST_ALLOCATOR_MEMORY];
inline void * operator new ( size_t n ) {
    char *res = allocator_memory + allocator_pos;
    allocator_pos += n;
    assert(allocator_pos <= (int)FAST_ALLOCATOR_MEMORY);
    return (void *)res;
}
inline void operator delete ( void * ) noexcept { }
//inline void * operator new [] ( size_t ) { assert(0); }
//inline void operator delete [] ( void * ) { assert(0); }
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const double DINF = numeric_limits<double>::infinity();
const ll MOD = 1e9 + 7;
const double EPS = 1e-7;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
mt19937 mmtw_(MOD);
uniform_int_distribution<ll> rd_;
ll randomll() { return rd_(mmtw_);}
ll rnd(ll x, ll y) { return rd_(mmtw_) % (y - x + 1) + x; }
template <class T> T fact(T n) { if (n == 1) return 1; return n * fact(n - 1); }
////////////////////////////////////////////////////////////////////////////////////////////////

int a, b;

int main() {
    cin >> a >> b;
    if (b >= a) {
        cout << a << endl;
    } else {
        cout << a - 1 << endl;
    }
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	static Scanner scanner;

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

        String s=gs();

        if(!s.substring(0,1).equals("A")) {
        	System.out.println("WA");
        	return;
        }
        
        if(!s.substring(2, s.length()-1).contains("C")) {
        	System.out.println("WA");
        	return;
        }
        
        if (s.length() - s.replace("C", "").length() !=1) {
        	System.out.println("WA");
        	return;
        }

        int c=0;
        for (int i=0; i<s.length(); i++) {
        	if(Character.isUpperCase( s.charAt( i ) )) {
        		c++;
        	}
        }
        //System.out.println("No");
        

	    if (c==2) {
	    	System.out.print("AC");
	    }else {
	    	System.out.print("WA");
	    }



	}
	
	public static int s(int n) {
		String S=String.valueOf(n);
		int c=0;
		for (int i=0; i<S.length();i++) {
			int k=Integer.parseInt(S.substring(i, i+1));
			c+=k;
		}
		return c;
	}

	public static long d(long n) {
		String a=String.valueOf(n);
		return (long)a.length();
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35648
N,M,X=[int(x) for x in input().rstrip().split()]
l=[]
for i in range(N):
  ca=[int(x) for x in input().rstrip().split()]
  l.append(ca)

A=[0 for i in range(M+2)]
flag=1
ans=10**10
cnt=0
for i in range(2**N):
  flag=1
  cost=0
  for j in range(N):
    if i>>j & 1:
      now=l[N-j-1]
      cost+=now[0]
      for s in range(M):
        A[s]+=now[s+1]
  for t in range(M):
    if X<=A[t]:
      continue
    else:
      flag=0
      break
  if flag==1:
    ans=min(ans,cost)
    cnt+=1

  A=[0 for v in range(M+2)]

if cnt==0:
  print(-1)
else:
  print(ans)
      



Measured memory_bytes: 9252
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] H = new int[N+1];
    for (int i = 1; i <= N; i++) {
      H[i] = sc.nextInt();
    }
    
    int ans = 1;
    for (int i = 2; i <= N; i++) {
      if (canSee(H, i)) {
        ans++;
      }
    }
    
    System.out.println(ans);
  }
  
  private static boolean canSee(int[] H, int i) {

    for (int j = 1; j <= i-1; j++) {
      if (H[i] < H[j]) {
        return false;
      }
    }
    
    return true;
  }
}

Measured memory_bytes: 23764
"use strict";
    
const main = arg => {
    const b = arg.split("\n")[0];
    
    if(b == "A") {
        console.log("T");
    } else if (b == "T") {
        console.log("A");
    } else if (b == "C") {
        console.log("G");
    } else if (b == "G") {
        console.log("C");
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	int n;
	cin >> n;

	int x = 1;
	while (true) {
		int guess = x * 1.08;
		if (guess == n) {
			cout << x << endl;
			break;
		} else if (guess > n) {
			cout << ":(" << endl;
			break;
		}
		x++;
	}
}

Measured memory_bytes: 256
def main():
    N = int(input())
    ans = [0 for _ in range(10005)]

    for i in range(1,100):
        for j in range(1,100):
            for k in range(1,100):
                v = i**2 + j**2 + k**2 + i*j + j*k + k*i
                if v < 10005:
                    ans[v]+=1
    for i in range(1,N+1):
        print(ans[i])

if __name__ == "__main__":
    main()

Measured memory_bytes: 9304
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int a,n;
inline int read()
{
	char c=getchar();
	int x=0,r=1;
	while(c<'0'||c>'9') 
	{
		if(c=='-') r=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
    {
    	x=x*10+c-48;
    	c=getchar();
    }
    return x*r;
}
int main()
{
	n=read();
	a=read();
	n%=500;
	if(a>=n) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 384
/**
*	  Name: Ajay Subhash Jadhav
*	  Institute: International Institute of Technology Hyderabad 
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <ctime>
#include <string.h>
#define LL long long
#define inf 0x7fffffff
#define mod 1000000007
#define pb push_back
#define ppi pair<int,int>
#define vi vector<int>
#define vii vector<ppi>
#define vll vector<LL>
#define mp make_pair
using namespace std;

void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void inputread()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
}
struct resto
{
	string city;
	int points;
	int id;
};

bool cmp(resto a,resto b)
{
	if(a.city==b.city)
		return a.points>b.points;
	return a.city<b.city;
}

int main()
{
      
  fastio();
  int n,m,i,j,t;
  cin>>n;
  vector<resto> a;
  for(i=1;i<=n;i++)
  {
  	resto r;
  	cin>>r.city>>r.points;
  	r.id=i;
  	a.pb(r);
  }
  sort(a.begin(),a.end(),cmp);
  for(i=0;i<n;i++)
  	cout<<a[i].id<<"\n";
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int K = sc.nextInt();
      int N = sc.nextInt();
      int[] arr = new int[N];
      for (int i = 0; i < N; i++) {
        arr[i] = sc.nextInt();
      }

      int[] distance = new int[N];// 次の家までの距離
      int ans = 0;
      for (int i = 0; i < N - 1; i++) {
        distance[i] = arr[i + 1] - arr[i];
        ans += distance[i];
      }
      distance[N - 1] = K - arr[N - 1] + arr[0];
      ans += distance[N - 1];

      java.util.Arrays.sort(distance);
      ans -= distance[N - 1];
      System.out.println(ans);
    }
  }
}


Measured memory_bytes: 76760
import math
from operator import mul
from functools import reduce

def cmb(n,r):
  if n>=r:
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return max(0,over//under)
  else:
    return 0

n,k=map(int,input().split())
mod=10**9+7
for i in range(1,k+1):
  print(cmb(k-1,i-1)*cmb(n-k+1,i)%mod)


Measured memory_bytes: 3956
#include<bits/stdc++.h>
#define INF 2147483647
#define inf 1000000007
#define SYOU(x) setprecision(x)
#define abs(x,y) (max(x,y)-min(x,y))
#define mp make_pair
#define fi first
#define se second
using namespace std;
long long i[111111];
vector<int> ii;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=1,e=0,f=0,g=0,h,j;
  cin >>a;
  for(int n=0;n<a;n++){
    cin >>b;
    e+=b,i[n]=e;
  }
  g=INF;
  for(int n=0;n<a;n++){
    f=abs(e,i[n]*2);
    if(f<g) g=f;
  }
  cout <<g<<'\n';
  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 REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N,T;
    cin >> N >> T;
    vector<ll> A(N);
    rep(i,N){
        cin >> A[i];
    }
    ll U = T/2;
    ll m = 1e18;
    ll M = 0;
    rep(i,N){
        cmax(M, A[i] - m);
        cmin(m, A[i]);
    }
    ll mm = 1e18;
    ll MM = 0;
    ll ans = 0;
    rep(i,N){
        if(A[i]-mm == M){
            ans++;
        }
        cmax(MM, A[i] - mm);
        cmin(mm, A[i]);

    }    
    cout << ans << endl;
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>

using namespace std;

using ull = unsigned long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vull = vector<ull>;
using vpii = vector<pii>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rFOR(i,a,b) for(int i=(b);i>=(a);i--)
#define SORT(a) sort((a).begin(),(a).end());
#define rSORT(a) sort((a).rbegin(),(a).rend());
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;

//sankou
//vvi = vector<vector<int>>(20, vector<int>(10, 0));

int isP(int n) {
    if(n<=1) return 0;
    FOR(i,2,(int)sqrt(n)) {
        if(n%i==0) return 0;
    }
    return 1;
}

int main() {
    
    int Q,mode=0;
    ull sq;
    cin >>Q;
    vull A(Q),B(Q);
    FOR(i,0,Q-1){
        cin >>A[i]>>B[i];
        
        sq=(ull)sqrt((double)(A[i]*B[i]));
        if((sq*sq)==(A[i]*B[i])) {
            if(A[i]==B[i]) {
                if(2*sq-2>0) cout <<(2*sq-2)<<endl;
                if(2*sq-2<=0) cout <<0<<endl;
            }
            if(A[i]!=B[i]) {
                if(2*sq-3>0) cout <<(2*sq-3)<<endl;
                if(2*sq-3<=0) cout <<0<<endl;
            }
        } else {
            if(sqrt((double)(A[i]*B[i]))>sqrt(double(sq*(sq+1)))) {
//migiuekaketa            
                if(2*sq-1>0) cout <<(2*sq-1)<<endl;
                if(2*sq-1<=0) cout <<0<<endl;
            }
            if(sqrt((double)(A[i]*B[i]))<=sqrt(double(sq*(sq+1)))) {
//migisitadake
                if(2*sq-2>0) cout <<(2*sq-2)<<endl;
                if(2*sq-2<=0) cout <<0<<endl;
            }
        }
        
        
        
        
    }
    
    

    return 0;
}








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

int main()
{
	int h, w, n, c[105][105], a[10005];
	scanf("%d%d%d", &h, &w, &n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	int cur = 0;
	for(int i = 0; i < h; i++)
	{
		if(i%2)
		{
			for(int j = w - 1; j >= 0; j--)
			{
				if(a[cur] == 0) cur++;
				a[cur]--;
				c[i][j] = cur + 1;
			}
		}
		else
		{
			for(int j = 0; j < w; j++)
			{
				if(a[cur] == 0) cur++;
				a[cur]--;
				c[i][j] = cur + 1;
			}
		}
	}
	for(int i = 0; i < h; i++)
	{
		for(int j = 0; j < w; j++)
		{
			if(j)
                printf(" ");
			printf("%d", c[i][j]);
		}
		puts("");
	}
	return 0;
}


Measured memory_bytes: 384
n = gets.to_i

if n == 1
	puts 1
	exit
end

queue = []

count = 0

queue << n/2

while !queue.empty? do
	x = queue.shift
	count += 1
	next if x == 1
	queue << x/2
end

sum = 0

(0..count).each do |i|
	sum += 2**i
end

puts sum

Measured memory_bytes: 3836
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
template <typename T> using posteriority_queue = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
template <typename T> void unique(vector<T> &a) { a.erase(unique(ALL(a)), a.end()); }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; cin >> n;
  vector<int> a(n); REP(i, n) cin >> a[i];
  sort(ALL(a));
  int ans = 0, idx = 0;
  REP(i, n - 1) {
    int val = min(a[i], a.back() - a[i]);
    if (val > ans) {
      ans = val;
      idx = i;
    }
  }
  cout << a.back() << ' ' << a[idx] << '\n';
  return 0;
}


Measured memory_bytes: 640
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		long H = sc.nextLong();
		int N = sc.nextInt();
		long ans = 0;
		for( int i=0; i<N; i++ ){
			int a = sc.nextInt();
			ans += a;
		}
		System.out.println(ans>=H?"Yes":"No");
	}
}


Measured memory_bytes: 45720
// --------------
// Tejas Pandey  |
// 05 - 07 - 20  |
// Atcoder BC 173|
// --------------

#include <bits/stdc++.h>
using namespace std;
     
#define mod 1000000007
#define vi vector<int>
typedef long long int ll;
     
int main (void){
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  //cin >> t;
  while(t--){
	int n;
	cin >> n;
	cout << (1000 - (n%1000))%1000 << "\n";
  }
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    vector<ll> H(N);
    REP(i,N) cin >> H[i];
    sort(H.rbegin(), H.rend());
    ll ans = 0;
    REP(i,N){
        if(K > 0){
            //ans++;
            K--;
        }
        else ans += H[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
import math

a, b, x = map(int, input().split())

theta = 0.0
if x > a * a * b / 2:
    theta = ((2 * a * a * b - 2 * x) / (a * a)) / a
else:
    theta = b / (2 * x / (a * b))

dig = math.degrees(math.atan(theta))
print(dig)

Measured memory_bytes: 3060
def maxHeapify(x)
  l = 2*x
  r = 2*x+1
  if l <= $n && $heap[l] > $heap[x]
    largest = l
  else
    largest = x
  end
  if r <= $n && $heap[r] > $heap[largest]
    largest = r
  end
  if largest != x
    $heap[x], $heap[largest] = $heap[largest], $heap[x]
    maxHeapify(largest)
  end
end
def buildMaxHeap
  ($n/2).downto(1){ |i| maxHeapify(i) }
end
$n = gets.to_i
$heap = gets.split.map(&:to_i)
$heap.unshift nil
buildMaxHeap
$heap.shift
$heap.each{ |i| print " ", i }
puts

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

using namespace std;
typedef long long ll;

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	int n; cin >> n;
  	for (int i = 1; i <= n; i++) {
      	if ((int)(i * 1.08) == n) {
          	return cout << i << endl, 0;
        }
    }
  	cout << ":(" << endl;
    return 0;
}


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

int n, m, l;

int main()
{
  cin >> n >> m >> l;
  vector<vector<long> > A(n, vector<long>(m));
  vector<vector<long> > B(m, vector<long>(l));
  vector<vector<long> > C(n, vector<long>(l));
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < m; j++)
    {
      cin >> A.at(i).at(j);
    }
  }
  for (int j = 0; j < m; j++)
  {
    for (int k = 0; k < l; k++)
    {
      cin >> B.at(j).at(k);
    }
  }

  for (int i = 0; i < n; i++)
  {
    for (int k = 0; k < l; k++)
    {
      long c_i_k = 0;
      for (int j = 0; j < m; j++)
      {
        c_i_k += A.at(i).at(j) * B.at(j).at(k);
      }
      C.at(i).at(k) = c_i_k;
    }
  }

  for (int i = 0; i < n; i++)
  {
    for (int k = 0; k < l; k++)
    {
      if (k)
      {
        cout << " ";
      }
      cout << C.at(i).at(k);
    }
    cout << endl;
  }
}


Measured memory_bytes: 3280
#define DEBUG 0

/**
 * File    : B2.cpp
 * Author  : Kazune Takahashi
 * Created : 2019-5-29 15:58:23
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <random>
#include <chrono>
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

/*
void Yes()
{
  cout << "Yes" << endl;
  exit(0);
}

void No()
{
  cout << "No" << endl;
  exit(0);
}
*/

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

const ll MOD = 1000000007;

int N;
int C[200010];
ll DP[200010];
ll sum[200010];

int main()
{
  cin >> N;
  for (auto i = 0; i < N; i++)
  {
    cin >> C[i];
    C[i]--;
  }
  C[N] = -1;
  DP[0] = 1;
  for (auto i = 1; i <= N; i++)
  {
    if (C[i - 1] == C[i])
    {
      DP[i] = DP[i - 1];
    }
    else
    {
      DP[i] = DP[i - 1] + sum[C[i - 1]];
      DP[i] %= MOD;
      sum[C[i - 1]] += DP[i - 1];
      sum[i] %= MOD;
    }
#if DEBUG == 1
    cerr << "DP[" << i << "] = " << DP[i] << endl;
#endif
  }
  cout << DP[N] << endl;
}

Measured memory_bytes: 4096
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Collectors;

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

		Scanner sc = new Scanner(System.in);
		List<Restaurant> restList;
		int n;

		n = sc.nextInt();
		restList = new ArrayList<>(n);

		String name;
		int point;
		for(int i = 1; i <=n; i++) {
			name = sc.next();
			point = sc.nextInt();
			Restaurant rest = new Restaurant(i, name, point);
			restList.add(rest);
		}


		Map<String, List<Restaurant>> restMap = restList.stream()
		.collect(Collectors.groupingBy(Restaurant::getName));

		restMap.keySet().stream()
		.sorted(Comparator.comparing(data -> data))
		.map(key -> restMap.get(key)
					.stream()
					.sorted(Comparator.comparing((Restaurant data) -> data.getPoint()).reversed())
					.collect(Collectors.toList())

		)
		.forEach(data ->
			{
				for(Restaurant elem : data) {
					System.out.println(elem.id);
				}
			}
			);

		sc.close();

	}

}

class Restaurant{
	int id;
	String name;
	int point;

	public Restaurant(int id, String name, int point) {
		super();
		this.id = id;
		this.name = name;
		this.point = point;
	}

	public int getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public int getPoint() {
		return point;
	}

}



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

int main() {
    long h, n, a, b, temp;
    cin >> h >> n;
    vector<vector<long>> mp(n + 1, vector<long>(h + 1, LONG_MAX));
    rep(i, n + 1) mp.at(i).at(0) = 0;
    rep(i, n) {
        cin >> a >> b;
        rep(j, min(a, h)) mp.at(i + 1).at(j + 1) = min(mp.at(i).at(j + 1), b);
        temp = a + 1;
        while(temp <= h) {
            mp.at(i + 1).at(temp) = min(mp.at(i).at(temp), mp.at(i + 1).at(temp - a) + b);
            temp++;
        }
    }
    cout << mp.at(n).at(h) << endl;
}

Measured memory_bytes: 78592
#include<iostream>
#include<string>
using namespace std;
int main(){
  int max=0, count =0;
  string str;
  cin>>str;
  for(int i=0; i<3; i++){
    if(str[i]=='R') count++;
    else count =0;
    if(count>max) max = count;
  }
  cout<<max<<endl;
    
    
return 0;
}

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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll K;
  cin >> K;
  ll N = 50;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    A[i] = 1LL * i;
  }
  ll q = K / N, r = K % N;
  for (int i = 0; i < N; i++) {
    A[i] += q;
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < N; j++) {
      A[j] += (i == j ? 1LL * N : -1LL);
    }
  }
  cout << N << '\n';
  for (int i = 0; i < N; i++) {
    cout << A[i] << " ";
  }
  return 0;
}


Measured memory_bytes: 256