akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
// Big two primes
#define X 1001100011100001111ll
#define mod 1000000007
#define ll long long
#define all(a) a.begin(),a.end()
#define sortall(a) sort(all(a))
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define nloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define arrip(a,n)  int a[n]; fo(i, n) cin >> a[i];
#define arrop(n)  fo(i,n) cout<<a[i]<<" ";
#define pb push_back
#define mp make_pair
#define itr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626

#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int>
#define fi first
#define se second
#define endl "\n"
#define pi pair<int, int>
#define vpi vector<pi>
#define sz(s) s.size()
#define bits(n) __builtin_popcount(n)//Count set bits

const int MAXN = (int)((1e5) + 100);
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
int max(int a, int b) {if (a > b) return a; else return b;}
int min(int a, int b) {if (a < b) return a; else return b;}


bool even(int n)
{
	if (n & 1)
		return false;
	return true;
}
int32_t main()
{
#ifndef ONLINE_JUDGE
	freopen("codechefi.txt", "r", stdin);
	freopen("codechefo.txt", "w", stdout);
#endif
	fio;

	int a, b, c;
	cin >> a >> b >> c;
	int cnt = 0;
	while (even(a) && even(b) && even(c))
	{
		int a1, b1, c1;
		a1 = a;
		b1 = b;
		c1 = c;
		a = (c1 / 2) + (b1 / 2);
		b = (a1 / 2) + (c1 / 2);
		c = (a1 / 2) + (b1 / 2);
		if (a == a1 && b == b1 && c == c1) {
			cout << "-1" << endl;
			return 0;
		}
		cnt++;

	}
	cout << cnt << endl;
}

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		char[][] matrix1 = new char[100][];
		char[][] matrix2 = new char[100][];
		
		int i , j , n , m;
		n = scan.nextInt();
		m = scan.nextInt();
		
		for (i = 0;i < n;i ++) {
			String input = scan.next();
			matrix1[i] = input.toCharArray();
		}
		
		for (i = 0;i < m;i ++) {
			String input = scan.next();
			matrix2[i] = input.toCharArray();
		}
		
		boolean result = false;
		for (i = 0;i + m - 1 < n;i ++)
			for (j = 0;j + m - 1 < n;j ++) {
				if (equals(matrix1 , matrix2 , i , j)) {
					result = true;
				}
			}
		if (result)
			System.out.println("Yes");
		else
			System.out.println("No");
		
	}
	
	private static boolean equals(char[][] matrix1 , char[][] matrix2 , int x1 , int y1) {
		
		int i , j , n = matrix1[0].length , m = matrix2[0].length;
		for (i = 0;i < m;i ++)
			for (j = 0;j < m;j ++) {
				char ch1 = matrix1[x1 + i][y1 + j];
				char ch2 = matrix2[i][j];
				if (ch1 != ch2)
					return false;
			}
		return true;
		
	}
	
}











Measured memory_bytes: 21076
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
    int n; cin >> n;
    vector<int> p(n), q(n), r(n);
    for(int i=0; i<n; ++i){cin >> p[i];}
    for(int i=0; i<n; ++i){cin >> q[i];}
    for(int i=0; i<n; ++i){r[i] = i+1;}
    int pn, qn;
    int cnt = 0;
    do{
        int pm = 0; int  qm = 0;
        for(int i=0; i<n; ++i){
          	
            if(p[i]!=r[i]){continue;}
            else if(p[i]==r[i]){
                pm++; 
                if(pm==n){pn = cnt; break;}
            }
        }
        for(int i=0; i<n; ++i){
            if(q[i]!=r[i]){continue;}
            else if(q[i]==r[i]){
                qm++; 
                if(qm==n){qn = cnt; break;}
            }
        }
        cnt++;
    }while(next_permutation(r.begin(), r.end()));
    cout << abs(pn-qn) << endl;
    return 0;
}

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

int main(){
int H[100000],W[100000];
int c=0;
for(int i=1;i<100000;i++){
cin>>H[i]>>W[i];
c++;
if(H[i]==0 && W[i]==0){
goto aa;
}
}
aa:;
for(int i=1;i<c;i++){
for(int j=0;j<H[i];j++){
for(int k=0;k<W[i];k++){
    if((j+k)%2==0){
    cout<<"#";
    }
    else{
    cout<<".";
    }
}
cout<<endl;
}
cout<<endl;
}
return 0;
}

Measured memory_bytes: 1164
#include <iostream>

using namespace std;
char Field[502][502];

void solve()
{
	int H, W;
	while(cin >> H >> W, H || W)
	{
		for(int i = 0; i < H + 1; ++i)
		{
			Field[i][0] = '*';
			Field[i][W + 1] = '*';
		}
		for(int i = 0; i < W + 1; ++i)
		{
			Field[0][i] = '*';
			Field[H + 1][i] = '*';
		}
		for(int i = 1; i < H + 1; ++i)
		{
			for(int j = 1; j < W + 1; ++j)
			{
				cin >> Field[i][j];
			}
		}
		int Max = 0;
		for(int i = 1; i < H + 1; ++i)
		{
			int square = 0;
			for(int j = 1; j < W + 1; ++j)
			{
				if(Field[i][j] == '.')
				{
					int pos_x = j;
					int pos_y = i;
					int width = 1;
					int height = 1;
					int max_width = 500;
					while(Field[pos_y][pos_x] == '.')
					{
						width = 1;
						while(Field[pos_y][pos_x] == '.')
						{
							if(max_width == width)
							{
								width++;
								break;
							}
							pos_x++;
							width++;
						}
						--width;
						if(max_width > width)
						{
							max_width = width;
						}
						square = width * height;
						if(square > Max)
						{
							Max = square;
						}
						pos_y++;
						height++;
						pos_x = j;
					}
				}
			}
		}
		cout << Max << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 0
import copy

N = int(input())
X = list(map(int, input().split()))

X2 = copy.deepcopy(X)
X.sort()

l = X[N // 2 - 1]
r = X[N // 2]

for i in X2:
  if i > l:
    print(l)
  else:
    print(r)

Measured memory_bytes: 25732
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD 998244353
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int K, N;

typedef vector<i64> Poly;

Poly operator*(const Poly &a, const Poly &b)
{
	Poly ret(a.size(), 0LL);
	for (int i = 0; i < a.size(); ++i) {
		for (int j = 0; j < b.size(); ++j) {
			if (i + j < a.size()) ADD(ret[i + j], a[i] * b[j]);
		}
	}
	return ret;
}

int main()
{
	scanf("%d%d", &K, &N);

	Poly P(N + 1, 1LL);
	Poly W = P, Q = P;
	for (int i = 0; i < 12; ++i) {
		if (((K - 1) >> i) & 1) {
			W = W * Q;
		}
		Q = Q * Q;
	}

	vector<i64> seq(2 * K - 1, -1LL);
	Poly L{ 1LL, 0LL, (i64)(MOD - 1) };

	for (int i = 0; i < K; ++i) {
		if (i % 2 == 0) {
			W = W * L;
		}
		seq[i] = W[N];
		seq[2 * K - 2 - i] = seq[i];
	}

	for (int i = 0; i < seq.size(); ++i) printf("%lld\n", seq[i]);

	return 0;
}


Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskC {

		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int a = in.nextInt();
			int b = in.nextInt();
			int c = in.nextInt();
			int d = in.nextInt();

			if (a > c) {
				int temp = a;
				a = c;
				c = temp;
				temp = b;
				b = d;
				d = temp;
			}
			int intersection = 0;
			if(b>c){
				if(b>d){
					intersection = d-c;
				}else{
					intersection = b-c;
				}
			}
			out.println(intersection);
		}

	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

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

		public double nextFloat() {
			return Double.parseDouble(next());
		}

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

	}
}

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

int num_diff(string S, string sol);

int main()
{
    string S;
    cin >> S;
    int N = S.length();
    string sol1, sol2;
    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            sol1 += "0";
            sol2 += "1";
        }
        else {
            sol1 += "1";
            sol2 += "0";
        }
    }
    int num_sol1, num_sol2;
    num_sol1 = num_diff(S, sol1);
    num_sol2 = num_diff(S, sol2);
    cout << min(num_sol1, num_sol2) << endl;
    return 0;
}

int num_diff(string S, string sol)
{
    int num = 0, N = S.length();
    for (int i = 0; i < N; i++) {
        if (S[i] == sol[i]) {}
        else {
            num++;
        }
    }
    return num;
}


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

int main() {
  ll K,N;
  cin >> K >> N;
  vector<ll> A(N);
  for(ll i=0;i<N;i++){
    cin >> A.at(i);
  }
  vector<ll> D(N);
  for(ll i=0;i<N;i++){
    if(i<N-1){
      D.at(i)=A.at(i+1)-A.at(i);
    }
    else if(i==N-1){
      D.at(i)=A.at(0)-A.at(i)+K;
    }
  }
  ll max=0;
  for(ll i=0;i<N;i++){
    if(D.at(i)>max){
      max=D.at(i);
    }
  }
  cout << K-max << endl;
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
typedef long long LL;
using namespace std;

int main(){
  int n, c;
  cin >> n >> c;
  int sum = 0;
  for (int i = 0; i < c; i ++) {
    int t; cin >> t;
    sum += t;
  }

  cout << ceil((double)sum / (n+1)) << endl;
}


Measured memory_bytes: 3284
#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;

struct point {
	point() { x = y = 0; i = 0; }
	long long x, y; int i;
}P[110], t;

long long ccw(point a, point b, point c)
{
	return a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y);
}

long long ccw(int a, int b, int c)
{
	return ccw(P[a], P[b], P[c]);
}

bool cmp1(const point& a, const point& b) { return a.y == b.y ? a.x < b.x : a.y < b.y; }
bool cmp2(const point& a, const point& b) {
	long long c = ccw(point(), a, b);
	if (c == 0) return a.x * a.x + a.y * a.y < b.x * b.x + b.y * b.y;
	return c > 0;
}

int N, sz, S[110]; double ans[110];

int main()
{
	scanf("%d", &N);
	for (int i = 0; i<N; i++) scanf("%lld %lld", &P[i].x, &P[i].y), P[i].i = i;
	for (int i = 1; i<N; i++) {
		if (cmp1(P[i], P[0])) {
			t = P[i]; P[i] = P[0]; P[0] = t;
		}
	}
	for (int i = N - 1; i >= 0; i--) {
		P[i].x -= P[0].x;
		P[i].y -= P[0].y;
	}
	sort(P + 1, P + N, cmp2);

	sz = 1; S[0] = 0;
	for (int i = 1; i<N; i++) {
		while (sz >= 2) {
			if (ccw(S[sz - 2], S[sz - 1], i) > 0) break;
			sz--;
		}
		S[sz++] = i;
	}

	if (sz == 2) {
		ans[P[S[0]].i] = ans[P[S[1]].i] = 0.5;
	}
	else {
		double pi = acos(-1.0);
		double sm = 0;
		for (int i = 0; i < sz; i++) {
			auto &a = P[S[i]];
			auto &b = P[S[(i + sz - 1) % sz]];
			auto &c = P[S[(i + 1) % sz]];
			double ax = b.x - a.x, ay = b.y - a.y;
			double bx = c.x - a.x, by = c.y - a.y;
			sm += acos((ax*bx + ay*by) / hypot(ax, ay) / hypot(bx, by));
			ans[a.i] = (pi - acos((ax*bx+ay*by)/hypot(ax,ay)/hypot(bx,by))) / pi / 2;
		}
	}

	for (int i = 0; i<N; i++) printf("%.12lf\n", ans[i]);

	return 0;
}

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

int main(void) {
  int a;
  cin >> a;
  if (a == 25) {
    cout << "Christmas" << endl;
  } else if (a == 24) {
    cout << "Christmas Eve" << endl;
  } else if (a == 23) {
    cout << "Christmas Eve Eve" << endl;
  } else if (a == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;


int main()
{
    int k;
    int odd = 0;
    cin >> k;

    int even = k/2;
    if(k%2 == 0)  odd = k/2;
    else odd = k/2 +1;

    cout << even*odd;
    return 0;
}


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

using namespace std;

#define BUF_SIZE 1024

class Stack{
public:
	Stack(int stack_size):
		m_index(0){
		m_array = new int[stack_size];
	};
	~Stack(){
		delete[] m_array;
	};
	void push(int var){
		m_array[m_index++] = var;
	};
	int pop(){
		return m_array[--m_index];
	};

	bool isEmpty(){
		return m_index == 0;
	};

private:
	int* m_array;
	int m_index;
};

int main(){
	char buf[BUF_SIZE];

	for(int i = 0; i < BUF_SIZE; i++){
		buf[i] = 'e';
	}
	fgets(buf,BUF_SIZE,stdin);

	Stack stack(BUF_SIZE);

	bool numFLG = false;
	int S = 0,op1=0,op2=0;

	for(int i = 0;buf[i] != 'e'; i++){
		if(buf[i] >= '0' && buf[i] <= '9'){
			numFLG = true;
			S = 10*S + (buf[i] - '0');
		}else{
			if(numFLG){
				stack.push(S);
				S = 0;
				numFLG = false;
			}

			if(buf[i] == '+'){
				op2 = stack.pop();
				op1 = stack.pop();
				stack.push(op1+op2);
			}else if(buf[i] == '-'){
				op2 = stack.pop();
				op1 = stack.pop();
				stack.push(op1-op2);
			}else if(buf[i] == '*'){
				op2 = stack.pop();
				op1 = stack.pop();
				stack.push(op1*op2);
			}
		}
	}

	op1 = stack.pop();
	printf("%d\n",op1);
}


Measured memory_bytes: 3228
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;

void dfs(const int n, string &s, set<string> &S){
  if(s.length() == n){
    S.insert(s);
    return;
  }
  char c;
  if(s.empty()) c = 'a';
  else c = *max_element(s.begin(), s.end()) + 1;
  for(char a = 'a'; a <= c; ++a){
    s += a;
    dfs(n,s,S);
    s.pop_back();
  }
}

int main(){
  int N;
  cin >> N;
  set<string> S;
  string s = "";
  dfs(N,s,S);
  for(auto e : S)
    cout << e << "\n";
}


Measured memory_bytes: 14208
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	//C問題

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Scanner scan = new Scanner(System.in);

		int n, k;

		n = scan.nextInt();
		k = scan.nextInt();

		List<Integer> amariList = new ArrayList<>();

		while (true) {
			int sho;
			int amari;

			sho = n / k;
			amari = n % k;

			amariList.add(amari);

			n = sho;

			if (sho == 0) {
				break;
			}
		}

		System.out.println(amariList.size());
	}

}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
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 gcd(int a,int b){return b?gcd(b,a%b):a;}

int x[20][20];
int y[20][20];

int main(){
  int n;
  cin >> n;
  vi a(n);
  rep(i, n){
    cin >> a[i];
    rep(j,a[i]){
      cin >> x[i][j] >> y[i][j];
    }
  }
  ll ans = 0;
  for (ll tmp = 0; tmp < (1 << n);tmp++){
    bool z = true;
    bitset<15> s(tmp);
    rep(i,n){
      if(s[i]==1){
        rep(j,a[i]){
          if(s[x[i][j]-1]!=y[i][j]){
            z = false;
            goto END;
          }
        }
      }
    }
    END:
    if(z){
      ll num = s.count();
      chmax(ans, num);
    }
  }
  print(ans);
}

Measured memory_bytes: 256
N, K, *A = map(int, open(0).read().split())

dp = [False] * (K + 1)
for i in range(1, K + 1):
    for a in A:
        if i - a >= 0:
            dp[i] |= not dp[i - a]

if dp[K]:
    print("First")
else:
    print("Second")

Measured memory_bytes: 41964
#include <iostream>
#include <stack>
#include <queue>
#include <set>
#include <vector>
#include <iomanip>
using namespace std;

int main()
{
	string str;
	cin >> str;

	int max = 0;
	int cnt = 0;

	for (auto s : str)
	{
		if (s == 'R') {
			cnt++;
			if (cnt > max) {
				max = cnt;
			}
		}
		else {
			cnt = 0;
		}
	}

	cout << max << endl;
}

Measured memory_bytes: 3620
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int x, y;
		int max, min, mod;
		
		x = sc.nextInt();
		y = sc.nextInt();
		
		while(y > 0){
			max = Math.max(x, y);
			min = Math.min(x, y);
			mod = max % min;
			
			x = min;
			y = mod;
		}
		
		System.out.println(x);
	}
}

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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector< ii >
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }

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

int32_t main(){
  DESYNC;
  int n;
  cin >> n;
  tuple<string, int, int> v[n];
  for(int i=0; i<n; i++){
    cin >> get<0>(v[i]) >> get<1>(v[i]);
    get<2>(v[i]) = i+1;
    get<1>(v[i]) = -get<1>(v[i]);
  }
  sort(v,v+n);
  for(int i=0; i<n; i++) cout << get<2>(v[i]) << endl;
}



Measured memory_bytes: 256
//Volume1-0150
import java.util.Scanner;

class Main {

    //declare
    private static final int       MAX = 10001;
    private static       boolean[] prm = new boolean[MAX];
    private static       int    [] twn = new int    [MAX];

	public static void main(String[] arg){

		initialize();

		//input
		Scanner sc = new Scanner(System.in);
		int n;
		while((n = sc.nextInt()) != 0){

			//output
			System.out.println(twn[n]-2+" "+(twn[n]));
		}
	}

    private static void initialize(){

    	//Creation of a prime number table.
        for(int i=0;i<MAX;i++){prm[i] = true;}
        prm[0] = false;
        prm[1] = false;
        for(int i=4;i<MAX;i+=2){prm[i] = false;}
        for(int i=3;i<MAX;i+=2){
            if(!prm[i]){continue;}
            for(int k=i*2;k<MAX;k+=i){
                prm[k] = false;
            }
        }

        //The table of twin primes is created.
        int twin = 5;
        for(int i=5;i<MAX;i++){
        	if(prm[i] && prm[i-2]){
        		twin = i;
        	}
        	twn[i] = twin;
        }
    }
}

Measured memory_bytes: 33504
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <unordered_map>
#include <list>
#define sz(a) int((a).size())
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef unordered_map<int,int> umapi;

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

#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif // _DEBUG
    //freopen("input.txt","r",stdin);
    int n ;
    cin>>n;
    cout<<n+pow(n,2)+pow(n,3);


    return 0;
}



Measured memory_bytes: 4076
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = n-1; i >= 0; --i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n,w;
  cin >> n >> w;
  
  const int wm = 3*n+1;
  vector<vector<int>> dp(n+1,vector<int>(wm+1,-1));
  int w0,v0;
  cin >> w0 >> v0;
  dp[0][0] = 0;
  if(w0<=w) dp[1][0] = v0;
  rep(_,n-1){
    int wi,vi;
    cin >> wi >> vi;
    wi -= w0;
    rep(i,n)rep(j,wm+1){
      if(dp[i][j]<0) continue;
      if(w0*(i+1)+j+wi>w) continue;
      dp[i+1][j+wi] = max(dp[i+1][j+wi],dp[i][j]+vi);
    }
  }
  int ans = 0;
  rep(i,n+1)rep(j,wm+1) ans = max(ans,dp[i][j]);
  cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <bitset>
#include <time.h>
#include <set>
#include <algorithm>
#define ll long long
#define MAXN 1000
#define MODD 1000000007
#define Inf 10000000000000000ll
#define ll long long
using namespace std;


map<pair<ll,int>,int> hashed;

ll Solve(ll left, int curr) {
    
    

    if (left <= 0)
        return 0;
    
    if (hashed.find(make_pair(left,curr)) != hashed.end())
        return hashed[make_pair(left,curr)];
    
    
    ll ret = Inf;
    for(int i=1;i<=6;i++) {
        if (curr+i != 7 && i!=curr) {
            //printf("here\n");
            //printf("L=%lld f=%d\n",left,curr);
            ll nxt = Solve(left-i,i);
            ret = min(ret, 1+nxt);
        }
    }
    
    return hashed[make_pair(left,curr)]=ret;
}

int main() {
    
    // {1,6}
    // {2,5}
    // {3,4}
    
    
    
    
    ll x;
    cin>>x;
    
    
    // 5,6,5,6,5,6...
    
    
    
    if (x > 11) {
        
        ll k = x/11;
        
        
        k = max(0ll,k-100);
        
        
        
        
        ll left = x-11*k;
        
        
        cout << min(Solve(left, 5)+2*k,Solve(left, 6)+2*k) << endl;


        
        // 5+6+1
    } else {
        
        ll ans = Inf;
        for(int i=1;i<=6;i++) {
            ll curr = Solve(x, i);
            ans = min(ans, curr);

        }
        
        cout << ans << endl;
        
        
    }
    
    
    
    
    
    
    
}

Measured memory_bytes: 768
n = int(input())
a = [int(x) for x in input().split()] + [-1]
b = [0] + [int(x) for x in input().split()]
c = [0] + [int(x) for x in input().split()]

ans = 0
for i in range(n):
    ans += b[a[i]]
    if a[i]+1 == a[i+1]:
        ans += c[a[i]]
print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main()
{
  int X, A, B;
  cin >> X >> A >> B;
  string ans = "safe";
  if (B - A <= 0)
    ans = "delicious";
  if (X < B - A)
    ans = "dangerous";
  cout << ans << endl;
  return 0;
}

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

using namespace std;

const int N = 2e5+5;

const int mod = 1e9+7;

int n;
int m;
int sz[N];
int parent[N];

int getP(int u){
    if(u == parent[u])
        return u;
    return parent[u] = getP(parent[u]);
}

void join(int u , int v){
    u = getP(u);
    v = getP(v);
    if(u == v)
        return;
    parent[v] = u;
    sz[u] += sz[v];
}

int main(){
    scanf("%d%d" , &n , &m);
    for(int i = 1; i <= n; i++)
        parent[i] = i , sz[i] = 1;
    for(int i = 1; i <= m; i++){
        int u , v;
        scanf(" %d%d" , &u , &v);
        join(u , v);
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        ans = max(ans , sz[getP(i)]);
    }
    printf("%d\n" , ans);
}


Measured memory_bytes: 5604
#include <iostream>
using namespace std;
int gcd(int a,int b){
    if(b==0){
        return a;
    }else{
        return gcd(b,a%b);
    }
}

int main(void){
    // Your code here!
    int n,x;
    std::cin >> n>>x;
    int ans,tmp;
    std::cin >> tmp;
    ans=abs(x-tmp);
    for (int i = 1; i < n; i++) {
        std::cin >> tmp;
        ans=gcd(ans,abs(tmp-x));
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
N = int(input())

for i in range(N):
    a = list(map(int, input().split()))
    if(i == 0):
        mx = a[0]
        my = a[0]
        mi = a[1]
    else:
        if(my < a[0]):
            my = a[0]
            mi = a[1]


score = my
score += mi
print(score)

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

using namespace std;


typedef long long LL;

const int N = 2e5 + 7;

LL b[N], h[N], c[N];

void update(int idx, int n, LL val) {
    for(int i = idx; i <= n; i += i & -i)
        b[i] = max(b[i], val);

}

LL query(int idx) { LL r = 0;
    for(int i = idx; i > 0; i -= i & -i)
        r = max(r, b[i]);
    return r;
}


int32_t main() {
    int n; cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> h[i];
    }
    LL ans = 0;
    for(int i = 1; i <= n; i++) {
        LL x; cin >> x;
        LL tmp = query(h[i] - 1) + x;
        ans = max(ans, tmp);
        update(h[i], n, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back

using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef unsigned long long int ull;
int MOD=1000000007;
int MOD2=998244353;
vector<int> bases;
const ll LLINF=1ll<<60;
const char en='\n';

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void yes() {cout<<"YES"<<en; exit(0);}
void no() {cout<<"NO"<<en; exit(0);}
inline int rund() {int x576363482791fuweh=rng();return abs(x576363482791fuweh)%RAND_MAX;}
template<class T>
void prVec(vector<T> w)
{
	cout<<w.size()<<endl;
	for (int i=0;i<int(w.size())-1;++i) cout<<w[i]<<' ';
	if (w.size()) cout<<w[w.size()-1]<<endl;
}

void M998()
{
	swap(MOD,MOD2);
}

ll raand()
{
	ll a=rund();
	a*=RAND_MAX;
	a+=rund();
    return a;
}

#define rand raand

ll raaand()
{
	return raand()*(MOD-7)+raand();
}

string to_upper(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
	return a;
}

string to_lower(string a)
{
	for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
	return a;
}

ll sti(string a)
{
	ll k=0;
	for (int i=0;i<(int)a.size();++i)
	{
		k*=10;
		k+=a[i]-'0';
	}
	return k;
}

string its(ll k)
{
	if (k==0) return "0";
	string a;
	while (k)
	{
		a.push_back((k%10)+'0');
		k/=10;
	}
	reverse(a.begin(),a.end());
	return a;
}

ll min(ll a,int b)
{
	if (a<b) return a;
	return b;
}

ll min(int a,ll b)
{
	if (a<b) return a;
	return b;
}

ll max(ll a,int b)
{
	if (a>b) return a;
	return b;
}

ll max(int a,ll b)
{
	if (a>b) return a;
	return b;
}

ll gcd(ll a,ll b)
{
	if (b==0) return a;
	return gcd(b,a%b);
}

ll lcm(ll a,ll b)
{
	return a/gcd(a,b)*b;
}

template<class T,class K>
pair<T,K> mp(T a,K b)
{
	return make_pair(a,b);
}

inline int mult(ll a,ll b)
{
	return (a*b)%MOD;
}

inline int pot(int n,int k)
{
	if (k==0) return 1;
	ll a=pot(n,k/2);
	a=mult(a,a);
	if (k%2) return mult(a,n);
	else return a;
}

int divide(int a,int b)
{
	return mult(a,pot(b,MOD-2));
}

inline int sub(int a,int b)
{
	if (a-b>=0) return a-b;
	return a-b+MOD;
}

inline int add(int a,int b)
{
	if (a+b>=MOD) return a+b-MOD;
	return a+b;
}

bool prime(ll a)
{
	if (a==1) return 0;
	for (int i=2;i<=round(sqrt(a));++i)
	{
		if (a%i==0) return 0;
	}
	return 1;
}

ll has(string x)
{
	ll h1=0,h2=0;
	x=to_lower(x);
	for (char a: x)
	{
		h1*=bases[0];
		h1+=a-'a';
		h1%=bases[3];
		h2*=bases[1];
		h2+=a-'a';
		h2%=bases[4];
	}
	return h1*(MOD+13893829)+h2;
}

const int N=300010;
int n,m;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	for (int i=0;i<10;++i) bases.push_back(rand()%(MOD-13893829)+13893829);
	cin>>n>>m;
	if (n<m) cout<<0;
	else cout<<10;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
using pii = pair<int, int>;
int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i < n + 1; i++) {
    cin >> a[i];
  }
  int count = 0;
  for (int i = 1; i < n + 1; i++) {
    if (i == a[a[i]]) {
      count++;
    }
  }

  /* for (int i = 1; i < n + 1; i++) {
    for (int j = i + 1; j < n + 1; j++) {
      if (a[i] == j && a[j] == i) count++;
    }
  } */

  cout << count / 2 << endl;
}

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

using namespace std;

long long a,b,c,x,y;

int main(){
	cin >> a >> b >> c >> x >> y;
	if(a+b<=c*2){
		cout << a*x+b*y;
	}
	else{
		if(x>y){
			if(a<=c*2) cout << min(x,y)*c*2+a*(x-min(x,y))+b*(y-min(x,y));
			else  cout << min(x,y)*c*2+c*2*(x-y);
		}
		else if(x<y){
			if(b<=c*2) cout << min(x,y)*c*2+a*(x-min(x,y))+b*(y-min(x,y));
			else cout <<  min(x,y)*c*2+c*2*(y-x);
		}
		else cout << min(x,y)*c*2;
	}
	return 0;
}

Measured memory_bytes: 256
require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

S, T = gets.split

puts T + S


Measured memory_bytes: 14508
#define s(X,Y,Z)(t=X,X=Y,Y=t,f(Z?&X:&Y),a&7)
f(int*a){*a^=127;}m,a,b,c,t,r;main(n){while(scanf("%d",&n),n){for(r=1,a=49,b=42,c=35;n--;scanf(" %c%*s",&t),m=t-76,r+=m%6==0?s(c,b,m):1<m&m<8?s(b,a,m^7):s(c,a,m>0));printf("%d\n",r);}}

Measured memory_bytes: 0
#include <iostream>
#include <stdlib.h>
using namespace std;

int main(void){
		int a,b,c;
		cin >> a >> b >> c;
		int f=0;
		for(int sum=1;sum<1000000;sum++){
				if(sum%b==c && sum%a==0){
						f=1;
						break;
				}
		}
		if(f==0){
				cout << "NO" << endl;
		}else{
				cout << "YES" << endl;
		}
		exit(0);
}


Measured memory_bytes: 256
import Foundation

let input_line = readLine()!.components(separatedBy: " ")
let X = Int(input_line[0])!
let Y = Int(input_line[1])!
let Z = Int(input_line[2])!

var A = X
var B = Y
var C = Z

swap(&A, &B)
swap(&A, &C)

print("\(A) \(B) \(C)")

Measured memory_bytes: 14148
program green_bin
    implicit none
    integer(4):: n,i,j,k
    integer(4),allocatable:: a(:)
    integer(8) :: count=0
    character(10):: c
    character(10),allocatable:: ca(:)
    character(26),parameter:: alpha='abcdefghijklmnopqrstuvwxyz'
    
    read*, n
    allocate(a(10), ca(n))

    do i=1,n
        read*,c(:)
        do j=1,10
            a(j) = ichar(c(j:j))
        end do
        call merge_sort(a(:),1,10)
        do j=1,10
            ca(i)(j:j) = char(a(j))
        end do
        
    end do

    call smerge_sort(ca(:), 1, n)

    block; integer(4):: fst, scd
        fst=1; scd=2
        do while (scd <= n)
            if (ca(fst)==ca(scd)) then
                count = count + scd-fst
                scd=scd+1
            else
                fst=scd
                scd=scd+1
            end if
        end do
    end block

    print*, count



contains
recursive subroutine merge_sort(ar,fst,lst)
    integer(4):: ar(:), fst, lst, mid, tmp

    if (lst-fst < 2)then
        if (ar(lst) < ar(fst)) then
            tmp = ar(fst)
            ar(fst) = ar(lst)
            ar(lst) = tmp
        end if
        return
    end if

    mid = (fst+lst)/2
    call merge_sort(ar,fst,mid)
    call merge_sort(ar,mid+1,lst)
    call merge(ar,fst,mid,lst)
end subroutine

subroutine merge(ar, fst, mid, lst)
    integer(4):: ar(:), fst, mid, lst
    integer(4),pointer:: tmp(:)
    integer(4):: it, il, ir
    
    allocate(tmp(lst-fst+1))
    it=1
    il=fst
    ir=mid+1

    do while(il <= mid .and. ir <= lst)
        if (ar(il) <= ar(ir)) then
            tmp(it)=ar(il)
            il=il+1
        else
            tmp(it)=ar(ir)        
            ir=ir+1
        end if
        it=it+1
    end do

    if(ir > lst) then
        tmp(it:) = ar(il:mid)
    else
        tmp(it:) = ar(ir:lst)
    end if

    ar(fst:lst) = tmp(:)
    deallocate(tmp)
    
end subroutine

recursive subroutine smerge_sort(ar, fst, lst)
    character(10):: ar(:), tmp
    integer(4):: fst, lst, mid

    if (lst-fst < 2) then
        if (ar(lst) < ar(fst)) then
            tmp = ar(fst)
            ar(fst) = ar(lst)
            ar(lst) = tmp
        end if
        return
    end if

    mid = (fst+lst)/2
    call smerge_sort(ar, fst, mid)
    call smerge_sort(ar, mid+1, lst)
    call smerge(ar, fst, mid, lst)
end subroutine

subroutine smerge(ar, fst, mid, lst)
    character(10):: ar(:)
    character(10),pointer:: tmp(:)
    integer(4):: fst, mid, lst
    integer(4):: it, il, ir

    allocate(tmp(lst-fst+1))
    it=1
    il=fst
    ir=mid+1

    do while(il <= mid .and. ir<=lst)
        if (ar(il) <= ar(ir)) then
            tmp(it) = ar(il)
            il=il+1        
        else
            tmp(it) = ar(ir)
            ir=ir+1
        end if
        it=it+1
    end do

    if (ir > lst) then
        tmp(it:) = ar(il:mid)
    else
        tmp(it:) = ar(ir:lst)
    end if
    ar(fst:lst) = tmp(:)
    deallocate(tmp)
end subroutine


    
end program green_bin

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<string> vs;
const ll mod = 1e9+7;
const ll inf = 1e17;
const int INF = 1e9;
const double PI = acos(-1);
#define fo(i, a, b) for(int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
int main()
{
  string s;
  cin >> s;

  string t = s;
  sort(all(s));
  s.erase(unique(all(s)), s.end());
  if(s.size() == t.size()) cout << "yes" << endl;
  else cout << "no" << endl;

  return 0;
}


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

int main()
{
    long long  n,m,k; std::cin >> n >> m >> k;
    long long  a[200001], b[200001];
    // std::vector<long long>  a(n+1), b(m+1);
    a[0]=0; b[0]=0;
    for (int i=1;i<n+1;i++)
        std::cin >> a[i];
    for (int i=1; i<m+1; i++)
        std::cin >> b[i];
    
    for (int i=1; i<n+1; i++)
        a[i]+=a[i-1];
    for (int i=1; i<m+1; i++)
        b[i]+=b[i-1];

    long long ans=0, r=m;
    for (int i=0; i<n+1; i++)
    {
        if(a[i]>k) break;
        while (a[i]+b[r]>k)
            r--;
        ans = std::max({ans, i+r});
    }
    
    std::cout << ans;

    return 0;
}

Measured memory_bytes: 6752
#include<bits/stdc++.h>
#include<atcoder/all>
#define a(x,y)if(std::gcd(x,y)==1)A=x*atcoder::inv_mod(x,y),m=std::min(m,(A>1?A:A+N)-1);
int main(){long long m,N,A,i=1;std::cin>>N;N*=2;m=N*9;for(;i*i<=N;i++)if(N%i==0){a(i,N/i)a(N/i,i)}std::cout<<m;}

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;
int main()
{
    int n;
    cin >> n;
    vector<int> p(n);
    int tmp = 200005;
    int cnt = 0;
    rep(i,n){
        cin >> p[i];
    }
    rep(i,n){
        if(p[i]<=tmp){
            cnt++;
            tmp = p[i];
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int popcount(T n) { return n ? 1 + popcount(n & (n - 1)) : 0; }
#endif
#ifdef __GNUC__
template <class T> int popcount(T n);
template <> int popcount(unsigned int n) { return n ? __builtin_popcount(n) : 0; }
template <> int popcount(int n) { return n ? __builtin_popcount(n) : 0; }
template <> int popcount(unsigned long long n) { return n ? __builtin_popcountll(n) : 0; }
template <> int popcount(long long n) { return n ? __builtin_popcountll(n) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CL(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };
bool valid_pos(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }

template <class T> void print(T a, int n, int br = 1, const string& deli = ", ") { cout << "{ "; for (int i = 0; i < n; ++i) { cout << a[i]; if (i + 1 != n) cout << deli; } cout << " }"; while (br--) cout << endl; }
template <class T> void print(const vector<T>& v, int br = 1, const string& deli = ", ") { print(v, v.size(), br, deli); }



int main()
{
	int n;
	while (cin >> n, n)
	{
		int a = 1 << 29, b = -(1 << 29);
		while (n--)
		{
			int s = 0;
			for (int i = 0; i < 5; ++i)
			{
				int t;
				cin >> t;
				s += t;
			}
			min_swap(a, s);
			max_swap(b, s);
		}
		cout << b << " " << a << endl;
	}
}

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

int main() {

  string S ; cin >> S;
  
  int N;
  N = S.size();
  
  char St, Sb;
  bool same = 1;
  
  //zentai
  for (int i = 0; i < N ; i++) {
    St = S.at(i);
    Sb = S.at(N - i -1);
    if (St != Sb) same = 0;    
  }
  
  //zenhan
  for (int i = 0; i < (N-1)/2 ; i++) {
    St = S.at(i);
    Sb = S.at( (N-1)/2 - i -1);
    if (St != Sb) same = 0;    
  }
  
if ( same ) cout << "Yes" << endl;
  else cout << "No" << endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#define N 100

int n, M[N][N];
int d[N], q[N];


void bfs(int s) {
   int u, v, i, x = 0, m = 0;

   for (i = 0; i < n; i++) {
    d[i] = 101;

 }

  q[s] = 0;
  d[s] = 0;

  while (x != 1) {
    u = q[m];

     for (v = 0; v < n; v++) {
       if (M[u][v] == 0) {
       continue;
      }
       if (d[v] != 101) {
       continue;
      }
      d[v] = d[u] + 1;
      q[++s] = v;
    }
     if (m == n - 1) {
       for (i = 0 ; i < n ; i++) {
        if (d[i] == 101) {
        d[i] = -1;
       }
     }
     x = 1;
    }
     m = m + 1;
   }

   for (u = 0; u < n; u++) {
    printf("%d %d\n", u + 1, d[u]);
  }
}

int main() {

  int u, v, k, i, j;

  scanf("%d", &n);
   for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
     M[i][j] = 0;
    }
  }

  for (i = 0; i < n; i++) {
    scanf("%d %d", &u, &k);
    u--;
    for (j = 0; j < k; j++) {
      scanf("%d", &v);
      v--;
      M[u][v] = 1;
    }
  }

  bfs(0);

  return 0;
}

Measured memory_bytes: 1808
h,w = map(int,input().split())
if h == 1 or w == 1:
    print(1)
else :
    a = int((h / 2) + (h % 2)) * int((w / 2) + (w % 2)) 
    b = int(h / 2) * int(w / 2)
    print(a + b)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
const long long INFL=1LL << 60;
const long long INF=1<<29;

int main() {
    int menu[5];
    int Min=10;
    int argmin=-1;
    int ans=0;
    int last=0;
    for(int i=0;i<5;i++){
        int temp;
        cin >> temp;
        menu[i]=temp/10*10;
        if(temp%10!=0){
            menu[i]+=10;
            if(temp%10<Min){
            Min=temp%10;
            argmin=i;
            last=temp;
            }
        } 
    }
    for(int i=0;i<5;i++){
        if(i==argmin)ans+=last;
        else ans+=menu[i];
    }
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
    public static void Main(string[] args)
    { 
        string[] str = Console.ReadLine().Split(' ');
        int k = int.Parse(str[0]);
        int x = int.Parse(str[1]);

        int w = k - 1;

        for(int i = 0; i < k*2-2; i++)
        {
            Console.Write(x - w + i + " ");
        }
        Console.WriteLine(x - w + k * 2 - 2);
    }
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll int h,w,n,r,s,res=0;
    cin>>h>>w>>n;
    r=max(h,w);
    s=min(h,w);
    while(n>0)
    {
    	n-=r;
    	res++;

    }
    cout<<res<<endl;

}	

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

using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//最終奥義 #define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void put_double(double obj){printf("%.12f\n",obj);};
//lambda: [](int x, int y){return x<y;}

signed main(void){
    ll a,b,c;cin>>a>>b>>c;
    ll d = c-a-b;
    if(d<=0){
        cout << "No" << endl;
    }
    else if(d*d>4*a*b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << 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 pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define SZ(x) ((int)(x).size())
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const double pi=acos(-1);




int main() {
  int H, W;
  cin >> H >> W;
  
  vector<string> masu(H+2);
  string s="";
  rep (i,W+2) s += ".";
  masu.at(0)=s;
  masu.at(H+1)=s;
  
  rep (i, H) {
  string t;
  cin >> t;
  masu.at(i+1)= "." + t + ".";
  }
  
  rep (i,H) {
    rep (j, W) {
      if((masu.at(i+1)).at(j+1)=='#' ) {
      cout << "#";
      } 
      if((masu.at(i+1)).at(j+1)=='.' ) {
        int sum = 0;
        if ((masu.at(i)).at(j)=='#') sum++;
        if ((masu.at(i)).at(j+1)=='#') sum++;
        if ((masu.at(i)).at(j+2)=='#') sum++;
        if ((masu.at(i+1)).at(j)=='#') sum++;
        if ((masu.at(i+1)).at(j+2)=='#') sum++;
        if ((masu.at(i+2)).at(j)=='#') sum++;
        if ((masu.at(i+2)).at(j+1)=='#') sum++;
        if ((masu.at(i+2)).at(j+2)=='#') sum++;
        cout << sum;
      }
     if (j==W-1) {
     cout << endl;
     }
    }
  }
  
}


Measured memory_bytes: 256
#include<iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include<unordered_map>
using namespace std;
const long long int mod1=1000000007;
const long long int mod2 = -1;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pp pop_back                                       
#define ff first
#define ss second
#define ll long long int
#define ull unsigned long long int
#define ordered_set tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define ordered1 tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define inf mod1
#define all(x) x.begin(),x.end()
ll gcd(ll a, ll b){
    ll c;
     while(b){
        c = b;
        b = a % b;
        a = c;
     }
     return a;
}
ll power1(ll a, ll b){
     if(b == 0) return 1;
     else if(b % 2) return a * power1(a, b - 1);
     else {
        ll temp = power1(a, b / 2);
        return temp * temp;
     }
}
ll power2(ll a, ll b, ll m){
     a %= m;
     if(b == 0) return 1;
     else if(b % 2) return (a * power2(a, b - 1, m)) % m;
     else{
        ll temp = power2(a, b / 2, m);
        return (temp * temp) % m;
     }
}
ll mod(ll x, ll p){
return (x % p + p) % p;
}
ll lcm(ll x, ll y){
return (x * y)/gcd(x, y);
}
int main(){
    fast;
    ll tt = 1;
    //cin >> tt;
    while(tt--){
        double x = 6.28318530717958623200;
        double n;
        cin >> n;
        cout << x * n << endl;   
    }
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
 
using namespace std; 
int main() {
    int n;cin>>n;
    int cur,nxt;
    cin>>cur;cur--;
    int ar[n-1];
    for(int i=0;i<n-1;i++)
    {
        cin>>ar[i];
    }
    
    for(int i=0;i<n-1;i++)
    {
        nxt=ar[i];
        if(nxt>cur)
        {
            nxt--;
        }
        if(cur>nxt)
        {
            cout<<"No";
            return 0;
        }
        cur=nxt;
    }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#define N 2005
using namespace std;

typedef long long ll;
ll M = 1e9 + 7;
ll n, k, ans, c1, c2, a[N];
int main()
{
	ll i, j;
	cin >> n >> k;
	for (i = 0; i < n; i++) scanf("%lld", &a[i]);
	for (i = 0; i < n; i++) {
		for (j = i + 1; j < n; j++) {
			if (a[i] > a[j]) ans = (ans + k * (k + 1) / 2) % M;
		}
		for (j = 0; j < i; j++) {
			if (a[i] > a[j]) ans = (ans + k * (k - 1) / 2) % M;
		}
	}
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import(
		"fmt"
		"strconv"
)

func main() {
		var n int
		var a int
		var b int
		count := 0
		fmt.Scan(&n, &a, &b)

		for i:=1; i<=n; i++ {
				i_s := strconv.Itoa(i)
				sum := 0
				for ele := range i_s {
						c,_ := strconv.Atoi(i_s[ele:ele+1])
						sum += c
				}
				if sum >= a && sum <= b {
					count += i
				}
		}
		
		fmt.Println(count)
}

Measured memory_bytes: 512
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n, k = LI()
a = LI()
check_num = [-1] * n
idx = 0
cnt = 1
while 1:
    idx = a[idx] - 1
    if check_num[idx] != -1:
        s = check_num[idx] - 1
        cnt -= 1
        break
    check_num[idx] = cnt
    cnt += 1

if cnt >= k:
    for i in range(n):
        if check_num[i] == k:
            print(i+1)
            quit()
else:
    roop_num = cnt - s
    x = (k - (s + 1)) % roop_num
    for i in range(n):
        if check_num[i] - s - 1 == x:
            print(i+1)
            quit()

Measured memory_bytes: 104100
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<int,ll> Pil;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<Pil,ll> P2;
const ll INF=1000000000000000001;
const int inf=1000000000;
//struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main(){

	int n,k;

	cin>>n>>k;

	if(n/2+n%2<k)cout<<"NO"<<endl;
	if(n/2+n%2>=k)cout<<"YES"<<endl;
	return 0;
}


Measured memory_bytes: 256
from collections import Counter

N = int(input())
S = [None] * N
for i in range(N):
    s = input()
    S[i] = s

counter = Counter(S)

cases = ["AC", "WA", "TLE", "RE"]
for case in cases:
    if case in counter:
        print(f"{case} x {counter[case]}")
    else:
        print(f"{case} x 0")


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

int main() {
    int N, L;
    cin >> N >> L;
    if (L < 0 && 0 < L+N-1) {
        cout << (2 * L + N - 1) * N / 2 << endl;
    } else if (L < 0) {
        cout << (2 * L + N - 1) * N / 2 - (L + N - 1) << endl;
    } else {
        cout << (2 * L + N - 1) * N / 2 - L << endl;
    }
}

Measured memory_bytes: 256