akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <utility>
using namespace std;

#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i > b; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)

const int kMaxN = 100000;

int N;
int t[kMaxN+1], x[kMaxN+1], y[kMaxN+1];
string ans;

int Abs(int a) {
  if (a < 0) {
    return -a;
  } else {
    return a;
  }
}

bool Check(int T, int X, int Y) {
  int xy = Abs(X)+Abs(Y);
  if ((T >= xy) && ((T-xy)%2 == 0)) {
    return true;
  } else {
    return false;
  }
}

int main() {
  cin >> N;
  REP(i, N) { cin >> t[i+1] >> x[i+1] >> y[i+1]; }

  t[0] = 0;
  x[0] = 0;
  y[0] = 0;
  bool f;
  REP(i, N) {
    f = Check(t[i+1]-t[i], x[i+1]-x[i], y[i+1]-y[i]);
    if (f == false) { break; }
  }

  if (f == true) {
    ans = "Yes";
  } else {
    ans = "No";
  }

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


Measured memory_bytes: 1408
import heapq


class UnionFind:
    from collections import deque

    def __init__(self, v):
        self.v = v
        self._tree = list(range(v + 1))

    def _root(self, a):
        queue = self.deque()
        while self._tree[a] != a:
            queue.append(a)
            a = self._tree[a]
        while queue:
            index = queue.popleft()
            self._tree[index] = a
        return a

    def union(self, a, b):
        root_a = self._root(a)
        root_b = self._root(b)
        self._tree[root_b] = root_a

    def find(self, a, b):
        return self._root(a) == self._root(b)


V, E = map(int, input().split(' '))
heap = []
for _ in range(E):
    s, t, w = map(int, input().split(' '))
    heapq.heappush(heap, (w, s, t))

uf = UnionFind(V)
cost = 0
while heap:
    w, s, t = heapq.heappop(heap)
    if not uf.find(s, t):
        uf.union(s, t)
        cost += w

print(cost)



Measured memory_bytes: 23428
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int main() {
    int l;
    cin >> l;
    double x = l / 3.0;
    printf("%.14f\n", x*x*x);
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
        public static void main(String[] args){
                Scanner scanner=new Scanner(System.in);
                String s=scanner.next();
                int[] a=new int[26];
                for(int i=0;i<26;i++){
                        a[i]=97+i;
                }
                int j=0;
                int counter=26;
                for(int i=0;i<s.length();i++){
                        j=s.charAt(i)-97;
                        if(a[j]!=0){
                                a[j]=0;
                                counter--;
                                if(counter==0){
                                        System.out.println("None");
                                        return;
                                }
                        }
                }
                for(int i=0;i<s.length();i++){
                        if(a[i]!=0){
                                System.out.println((char)(i+97));
                                return;
                        }
                }
                System.out.println("None");
        }
}

Measured memory_bytes: 24348
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;


int main(){
  ll s; cin >> s;
  
  if(s == 4||s == 2||s == 1) cout << 4 << endl;
  else{
    for(ll i=1; i < 1000001; i++){
   
    
      if(s % 2 == 0){ s /= 2;}
    
      else s = 3*s+1;
    
    
      if(s == 4){
      
        cout << i+4 << endl;
      
        break;
    }
  }
  
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
   
using namespace std;
   
long long calc(long long h){
  
  if(h == 1){
      return 1;
    }else if(h > 1){
      return 2 * calc(h/2) + 1;
  }
  
    return -1;
  
}
 
int main(){
  long long h;
  cin >> h;
  
  cout << calc(h) << endl;
  
  return 0;
  
}

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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		//System.setIn(new FileInputStream("./ALDS1_4_A-in10.txt"));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] s = new int[n+1];
		String[] l = br.readLine().split(" ");
		for(int i = 0; i < n; ++i){
			s[i] = Integer.parseInt(l[i]);
		}
		int q = Integer.parseInt(br.readLine());
		l = br.readLine().split(" ");
		int[] t = new int[q];
		for(int i = 0; i < q; ++i) {
			t[i] = Integer.parseInt(l[i]);
		}
		//long start = System.nanoTime();
		int cnt = 0;
		for(int i = 0; i < q; ++i) {
			s[n] = t[i];
			int j = 0;
			while(t[i] != s[j]) {
				j += 1;
			}
			if(j != n){
				cnt += 1;
			}
		}
		System.out.println(cnt);
		/*System.out.println("Time:" + (System.nanoTime() - start) / 1000000f + " ms");

		start = System.nanoTime();
		cnt = 0;
		for(int i = 0; i < q; ++i) {
			for(int j = 0; j < n; ++j){
				if(s[j] == t[i]){
					cnt++;
					break;
				}
			}
		}
		System.out.println(cnt);
		System.out.println("Time:" + (System.nanoTime() - start) / 1000000f + " ms");
		*/
	}

}

Measured memory_bytes: 27824
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    A, B = map(int, readline().split())

    ans = 0
    for i in range(A, B + 1):
        s = str(i)
        if s == s[::-1]:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


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

int main()
{
	ios::sync_with_stdio(false);
	int num, time, i, rec;
	cin >> num >> time;
	int c[num], t[num];
	for (i = 0; i < num; i++)cin >> c[i] >> t[i];
	rec = 10000;
	for (i = 0; i < num; i++) {
		if (rec>c[i]&&t[i]<=time) {
		rec = c[i];
		}
	}
	if (rec == 10000) cout << "TLE";
	else cout << rec;
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <ll, ll> dl;
typedef pair <int, int> ii;
typedef vector <ii> vii;
typedef vector <vi> graph;

bool comp(ll a, ll b) {
	return a > b;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	int n, m, c;
	cin >> n >> m >> c;
	int b[m];
	int in;
	for (int i = 0; i < m; ++i)
	{
		cin >> b[i];
	}
	int cont = 0;
	for (int i = 0; i < n; ++i)
	{
		int suma = c;
		for (int j = 0; j < m; ++j)
		{
			cin >> in;
			suma += (b[j] * in);
		}
		if (suma > 0) cont++;
	}
	cout << cont << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a,b;
    cin>>a>>b;
    if(a<b){
        for(ll i=0;i<b;i++)
        cout<<a;
    }
    else {
        for(ll i=0;i<a;i++)
        cout<<b;
    }
} 


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;



int main(){
    fast_io
    
    int n;
    cin>>n;
    vector<ll> a(n);
    int s=0;
    rep(i,n) {
        cin>>a[i];
        s^=a[i];
    }
    rep(i,n){
        int ans=s^a[i];
        cout<<ans<<" ";
    }
    
    
    return 0;
    
}


Measured memory_bytes: 4712
n, l = map(int, input().split())

apples = [i + l - 1 for i in range(1, n+1)]
all = sum(apples)
diff = 500
ans = 0

for i in range(n):
  point = sum(apples[i+1:] + apples[:-n+i])
  nextDiff= abs(point-all)
  if min(nextDiff, diff) == nextDiff:
    diff = nextDiff
    ans = point

print(ans)


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

int main(){
  string s, t, u;
  int a, b;
  cin >>s>>t>>a>>b>>u;
  if(s == u){
  	cout << a-1 << endl;
  }
  else{
  	cout<< a << endl;
  }
  if(t == u){
  	cout << b-1 << endl;
  }
  else{
  	cout<< b << endl;
  }
}


Measured memory_bytes: 256
//Pantyhose(black) + glasses = infinity

#include <bits/stdc++.h>
using namespace std;
 
#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define FILE_NAME "data"

int main() {
	#ifdef GLASSES_GIRL
		freopen(FILE_NAME".inp", "r", stdin);
		freopen(FILE_NAME".out", "w", stdout);
	#endif
	ios::sync_with_stdio(0); cin.tie(0);

	int64_t k, A, B;

	cin >> k >> A >> B;

	int64_t res = k+1;
	if (k-A+1>=0)
		res = max(res, A + (k-A+1)/2*(B-A) + (k-A+1)%2);
	
	cout << res;
}

Measured memory_bytes: 256
N,Y=gets.split.map &:to_i
res=false
(N+1).times do |x|
  (N+1).times do |y|
    z=(Y-10000*x-5000*y)/1000
    if x+y+z===N && z>=0
      puts "#{x} #{y} #{z}"
      res=true
      break
    end
  end
  break if res
end
puts "-1 -1 -1" unless res

Measured memory_bytes: 1788
#include <stdio.h>
int main(void)
{
    int i,j;
    int H,W;
    for(;;){
        scanf("%d %d",&H,&W);
        if(H==0 && W==0) 
            break;
        for(i=0;i<H;i++){
            for(j=0;j<W;j++){
                printf("#");
            }
            puts("");
        }
    puts("");
    }
    return 0;
}



Measured memory_bytes: 2104
#include<iostream>

using namespace std;

int main(void)

{
    int n, a, b, i, flag = 0;
    cin>>n>>a>>b;
    for(i = a; i <= b; i++){
        if(i%n == 0){
            flag = 1;
            break;
        }
    }
    if(flag == 1){
        cout<<"OK\n";
    }
    else{
        cout<<"NG\n";
    }
    return 0;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
const int mod = 998244353;
int main()
{
    int n;
    cin >> n;
    vector<pll> p(n);
    rep(i,n)cin >> p[i].first >> p[i].second;
    sort(p.begin(),p.end());
    vector<ll> dp(n+1,0);
    dp[n] = 1;
    deque<pair<int,ll>> que;
    que.emplace_back(n,(ll)2e9);
    for(int i = n-1;i >= 0;--i){
        dp[i] = dp[i+1];
        while(que.size()&&que.back().second < p[i].second + p[i].first){
            que.pop_back();
        }
        int ind = que.back().first;
        que.emplace_back(i,p[i].first);
        dp[i] = (dp[i] + dp[ind])%mod;



    }
    cout << dp[0] << endl;

    return 0;
}

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

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

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



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll x,n; cin>>x>>n;
  map<ll,ll> m;
  rep(i,n){
    ll a; cin>>a;
    m[a]=1;
  }
  ll ans=0;
  ll diff=LINF;
  for(ll i=0; i<=101; i++){
    if(m[i]==0){
      if(chmin(diff,abs(x-i))){
        ans=i;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3660
A = [input().split() for _ in range(3)]
N = int(input())
B = [input() for _ in range(N)]


fl = 0
for b in range(N):
  for i in range(3):
    for j in range(3):
      if A[i][j] == B[b]:
        A[i][j] = -1
        
for i in range(3):
  if A[i] == [-1,-1,-1]:
    fl = 1
    
for i in range(3):
    if int(A[0][i])*int(A[1][i])*int(A[2][i]) == -1:
      fl = 1

if int(A[0][0])*int(A[1][1])*int(A[2][2]) == -1 or int(A[0][2])*int(A[1][1])*int(A[2][0]) == -1:
  fl = 1

if fl == 1:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
from collections import deque
n=int(input())
K=0
g=[[] for _ in range(n+1)]
for  i in range(n-1):
    a,b=map(int,input().split())
    g[a].append([b,i])
    g[b].append([a,i])
for i in range(n):
    K=max(len(g[i]),K)
print(K)
ans=[0]*(n-1)
q=deque([(-1,1)])
while q:
    s,p=q.popleft()
    C = (c for c in range(1, K + 1) if c != s)
    for i,j in g[p]:
        g[i].remove([p,j])       
        sa=next(C)
        ans[j]=sa
        q.append((sa,i) )
for i in ans:
    print(i)

Measured memory_bytes: 89248
#include <iostream>
#include <string>
using namespace std;
int main(){
    string s,t; cin >> s >> t;
    int i,n = s.size();
    if(s.size() + 1!=t.size()){
        cout << "No" << endl;
        return 0;
    }
    for(i=0;i<n;i++){
        if(s[i]!=t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;

inline ll read(){
	int x = 0, f = 1; char ch = getchar();
	while (ch>'9' || ch<'0'){ if (ch == '-')f = -1; ch = getchar(); }
	while (ch >= '0'&&ch <= '9'){ x = x * 10 + ch - '0'; ch = getchar(); }
	return x*f;
}

/***********************************************************/

const int maxn = 105;
int a[maxn];

int main() {
	
	int n;
	cin >> n;
	int ans = 1;
	int x;
	cin >> x;
	for (int i = 1; i < n; i++){
		int y;
		cin >> y;
		if (y >= x) {
			ans++;
			x = y;
		}
	}

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

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

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main(void){
    
    int N;
    vector<pair<long long, long long>> v;
    long long x,l;
    cin >> N;
    int mx;
    for(int i = 0; i < N;i++){
        cin >> x >> l;
        v.push_back(make_pair(x-l,x+l));
    }
    
    sort(v.begin(),v.end(),compare_by_b);
    mx = v[0].second;
    v.erase(v.begin());
    
    int cont = 0;
    
    for(auto u:v){
        
        //cout  << u.first <<" "<<mx;
        if(u.first<mx){cont++;}
        else{mx = u.second;}

    }
    
    cout << v.size() + 1 -cont << endl;    
    
}


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


int main() {
  
  int N;
  cin  >> N;
  
  vector<int> a(N);
  
  rep(i,N){
    cin >> a.at(i);
  }
    sort(a.begin(), a.end()); // {1, 2, 2, 5}
    
  int num=1;
  
    for (int i = 1; i < N; i++) {
      if(a.at(i)!=a.at(i-1))
        num++;
    }
  
  cout << num << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		char b = 'a';       
        if(a.equals("a")){b='b';}
           if(a.equals("b")){b='c';}                                      
           if(a.equals("c")){b='d';}                 
      if(a.equals("d")){b='e';}
      if(a.equals("e")){b='f';}
      if(a.equals("f")){b='g';}
      if(a.equals("g")){b='h';}
      if(a.equals("h")){b='i';}
      if(a.equals("i")){b='j';}
      if(a.equals("j")){b='k';}
      if(a.equals("k")){b='l';}
      if(a.equals("l")){b='m';}
      if(a.equals("m")){b='n';}
      if(a.equals("n")){b='o';}
      if(a.equals("o")){b='p';}
      if(a.equals("p")){b='q';}
      if(a.equals("q")){b='r';}
      if(a.equals("r")){b='s';}
      if(a.equals("s")){b='t';}
      if(a.equals("t")){b='u';}
      if(a.equals("u")){b='v';}
      if(a.equals("v")){b='w';}
      if(a.equals("w")){b='x';}
      if(a.equals("x")){b='y';}
      if(a.equals("y")){b='z';}
		System.out.println(b);
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
#include <string.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;

#define MAX_V 500
struct edge { int to, cap, rev; };

vector<edge> G[MAX_V];
int level[MAX_V];
int iter[MAX_V];

void add_edge(int from, int to, int cap) {
	G[from].push_back((edge) { to, cap, (int)G[to].size() });
	G[to].push_back((edge) { from, 0LL, (int)G[from].size() - 1 });
}

void bfs(int s) {
	memset(level, -1LL, sizeof(level));
	queue<int> que;
	level[s] = 0;
	que.push(s);
	while (!que.empty()) {
		int v = que.front(); que.pop();
		for (int i = 0; i < G[v].size(); i++) {
			edge &e = G[v][i];
			if (e.cap > 0 && level[e.to] < 0) {
				level[e.to] = level[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v, int t, int f) {
	if (v == t) return f;
	for (int &i = iter[v]; i < G[v].size(); i++) {
		edge &e = G[v][i];
		if (e.cap > 0 && level[v] < level[e.to]) {
			int d = dfs(e.to, t, min(f, e.cap));
			if (d > 0) {
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t) {
	int flow = 0;
	for (;;) {
		bfs(s);
		if (level[t] < 0) return flow;
		memset(iter, 0, sizeof(iter));
		int f;
		while ((f = dfs(s, t, INF)) > 0) {
			flow += f;
		}
	}
}

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

	
	int N, M; cin >> N >> M;
	REP(i, M) {
		int a, b, c; cin >> a >> b >> c;
		add_edge(a, b, c);
	}
	cout << max_flow(0, N - 1) << endl;

	return 0;
}




Measured memory_bytes: 3352
# -*- coding: utf-8 -*-
from collections import Counter
N = int(input())
A = tuple(map(int, input().split()))

c0 = Counter()
c1 = Counter()
c2 = Counter()
for a in A:
    c0[(a+0)//3] += 1
    c1[(a+1)//3] += 1
    c2[(a+2)//3] += 1
    
print(max(sorted(c0.values(), reverse = True)[0],
          sorted(c1.values(), reverse = True)[0],
          sorted(c2.values(), reverse = True)[0]))  


Measured memory_bytes: 16292
// Template
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
#include <complex>
#include <cassert>
#define rep(i, x) for (int i = 0; i < (x); ++i)
#define rng(i, x, y) for (int i = (x); i < (y); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}
void solve();
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    solve();
    return 0;
}


// Main Code
void solve() {
    string s;
    cin >> s;
    cout << s.substr(0, 4) << " " << s.substr(4, 8) << "\n";
    return;
}


Measured memory_bytes: 3640
/**Bismillahir Rahmanir Rahim.**/
#include<bits/stdc++.h>
#define ll 	 long long
#define pb push_back
#define mp make_pair
using namespace std;

int main() 
{ 

ll n; cin>>n;

vector<ll>a(200009), sum(200009, 0);

for(ll i=0; i<n; i++) {
	cin>>a[i];
	sum[i]=a[i];
}

sum[n]=0;

for(ll i=n-1; i>=0; i--)
{
	sum[i]+=sum[i+1];
}

ll ans=0;

for(ll i=0; i<n; i++)
{
	ans= (ans+ (a[i]*(sum[i+1]%1000000007)))%1000000007;
}

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

Measured memory_bytes: 6428
#include <iostream>

using namespace std;

int main(){
    int a[3],*max,*mid,*min,x;
    for(int i=0;i<3;i++){
        cin>>a[i];
    }
    max=&x;
    *max=1;
    for(int i=0;i<3;i++){
        if(a[i]>*max) max=&(a[i]);
    }
    min=&x;
    *min=10000;
    for(int i=2;i>=0;i--){
        if(a[i]<*min) min=&(a[i]);
    }
    mid=&x;
    for(int i=0;i<3;i++){
        if((&(a[i])!=min)&&(&(a[i])!=max)){
          *mid=a[i];
        }
    }
    cout<<*min<<" "<<*mid<<" "<<*max<<endl;
    return 0;
}



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

int main()
{
    int n;
    while(cin >> n){
        if(n==0)
            break;
            
        int dp[2][10000] = {0};
        dp[0][0] = 1;
        dp[1][0] = 1;
        for(int i=0;i<n;i++){
            int a,b;
            cin >> a >> b;
            for(int k=0;k<=1000;k++){
                if(dp[0][k]!=0){
                    for(int i=1;i<=b;i++){
                        dp[1][k+a*i]+= dp[0][k];
                    }     
                }
            }
            for(int k=0;k<=1000;k++)
                dp[0][k] = dp[1][k];
        }
        int m;
        cin >> m;
        for(int j=0;j<m;j++){
            int k;
            cin >> k;
            cout << dp[0][k] << endl;
        }      
    }
    return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

using namespace std;
using ll = 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;
}
template <typename T> constexpr T INF = numeric_limits<T>::max() / 2;

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

  int n;
  cin >> n;
  vector<int> S(n);
  REP(i, n) { cin >> S.at(i); }
  int q;
  cin >> q;
  vector<int> T(q);
  REP(i, q) { cin >> T.at(i); }

  int ans = 0;
  REP(i, q) {
    REP(j, n) {
      if (T.at(i) == S.at(j)) {
        ans++;
        break;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3152
#pragma region Macros
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

template<class T>bool chmax(T &a, const T &b) { if (b > a) { a = b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;
constexpr double EPS = 1e-10;
#pragma endregion

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i=0; i<n; i++) {
        cin >> a.at(i);
    }
    int res = 0, cur = INF;
    for (int i=0; i<n; i++) {
        if (chmin(cur, a.at(i))) {
            res++;
        }
    }
    cout << res << "\n";
}

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

    solve();

    return 0;
}


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

#define ll long long
#define NIL 0
#define INF 1e18
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vl vector<ll>
#define vvl vector<vector<ll>> 
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define pb push_back
#define F first
#define S second
#define pp pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define rpk(i,k,n) for(int i=k;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++) 
#define RPK(i,k,n) for(int i=k;i<=n;i++) 
#define ritr(i,gr) for(auto i=gr.begin();i!=gr.end();i++)

const int M = 1e9+7;

int V, E, i, j, k, u, v, x, y, p, q, r, t, n,m;
vi *g;
ll dp[2][100050];


ll dfs_util(int u, int pv) {
    if(dp[0][u]!=-1) return (dp[0][u]+dp[1][u]+M)%M;
    ll nb =1, nw=1;
    
    for(auto v: g[u]) {
        if(v==pv) continue;
        dfs_util(v, u);
        nb = (nb*dp[1][v])%M;
        nw = (nw*(dp[0][v]+dp[1][v]+M))%M;
    }
    
    dp[0][u] = nb;
    dp[1][u] = nw;
    return (dp[0][u]+dp[1][u]+M)%M;    
}

void dfs() {
    ll res=0;
    res = dfs_util(1,1);
    cout<<res<<endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  
    cin>>V;
    g = new vi[V+1];
    rep(i,V-1) cin>>x>>y, g[x].pb(y), g[y].pb(x);
    rep(i,2) {rep(j,V+1) dp[i][j] =-1;}
    dfs();
}

Measured memory_bytes: 17364
#include <bits/stdc++.h>
#include <string>
#include <vector>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;


int inum(int N,int W){
    return N/W;
}
int jnum(int N,int W){
    if((N/W)%2) return N%W;
    else return W - (N%W) - 1;
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    int ai = *a.rbegin();
    double in = double(ai)/2;
    vector<int>::iterator uit = lower_bound(a.begin(),a.end(),in);
    vector<int>::iterator lit = uit-1;
    int bi;
    //cout << *lit << " " << *uit << endl;
    if(ai-2*(*lit) > 2*(*uit) - ai) bi = *uit;
    else bi = *lit;

    cout << ai << " " << bi << endl;
    
 }


Measured memory_bytes: 3744
$<.map{|s|
    a,b=s.split.map &:to_f;
    if a<35.5&&b<71
        puts :AAA
    elsif a<37.5&&b<77
        puts :AA
    elsif a<40&&b<83
        puts :A
    elsif a<43&&b<89
        puts :B
    elsif a<50&&b<105
        puts :C
    elsif a<55&&b<116
        puts :D
    elsif a<70&&b<148
        puts :E
    else
        puts :NA
    end
}


Measured memory_bytes: 6844
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int n;
	while(cin>>n,n){
		int y;
		cin>>y;
		double ma=-1;
		int out;
		rep(i,n){
			int a,b,c;
			cin>>a>>b>>c;
			double tmp;
			if(c==1)tmp=1+y*b/100.0;
			else tmp=pow(1+b/100.0,y);
			if(ma<tmp){
				ma=tmp;
				out=a;
			}
		}
		cout<<out<<endl;
	}
}

Measured memory_bytes: 1164
<?php

fscanf(STDIN, "%d", $n);
$p_arr = explode(' ', trim(fgets(STDIN)));

$count = 0;
$min = $n + 1;
for ($i = 0; $i < $n; ++$i) {
    if ($p_arr[$i] <= $min) {
        ++$count;
    }

    $min = min($min, $p_arr[$i]);
}

echo $count;


Measured memory_bytes: 18932
#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

#define FOR(i,a,b) for (int i = a; i < b; ++i)
#define FORR(i,a,b) for (int i = b - 1; i >= a; --i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,0,n)

void solve(ll n) {
	n -= 1;
	if (n >= 26) {
		solve(n / 26);
	}

	cout << (char)('a' + n % 26);
}

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

	solve(N);
	cout << endl;

	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define lowbit(x) ((x)&(-(x)))
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 0x3f3f3f3f;
const LL LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
const int maxn = 1e5 + 10;
int H, W, K;
char g[10][10];
bool rl[10], cl[10];
bool check()
{
    int cnt = 0;
    for(int i = 0; i < H; i++)
    {
        for(int j = 0; j < W; j++)
        {
            if(!rl[i] && !cl[j] && g[i][j] == '#')
                cnt++;
        }
    }
    return cnt == K;
}
int main()
{
    scanf("%d %d %d", &H, &W, &K);
    getchar();
    for(int i = 0; i < H; i++)
    {
        for(int j = 0; j < W; j++)
            g[i][j] = getchar();
        getchar();
    }
    int ans = 0;
    for(int i = 0; i < (1 << (H + W)); i++)
    {
        memset(rl, 0, sizeof(rl));
        memset(cl, 0, sizeof(cl));
        for(int j = 0; j < H + W; j++)
        {
            if(!((i >> j) & 1))
                continue;
            if(j < H)
                rl[j] = true;
            else
                cl[j-H] = true;
        }
        if(check())
            ans++;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 3828
import heapq
N,M = map(int,input().split())
a = [-i for i in list(map(int,input().split()))]
heapq.heapify(a)
for i in range(M):
    m = heapq.heappop(a)
    heapq.heappush(a,-(-m//2))
print(-sum(a))

Measured memory_bytes: 73068
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

bool hoge(V &v){
    ll idx = 0;
    rep(i, v.size())if(v[idx] < v[i])idx = i;
    rep(i, v.size())if(i != idx)v[i]++;
    v[idx] -= v.size();
    return v[idx] >= 0;
}

int main(){
    
    ll K;
    cin >> K;
    ll N = 50;
    ll X = (K / N) + N;
    V v(N, X);
    ll Y = N * (X - N + 1);
    for(;Y > K;Y--)hoge(v);
    cout << v.size() << endl;
    rep(i, v.size()){
        cout << v[i];
        if(i + 1 == v.size())cout << endl;
        else cout << " ";
    }
    
    return 0;
}

Measured memory_bytes: 256
n=int(input())
li =list(map(int,input().split()))	
a=True
for i in li:
    if(i%2==1):
        continue
    elif(i%3==0 or i%5==0):
        continue
    a=False
    break
if(a):
    print("APPROVED")
else:
    print("DENIED")


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
using namespace std;
const double EPS = 1e-8;
const double INF = 1e12;
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : array<P, 2>{
    L(const P& a, const P& b){ at(0)=a; at(1)=b; }
    L(){}
};
namespace std{
    bool operator < (const P& a, const P& b){
        return !EQ(a.X,b.X) ? a.X<b.X : a.Y+EPS<b.Y;
    }
    bool operator == (const P& a, const P& b){
        return abs(a-b) < EPS;
    }
}

double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}
int ccw(P a, P b, P c){
    b -= a;
    c -= a;
    if(cross(b,c) > EPS) return +1; //ccw
    if(cross(b,c) < -EPS) return -1; //cw
    if(dot(b,c) < -EPS) return +2; //c-a-b
    if(dot(b,b-c) > EPS) return -2; //a-b-c
    return 0; //a-c-b
}

bool intersectSS(const L& a, const L& b){
    return ( ccw(a[0],a[1],b[0]) *ccw(a[0],a[1],b[1]) <= 0 ) &&
        ( ccw(b[0],b[1],a[0]) *ccw(b[0],b[1],a[1]) <= 0 );
}
bool isParallel(const P &a, const P &b){
    return abs(cross(a,b)) < EPS;
}
bool isParallel(const L &a, const L &b){
    return isParallel(a[1]-a[0], b[1]-b[0]);
}
P crosspointLL(const L &l, const L &m) {
  double A = cross(l[1]-l[0], m[1]-m[0]);
  double B = cross(l[1]-l[0], l[1]-m[0]);
  return m[0] + B/A *(m[1]-m[0]);
}

int main(){
    int n;
    cin >> n;
    VP p(n);
    for(int i=0; i<n; i++){
        int x,y;
        cin >> x >> y;
        p[i] = P(x, y);
    }
    vector<double> area;
    const double dd = 0.5/4;
    for(double x=-1e3; x<1e3+EPS; x+=0.5){
        double len[2] = {0, 0};
        for(int d=0; d<2; d++){
            double xx = x +(1 +2*d)*dd;
            L cut(P(xx, -1e3), P(xx, 1e3));
            VP cp;
            for(int i=0; i<n; i++){
                L edge(p[i], p[(i+1)%n]);
                if(!isParallel(cut, edge) and intersectSS(cut, edge)){
                    cp.push_back(crosspointLL(cut, edge));
                }
            }
            sort(cp.begin(), cp.end());
            for(int i=0; i<(int)cp.size(); i+=2){
                len[d] += abs(cp[i+1] -cp[i]);
            }
        }
        double diff = (len[1]-len[0])/2;
        len[0] -= diff;
        len[1] += diff;
        area.push_back((len[0] +len[1])/4);
    }
    double s[2] = {0, 0};
    for(int i=0; i<(int)area.size(); i++){
        s[i%2] += area[i];
    }
    cout << fixed << setprecision(10);
    cout << max(s[0], s[1]) << endl;
    return 0;
}



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

const ll mod = 1e9 + 7;


typedef struct four {
	ll f, s, t, fr;
} four;



int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n, i;
	cin >> n;
	vector<four> vp(n);
	for (i=0; i<n; ++i) {
		cin >> vp[i].f >> vp[i].s;
		vp[i].t = vp[i].f + vp[i].s;
		vp[i].fr = vp[i].f - vp[i].s;
	}
	ll max_x = LLONG_MIN, min_x = LLONG_MAX, min_y = LLONG_MAX, max_y = LLONG_MIN;
	for (i=0; i<n; ++i) {
		if (max_x < vp[i].t) max_x = vp[i].t;
		if (max_y < vp[i].fr) max_y = vp[i].fr;
		if (min_x > vp[i].t) min_x = vp[i].t;
		if (min_y > vp[i].fr) min_y = vp[i].fr;
	}
	cout << max(max_x-min_x, max_y-min_y) << "\n";
	return 0;
}


Measured memory_bytes: 9528
"use strict";
const Main = (input) =>{
   let xs = input.trim().split('\n');
   let S = xs[0].split('');
   let T = xs[1].split('');
   let count = 0;
   for(let i=0; i<S.length; i++){
     if(S[i]!=T[i]){
       count++
     }
   }
   console.log(count);
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));

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


int main(){
    
    int H,W;
    
    while(1) {
        
        cin >> H >> W;
        if (H == 0 && W == 0) break;
    
    
    for (int i = 0; i < H; i++){
                for ( int j = 0; j < W; j++ ){
        cout << "#";
        
        }
        cout << "\n";
  
    }
  cout << endl;
    }
   
    
    
    return 0;
    
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, k;
  cin >> n >> k;
  vl a(n);
  rep(i, n) cin >> a[i];
  ll ans = 1e18;
  rep(i, n - k + 1) {
    ll now = 0;
    int j = i + k - 1;
    now += min(abs(a[i]), abs(a[j]));
    now += abs(a[j] - a[i]);
    ans = min(ans, now);
  }
  cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

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

	int N, L;
	cin >> N >> L;

	ll ans = 0;
	rep(i, N){
		ans += L + i;
	}

	if(L >= 1){
		ans -= L;
	}else if(L + N - 1 <= -1){
		ans -= L + N - 1;
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

T=int(input())

def base(B):

    L=len(B)
    flag=1
    
    while flag:
        B.sort(reverse=True)
        
        flag=0

        for i in range(L):
            for j in range(i+1,L):
                if B[i]^B[j]<B[i]:
                    B[i]=B[i]^B[j]
                    flag=1
                    break
            if flag:
                break
    return B     

def rep(x):
    flag=1

    while flag:
        flag=0
        for b in B:
            if b^x<x:
                x=b^x
                flag=1
                break
    return x

for tests in range(T):
    N=int(input())
    A=list(map(int,input().split()))
    B=[]
    S=input().strip()

    flag=1

    for i in range(N-1,-1,-1):
        if flag==0:
            break
        if S[i]=="0":
            v=rep(A[i])

            if v==0:
                continue
            B.append(v)
            B=base(B)

        else:
            if rep(A[i])!=0:
                print(1)
                flag=0
                break

    if flag:
        print(0)
            
        


Measured memory_bytes: 69264
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
string s[n];
long long t[n];
for(int i=0;i<n;i++){
  cin>>s[i];
  cin>>t[i];
}
string u;
cin>>u;
int temp;
long long ans=0;
for(int i=0;i<n;i++){
  if(u==s[i]){
    temp=i;
    break;
  }
}
for(int i=temp+1;i<n;i++){
  ans+=t[i];
}
cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int64_t N, K;
    cin >> N >> K;
    
    int64_t sum = 0;
    
    for (int i = 0; i < N - K + 2; i++){
        sum += ((N - K + 1 - i) + N) * (K + i) / 2 - (0 + (K + i - 1)) * (K + i) / 2 + 1;
    }
            if (sum > 1000000007)
            sum %= 1000000007;
    cout << sum << endl;
}


Measured memory_bytes: 3624
#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    ll a[100002], b[100002];
    for(int i = 0; i <= n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    ll ans = 0;
    for(int i = 0; i < n; i++){
        if(a[i] >= b[i]){
            a[i] -= b[i];
            ans += b[i];
        }
        else if(a[i] + a[i + 1] >= b[i]){
            ans += b[i];
            a[i + 1] -= b[i] - a[i];
        }
        else{
            ans += a[i] + a[i + 1];
            a[i + 1] = 0;
        }
    }
    cout << ans << endl;
}

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

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

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);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int[] array = new int[5];
			for(int i = 0; i < array.length; i++) {
				array[i] = in.nextInt();
			}
			int time = 0;
			int tmp = 0;
			int ans = 0;
			for(int i = 0; i < array.length; i++) {
				if(10 - array[i] % 10 > tmp && 10 - array[i] % 10 != 10) {
					tmp = 10 - array[i] % 10;
					ans = i;
				}
			}
			for(int i = 0; i < array.length; i++) {
				if(i != ans) {
					time += (10 - array[i] % 10) + array[i];
					if(array[i] % 10 == 0) {
						time -= 10;
					}
				}
			}
			out.println(time + array[ans]);
 		}
	}

	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 char nextChar() {
			return next().charAt(0);
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}

	}
}


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

namespace A
{
    class Program
    {
        public static void Main(string[] args)
        {
            //var a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

            var n = int.Parse(Console.ReadLine());
            var a = int.Parse(Console.ReadLine());

            var result = "No";

            for(int i = 0; i <= a; i++) {
                if((n-i) % 500 == 0) {
                    result = "Yes";
                    break;
                }
            }

            Console.WriteLine(result);
            Console.ReadLine();
        }
    }
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;


int get_gcd(int n, int m) {
	if (n < m) swap(n, m);
	while (m) {
		swap(n, m);
		m %= n;
	}
	return n;
}

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

	int A, B;
	cin >> A >> B;
	cout << A*B/get_gcd(A, B) << endl;

	return 0;
}

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

using namespace std;

#define all(v) (v).begin(), (v).end()
#define Rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rep(i, n) Rep(i, 0, n)
#define vi vector<int>
#define vvi vector<vi>

typedef long long ll;

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

Measured memory_bytes: 256
n=int(input())
arr=[int(input()) for _ in range(n)]
arr=sorted(arr)
dic={}
for i in arr:
  if i in dic:
    dic[i]+=1
  else:
    dic[i]=1
count=0
for i in dic:
  if dic[i]%2==1:
    count+=1
print(count)

Measured memory_bytes: 16312
/*#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;  // n persons
  vector< vector<int> > v;
  for(int i=0;i<n;i++)
  {
    vector<int> a;
    int size;
    cin>>size;
    for(int i=0;i<size;i++)
    {
      int b;
      cin>>b;
      a.push_back(b);
    }
    v.push_back(a);
  }
  for(int b=0;b<(1<<n);b++)
  {
   
    for(int h=0;h<n;h++)
    {
      */
    #include <bits/stdc++.h>
using namespace std;
 
int N;
int A[20];
int x[20][20];
int y[20][20];
 
int counter(int x) {
    if(x == 0) return 0;
    return counter(x >> 1) + (x & 1);
}
 
void solve() {
    cin >> N;
    for(int i = 1; i <= N; i++) {
        cin >> A[i];
        for(int j = 1; j <= A[i]; j++) {
            cin >> x[i][j] >> y[i][j];
        }
    }
    int ans = 0;
    for(int bits = 1; bits < (1 << N); bits++) {
        bool ok = true;
        for(int i = 1; i <= N; i++) {
            if(!(bits & (1 << (i-1)))) continue;
            for(int j = 1; j <= A[i]; j++) {
                if(((bits >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = false;
            }
        }
        if(ok) ans = max(ans, counter(bits));
    }
    cout << ans << endl;
    return;
}
 
int main() {
    solve();
    return 0;
}
    
    
    
    
    
    
    
    
  
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back 
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define ld long double
#define int long long int 
#define F first 
#define S second
signed main()
{
    fast;
    int n;
    cin>>n;
    int x[n+1],y[n+1];
    map<pii,int> mp;
    for(int i=1;i<=n;i++)
    {
        cin>>x[i]>>y[i];
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
            if(i!=j)
                mp[{x[i]-x[j],y[i]-y[j]}]++;
    }
    int mx = 0;
    for(auto it:mp)
    {
        mx = max(it.second,mx);
    }
    cout<<n-mx;
}

Measured memory_bytes: 384
while 1:
    n=int(input())
    if n==0:break
    x=y=10
    b=[list(map(int,input().split())) for _ in range(n)]
    for i,j in [input().split() for _ in range(int(input()))]:
        for _ in range(int(j)):
            if 'N'<=i<='S': y+=1 if i=='N' else -1
            else: x+=1 if i=='E' else -1
            if [x,y] in b:del b[b.index([x,y])]
    print(['Yes','No'][bool(b)])

Measured memory_bytes: 7776
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}

int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n,r;
    cin>>n>>r;
    ll temp=max(0ll,10-n);
    cout<<r+temp*100;
}


Measured memory_bytes: 256
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def func(n):
    ans =0
    if n%2==0:
        ans=n//2
    else:
        ans=3*n+1
    return ans

def main():
    s = int(input())
    dp=[s]
    counter=0

    if s==1 or s==2:
        print(4)
        exit()

    while counter < 1000001:
        n=dp.pop()
        tmp = func(n)
        dp.append(n)
        dp.append(tmp)
        counter+=1
        if tmp==4:
            print(dp.index(tmp)+4)
            break

if __name__=="__main__":
    main()

Measured memory_bytes: 9216