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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

/*
 * Because the first one has to be taken out, we can put the bomb at
 * the place where it can reach to x[i]+2*d. We need a segtree to take
 * care of range add operation. Alternatively we can just use a prefix
 * sum.
 *
 *   i           j      Let's say we drop a bomb that covers [i,j), we
 * -[x]-[x]-[x]-[x]-    can add v at i, and add -v at j. This way, when
 *   |           |      we move to i+1, prefix sum carries +v, but
 *  +v          -v      we reach to j, prefix sum cancels out w/ -v.
 */

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    int n,d,a;
    while (cin >> n >> d >> a) {
        vector<PII> A(n+1);
        FOR(i,1,n+1)
            cin >> A[i].first >> A[i].second;
        sort(ALL(A));
        vector<LL> x(n+1), h(n+1);
        FOR(i,1,n+1)
            x[i] = A[i].first, h[i] = A[i].second;
        LL ans = 0; vector<LL> sum(n+2);
        FOR(i,1,n+1) {
            sum[i] += sum[i-1];
            h[i  ] -= sum[i]*a;
            if (h[i] > 0) {
                const int j = upper_bound(ALL(x), x[i]+2*d) - x.begin();
                const int c = (h[i]+a-1) / a;
                sum[i] += c;
                sum[j] -= c;
                ans += c;
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 6528
//============================================================================
// Name        : HelloCPP.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <stdio.h>
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++ ){	//gyou
			for(int j = 0; j < W; j++){ // retsu
				if((i == 0)|(i == H-1)| (j == 0)|(j == W-1)){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}

	return 0;
}

Measured memory_bytes: 3008
n = int(input())
jobs = [list(map(int, input().split())) for _ in range(n)]
jobs.sort(key=lambda x:x[1])
count = 0
for i in range(n):
    count += jobs[i][0]
    if count > jobs[i][1]:
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 53600
#include<bits/stdc++.h>
using namespace std;
const int maxN = 100100;
int grid[maxN][4];
int input[maxN][4];
int n;
int solve(int i,int type){
	if(i > n){
		return 0;
	}
	if(grid[i][type] != -1){
		return grid[i][type];
	}
	int res = 0;
	for(int j = 1;j <= 3; j++){
		if(j != type){
			res = max(res,input[i][j] + solve(i + 1,j));
		}
	}
	return grid[i][type] = res;
}
int main(){
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    memset(grid,-1,sizeof(grid));
    cin >> n;
    for(int i = 1;i <= n; i++){
		cin >> input[i][1] >> input[i][2] >> input[i][3];
	}
	cout << solve(1,0) << "\n";
}
 


Measured memory_bytes: 14568
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
double pi=acos(-1);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
// #define mp make_pair
#define pq priority_queue
const ll mod=1000000007;
#define f first
#define s second
#define pii pair< ll, ll >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace boost::multiprecision;
using namespace std;
void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


const int N=1000005;
ll fact[N],invfact[N];
ll power(ll x,ll y){
  if(y<=0) return 1LL;
  ll z=power(x,y/2);
  if(y%2) return (((z*z)%mod)*x)%mod;
  return (z*z)%mod;
}

void pre(){
  fact[0]=invfact[0]=invfact[1]=fact[1]=1;
  rep(i,2,N) fact[i]=(i*fact[i-1])%mod;
  rep(i,2,N) invfact[i]=(invfact[i-1]*power(i,mod-2))%mod;
}
ll nCr(ll n,ll k){ return (((fact[n]*invfact[n-k])%mod)*invfact[k])%mod; }



const int N1=1e6+1;
vector<int> isprime(N1,1),prime;
void seive(){
  rep(i,2,sqrt(N1)+1){
      if(isprime[i]){
        for(int j=i*i;j<N1;j+=i) isprime[j]=0;
        prime.pb(i);
      }
  }
  rep(i,sqrt(N1)+1,N1) if(isprime[i]) prime.pb(i);
}



struct dsu {
    vector<int> par, rank;
    dsu(int n): par(n+1), rank(n+1) {
        for (int i = 0; i <= n; i++) {
            par[i] = i;
            rank[i]= 1;
        }
    }
    int root(int a) {
        if (a == par[a]) return a;
        return par[a] = root(par[a]);
    }
    void merge(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (rank[a] > rank[b]) swap(a, b);
        par[b] = a;
    }
    set<int> parent(int n){
        set<int> s;
        for(int i=1;i<=n;i++){
            s.insert(root(i));
        }
        return s;
    }
};

void solve(){
  ll a[100];
  int n;
  cin>>n;
  a[0]=2;
  a[1]=1;
  rep(i,2,100) a[i]=a[i-1]+a[i-2];
  cout<<a[n]<<endl;
}

int main(){
    optimizeIO();
    int r=1;
    {solve();}
}


Measured memory_bytes: 7060
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());
        char[] s = sc.next().toCharArray();
        
        char prev = s[0];
        int cnt = 0;
        for (int i=1;i<n;i++){
            if(prev==s[i]){
                cnt++;
            }
            prev = s[i];
        }  
        
        System.out.println(n-cnt);
        
    }

    private static char[] rotateArray(char[] c, int d){
        char[] newc = new char[c.length];
        for(int i=0;i<c.length;i++){
            newc[(i+d)%c.length] = c[i];
        }
        return newc;
    }
    
    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: 25896
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline().rstrip()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
input = sys.stdin.readline

import itertools
N,M,Q = MI()
l = LI2(Q)
result=0
nums = list(range(1,M+1))
for balls in itertools.combinations_with_replacement(nums, N):
    ans = 0
    for i in range(Q):
        if balls[l[i][1]-1]-balls[l[i][0]-1]==l[i][2]:
            ans += l[i][3]
    result = max(ans,result)
print(result)


Measured memory_bytes: 73044
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int const INF = 1001001001;


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

int n;
cin >> n;
string s,t;
cin >> s >> t;

int ans = 2 * n;
rrep(i,n){
    if(s.substr(n-i,i) == t.substr(0,i)) ans = 2*n - i;
}

cout << ans << endl;

return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		ABC057CCSolve solve = new ABC057CCSolve();
		solve.main();
	}
}

class ABC057CCSolve {
	
	long N;
	
	ABC057CCSolve() {
		Scanner cin = new Scanner(System.in);
		this.N = cin.nextLong();
	}
	
	void main() {
		int min = Integer.MAX_VALUE;
		for (int i = 1; i <= Math.sqrt(N); i++) {
			if (N % i != 0) continue;
						
			long a = i;
			long b = N / a;
			min = Math.min(min, F(a, b));
		}
		System.out.println(min);
	}
	
	int F(long A, long B) {
		return Math.min(String.valueOf(B).length(), String.valueOf(B).length());
	}
	
}


Measured memory_bytes: 22868
n, a, b, c = map(int, input().split( ))
l = []

for _ in range(n):
    l.append(int(input()))
 
ind = 2**(2*n)
ans = 10000000

for i in range(ind):
    use = [[] for _ in range(4)]
    for j in range(n):
        t = (i>>(2*j))&3
        use[t].append(l[j])
        ax = sum(use[0])
        bx =sum(use[1])
        cx = sum(use[2])
        tmp = abs(a-ax) + abs(b-bx) + abs(c-cx) + 10*len(use[0]) -10 + 10*len(use[1]) - 10 + 10*len(use[2]) - 10
        if tmp<ans and len(use[0]) and len(use[1]) and len(use[2]):
            
            ans = tmp
print(ans)
        
        

Measured memory_bytes: 3064
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

s = ns()
now = s[0]
count = 0
for i in range(len(s)):
    if s[i] != now:
        count += 1
        now = s[i]
print(count)


Measured memory_bytes: 3564
#include <stdio.h>

int main()
{
    int W, H, x, y, r;

    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

    if(((x-r) < 0) || (x+r) > W || (y-r) < 0 || (y+r) > H) {
        printf("No\n");
    } else {
        printf("Yes\n");
    }

    return 0;
}


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

int main()
{
  int n;
  cin >> n;
  map<int, int> mp;
  for (int i = 0; i < n; ++i)
  {
    int s;
    cin >> s;
    mp[s]++;
  }

  int q;
  cin >> q;
  int cnt = 0;
  for (int i = 0; i < q; ++i)
  {
    int t;
    cin >> t;
    if (mp[t] > 0)
      cnt++;
  }
  cout << cnt << endl;

  return 0;
}



Measured memory_bytes: 3136
#include <iostream>
#include <string>

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


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

int main() {
  int r,D;
  cin>>r>>D;
  vector<int> W(11);
  cin>>W.at(0);
  
  for (int i = 1; i < 11; i++) {
    W.at(i)=r*W.at(i-1)-D;
  }
  for (int i = 1; i < 11; i++) {
    
    cout<<W.at(i)<<endl;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N;
int A[100100];
ll ans = 0ll;
int main(){
	scanf("%d",&N);
	for(int i=0;i<N;i++)scanf("%d",&A[i]);
	for(int i=0;i<N;i++){
		if(A[i]%2==1){
			ans += A[i]/2;
			A[i]=1;
		}
		if(A[i]%2==0&&A[i]>0){
			ans += A[i]/2-1;
			A[i]=2;
		}
	}
	if(A[0]==2){
		A[0]=0;
		ans++;
	}
	for(int i=1;i<N;i++){
		if(A[i]==0)continue;
		if(A[i-1]==1){
			A[i]--;
			A[i-1]--;
			ans++;
		}else{
			if(A[i]==2){
				ans++;
				A[i]=0;
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>

template <typename QvQ> inline QvQ Min(QvQ a,QvQ b){if(a<b) return a;return b;}
template <typename QvQ> inline QvQ Max(QvQ a,QvQ b){if(a>b) return a;return b;}

#define inf 2147483647
#define dinf 0x3f3f3f3f
#define llinf 0x7f7f7f7f7f7f7f7f

#define ll long long
#define rei register int
#define inv inline void
#define ull unsigned long long
#define il inline

#define bl putchar(' ')
#define ed putchar('\n')
#define test cout<<"this:" 

#define read2(a,b) read(a),read(b)
#define write2(a,b) write(a),bl,write(b)
#define read3(a,b,c) read(a),read(b),read(c)
#define write3(a,b,c) write(a),bl,write(b),bl,write(c)

template <typename QvQ>inv read(QvQ &x){
	x=0;int f=1;
	char c=getchar();
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
	for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
	x=x*f;
}
template <typename QvQ>inv write(QvQ x){
	if(x<0) x=-x,putchar('-');
	if(x>9) write(x/10);
	putchar(x%10+48);
}
using namespace std;
#define int long long
const int maxn=3e6+5;
const int mod=998244353;
int n,dis[maxn],tot[maxn];
int qpow(int a,int b){
	int ret=1;
	while(b){
		if(b&1) ret=ret*a%mod;
		a=a*a%mod; b>>=1;
	}
	return ret;
}
signed main()
{
	read(n); ll ans=1,mx=0;
	for(rei i=1;i<=n;++i){
		read(dis[i]);
		++tot[dis[i]];
		mx=Max(mx,dis[i]);
	}
	if(tot[0]!=1||dis[1]!=0){
		write(0);
		return 0;
	}
	for(rei i=1;i<=mx;++i) ans=ans*qpow(tot[i-1],tot[i])%mod;
	write(ans);
	return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;



int main() {
	int n;
	cin >> n;
	VI a(n);
	rep(i, 0, n) scanf("%d", &a[i]);
	sort(ALL(a), greater<int>());

	int alice = 0, bob = 0;	
	rep(i, 0, n){
		if (i % 2 == 0) alice += a[i];
		else bob += a[i];
	}

	cout << alice - bob << "\n";
}


Measured memory_bytes: 256
#include<cstring>
#include<cstdio>
#include<deque>
#define mp make_pair
using namespace std;
const int N = 100010;
int n;
bool b[N];
deque<pair<int, int> >q;

int main(void) {
	scanf("%d", &n);
	q.push_back(mp(1, 1));
	while (!q.empty()) {
		pair<int, int> now = q.front(); q.pop_front();
		if (b[now.first]) continue;
		b[now.first] = 1;
		if (now.first == 0) {
			printf("%d\n", now.second);
			break;
		}
		q.push_back(mp((now.first + 1) % n, now.second + 1));
		q.push_front(mp(now.first * 10 % n, now.second));
	}
	
	return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>
#define max 10001

int main() {
	int N,i=0;
	char s[max];
  	scanf("%d",&N);
  	scanf("%s",&s);
  	while(s[i]!='\0') {
      	if(i==max) {
        	return 0;
        }
    	s[i] += (char)N;
      	if(s[i]>'Z') {
        	s[i]-=26;
        }
      	printf("%c",s[i]);
      	i++;
    }
  	return 0;
}

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

const int MaxN=1e5+5;

int N;
int Col[MaxN];
bool Tag[MaxN];

vector<int> To[MaxN];

struct Tree{
	int Root;
	int Fa[MaxN],A[MaxN];
	bool P[MaxN];
	
	vector<int> Son[MaxN];
	
	void Init(){
		int i;
		for(i=1;i<=N;i++){
			scanf("%d",&Fa[i]);
			if(Fa[i]<0)
				Root=i;
			else Son[Fa[i]].push_back(i);
		}
	}
	
	void DFS(int u){
		int i,v,cnt=Son[u].size(),x,y;
		for(i=0;i<cnt;i++)
			DFS(Son[u][i]);
		for(i=0;i+1<cnt;i+=2){
			x=A[Son[u][i]],y=A[Son[u][i+1]];
			To[x].push_back(y);
			To[y].push_back(x);
			Tag[x]=Tag[y]=1;
		}
		if(Son[u].size()&1)
			A[u]=A[Son[u][cnt-1]];
		else A[u]=u,P[u]=1;
	}
}T1,T2;

void DFS(int u){
	int i,v;
	for(i=0;i<To[u].size();i++)
		if(!Col[v=To[u][i]])
			Col[v]=3-Col[u],DFS(v);
}

int main(){
	int i;
	scanf("%d",&N);
	T1.Init(),T2.Init();
	T1.DFS(T1.Root),T2.DFS(T2.Root);
	for(i=1;i<=N;i++)
		if(T1.P[i]^T2.P[i]){
			puts("IMPOSSIBLE");
			return 0;
		}
	puts("POSSIBLE");
	for(i=1;i<=N;i++)
		if(Tag[i]){
			if(!Col[i])
				Col[i]=1,DFS(i);
			printf("%d ",Col[i]<2?1:-1);
		}
		else printf("%d ",T1.P[i]);
	return 0;
}

Measured memory_bytes: 19456
<?php
$input = explode(' ', trim(fgets(STDIN)));

$n = (int)$input[0];
$t = (int)$input[1];

$t_array = explode(' ', trim(fgets(STDIN)));

if ($n === 1) {
	echo $t;
	exit();
}

$sum = 0;
for ($i=1; $i < $n ; $i++) { 
	$tmp_t = $t_array[$i];
	$pre_t = $t_array[$i-1];
	$diff = $tmp_t - $pre_t;
	if ($diff >= $t) {
		$sum += $t;
	}else{
		$sum += $diff;
	}
}
$sum += $t;
echo $sum;

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

long long INF=LLONG_MAX;

ll h[100111],c[100111];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	ll n; cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> h[i];
		c[i] = 1e9;
	}
	
	c[1] = 0;
	for(int i = 1; i <= n; i++){
		if(i+2<=n)c[i+2] = min(c[i+2],c[i]+abs(h[i+2]-h[i]));
		if(i+1<=n)c[i+1] = min(c[i+1],c[i]+abs(h[i+1]-h[i]));
	}
	cout << c[n] << endl;
}	


Measured memory_bytes: 1792
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H;
		int W;
		
		while (sc.hasNext()) {
			H = sc.nextInt();
			W = sc.nextInt();
			
			//0 0?????????
			if (H ==0 && W ==0) {
				break;
			}
			
			//????????¢???????????????
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					System.out.print('#');
				}
				//?¬??????????????????????
				System.out.println();
			}
			//???????????????????????????
			System.out.println();
		}
	}
}

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

#define int long long
#define pb emplace_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(0);
bool fun(int n)
{
	if(n==1 || n==2)    return 1;
	for(int i=2 ; i*i <=n ; i++)
	{
		if(n%i==0)  return 0;
	}
	return 1;
}
int32_t main(){
	
	fast;
	int a,b;
	cin >> a >> b;
	
	int ans = 0;
	for(int i = 1 ; i*i <= a ; i++)
	{
		if(a%i == 0)
		{
			int x = i;
			int y = a/i;
			if(x != y)
			{
				if(fun(x)== 1 && b%x==0) ans++;
				if(fun(y) == 1 && b%y==0) ans++;
			}
			else
			{
				if(fun(x)==1 && b%x==0)   ans++;
			}
		}
	}
	
	cout << ans;
	
}







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

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x)      cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x)      cout << ((x) ? "YES" : "NO") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )

int main(int argc, const char* argv[]) {
	ll n, m;
	cin >> n >> m;

	ll maxl = 1;
	ll minr = n;
	rep(i, m) {
		ll l, r;
		cin >> l >> r;

		if(maxl < l) maxl = l;
		if(r < minr) minr = r;
	}

	cout << (maxl <= minr ? minr - maxl + 1 : 0) << endl;

	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <math.h>

int main()
{
	double x[3];
	double y[3];
	double point[2];
	int i;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&point[0],&point[1]) != EOF)
	{
		double Tsurface;
		double Psurface;
		x[1] -= x[0];
		x[2] -= x[0];
		point[0] -= x[0];
		y[1] -= y[0];
		y[2] -= y[0];
		point[1] -= y[0];
		Tsurface = 0.5*fabs(x[1]*y[2]-x[2]*y[1]);
		Psurface = 0.5*(fabs(x[1]*point[1]-point[0]*y[1])+fabs(x[2]*point[1]-point[0]*y[2]));
		x[1] -= point[0];
		x[2] -= point[0];
		y[1] -= point[1];
		y[2] -= point[1];
		Psurface += 0.5*fabs(x[1]*y[2]-x[2]*y[1]);
		if(Psurface > Tsurface)
		{
			printf("NO\n");
		}
		else
		{
			printf("YES\n");
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <random>
#include <stdio.h>
#include <bitset>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef string ST;


#define REP(i,n) for(LL (i)=0;(i)<(n);(i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v) {LL i=0; for(auto (a): v ){   cerr <<i << " : "<<  a << endl; i++;}}
#define PRINTSP(v) for(auto (a): v ) {cerr << a << " ";} cerr << endl



void func() {
  LL A;
  cin >> A;
  LL B;
  cin >> B;

  if (A < 10 && B < 10) {
    cout << A * B;
  }
  else {
    cout << -1;
  }





}

#ifdef CALC_TIME 
#include <windows.h>
int main()
{
  LARGE_INTEGER freq;
  QueryPerformanceFrequency(&freq);
  LARGE_INTEGER start, end;
  QueryPerformanceCounter(&start);
  // 何かの処理
  func();
  QueryPerformanceCounter(&end);
  double time = static_cast<double>(end.QuadPart - start.QuadPart) * 1000.0 / freq.QuadPart;
  fprintf(stderr, "\n%lf[ms]\n", time);
  return 0;
}
#else 
int main()
{
  func();
  return 0;
}
#endif





Measured memory_bytes: 256
# ALDS1_4_C.
# ハッシュテーブル。

def get_key(_str):
    key = 0
    for i in range(len(_str)):
        if _str[i] == 'A': key += 1
        elif _str[i] == 'C': key += 2
        elif _str[i] == 'G': key += 3
        elif _str[i] == 'T': key += 4
        key *= 5
    return key
    
def main():
    n = int(input())
    dict = {}
    for i in range(n):
        command = input().split()
        if command[0][0] == 'i':
            dict[get_key(command[1])] = command[1]
        else:
            key = get_key(command[1])
            if key in dict: print('yes')
            else: print('no')
    
if __name__ == "__main__":
    main()



Measured memory_bytes: 41812
#include <bits/stdc++.h>
#define endl '\n'


//This solution is  recursive but slow

using namespace std;

int main() { 
    int n; cin >> n;
    int jumps[n];
    vector<int> dp(n, 0); // dp[i] : Minimum cost for the frog to reach position i.
    for (int i = 0; i < n; i++) cin >> jumps[i];
    dp[1] = abs(jumps[1] - jumps[0]); // Base value
    for (int i = 2; i < n; i++)
        dp[i] = min(abs(jumps[i] - jumps[i - 1]) + dp[i - 1], abs(jumps[i] - jumps[i - 2]) + dp[i - 2]);
    cout << dp[n - 1] << endl;
    return 0;
}


Measured memory_bytes: 3960
def power_func(a,n,p):
  bi=str(format(n,"b"))#2進表現に
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res

MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

A.sort()
if N%2:
  correct = [0]
  for i in range(N//2):
    correct += [(i+1)*2]*2
else:
  correct = []
  for i in range(N//2):
    correct += [i*2+1]*2
    
if A == correct:
  print(power_func(2, N//2, MOD))
else:
  print(0)

Measured memory_bytes: 13880
#include<bits/stdc++.h>
using namespace std;
const int MXN = 1E5;
int a[MXN];
int l[MXN];
int main()
{
    int n;
    scanf("%d", &n);
    int i;
    for(i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }
    int lis_len = 0; l[lis_len] = -1;
    for(i = 0; i < n; i++){
        if(a[i] > l[lis_len]) l[++lis_len] = a[i];
        else{
            int h, t;
            h = 0, t = lis_len;
            while(h<t){
                int mid = (h+t)/2;
                if(l[mid] >= a[i]) t = mid;
                else h = mid+1;
            }
            l[h] = a[i];
        }
    }
    printf("%d\n", lis_len);
    return 0;
}



Measured memory_bytes: 3984
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
E = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = map(int, input().split())
    E[a].append(b)
    E[b].append(a)
Q = int(input())
VDC = [list(map(int, input().split())) for _ in range(Q)]
Ans = [0] * (N+1)
D = [-1] * (N+1)

def dfs(v, d, c):
    if D[v] >= d:
        return
    D[v] = d
    if Ans[v]==0:
        Ans[v] = c
    for u in E[v]:
        dfs(u, d-1, c)

for v, d, c in VDC[::-1]:
    dfs(v, d, c)

print("\n".join(map(str, Ans[1:])))


Measured memory_bytes: 53612
#include<stdio.h>
int main(void){
int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(0<=x-r&&0<=y-r&&W>=x+r&&H>=y+r){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
		
}

Measured memory_bytes: 2656
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    a,b,c,k = I2()
    l = k-a-b
    #print(l)
    if k <= a:print(k)
    elif a+b >= k:print(a)
    elif l <= c:print(a-l)

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v)                                                            \
  do {                                                                         \
    x = max(x, v);                                                             \
  } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll x, y;
  cin >> x >> y;
  string s, t;
  rep(i, y) { s += (char)(x + '0'); }
  rep(i, x) { t += (char)(y + '0'); }
  cout << min(s, t) << endl;
  return 0;
}


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

int main(){
	int n, x, i, j, k, s;
	
	while(1){
		cin >> n >> x;
		
		if(n == 0 && x == 0){
			break;
		}
		
		s = 0;
		
		for(i = 1; i <= n - 2; i++){
			for(j = i + 1; j <= n - 1; j++){
				for(k = j + 1; k <= n; k++){
					if(i + j + k == x){
						s++;
					}
				}
			}
		}
		cout << s <<endl;
	}
    return 0;
}

Measured memory_bytes: 3076
def orderN(N,L,ices):
    upPeak = L - ices[0]
    downPeak = L - ices[0]
    peaks = []
    for i in xrange(len(ices)):
        if i < N-1:
            if ices[i] < ices[i+1]:
                peaks.append(downPeak)
                downPeak = L - ices[i+1]
                upPeak += L - ices[i+1]
            else:
                peaks.append(upPeak)
                upPeak = L - ices[i+1]
                downPeak += L - ices[i+1]
        else:
            peaks.append(upPeak)
            peaks.append(downPeak)
    print(max(peaks))

N,L = map(int,raw_input().strip().split())
ices = [int(raw_input().strip()) for _ in xrange(N)]

orderN(N,L,ices)

Measured memory_bytes: 12532
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#define mod 1000000007
typedef long long ll;
using namespace std;
const int MAX = 100050;
int main(){
  int N,K; cin >> N >> K;
  int x[MAX];
  for(int i=0;i<N;i++) cin >> x[i];
  // 連続したK個のCandleを消すのが最適.
  int ans = 1000000000;
  for(int i=0;i<N;i++){
    if(i+K-1 > N-1) break;
    int d = min((abs(x[i])+abs(x[i+K-1]-x[i])),(abs(x[i+K-1])+abs(x[i]-x[i+K-1])));
    ans = min(ans,d);
  }
  cout << ans << endl;
  return 0;
}
    

Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
	int m[10];
	int i, j;
	int t;
	
	for (i = 0; i < 10; i++){
		scanf("%d", &m[i]);
	}
	
	for (i = 0; i < 10 - i;  i++){
		for (j = 10 - 1; j > i; j--){
			if (m[j] > m[j - 1]){
				t = m[j];
				m[j] = m[j - 1];
				m[j - 1] = t;
			}
		}
	}
	for (i = 0; i < 3; i++){
		printf("%d\n", m[i]);
	}
	
	return (0);
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
int MOD = 1000000007;

bool isKaibun(string s){
	string s_1 = s;
	reverse(s_1.begin(), s_1.end());
	if(s==s_1) return true;
	else return false;
}

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	
	int n = s.size();
	int n_1 = (n-1)/2;
	int n_2 = (n+3)/2;
	string s_1 = s.substr(0,n_1);
	string s_2 = s.substr(n_2-1,n_1);

	if(isKaibun(s) && isKaibun(s_1) && isKaibun(s_2)) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
//package unk;

import java.util.Scanner;

/**
 * @author sguar <shugangcao@gmail.com>
 * welcome to kuaishou
 * Created on 2020-01-10
 */
public class Main {

    public void run() {
        Scanner cin = new Scanner(System.in);
        int h = cin.nextInt();
        int w = cin.nextInt();
        int n = cin.nextInt();
        h = Math.max(h, w);
        int ans = n / h;
        if (n % h != 0) ans++;
        System.out.println(ans);
    }
    public static void main(String[] args) {
        new Main().run();
    }
}


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

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

    vector<int> a(N);
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
        if (a[i] % 2 != 0)
            odd++;
    }

    if (odd % 2 == 0)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 3148
#include<stdio.h>

int main(){
  int A,B,C,D;
  scanf("%d%d%d%d",&A,&B,&C,&D);
  if(C/B+1*bool(C%B)<=A/D+1*bool(A%D))
    printf("Yes");
  else
    printf("No");
  
  return(0);
}

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

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    int ok = 0, f = 1;
    rep(i, s.size()) {
        if(s[i]=='a'){
            if(a+b>ok){
                ok++;
                cout << "Yes" << endl;
            }
            else cout << "No" << endl;
        }
        else if(s[i]=='b'){
            if(a+b>ok && f <= b){
                f++;
                ok++;
                cout << "Yes" << endl;
            }
            else cout << "No" << endl;
        }
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 896
#include <cstdint>
#include <iostream>
#include <string>

using namespace std;

int32_t main()
{
  string a, b, c;
  cin >> a >> b >> c;

  cout << (char)(a[0] - 'a' + 'A') << (char)(b[0] - 'a' + 'A') << (char)(c[0] - 'a' + 'A') << endl;

  return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.ascii;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.random;
import std.regex;
import std.typecons;

struct Point {
    double x, y, z;
}

int N;
double[] d;
Point[] ps;

void input() {
    d = new double[3];
    scanf("%lf %lf %lf\n", &d[0], &d[1], &d[2]);
    scanf("%d\n", &N);
    bringToFront(d[$ - 2 .. $], d[0 .. $ - 2]);
    ps = new Point[N];
    foreach (i; 0 .. N) {
        double x, y, z;
        scanf("%lf %lf %lf\n", &x, &y, &z);
        ps[i] = Point(x, y, z);
    }
}

double distance(in Point a, in Point b) {
    auto dx = a.x - b.x,
         dy = a.y - b.y,
         dz = a.z - b.z;
    return sqrt(dx * dx + dy * dy + dz * dz);
}

const EPS = 1e-3;
bool EQ(double a, double b) {
    return abs(a - b) <= EPS;
}

void solve() {
    foreach (i; 0 .. N) {
        foreach (j; 0 .. N) {
            foreach (k; 0 .. N) {
                if (i == j || j == k || k == i) continue;
                double[] len;
                len ~= ps[i].distance(ps[j]);
                len ~= ps[j].distance(ps[k]);
                len ~= ps[k].distance(ps[i]);
                static if (false) {
                    writeln(d);
                    write([i, j, k]);
                    writeln(len);
                    writeln(iota(0, 3, 1).map!((x) => len[x] / d[x]));
                    writeln;
                }
                double m = len[0] / d[0];
                foreach (a; 1 .. 3) {
                    if (!EQ(m, len[a] / d[a])) {
                        goto next;
                    }
                }
                writefln("%s %s %s", i + 1, j + 1, k + 1);
                return;
next:;
            }
        }
    }
}

void main() {
    int T; scanf("%d\n", &T);
    foreach (t; 0 .. T) {
        input; solve;
    }
}

Measured memory_bytes: 2044
def main():
  n = int(input())
  dp = [0, 0, 0]
  
  for activities in [list(map(int, input().split())) for _ in range(n)]:
    new_dp = [0, 0, 0]
    
    for i in range(3):
      offset = dp[i]
      for j in range(3):
        if i == j: continue
          
        new_dp[j] = max(new_dp[j], offset + activities[j])
    
    dp = new_dp
  
  print(max(dp))

if __name__ == "__main__":
  main()

Measured memory_bytes: 30580
#include<bits/stdc++.h>
using namespace std;
int main() {
    int N, Y;
    cin >> N >> Y;
    int man = -1;
    int gosen = -1;
    int sen = -1;

    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= N; j++) {
            int k = N - i - j;
                if (i+j+k == N && 1000*k + 5000*j + 10000*i == Y && k >= 0) {
                    man = i;
                    gosen = j;
                    sen = k;
                }
        }
    }

    cout << man << " " << gosen << " " << sen << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using  namespace std;
const int N = 1e5+5;
int h[N], k, n;
int main() {
    scanf("%d %d", &n, &k);
    int sum = 0;
    for(int i = 0 ; i < n ; i++)
    {
        scanf("%d", &h[i]);
        if (h[i]>=k)
            sum++;
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2303>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

double powmod(double x, ll n) {
    double res = 1;
    while (n > 0) {
        if (n & 1) { //奇数なら
            res =(res*x);
        }
        x = (x*x);
        n >>= 1;
    }
    return res;
}
void solve(){
    int N,M,L; cin >> N >> M >> L;
    vector<double> P(N),T(N),V(N);
    for(int i = 0; i < N;i++){
        cin >> P[i] >> T[i] >> V[i];
        P[i]/=100.;
    }
    const int MAX_M = 50;
    double comb[MAX_M+1][MAX_M+1];
    for (int i = 0; i <= MAX_M; i++) {
        for (int j = 0; j <= i; j++) {
            if (j == 0 || j == i)
                comb[i][j] = 1;
            else
                comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
        }
    }
    
    cout << fixed << setprecision(12);
    for(int i = 0; i < N;i++){
        if(V[i] == 0){ cout << 0. << endl; continue;}
        double ans = 0;
        for(int j = 0; j <= M;j++){
            double tans = powmod(P[i],j)*powmod(1-P[i],M-j)*comb[M][j];
            double Time = T[i]*j + L/V[i];
            for(int k = 0; k < N;k++){
                if(i == k) continue;
                double sum = 0;
                for(int l = 0; l <= M; l++){
                    double TTime = T[k]*l + L/V[k];
                    if(TTime < Time + 1e-9) continue;
                    sum += powmod(P[k],l)*powmod(1-P[k],M-l)*comb[M][l];
                }
                tans *= sum;
            }
            ans += tans;
        }
        cout << ans << endl;
    }
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve();
    return 0;
}



Measured memory_bytes: 3300
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int people , item;
	scanf("%d%d",&people,&item);
	int items[item+1] = {};
	for(int i = 0 ; i < people ; i++){
		int foods;
		scanf("%d",&foods);
		while(foods--){
			int x;
			scanf("%d",&x);
			items[x] ++;
		}
	}
	int cnt = 0;
	for(int i = 1; i <= item ; i++)
		if(items[i]==people)
			cnt++;
	
	printf("%d\n",cnt);
	
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
    string s;
    cin >> s;

    int ma = 0;
    for(int i=0; i<s.size(); i++){
        int count=0;
        if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
            count++;
            ma = max(ma,count);
            for(int j=i+1; j<s.size(); j++){
                if(s[j]=='A'||s[j]=='C'||s[j]=='G'||s[j]=='T'){
                    count++;
                    ma = max(ma,count);
                }
                else{
                    break;
                }
            }
        }
    }
    cout << ma << 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[] abcde = new int[5];
        for (int i = 0; i < 5; i++) {
            abcde[i] = sc.nextInt();
        }
        int minIdx = 0;
        int min = 9;
        for (int i = 0; i < 5; i++) {
            String target = String.valueOf(abcde[i]);
            int t = Integer.parseInt(target.substring(target.length() - 1));
            if (t != 0 && t < min) {
                minIdx = i;
                min = t;
            }
        }
        int tmp = abcde[minIdx];
        abcde[minIdx] = abcde[4];
        abcde[4] = tmp;
        int sum = 0;
        for (int i = 0; i < abcde.length; i++) {
            int target = abcde[i];
            if (i == 4) {
                sum += target;
                continue;
            }
            if (target % 10 == 0) {
                sum += (target / 10) * 10;
                continue;
            }
            sum += (target / 10 + 1) * 10;
        }
        System.out.println(sum);
    }

}


Measured memory_bytes: 23124
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let n: usize = s.trim().parse().unwrap();

    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();

    let ws = s.trim().chars();
    let mut v: Vec<char> = Vec::new();

    let mut cnt=1;

    for i in ws {
        v.push(i);
    }
    
    for i in 1..n {
        if v[i-1]!=v[i] {
            cnt += 1;
        }
    }

    println!("{}",cnt);
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <vector>
#include <array>
#include <string>
#include <iostream>

using std::string;


int main(){

    string str, pattern;

    getline(std::cin, str);
    getline(std::cin, pattern);

    string dummyRinged = str;
    while(dummyRinged.size() < str.size() + pattern.size() -1) {
        dummyRinged += str;
    }
    if (dummyRinged.find(pattern) == string::npos) {
        printf("No\n");
    } else {
        printf("Yes\n");
    }


}


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

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

    if (n % 10 == 9 || n / 10 == 9) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    int n;
    string s;
    cin>>n>>s;
    for(int i=0;i<s.length();++i){
        s[i]+=n;
        if(s[i]>'Z')s[i]=s[i]-26;
    }
    cout<<s<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
struct Node {
    int now, cost, light;
};
bool operator<(const Node &lhs, const Node &rhs) {
    return lhs.cost < rhs.cost;
}
int dist(int x, int y, int x2, int y2) {
    return abs(x - x2) + abs(y - y2);
}
int main () {
    int w, h, n;
    cin >> w >> h >> n;
    vector<pair<int, int>> xy(n);
    for(int i = 0; i < n; i++) cin >> xy[i].first >> xy[i].second;
    multiset<Node> q;
    q.insert(Node{0, 0, 0});
    bool c[110][1000] = {false};
    while(q.size() > 0) {
        Node now = *q.begin();
        q.erase(q.begin());
        if (c[now.now][now.light]) {
            continue;
        }
        c[now.now][now.light] = true;
        if (now.now == n + 1) {
            cout << now.cost << endl;
            return 0;
        }
        if (now.now == 0) {
            for(int i = 0; i < n; i++) {
                int cost = dist(1, 1, xy[i].first, xy[i].second);
                q.insert(Node{i + 1, cost, cost});
            }
        } else {
            for(int i = 0; i < n; i++) {
                int cost = dist(xy[now.now - 1].first, xy[now.now - 1].second, xy[i].first, xy[i].second) - 1 - now.light;
                if (c[i + 1][max(0, cost)]) continue;
                q.insert(Node{i + 1, now.cost + max(0, cost), max(0, cost)});
            }
            int cost = dist(xy[now.now - 1].first, xy[now.now - 1].second, w, h);
            q.insert(Node{n + 1, now.cost + max(0, cost - now.light), -1});
        }
    }
    return 0;
}


Measured memory_bytes: 89868
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef complex<double> comp;
const ll INF=1e9+7;
const ll inf=INF;
const ll MOD=998244353;
const int MAX=200010;

signed main(){
    ll k;cin>>k;
    string ans="";
    rep(i,k){
        ans+="ACL";
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3528
#include <stdio.h>

int main() {
    int aaa, bb, cc;
    scanf("%d %d %d", &aaa, &bb, &cc);
   int i = aaa-bb;
   int j = aaa-cc;
 
   
    if(i<0){
        i = -i;
    }
    if(j<0){
        j = -j;
    }
    
    if(i == -i){
        i *= -1;
    }
   if(j == -j){
       j *= -1;
   }
    if(i < j){
        printf("A");
    }
    else{
        printf("B");
    }

    return 0;
}

Measured memory_bytes: 1628
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <vector>
#include <unordered_set>
#include <unordered_map>

typedef long long ll;

using namespace std;

int main(void) {
  string S;
  ll K;
  cin >> S >> K;

  for (int i = 0; i < min((ll)S.size(), K); i++) {
    if (S[i] >= '2') {
      cout << S[i] << endl;
      return 0;
    }
  }
  cout << "1" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
                            
#define ll long long
#define ld long double
#define ull unsigned ll
#define ioi exit(0);
 
#define f first
#define s second
 
#define inf (int)1e9 + 7
 
#define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
 
#define mp(x,y) make_pair(x,y)
 
#define lb(x) lower_bound(x)
#define ub(x) upper_bound(x)
 
#define pb push_back
#define ppb pop_back
 
#define bitcoin __builtin_popcount
 
#define endl "\n"
 
#define in(x) insert(x)
 
#define sz(x) (int)x.size()
 
#define all(x) x.begin(),x.end()
 
#define pw2(x) (1ll<<x) //2^x
 
#define forit(it,v) for (typeof(v.begin()) it = v.begin(); it != v.end(); ++it)
 
#define sqr(x) ((x) * 1ll * (x))
 
#define UpdateRandom srand (time(NULL));
 
using namespace std;
 
const int N = (int)5e5 + 7, MOD = (int)1e9 + 7;

int main(){
		
	NFS
	
	int h1,m1,h2,m2,x;
	
	cin >> h1 >> m1 >> h2 >> m2 >> x;
	
	int have=(h2*60+m2)-(h1*60+m1);
	
	cout << have-x << endl;

	ioi
}

Measured memory_bytes: 3608