akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
struct edge{ll to,cost;};
const int inf = 1<<28;
const ll INF = 1LL<<53;
const int COMBMAX = 500005;
const ll MOD = 1e9+7;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;++i)
#define repf(i,n) for(int i=0;i<=n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define eachdo(v, e) for(const auto& e : v)
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (ll)distance(v.begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (ll)distance(v.begin(), upper_bound((v).begin(), (v).end(), e))
ll mpow(ll a, ll n,ll mod=MOD){ll res=1;while(n>0){if(n&1)res=res*a%mod;a=a*a%mod;n>>=1;}return res;}
template<class T1, class T2> ll bcount(T1 v, T2 a){return upper_index(v,a)-lower_index(v,a);} 
template<class T> bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
template<class T> void debug2(T v){rep(i,v.size()){rep(j,v[i].size())cout<<v[i][j]<<" ";cout<<endl;}}
template<class T> void rdv(T &v){rep(i,v.size())cin>>v[i];}
template<class T> void rdvv(T &v){rep(i,v.size()){rep(j,v[i].size())cin>>v[i][j];}}
// multimap
// mmap.emplace(key,value);
// auto ngw = list.equal_range("");
// for(auto e = ngw.first; it != ngw.second ; ++e)


int main(){
    ll N,M;cin >> N >> M;
    vl x(N),y(N),z(N);
    rep(i,N){
        cin >> x[i] >> y[i] >> z[i];
    }
    ll ans = 0;
    rep(b,8){
        vl s(N);
        rep(i,N){
            s[i] = (1 - ((b & 1)<<1))*x[i] + (1 - (((b>>1) & 1)<<1))*y[i] + (1 - (((b>>2) & 1)<<1))*z[i];
        }
        sort(all(s));
        ll cnt = 0;
        rep(i,M){
            cnt += s[N-i-1];
        }
        chmax(ans,cnt);
    }
    cout << ans << endl;
    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  ll N, K; cin >> N >> K;
  vector<int> A(N); REP(i, N) cin >> A[i], A[i]--; // 0-indexedに変更
  int logK = 1;
  while((1LL << logK) < K) {
    logK++; // Kの2進数における桁数をカウントしている
  }
  vector<vector<int>> d(logK, vector<int>(N));
  for(int i = 0; i < N; ++i) {
    d[0][i] = A[i];
  }
  for(int k = 0; k < logK - 1; ++k) {
    for(int i = 0; i < N; ++i) {
      d[k + 1][i] = d[k][d[k][i]];
    }
  }
  int now = 0;
  for (int k = 0; K > 0; k++) { // いまKの何ビット目を見ているか？
      if (K & 1) now = d[k][now]; // 0001とKのANDを取り、1ならk桁目のnowを更新する
      K = K >> 1; // 右に1ビットシフトする
  }
  cout << now + 1 << endl;
}

Measured memory_bytes: 51772
#include<bits/stdc++.h>
using namespace std;
int n; 
long long z__,maxx;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		char a;
		cin>>a;
		if(a=='I')
		z__++;
		else
		z__--;
		if(z__>maxx)
		{
			maxx=z__;
		}
	}
	cout<<maxx;
	return 0;
}

Measured memory_bytes: 256
S = input()
S = list(S)

cnt = 1

if S[0]=='R' and S[1]=='R':
    cnt =2

if S[1]=='R' and S[2]=='R':
    cnt = 2

if S[1] == 'R' and S[2] == 'R' and S[0] == 'R':
    cnt = 3

if S.count('R') == 0:
    cnt = 0

print(cnt)


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

int main()
{
  int N ;
  cin>>N ;
  vector<int>A(N) ;
  for(int i=0;i<N;i++) cin>>A.at(i) ;
  sort(A.begin(),A.end()) ;
  reverse(A.begin(),A.end()) ;
  
  int count=1 ;
  int64_t tate=0,yoko=0 ;
  for(int i=0;i<N-1;i++){
    if(i<N-2){
      if(A.at(i)==A.at(i+1)) count++ ;
      else{
        if(count>=4){
          if(tate==0){
            tate=A.at(i) ;
            yoko=A.at(i) ;
          }else if(yoko==0) yoko=A.at(i) ;
          else{
            cout<<tate*yoko<<endl ;
            return 0 ;
          }
        }else if(count>=2){
          if(tate==0) tate=A.at(i) ;
          else if(yoko==0) yoko=A.at(i) ;
          else{
            cout<<tate*yoko<<endl ;
            return 0 ;
          }
        }
        count=1 ;
      }
    }else{
      if(A.at(i)==A.at(i+1)) count++ ;
      if(count>=4){
        if(tate==0){
          tate=A.at(i) ;
          yoko=A.at(i) ;
        }else if(yoko==0) yoko=A.at(i) ;
        else{
          cout<<tate*yoko<<endl ;
          return 0 ;
        }
      }else if(count>=2){
        if(tate==0) tate=A.at(i) ;
        else if(yoko==0) yoko=A.at(i) ;
        else{
          cout<<tate*yoko<<endl ; 
          return 0 ;
        }
      }
    }
  }
  cout<<tate*yoko<<endl ;
  
  return 0 ;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pi pair<int,int>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

signed main(){
  int n,m;
  cin>>n>>m;
  int P[100000],Y[100000];
  vi V[100001];
  rep(i,m){
    cin>>P[i]>>Y[i];
    V[P[i]].pb(Y[i]);
  }
  rep(i,n+1) sort(all(V[i]));

  rep(i,m){
    // auto v=V[P[i]];
    int l=0,r=V[P[i]].size(),mid;
    while(l+1<r){
      mid=(l+r)/2;
      if(V[P[i]][mid]>Y[i]) r=mid;
      else l=mid;
    }
    cout<<setw(12)<<setfill('0')<<P[i]*1000000+l+1<<endl;
  }
  return 0;
}


Measured memory_bytes: 8576
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}

int gcd(ll(a), ll(b)) {
	ll c = a;
	while (a % b != 0) {
		c = a % b;
		a = b;
		b = c;
	}
	return b;
}



int main() {
	int N;
	cin >> N;
	string S ;
	cin>> S;
	if (S.size()>N) {
		rep(i, N) {
			cout << S.at(i);
		}
		cout << "..." << endl;
	}
	else  {
		cout << S << endl;
	}
	

}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template <typename T> void read(T &x){
	x=0;char c=getchar();int fh=1;
	while (!isdigit(c)){if (c=='-')fh=-1;c=getchar();}
	while (isdigit(c))x=x*10+c-'0',c=getchar();
	x*=fh;
}
int a,b,c;
int main(){
	read(a);read(b);read(c);
	if (a==b&&b==c)puts("Yes");else puts("No");
	return 0;
}

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

signed main()
{
	ios::sync_with_stdio(false);
	int n,a,b;
	cin>>n>>a>>b;
	if((b-a)%2==0) cout<<(b-a)/2<<endl;
	else{
		int ans1=a+(b-a)/2;
		int ans2=(n-b+1)+(b-a)/2;
		cout<<min(ans1,ans2)<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#define NDEBUG
#include <cassert>
#include <cstdint>
#include <functional>
#include <vector>

template <typename Abelian> class FenwickTree {
	using uint32 = std::uint_fast32_t;
	using const_reference = const Abelian &;
	using F = std::function<Abelian(const_reference, const_reference)>;
	const Abelian neutral_;
	const F p, m;
	std::vector<Abelian> tree;

public:
	FenwickTree(const uint32 size, const_reference neutral = Abelian(),
		const F &p = std::plus<Abelian>(),
		const F &m = std::minus<Abelian>())
		: neutral_(neutral), p(p), m(m), tree(size + 1, neutral_) {}
	FenwickTree(const uint32 size, const_reference neutral, const F &p,
		const std::function<Abelian(const_reference)> &n)
		: neutral_(neutral), p(p),
		m([&p, &n](const_reference l, const_reference r) { return p(l, n(r)); }),
		tree(size + 1, neutral_) {}
	void update(uint32 index, const std::function<void(Abelian)> &g) {
		assert(index < tree.size() - 1);
		++index;
		const Abelian a = tree[index];
		g(tree[index]);
		const_reference b = tree[index];
		while ((index += index & ~index + 1) < tree.size())
			tree[index] = p(m(tree[index], a), b);
	}
	void update(uint32 index, const_reference data) {
		update(index, [&data](Abelian &d) { d = data; });
	}
	void add(uint32 index, const_reference diff) {
		assert(index < tree.size() - 1);
		++index;
		do
			tree[index] = p(tree[index], diff);
		while ((index += index & ~index + 1) < tree.size());
	}
	Abelian range(uint32 end) const {
		assert(end < tree.size());
		Abelian ret = neutral_;
		do
			ret = p(tree[end], ret);
		while (end &= end - 1);
		return ret;
	}
	Abelian range(uint32 begin, uint32 end) const {
		assert(begin <= end);
		return m(range(end), range(begin));
	}
	Abelian operator[](uint32 index) const {
		assert(index < tree.size() - 1);
		return range(index, index + 1);
	}
};

#include <iostream>
int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int n, q;
	std::cin >> n >> q;
	FenwickTree<int> T(n, 0);
	while (q--) {
		int c, x, y;
		std::cin >> c >> x >> y;
		if (c) {
			std::cout << T.range(x - 1, y) << "\n";
		}
		else {
			T.add(x-1,y);
		}
	}
	return 0;
}


Measured memory_bytes: 3368
#include<iostream>
#include<cstring>

using namespace std;

string outputWord(string str);

int main() {
  int n;
  string tmp;
  cin>>n;
  getline(cin, tmp);
  while(n--) {
    string inputStr;
    getline(cin, inputStr);    
    cout<<outputWord(inputStr)<<endl;
  }
}

string outputWord(string str) {
  string ans, tmp;

  for(int i=0; i<str.length(); i++) {
    switch(str[i]) {
    case '0':
      ans += tmp;
      tmp.clear();
      break;
    case '1':
      if(tmp.length()==0 || tmp==" ") {
	tmp = ".";
      }
      else if(tmp == ".") {
	tmp = ",";
      }
      else if(tmp == ",") {
	tmp = "!";
      }
      else if(tmp == "!") {
	tmp = "?";
      }
      else if(tmp == "?") {
	tmp = " ";
      }
      break;
    case '2':
      if(tmp.length()==0 || tmp=="c") {
	tmp = "a";
      }
      else if(tmp == "a") {
	tmp = "b";
      }
      else if(tmp == "b") {
	tmp = "c";
      }
      break;
    case '3':
      if(tmp.length()==0 || tmp=="f") {
	tmp = "d";
      }
      else if(tmp == "d") {
	tmp = "e";
      }
      else if(tmp == "e") {
	tmp = "f";
      }
      break;
    case '4':
      if(tmp.length()==0 || tmp=="i") {
	tmp = "g";
      }
      else if(tmp == "g") {
	tmp = "h";
      }
      else if(tmp == "h") {
	tmp = "i";
      }
      break;
    case '5':
      if(tmp.length()==0 || tmp=="l") {
	tmp = "j";
      }
      else if(tmp == "j") {
	tmp = "k";
      }
      else if(tmp == "k") {
	tmp = "l";
      }
      break;
    case '6':
      if(tmp.length()==0 || tmp=="o") {
	tmp = "m";
      }
      else if(tmp == "m") {
	tmp = "n";
      }
      else if(tmp == "n") {
	tmp = "o";
      }
      break;
    case '7':
      if(tmp.length()==0 || tmp=="s") {
	tmp = "p";
      }
      else if(tmp == "p") {
	tmp = "q";
      }
      else if(tmp == "q") {
	tmp = "r";
      }
      else if(tmp == "r") {
	tmp = "s";
      }
      break;
    case '8':
      if(tmp.length()==0 || tmp=="v") {
	tmp = "t";
      }
      else if(tmp == "t") {
	tmp = "u";
      }
      else if(tmp == "u") {
	tmp = "v";
      }
      break;
    case '9':
      if(tmp.length()==0 || tmp=="z") {
	tmp = "w";
      }
      else if(tmp == "w") {
	tmp = "x";
      }
      else if(tmp == "x") {
	tmp = "y";
      }
      else if(tmp == "y") {
	tmp = "z";
      }
      break;
    }
  }

  return ans;
}

Measured memory_bytes: 1212
n = int(input())
r = range(1, min(9, n) + 1)
a = [None] + [[None] * 10 for _ in r]
for i in r:
  for j in r:
    a[i][j] = i == j
    k = 1
    while 10 * k * i + j <= n:
      a[i][j] += min(k, (n - j) // 10 - k * i + 1)
      k *= 10
print(sum(a[i][j] * a[j][i] for i in r for j in r))

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

int main(){
  int A,B,C,D;
  int left,right;
  
  cin >> A >> B >> C >> D;
  left = A+B;
  right = C+D;
  
  if(left > right){
	cout << "Left" << endl;
  }else if (left < right){
	cout << "Right" << endl;
  }else{
	cout << "Balanced" << endl;
  }
}

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

int main() 
{
	char ch;
	int cnt[26] = {};
	
	while(cin >> ch){
		ch = tolower(ch);
		if( isalpha(ch)){
			cnt[ch - 'a']++;
		}
	}
	for( int i = 0;i < 26;i++){
		printf("%c : %d\n",i+'a',cnt[i]);
	}
	return 0;
}

Measured memory_bytes: 1124
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  
  vector<int> vec(N);
  for (int i = 0; i<N; i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  
  int ans = 0;
   for (int i = 0; i<K; i++) {
     ans += vec.at(i);
   }
  
  cout << ans << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
#include <numeric>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define fi first
#define se second

void print(bool a)
{
    if (a == true)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

ll gcdll(ll a, ll b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

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

int main()
{
    int a, b, c, n;
    cin >> a >> b;
    //string s;
    //cin >> s;

    if (a >= 13)
        cout << b << endl;
    else if (a >= 6)
        cout << b / 2 << endl;
    else
        cout << 0 << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] a = new int[n];
		for(int i=0; i<n; i++){
			a[i] = scn.nextInt();
		}
      	int count4 = 0;
      	int count2 = 0;
      	for(int i=0; i<n; i++){
          if(a[i]%4==0) count4++;
          else if(a[i]%2==0) count2++;
        }
      	String ans = "No";
      	if(count4>=n/2 || count2==n-2*count4) ans = "Yes";
      	System.out.println(ans);
	}
}


Measured memory_bytes: 59516
#include<bits/stdc++.h>
using namespace std;
int x,a,b,c;
int main(void)
{
    scanf("%d %d %d",&a,&b,&c);
    x = 3*max({a,b,c})-(a+b+c);
    printf("%d",x%2==0?x/2:(x+3)/2);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int ,P> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

vector<bool> IsPrime;

void sieve(int max) {
    IsPrime.resize(max + 1, true);
    IsPrime[0] = IsPrime[1] = false;
    for (int i = 2; i * i <= max; ++i){
        if (IsPrime[i]){
            for (int j = i * i; j <= max; j += i) IsPrime[j] = false;
        }
    }
}

int main() {
    ll n, ans=0;
    cin >> n;
    sieve(n+2);
    REP(i,n+1){
        if(IsPrime[i] && IsPrime[i+2]) ans++;
    }
    cout << ans*2 << endl;
    return 0;
}



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

using namespace std;
using ll = long long;
using edge = struct {int to; ll cost;};

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define INF (1 << 29)


//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);


void solve()
{
    int x, a, b;
    cin >> x >> a >> b;
    x -= a;
    while(x >= b){
        x-=b;
    }
    cout << x << "\n";
}

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

Measured memory_bytes: 256
n = int(input())
d,x = map(int,input().split())
a = [int(input()) for i in range(n)]
ans = x
for i in range(n):
  for j in range(1,d+1):
    if j % a[i] - 1 == 0:
      ans += 1
    elif a[i] == 1:
      ans += 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
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; }

ll gcd(ll x, ll y)
{
    ll temp;
    while (y != 0) {
        temp = y;
        y = x % y;
        x = temp;
    }
    return (x);
}

ll lcm( ll mm, ll nn )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == mm ) || ( 0 == nn ) )
		return 0;
	
	return ((mm / gcd(mm, nn)) * nn); // lcm = m * n / gcd(m,n)
}//lcm

int main() {
  ll n,m;
  scanf("%lld%lld", &n,&m);
  string s,t;
  cin >> s >> t;

  ll ans = lcm(n,m);
  ll g = gcd(n,m);

  n /= g;
  m /= g;

  FOR(i,0,g-1){
    if(s[i*n]!=t[i*m]){
      cout << -1 << endl;
      return 0;
    }
  }

  cout << ans << endl;




}



Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int k[2020],f[2000005],a[2000005],g[2000005];
long long sum;
int main() {
string s;
cin>>s;
int n=s.size();
for(int i=0;i<n;i++){
a[i+1]=s[i]-'0';
}
int l=1;
for(int i=n;i>=1;i--){
g[i]=l;
l*=10;
l%=2019;
}
for(int i=n;i>=1;i--){
f[i]=(f[i+1]+a[i]*g[i])%2019;
k[f[i]]++;
}
sum=k[0];
sum+=(k[0]*(k[0]-1)/2);
for(int i=1;i<=2018;i++){
sum+=(k[i]*(k[i]-1)/2);
}
cout<<sum;
return 0;
}

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

namespace ABC061A
{
	class Program
	{
		static void Main(string[] args)
		{
			var word = Console.ReadLine().Split(' ');

			int a = int.Parse(word[0]);
			int b = int.Parse(word[1]);
			int c = int.Parse(word[2]);

			if(a <= c && c <= b)
				Console.WriteLine("Yes");


			else
				Console.WriteLine("No");


			Console.ReadKey();
		}
	}
}

Measured memory_bytes: 11092
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

//std::cout << std::fixed << std::setprecision(10)
constexpr long long MOD = 1000000007;

int main()
{
  int N;
  std::cin >> N;
  std::vector<long long> A(N);
  for (auto& a: A)
    std::cin >> a;
  std::vector<long long> acc1(N, 0);
  acc1[0] = A[0];
  for (int i = 1; i < N; ++i)
  {
    acc1[i] = acc1[i - 1] + (i % 2 == 0 ? A[i] : -A[i]);
  }
  std::vector<long long> acc2(N, 0);
  acc2.back() = A.back();
  for (int i = N - 2; 0 <= i; --i)
  {
    acc2[i] = A[i] - acc2[i + 1];
  }
  
  for (int i = 0; i < N; ++i)
  {
    long long ans = acc2[i];
    if (i == 0)
      std::cout << ans << " ";
    else
    {
      auto d = N - i;
      ans += (d % 2 == 0 ? acc1[i - 1] : -acc1[i - 1]);
      std::cout << ans << " ";
    }
  }
  std::cout << std::endl;
  return 0;
}



Measured memory_bytes: 3712
import java.util.Scanner;

public class Main {

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

		int x = 1 ;
		int i = 0 ;
		
		while ( !(x == 0) ){
			if ( !(i == 0)){
				System.out.println("Case " + i + ": " + x);
			}
			x = sc.nextInt();
			i++;
		}

	}

}



Measured memory_bytes: 42480
a,b = map(int,input().split())
s = input()

def ifnum(v):
  for i in range(0,len(v)):
    if(v[i] == "0" or v[i] == "1" or v[i] == "2" or v[i] == "3" or v[i] == "4" or v[i] == "5" or v[i] == "6" or v[i] == "7" or v[i] == "8" or v[i] == "9"):
      continue
    else:
      return 0
  return 1
#print(s[a+1:])

if(ifnum(s[0:a]) == 1 and s[a] == "-" and ifnum(s[a+1:]) == 1):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define int long long int
#define INF (int)1e9
#define INFL (int)1e15
#define MAXN (int)1e6
#define err 1e-15
#define sz size
int getInt(char ch) {
    return (int)(ch - '0');
}
int cdiv(int num, int den) {
    return (num%den == 0) ? (num/den) : (num/den)+1;
}
using namespace std;

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

    int n;
    cin >> n;

    cout << (n*(n-1))/2 << endl;

    return 0;
}	

Measured memory_bytes: 256
n = int(input())
W = [input() for i in range(n)]
flg = 1

Word = [W[0]]
for i in range(1,n):
    s = W[i-1]
    t = W[i]
    
    if(s[-1] != t[0] or t in Word): 
        flg = 0
        break
    Word.append(t)
    
if (flg): print("Yes")
else: print("No")



Measured memory_bytes: 62540
#include<bits/stdc++.h>
#define PB push_back
#define F first
#define S second
#define MP m ake_pair
#define LB lower_bound
#define UB upper_bound

using namespace std;
typedef long long ll;
typedef pair<int , int> pii;
typedef long double DB;

const int N = 200100;
const ll INF = 1000*1000*1000LL*1000*1000*1000;
ll a[N] , ps[N];

int main(){

	ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
	
	int n;
	ll ans(INF);

	cin >> n;

	for(int i = 0 ; i < n ; i++){
	   cin >> a[i];
	   ps[i] += a[i];
	   ps[i+1] += ps[i];
	}

	for(int i = 1 ; i < n-2 ; i++){
	   	ll t = ps[i]/2;
		int k = LB(ps , ps+i , t) - ps;
		if(k && abs(ps[i] - 2*ps[k]) > abs(ps[i] - 2*ps[k-1]))
		   k--;
		
		t = (ps[n] - ps[i])/2 + ps[i];
		int k2 = LB(ps+i+1 , ps+n-1 , t) - ps;
		if(k2-1 > i && abs(ps[n] - ps[i] - 2*(ps[k2]-ps[i])) > abs(ps[n] - ps[i] - 2*(ps[k2-1]-ps[i])))
		   k2--;
		
		ll mx = max(max(ps[k] , ps[i] - ps[k]) , max(ps[k2] - ps[i] , ps[n] - ps[k2]));
		ll mn = min(min(ps[k] , ps[i] - ps[k]) , min(ps[k2] - ps[i] , ps[n] - ps[k2] ));
		
		ans = min(ans , mx-mn);
	}


	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 3328
import copy
n,m,k = map(int, input().split())
if m==1:
    if (n-1==k):
        print(1)
    else:
        print(0)
    exit()

mod = 998244353
if (n-1==k):
    print(pow(m,n,mod))
    exit()
#dp[i][j]:i個まで、j組
def com(n,r,m):
    #a = math.factorial(n)%m
    a = 1
    for i in range(1,n+1):
        a *= i
        a %= m
    A = pow(a,m-2,m)
    
    
    b= copy.deepcopy(A)   
    for i in range(n,r,-1):
        b = (b*i)%m
    
    c = copy.deepcopy(A)
    for i in range(n,n-r,-1):
        c = (c*i)%m
       
    return (a*b*c)%m

ans = m*pow(m-1,n-1,mod)
ans %= mod
#print(ans)
p = pow(m-1,n-k-2,mod)
#com(n-1,i,mod)
c = com(n-1,k+1,mod)
#print(c)
for i in range(k,0,-1):
    p *= (m-1)
    p %= mod
    c *= (i+1)
    c *= pow(n-i-1,mod-2,mod)
    c %= mod
    ans += m * p * c
    ans %= mod
    #print(m-1,i,mod)
    #print(ans)
print(ans)

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

typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int k, q;
	cin >> k >> q;
	vector<ll> d(k);
	for(ll& x : d) cin >> x;
	
	for(int rep = 0; rep < q; rep++) {
		ll n, x, m;
		cin >> n >> x >> m;
		vector<ll> tmp_d(k), occur(k);
		for(int i = 0; i < k; i++) {
			tmp_d[i] = d[i] % m;
			occur[i] = (n-1)/k + (i < (n-1) % k);
		}
		
		ll a = x % m;
		for(int i = 0; i < k; i++) {
			a += tmp_d[i]*occur[i];
		}
		//$ cerr << a << endl;
		a /= m;
		for(int i = 0; i < k; i++) {
			if(tmp_d[i] == 0) {
				a += occur[i];
			}
		}
		
		cout << n - 1 - a << '\n';
	}
}


Measured memory_bytes: 384
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <numeric>
#include <cassert>
#include <cmath>
#include <map>
#include <set>
#include <iostream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> PII;
typedef vector<PII > VPII;
typedef vector<VPII> VVPII;

#define FOR(k,a,b) for(int k(a); k < (b); ++k)
#define REP(k,a) for(int k=0; k < (a); ++k)
#define ABS(a) ((a)>0?(a):-(a))
#define EPS 1e-9

int main(int argc, char** argv) {
#ifdef HOME
	freopen("in.txt", "rb", stdin);
	freopen("out.txt", "wb", stdout);
#endif
	int N,u,o;
	scanf("%d", &N);
	vector<int> v(N);
	REP(i, N)
	{
		scanf("%d", &v[i]);
	}
	vector<vector<int> > neigh(N);
	REP(i, N - 1)
	{
		scanf("%d %d", &u,&o);
		--u;--o;
		neigh[u].push_back(o);
		neigh[o].push_back(u);
	}
	vector<int> q;
	vector<bool> used(N);
	used[0] = 1;
	q.push_back(0);
	REP(i, N )
	{
		int act = q[i];
		REP(j, neigh[act].size())
		{
			if (!used[neigh[act][j]])
			{
				used[neigh[act][j]] = 1;
				q.push_back(neigh[act][j]);
			}
		}
	}
	vector<bool> prev(N);
	reverse(q.begin(), q.end());
	REP(i, N)
	{
		int act = q[i];
		prev[act] = 1;
		if(neigh[act].size() == 1 && i != N -1 )
			continue;
		LL su = 0;
		LL mx = 0;
		REP(j, neigh[act].size()) if(prev[neigh[act][j]])
		{
			int other = neigh[act][j];
			mx = max<LL>(mx,v[other]);
			su += v[other];
		}
		if (v[act] > su || v[act] < su / 2)
		{
			printf("NO\n");
			return 0;
		}
		if (i == N - 1 && neigh[act].size() == 1)
		{
			printf("%s\n", (v[act] == su ? "YES" : "NO"));
			return 0;
		}
		LL d = v[act];
		v[act] = 2 * v[act] - su;
		d -= v[act];
		if (su - mx < d)
		{
			printf("NO\n");
			return 0;
		}
		prev[act] = 1;
	}
	printf("%s\n", ( v[0] == 0 ? "YES" : "NO"));
	return 0;
}


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

int main()
{

	long long int a, b, c, k;

	cin >> a >> b >> c >> k;

	long long int sum = 0;
	if (k - a >= 0)
	{
		sum += a;
		k -= a;
		if (k > 0 && k - b >= 0)
		{
			k -= b;

			if (k > 0)
			{
				// sum -= c;
				// k -= c;
				cout << sum-k << endl;
			}
			else cout << sum << endl;
		}
		else
		{
			cout << sum << endl;
		}
	}
	else
	{
		cout << k << endl;
	}
	return 0;
}

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

typedef long long ll;

int main() {
    string s, t;
    int i, j;
    cin >> s >> t;

    for (i = s.size()-t.size(); i>=0; i--) {
        for (j = 0; j < t.size(); j++) {
            if (s[i+j] != t[j] && s[i+j] != '?') break;
        }
        if (j == t.size()) break;
    }

    if (i < 0) {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }

    for (j = 0; j < t.size(); j++) {
        s[i+j] = t[j];
    }
    for (i = 0; i < s.size(); i++) {
        if (s[i] == '?') {
            s[i] = 'a';
        }
    }
    cout << s << endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

map<int, int> mp;

int main(int argc, char* argv[]){
	long long N, K;
	cin >> N >> K;

	for(int i=1; i<=N; i++){
		int a, b;
		cin >> a >> b;
		if(mp.count(a)==0){
			mp[a] = b;
		}
		else{
			int c = mp[a];
			mp[a] = c + b;
		}
	}

	int ans = 0;
	long long count = 0;
	for(auto itr = mp.begin(); itr != mp.end(); itr++){
		ans = itr->first;
		count += (long long)itr->second;
		if(count >= K){ break; }
	}
	cout << ans << endl ;
	return 0;
}

Measured memory_bytes: 4608
h,w=map(int,input().split())
tmp=[]
for i in range(h):
    tmp.append(input())
for i in range(h+2):
    if i==0:
        a="#"*(w+2)
        print(a)
    elif i==(h+1):
        a="#"*(w+2)
        print(a)
    else:
        print("#{}#".format(tmp[i-1]))


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

public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			String line[] = br.readLine().split(" ");
			int n = Integer.parseInt(line[0]);
			int k = Integer.parseInt(line[1]);
			if(n==0){break;}

			int maxi = 0;
			int sum = 0;
			int[] seq = new int[n];
			for(int i=0; i<n; i++){
				seq[i] = Integer.parseInt(br.readLine());
			}

			for(int i=0; i<k; i++){
				sum += seq[i];
			}
			maxi = sum;
			for(int i=k; i<n; i++){
				sum -= seq[i-k];
				sum += seq[i];
				maxi = Math.max(maxi, sum);
			}

			System.out.println(maxi);
		}
	}
}

Measured memory_bytes: 35920
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

L = int(input())

ans = (L / 3) ** 3
print(ans)


Measured memory_bytes: 7740
n=int(input())
ne=[[] for _ in range(n+1)]
for _ in range(n):
    u,k,*v=map(int,input().split())
    ne[u]=v

class dfs:
    def __init__(self, n, ne):
        self.n=n
        self.ne=ne
        self.d=[0]*(n+1)
        self.f=[0]*(n+1)
        self.t=0
    def search(self, a):
        self.t+=1
        self.d[a]=self.t
        for p in ne[a]:
            if self.d[p]==0:
                self.search(p)
        self.t+=1
        self.f[a]=self.t
DFS=dfs(n,ne)
for i in range(1,n+1):
    if DFS.d[i]==0:
        DFS.search(i)
    print(i,DFS.d[i],DFS.f[i])


Measured memory_bytes: 5712
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const ld pi = 3.14159265358;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

ll fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<ll> memo(50);
    memo[0] = 1;memo[1] = 1;
    for(ll i = 2;i < 50;i++){
        memo[i] = memo[i - 1] + memo[i - 2];
    }
    ll n;
    cin >> n;
    cout << memo[n] << endl;
}


Measured memory_bytes: 3164
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
q = int(input())
count_a = Counter(a)
total = sum(a)
nums = []
for i in range(q):
    b, c = map(int, input().split())
    if b in count_a:
        tmp = count_a[b]
    else:
        tmp = 0
    total = total - count_a[b] * b + tmp * c
    print(total)
    count_a[c] = count_a[c] + tmp
    count_a[b] = 0


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

void solve(){
    ll h,w;
    cin >> h >> w;
    ll ch,cw,dh,dw;
    cin >> ch >> cw >> dh >> dw;
    ch--;
    cw--;
    dh--;
    dw--;
    vector<vector<char>> s(h,vector<char>(w));
    rp(i,h){
        rp(j,w){
            cin >> s[i][j];
        }
    }
    deque<pair<PLL,ll>> deq;
    deq.pb(mp(mp(ch,cw),0));
    matrix mat(h,Vi(w,100000000));
    mat[ch][cw]=0;
    while(!deq.empty()){
        PLL pl=deq.front().first;
        ll dist=deq.front().second;
        deq.pop_front();
        repi(i,-2,3){
            repi(j,-2,3){
                if(i==0&&j==0) continue;
                if(pl.first+i<0||pl.first+i>=h) continue;
                if(pl.second+j<0||pl.second+j>=w) continue;
                if(s[pl.first+i][pl.second+j]=='#') continue;
                if(mat[pl.first][pl.second]<dist) continue;

                if(abs(i)+abs(j)==1){
                        if(chmin(mat[pl.first+i][pl.second+j],mat[pl.first][pl.second])) deq.push_front(mp(mp(pl.first+i,pl.second+j),dist));
                        
                }else{
                    if(chmin(mat[pl.first+i][pl.second+j],mat[pl.first][pl.second]+1)) deq.pb(mp(mp(pl.first+i,pl.second+j),dist+1));
                    
                }
            }
        }
    }
    if(mat[dh][dw]>10000000) print(-1);
    else print(mat[dh][dw]);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

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

typedef long long ll;

bool changed[100];

int main()
{
    string s;
    cin >> s;
    int n = s.length();
    ll k;
    cin >> k;
    ll count = 0;
    int idx = n - 1;
    while (idx > 0 && s.at(idx) == s.at(0))
    {
        idx--;
    }
    if (idx == 0)
    {
        cout << n * k / 2 << endl;
        return 0;
    }
    idx++;
    ll count1 = -1;
    count = n - idx + 1;
    ll result = 0;
    for (int i = 1; i < idx; i++)
    {
        if (s.at(i) == s.at(i - 1))
        {
            count++;
        }
        else
        {
            result += count / 2;
            if (count1 == -1) {count1 = count;}
            count = 1;
        }
    }
    result += count / 2;
    result *= k;
    ll count2 = 0;
    while (s.at(count2) == s.at(0))
    {
        count2++;
    }
    result -= count1 / 2 - count2 / 2 - (count1 - count2) / 2;
    cout << result << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using static System.Console;

class class_A
{
    static void Main()
    {
        var A = int.Parse(ReadLine());
        var B = int.Parse(ReadLine());
        var C = int.Parse(ReadLine());
        var X = int.Parse(ReadLine());
        var cnt = 0;

        for (var a = 0; a <= A; a++)
        {
            for (var b = 0; b <= B; b++)
            {
                for (var c = 0; c <= C; c++)
                {
                    if (a * 500 + b * 100 + c * 50 == X)
                    {
                        cnt++;
                    }
                }
            }
        }
        WriteLine(cnt);
    }
}


Measured memory_bytes: 11092
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] l = new int[n];
        for(int i=0;i<n;i++){
            l[i] = Integer.parseInt(sc.next());
        }
        sort(l, 0, n-1);
        long cnt = 0;
        for(int i=0;i<n-2;i++){
            int a = l[i];
            for(int j=i+1; j<n-1; j++){
                int b = l[j];
                for(int k=j+1;k<n;k++){
                int c = l[k];
                if(a<b+c){
                    cnt++;
                    continue;
                }
                break;
                }
                continue;
            }
        }
        System.out.println(cnt);
        
    }
    
    private static void sort(int[] d, int left, int right){
        if(left>=right){return;}
        int p = d[(left+right)/2];
        int l=left, r=right;
        int tmp;
        while(l<=r){
            while(d[l]>p){l++;}
            while(d[r]<p){r--;}
            if(l<=r){
                tmp=d[l];
                d[l] = d[r];
                d[r] = tmp;
                l++; r--;
            }
        }
        sort(d, left, r);
        sort(d, l, right);
    }
}

Measured memory_bytes: 25772
#include <bits/stdc++.h>
#define llint long long int
#define ldouble long double

using namespace std;

int main() {
    vector<int> a(5);
    for(int i=0;i<5;i++){
        cin>>a.at(i);
    }

    int last=0; //ばんめ
    int lastc=10;

    for(int i=0;i<5;i++){
        if(a.at(i)%10<lastc && a.at(i)%10!=0){
            last=i;
            lastc=a.at(i)%10;
        }
    }

    int sum=0;
    for(int i=0;i<5;i++){
        if(i!=last){
            if(a.at(i)%10!=0){
                sum+=(a.at(i)/10+1)*10;
            }
            else{
                sum+=a.at(i);
            }
        }
    }

    sum+=a.at(last);
    cout<<sum<<endl;
return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
       
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(c < (a * b)){
            System.out.println(c);
        }else{
            System.out.println(a * b);
        }
	}
}


Measured memory_bytes: 21844
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramC
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            var dic = new Dictionary<string, long>();
            for (var i = 0; i < n; i++)
            {
                var s = Console.ReadLine().Select(x => x.ToString()).ToList();
                s.Sort();
                var ss = string.Join("", s);
                if (dic.ContainsKey(ss))
                    dic[ss]++;
                else
                    dic.Add(ss, 1);
            }

            var result = 0L;
            foreach (var d in dic)
            {
                result += comb(d.Value, 2);
            }

            Console.WriteLine(result);
        }

        static long comb(long n, long r)
        {
            var p = fact(n, n - r + 1);
            return p / fact(r);
        }

        static long fact(long s, long e = 0)
        {
            if (s == e)
            {
                return Math.Max(s, 1);
            }
            return s * fact(s - 1, e);
        }
    }
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;
}

Node treeMaximum(Node x){


}

Node treeSearch(Node u, int k){
  if(u == NIL) return NIL;
  else if(u->key == k) return u;
  else if(u->key < k) return treeSearch(u->right,k);
  else return treeSearch(u->left,k); 
}

Node treeSuccessor(Node x){
  Node y;
  
  if(x->right != NIL) return treeMinimum(x->right);

  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);

  if(y->left != NIL) x = y->left;
  else x = y->right;

  if(x != NIL) x->parent = y->parent;

  if(y->parent == NIL) x->parent = NIL;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;

  if( y != z) z->key = y->key;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
    z->parent = y;

    if(y == NIL) root = z;
    else if(z->key < y->key) y->left = z;
    else y->right = z;

}

void inorder(Node u){
  if(u->left != NIL) inorder(u->left);
  printf(" %d",u->key);
  if(u->right != NIL) inorder(u->right);
}
void preorder(Node u){
  printf(" %d",u->key);
  if(u->left != NIL) preorder(u->left);
  if(u->right != NIL) preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



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

using namespace std;

#define rep1(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep2(i, n, m) for (long long i = (long long)(n); i <= (long long)(m); i++)
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 (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
const ll mod = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    ll a[n];
    rep1(i, n) cin >> a[i];
    ll b[n];
    rep1(i, n) cin >> b[i];
    ll c[n];
    rep1(i, n) cin >> c[i];
    sort(a, a + n);
    sort(c, c + n);
    ll count = 0;
    rep1(i, n) {
        ll len1 = lower_bound(a, a + n, b[i]) - a;
        ll len2 = c + n - upper_bound(c, c + n, b[i]);
        count += len1 * len2;
    }
    cout << count << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  
  int num = 1;
  for (int i=0;i<N;i++) {
    if (num*2 < num+K)
      num = num*2;
    else num += K;  
  }
  cout << num << endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split(' ')))
b = [0] +list(map(int, input().split(' ')))
c = [0] +list(map(int, input().split(' ')))
last = 0
g = 0
for i in a:
    g += b[i]
    if last > 0 and i - last == 1:
        g += c[i - 1]
    last = i
print(g)

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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion

#define int long long


signed main()
{
    int N, M;
    while(cin>>N>>M, N) {
        vector<pair<int, int> > members[10001];
        int r;
        cin >> r;
        for(int i=0; i<r; ++i) {
            int t, n, m, s;
            cin >> t >> n >> m >> s;
            members[m].push_back(pair<int,int>(t,s));
        }
        for(int i=1; i<=M; ++i) sort(members[i].begin(), members[i].end());
        int q;
        cin >> q;
        for(int i=0; i<q; ++i) {
            int s, e, m;
            cin >> s >> e >> m;
            int pc_count = 0;
            int current_time = s;
            int ans = 0;
            vector<pair<int, int> > member = members[m];
            for(int i=0; i<member.size(); ++i) {
                pair<int, int> p = member[i];
                if(current_time <= p.first && pc_count > 0)
                    ans += min(e, p.first) - current_time;

                current_time = max(s, min(e, p.first));
                pc_count += p.second ? 1 : -1;

                if(current_time == e) break;
            }
            cout << ans << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3352