akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main(){
  vector<int> a(5);
  vector<int> b(5);
  int k=10;
  int l;
  int ans;
  for(int i=0; i<5; i++){
    cin >> a[i];
    if(a[i]%10>0){
      b[i]=a[i]/10+1;
      k = min(k,a[i]%10);
    }else{
      b[i]=a[i]/10;
    }
  }
    for(int i=0; i<5; i++){
      l +=b[i];
    }
    ans = (l-1)*10+k;
    cout << ans << endl;
  }


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

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define all(x) x.begin(),x.end()

const int INF=INT_MAX;
const ld PI=3.1415926535897932384626433;
const ld E=2.71828183;
const int MOD=1e9+7;

vi bfs(vector<vi>adj,int src){
    //adjacency list, not-weighted, possibly directed ,src is 1-indexed, adj[0].size()=0!!!
    //for n vertices, adj.size()=n+1. (constructed via push_back() ).

    queue<int>q;
    q.push(src);
    vi dst(adj.size(),INF);
    dst[src]=0;
    while(!q.empty()){
        int c=q.front();
        q.pop();
        for(int nbr:adj[c]){
            if(dst[nbr]==INF){
                dst[nbr]=dst[c]+1;
                q.push(nbr);
            }
        }
    }
    return dst;
}
vi bfsParents(vector<vi>adj,int src){
    vi parents=vi(adj.size(),INF);
    parents[src]=-1;
    queue<int>q;
    q.push(src);
    vi dst(adj.size(),INF);
    dst[src]=0;
    while(!q.empty()){
        int c=q.front();
        q.pop();
        for(int nbr:adj[c]){
            if(dst[nbr]==INF){
                parents[nbr]=c;
                dst[nbr]=dst[c]+1;
                q.push(nbr);
            }
        }
    }
    return parents;
}
vi shortestPath(vector<vi>adj,int src,int dst){
    vi bfsParetns=bfsParents(adj,src);
    vi ans;
    while(src!=dst){
        if(bfsParetns[src]==INF)
            return {};
        ans.push_back(src);
        src=bfsParetns[src];
    }
    return ans;
}
int powMod(int base,int exp,int mod){
    //(base^exp) %mod
    int ans=1;
    for(int i=0; i<exp; i++)
        ans=((ans%mod)*(base%mod))%mod;
    return ans;
}
vi divisorsOf(int n){
    //vector of divisors of n (inc. 1 , excl.n)
    vi ans;
    for(int i=1; i*i<=n; i++){
        if(n%i==0)
            ans.push_back(i);
        if(i*i!=n && i!=1)
            ans.push_back(n/i);
    }
    return ans;
}
int gcd(int a,int b){
    if(a%b==0)
        return b;
    else
        return gcd(b,a%b);
}

ld log (ld a,ld b){return log(b)/log(a);}
void solve();

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
  //  cin >> t;
  //  while(t--)
        solve();
    return 0;
}

void solve(){
    int n;
    cin >> n;
    bool ok=true;
    while(n--){
        int x;
        cin >> x;
        if(x%2==0 && !(x%3==0 || x%5==0)){
            ok=false;
        }

    }

    if(ok)
        cout << "APPROVED";
    else
        cout << "DENIED";
}





Measured memory_bytes: 256
s = input()
tuki = ('01','02','03','04','05','06','07','08','09','10','11','12')
mae = s[0] + s[1]
usiro = s[2] + s[3]
if mae in tuki and usiro in tuki:
        print('AMBIGUOUS')
elif mae in tuki:
        print('MMYY')
elif usiro in tuki:
        print('YYMM')
else:print('NA')

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

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define maxN 200005
#define MOD 1000
#define oo 1000000000000000007LL
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int n, dp[maxN], p[maxN];

int main () {
    scanf("%d", &n);
    fto(i, 1, n) scanf("%d", &p[i]);

    fto(i, 1, n) {
        dp[p[i]] = dp[p[i]-1]+1;
    }

    int ans = *max_element(dp+1, dp+n+1);
    cout << n-ans;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <bits/stdc++.h>
#include <cmath>
#include <stdio.h>
#include <utility>
using namespace std;
#define ll long long

int main()
{
  int a,b,h;cin>>a>>b>>h;
  int res;
  res=((a+b)*h)/2;
  cout<<res<<endl;
return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=200111;
const int inf=1000000007;
const int MOD=1000000007;
const double PI = 3.1415926535897932384626433;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


struct UnionFind {
	vector<int> par;
	UnionFind(int n) : par(n, -1) { }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

vvl comb(int n) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
		}
	}
	return v;
}

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll __gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

int keta(ll a){
	int ke=1;
	while(a/=10)ke++;
	return ke;
}

vector<long long> enum_divisors(long long N) {
	vector<long long> res;
	for (long long i = 1; i * i <= N; ++i) {
		if (N % i == 0) {
			res.push_back(i);
			// 重複しないならば i の相方である N/i も push
			if (N/i != i) res.push_back(N/i);
		}
	}
	// 小さい順に並び替える
	sort(res.begin(), res.end());
	return res;
}

ll zyou(ll x,ll n){
	ll y=1;
	rep(i,0,n){
		y*=x;
	}
	return y;
}

int main() {
	int a,b;
	cin>>a>>b;
	bool f=false;
	if(a%3==0)f=true;
	if(b%3==0)f=true;
	if((a+b)%3==0)f=true;
	if(f)print("Possible");
	else print("Impossible");
}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }


int main(int argc, char const *argv[])
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string S;
	cin >> S;

	if (S == "Sunny")
	{
		cout << "Cloudy" << endl;
	} else if (S == "Cloudy") {
		cout << "Rainy" << endl;
	} else {
		cout << "Sunny" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn vec<T, F: FnMut(usize) -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|i| f(i)).collect()
}

fn main() {
    use std::collections::VecDeque;
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let d: usize = scan(tokens);
    let a: usize = scan(tokens);
    let mut xh: Vec<(usize, usize)> = vec(n, |_| (scan(tokens), scan(tokens)));
    xh.sort();
    let mut ans: usize = 0;
    let mut queue: VecDeque<(usize, usize)> = VecDeque::new();
    let mut sum: usize = 0;
    for (x, h) in xh {
        while queue.front().map_or(false, |&(y, _)| y < x) {
            let (_, b) = queue.pop_front().unwrap();
            sum -= b;
        }
        if h > sum {
            let c = (h - sum + a - 1) / a;
            ans += c;
            sum += c * a;
            queue.push_back((x + 2 * d, c * a));
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 16632
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll maxn=2e5+1;
void solve()
{
	ll M1,D1,M2,D2;
	cin>>M1>>D1>>M2>>D2;
	if(M1!=M2) cout<<"1"<<"\n";
	else cout<<"0\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll T=1,p=0;
	//cin>>T;
	do
	{
		solve();
		p++;
	}while(p<T);
	return 0;
}



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

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

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

  int index=1;
  int ans=0;
  for(int i=1;i<=n;i++)
  {
      int temp;
      cin>>temp;
      if(temp==index)
      {
          index++;
          ans++;
      }

  }
  if(ans==0)
    cout<<-1;
  else
  cout<<n-ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;
bool g[52][52];
bool used[52];
int dfs(int p)
{
	used[p]=true;
	int ret=1;
	for(int to=0;to<n;to++)
	{
		if(used[to])continue;
		if(!g[p][to])continue;
		ret+=dfs(to);
	}
	return ret;
} 
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		a--,b--;
		g[a][b]=g[b][a]=true;
	} 
	int ans=0;
	for(int i=0;i<n;i++)
	for(int j=0;j<i;j++)
	{
		if(g[i][j]){
			g[i][j]=g[j][i]=false;
			for(int k=0;k<n;k++)
			used[k]=false;
			if(dfs(0)!=n)
				ans++;
			g[i][j]=g[j][i]=true;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    string S;
    cin >> N >> S;
    if(N%2==1){
    	cout << "No" << endl;
    	return 0;
    }
    bool ok = true;
    REP(i, N/2){
    	if(S[i] != S[N/2+i]) ok = false;
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}

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

using namespace std;

const int N = 100100;

vector <int> adj[N];
int v[N], d[N], c[N];

int col[N];
int pass[N];
int dist[N];
int func[N][13];

void dfs(int v, int d, int c) {
	if(d == -1) return;
	if(func[v][d] == 0) {
		func[v][d] = 1;
		if(col[v] == 0) {
			col[v] = c;
		}
		dfs(v, d-1, c);
		for (int x: adj[v]) {
			dfs(x, d-1, c);
		}
	}
}

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

	for (int i = 0; i < m; ++i) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	int q;
	cin >> q;

	for (int i = 0; i < q; ++i) {
		cin >> v[i] >> d[i] >> c[i];
		v[i]--;
	}

	for (int i = q-1; i >= 0; --i) {
		dfs(v[i], d[i], c[i]);
	}
	for (int i = 0; i < n; ++i) {
		printf("%d\n", col[i]);
	}

}

Measured memory_bytes: 13944
/*
	C - Together
*/
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;

double EPS = 1e-10;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define int(x) int x; cin >> x;
#define lint(x) long long x; cin >> x;
#define vint(v,n) vector<int> v(n); REP(i,n) cin >> v[i];
#define vlint(v,n) vector<lint> v(n); REP(i,n) cin >> v[i];
#define double(x) double x; cin >> x[i];
#define vdouble(v,n) vector<double> v(n); REP(i,n) cin >> v[i];
#define string(x) string x; cin >> x;

int main()
{
	int(N);
	vint(a, N);
	int num = 1;

	if (N == 1)
	{
		cout << 1;
		return 0;
	}
	else if (N == 2)
	{
		if (abs(a[0] - a[1]) <= 1)
		{
			cout << 2 << endl;
			return 0;
		}
		else
		{
			cout << 1 << endl;
			return 0;
		}
	}
	else
	{
		sort(a.begin(), a.end());
		vector<int> b(a.back() + 1);
		for (int i = 0; i < b.size(); i++)
		{
			b[i] = 0;
		}
		vector<int> c;

		for (int i = 0; i < a.size(); ++i)
		{
			if (b[a[i]] == 0)
			{
				c.push_back(a[i]);
			}
			b[a[i]]++;
		}
		
		if (c.size() == 1)
		{
			cout << b[c[0]] << endl;
			return 0;
		}
		else if (c.size() == 2)
		{
			if (abs(c[0] - c[1]) <= 1)
			{
				cout << b[c[0]] + b[c[1]] << endl;
				return 0;
			}
			else
			{
				cout << max(b[c[0]],b[c[1]]) << endl;
				return 0;
			}
		}

		num = (b[c[0]] + b[c[1]] + b[c[2]]);
		for (int i = 2; i < c.size() - 1; ++i)
		{
			int tmp = (b[c[i - 1]] + b[c[i]] + b[c[i + 1]]);
			if (num < tmp)
			{
				num = tmp;
			}
		}
	}
	cout << num << endl;
	return 0;
}

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

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

using namespace std;

const int IINF = INT_MAX;
const int MAX = 310;
int n, p[MAX][MAX],sum[2][MAX][MAX]; // 0 : h, 1 : w

void compute() {
  rep(y,n) {
    sum[0][y][0] = p[y][0];
    REP(x,1,n) {
      sum[0][y][x] = sum[0][y][x-1] + p[y][x];
    }
  }
  rep(x,n) {
    sum[1][0][x] = p[0][x];
    REP(y,1,n) {
      sum[1][y][x] = sum[1][y-1][x] + p[y][x];
    }
  }
  int maxi = -IINF;
  rep(y1,n) REP(y2,y1+1,n) {
    int maxi2 = 0;
    int v = sum[0][y1][0] + sum[0][y2][0];
    v += sum[1][y2][0];
    if( y1-1 >= 0 ) v -= sum[1][y1-1][0];
    v -= p[y1][0];
    v -= p[y2][0];
    maxi = max(maxi,v);
    REP(x,1,n) {
      int t = sum[1][y2][x-1];
      if( y1-1 >= 0 ) t -= sum[1][y1-1][x-1];
      t -= p[y1][x-1];
      t -= p[y2][x-1];
      if( x-2 >= 0 ) t -= sum[0][y1][x-2];
      if( x-2 >= 0 ) t -= sum[0][y2][x-2];
      maxi2 = max(maxi2,t);
      
      int v = sum[0][y1][x] + sum[0][y2][x];
      v += sum[1][y2][x];
      if( y1-1 >= 0 ) v -= sum[1][y1-1][x];
      v -= p[y1][x];
      v -= p[y2][x];
      maxi = max(maxi,v+maxi2);
    }
  }

  rep(y1,n) {
    int mini = 0;
    rep(x,n) {
      maxi = max(maxi,sum[0][y1][x]-mini);
      mini = min(mini,sum[0][y1][x]);
    }
  }
  
  cout << maxi << endl;
}

int main() {
  scanf("%d",&n);
  rep(i,n) rep(j,n) scanf(" %d",&p[i][j]);
  compute();
  return 0;
}

Measured memory_bytes: 2308
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

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

    for (int i = 0; i < str.length(); i++)
    {
        if (i % 2 == 0)
        {
            if (str[i] != 'R' && str[i] != 'D' && str[i] != 'U')
            {
                cout << "No";
                return 0;
            }
        }
        else if (str[i] != 'L' && str[i] != 'U' && str[i] != 'D')
        {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

const ll mod=1000000007;
//head

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int s, w;
    cin >> s >> w;
    cout << (s > w ? "safe" : "unsafe") << endl;
    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    int h[n], dp[n];
    for (int &i:h)
    {
        cin >> i;
    }
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for (int i=2; i < n;++i)
    {
        dp[i] = min(abs(h[i] - h[i - 2]) + dp[i - 2], abs(h[i] - h[i - 1]) + dp[i - 1]);
    }
    cout << dp[n - 1];
    return 0;
}

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

int main() 
{
    int N,ans=0;
    cin >> N;

    for(int i=1;i<=N;i++) {
        string s = to_string(i);
        if(s.size()%2!=0) ans++;
    }
    cout << ans << endl;
}


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

using namespace std;
typedef long long ll;

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

    if(n/2 + n/2 == n){
        cout << n/2 -1 << endl;
    }else{
        cout << n/2 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
gets.to_i.times do
  order = gets.chomp.split('')
  msg = gets.chomp.split('')
  len = msg.length
  order.reverse.each do |c|
    case c
    when 'J'
      msg.rotate!(-1)
    when 'C'
      msg.rotate!(1)
    when 'E'
      if len.even? then msg = msg[len/2..-1] + msg[0...len/2]
      else
        msg = msg[(len+1)/2..-1] + [msg[len/2]] + msg[0...len/2]
      end
    when 'A'
      msg.reverse!
    when 'P'
      msg.map!{ |a| a.to_i.to_s != a ? a : ((a.to_i + 9) % 10).to_s }
    when 'M'
      msg.map!{ |a| a.to_i.to_s != a ? a : ((a.to_i + 1) % 10).to_s }
    end
  end
  puts msg.join
end

Measured memory_bytes: 8752
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    ll n;
    cin>>n;
    ll ans=longinf;
    REP(i,1,1000001){
        if(n%i==0){
            ans = min(ans,n/i+i);
        }
    }
    cout<<ans-2<<endl;
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int t[n];
    for (int i = 0; i < n; i++) cin >> t[i];
    int m;
    cin >> m;
    int p[m], x[m];
    for (int i = 0; i < m; i++) cin >> p[i] >> x[i];
    
    for (int i = 0; i < m; i++) {
        int ans = 0;
        for (int j = 0; j < n; j++) {
            if (j == p[i] - 1) ans += x[i];
            else ans += t[j];
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 256
N=int(input())
h,n,w=0,0,0

for h in range(1,3*N//4+1):
  for w in range(3*N//4,3500+1):
    a = N*h*w
    b = 4*h*w-N*(w+h)
    if b==0:
      continue
    if a%b==0:
      n=a//b
      if 1<=n:
        print(h,n,w);exit()

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class Program
{
    static void Main()
    {
        var MD = ReadLine().Split().Select(int.Parse).ToArray();
        var M = MD[0];
        var D = MD[1];

        var c = 0;
        for (int i = 1; i <= M; i++)
        {
            for (int j = 1; j <= D; j++)
            {
                if (j >= 10 && j % 10 >= 2 && j / 10 >= 2 && (j / 10) * (j % 10) == i)
                {
                    c++;
                }
            }
        }

        WriteLine(c);
    }
}


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

#define rep(i, s, n) for(int i = s; i < n; ++i)
#define rrep(i, n) for(int i = n - 1; i > -1; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    ll n, m, x, ans = INF;
    cin >> n >> m >> x;
    vector<vector<ll>> a(n, vector<ll>(m + 1));
    rep(i, 0, n){
        cin >> a[i][0];
        rep(j, 1, m + 1) cin >> a[i][j];
    }
    for(int bit = 1; bit < (1<<n); ++bit){
        vector<int> S;
        rep(i, 0, n){
            if(bit  & (1<<i)){
                S.push_back(i);
            }
        }
        ll cost = 0;
        vector<ll> b(m);
        rep(i, 0, S.size()){
            cost += a[S[i]][0];
            rep(j, 0, m){
                b[j] += a[S[i]][j + 1];
            }
        }
        int ok = 1;
        rep(i, 0, m){
            if(b[i] < x){
                ok = 0;
                break;
            }
        }
        if(ok == 1) ans = min(ans, cost);
    }
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 3564
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    int a[n],sum=0;
    for(int i=0;i<n;i++) {
        cin>>a[i];
        sum+=a[i];
    }
    sort(a,a+n);
    int cnt=0;
    for(int i=n-1;i>=0;i--){
        if(a[i]*4*m>=sum)cnt++;
    }
    if(cnt>=m)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

int	main()
{
	int	N, X, Y;
	cin >> N >> X >> Y;
	--X; --Y;
	vector<int>	cnt_vec(N, 0);
	int	dist;
	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) {
			dist = min(j - i, abs(j - Y) + 1 + abs(X - i));
			++cnt_vec.at(dist);
		}
	}
	for (int k = 1; k <= N - 1; ++k) {
		cout << cnt_vec.at(k) << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
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; }

using Lint=long long;

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

    int r; cin>>r;
    cout<<r*r<<endl;
    return 0;
}

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

int main(){
    double l;
    cin >> l;
    double b=0.0;
    //double a;
    double ans=0.0;
    while(b<l){
        double a=(l-b)/2.0;
        double temp=(b*(l-b)*(l-b))/4.0;
        ans=max(ans,temp);
        b+=0.0001;
    }
    printf("%lf\n",ans);

}

Measured memory_bytes: 256
import itertools

n, m = map(int,input().split())

sw = [[] for _ in range(m)]
for i in range(m):
    sw[i] = list(map(int,input().split()[1:])) #k不要
     
p = list(map(int,input().split()))

res = 0
for tpl in itertools.product([0,1],repeat=n):
    bl = True
    for i in range(m):
        s = sum([tpl[s-1] for s in sw[i]]) # 電球iを計算
        if (s-p[i])%2 != 0:
            bl = False
            break
    if bl:
        res += 1
print(res)

Measured memory_bytes: 40944
// by ξ
// program sky  :)

#include <vector>
#include <bitset>
#include <complex>
#include <stdio.h>
#include <cassert>
#include <algorithm>

#define Rin register int
#define oo (c=getchar())
#define For(i,l,r) for(int _r=r,i=l;i<=_r;++i)
#define rep(i,l,r) for(int _r=r,i=l;i<_r;++i)
#define dto(i,r,l) for(int _l=l,i=r;i>=_l;--i)
#define ALL(V) V.begin(),V.end()
#define SZ(A) (int(A.size()))
#define pb push_back
#define mk make_pair
#define x first
#define y second

using namespace std;

typedef double db;
typedef long long LL;
typedef pair<int ,int> PII;
typedef complex<db> cpx;
typedef vector<int> VI;
typedef vector<PII> VII;

inline int IN(){
	char c;Rin x=0;
	for(;oo<48 && c^'-' || c>57;);bool f=c=='-';if(f)oo;
	for(;c>47 && c<58;oo)x=(x<<3)+(x<<1)+c-48;if(f)x=-x;return x;
}

inline void hello(){
	freopen("ha.in","r",stdin);
//	freopen("ha.out","w",stdout);
}

const int mo=1e9+7;

int ans,n,r,pw[333*333],dp[333][333];

typedef bitset<333> vec;
vec base[333];

inline void inc(int &x,int y){
	if((x+=y)>=mo)x-=mo;
}

inline int Pow(int x,int y){
	int z=1;
	for(;y;y>>=1,x=1ll*x*x%mo)if(y&1)z=1ll*z*x%mo;
	return z;
}

int main(){
// say hello
	//hello();
	n=IN();
	rep(i,0,n){
		vec v(0);
		rep(j,0,n)v[j]=IN();
		dto(k,n-1,0)if(v[k]){
			if(base[k][k])v^=base[k];else{
				base[k]=v;++r;
				break;
			}
		}
	}
	*pw=1;
	For(i,1,n*n)pw[i]=pw[i-1]*2%mo;
	**dp=1;
	rep(i,0,n)For(j,0,i)if(dp[i][j]){
		inc(dp[i+1][j],pw[j]*1ll*dp[i][j]%mo);
		inc(dp[i+1][j+1],(pw[n]-pw[j]+mo)*1ll*dp[i][j]%mo);
	}
	For(i,r,n){
		inc(ans,1ll*dp[n][i]*pw[n*(n-i)]%mo*dp[i][r]%mo);
	}
	printf("%d\n",1ll*ans*Pow(dp[n][r],mo-2)%mo);
// never say goodbye
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

int n;
int a[100];

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

Measured memory_bytes: 256
s = gets.chomp
t = gets.chomp
s_hash = Hash.new(-1)
s_arr = Array.new{Array.new}
s_i = 0
t_hash = Hash.new(-1)
t_arr = Array.new{Array.new}
t_i = 0
len = s.length
len.times do |i|
  if s_hash[s[i]] == -1
    s_hash[s[i]] = s_i
    s_arr[s_i] = []
    s_arr[s_i].push(i)
    s_i += 1
  else
    s_arr[s_hash[s[i]]].push(i)
  end
  if t_hash[t[i]] == -1
    t_hash[t[i]] = t_i
    t_arr[t_i] = []
    t_arr[t_i].push(i)
    t_i += 1
  else
    t_arr[t_hash[t[i]]].push(i)
  end
end
if s_arr == t_arr
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 19660
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_G&lang=jp
?????°??¶????????????????????¶????????????
????????? vi ????????? wi ??§??????????????? N ?¨???????????????¨???????????? W ??????????????¶????????????????????????

?¬?????????¶?????????????????????????????????????????§???????????¶???????????\????????????

???????????????????????????????¨??????§???????????????????????????
???????????????????????????????????? W ????¶?????????????
i ?????????????????? mi ????????§?????¶?????¨?????§?????????
?????????????¨?????????§???????±??????????????????????

??¶?´?
1 ??? N ??? 100
1 ??? vi ??? 1,000
1 ??? wi ??? 1,000
1 ??? mi ??? 10,000
1 ??? W ??? 10,000
*/

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N, W; cin >> N >> W;
	vector<ll> v(N), w(N), m(N);
	for (int i = 0; i < N;i++) cin >> v[i] >> w[i] >> m[i];

	vector<ll> dp(W + 1, 0);
	for (int i = 0; i < N;i++) {
		ll num = m[i];
		for (int k = 1; num > 0; k <<= 1) {
			ll mul = min((ll)k, num);
			for (int j = W; j >= w[i] * mul;j--) {
				dp[j] = max(dp[j], dp[j - w[i] * mul] + v[i] * mul);
			}
			num -= mul;
		}
	}
	cout << dp[W] << endl;
	return 0;
}

Measured memory_bytes: 3272
#include<stdio.h>
#define MAX 1000

//A[]にある数を　前からn番目から昇順に整列させ、A[]に再入力
//配列、n/ 埋め込む
void insertionSort(int *A,int  n){
  int i,j;
  int key;

  for(i=1;i<=n-1;i++){
    key=A[i];
       
    for(j=i-1;j>=0&&A[j]>key;j--){
      A[j+1]=A[j];
    }
    A[j+1]=key;
     
    for(j=0;j<n;j++){//経過を見るため
      if(j)  printf(" ");
      printf("%d",A[j]);
    }
    printf("\n");
  }
}


int main(){
  int i,j,n;
  int A[MAX];//need
  
  scanf("%d",&n);//input
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  
  for(i=0;i<n;i++){//output
    if(i)printf(" ");
    printf("%d",A[i]);
  }

  printf("\n");
  insertionSort(A, n);
   
  return 0;
}

/*
3
3 2 1
を昇順に並べる
経過も出力
 */



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

int main()
{
	std::string str;
	std::cin >> str;
	int cnt = 0;
	int tmp_cnt = 0;
	for (int i=0; i<str.length(); i++) {
		if (str[i] == 'R') {
			tmp_cnt++;
			cnt = std::max(cnt, tmp_cnt);
		}
		else tmp_cnt = 0;
	}
	std::cout << cnt << std::endl;
	return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <set>
using namespace std;

int main(){
    int r; cin >> r;
    string ans;
    if ( r >= 2800) ans = "AGC";
    else if ( r >= 1200 ) ans = "ARC";
    else ans = "ABC";

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
typedef long double ld;
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 a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
vector<ll> divisor(ll n){
  vector<ll> res;
  for(ll i=1; i*i<=n ; i++){
    while(n%i==0){
      ++res[i];
      n /= i;
    }
  }
  if(n!=1) res[n]=1;
  return res;
}
int main(){
  int N;  cin>>N;
  int cnt=0;
  for(int n=1 ; n<=N ; n++){
    int temp=0;
  for(int i=1 ; i<=n ; i++){
    if(i*i>n) break;;
    for(int j=i ; i+j<=n ; j++){
      if(i*i+j*j+i*j>n) break;
      for(int k=j ; i+j+k<=n ; k++){
        if(i*i+j*j+k*k+i*j+j*k+k*i>n) break;
        if(i*i+j*j+k*k+i*j+j*k+k*i==n){
        if(i!=j && j!=k) temp += 6;
        else if(i==j && j==k) temp++;
        else{
          temp += 3;
        }
      }
      }
      }
    }
    cout<<temp<<endl;
  }

  return 0;
}


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

void solve() {
    int n;
    string s;
    cin >> n >> s;

    int cnt = 0;
    rep(i, 1000) {
        int c[3] = {i / 100, (i / 10) % 10, i % 10};
        int f = 0;
        rep(j, n) {
            if (s[j] == ('0' + c[f])) {
                f++;
            }
            if (f == 3) {
                cnt++;
                break;
            }
        }
    }

    cout << cnt << endl;

}

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


Measured memory_bytes: 3676
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = long.Parse(spl[0]);
        var k = long.Parse(spl[1]);

        long c = 0;

        for(long b = k+1; b<=n; b++) {
            /*
             * (b-k) * n / b + max(n%b, 0)
             * (5-3) * (n / b)
             */
            var x = (b - k) * (n / b);
            if(n % b >= k) {
                x += (n % b) - Math.Max((k - 1), 0);
            }
            c += x;
            //Debug.WriteLine($"a % {b} >= {k} : {x}");
        }
        return c;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 13140
fun main(args:Array<String>){
    val n=readLine()!!.toInt()
    val s=Array(n){ readLine()!!}
    val a=s.indices.filter{s[it].last()=='A'}
    val b=s.indices.filter{s[it].first()=='B'}
    val ab=s.indices.filter{s[it].first()=='B'&&s[it].last()=='A'}
    var ans=0
    for(t in s){
        for(i in 0..t.length-2) {
            ans += if (t.slice(i..i + 1) == "AB") 1 else 0
        }
    }
    if(ab==a&&ab==b&&ab.size>0){
        println(ans+Math.min(a.size,b.size)-1)
    }
    else{
        println(ans+Math.min(a.size,b.size))
    }
}


Measured memory_bytes: 42048
# -*- coding: utf-8 -*-
# 標準入力を取得
N = int(input())

# 求解処理
ans = 0
for n in range(1, N + 1, 2):
    divisors_count = 0
    for i in range(1, n + 1):
        if n % i == 0:
            divisors_count += 1
    if divisors_count == 8:
        ans += 1

# 結果出力
print(ans)


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

using namespace std;

void find_card(string mark, int A[])
{
    for(int i = 0; i < 13; ++i)
    {
        if(A[i] == 0)
        { cout << mark << " " << i + 1<< endl; }
    }
}

int main()
{
    int N, a;
    int S[13], C[13], H[13], D[13];
    string mark;
    
    for(int i = 0; i < 13; ++i)
    { S[i] = C[i] = H[i] = D[i] = 0; }
    
    cin >> N;
    for(int i = 0; i < N; ++i)
    {
        
        cin >> mark >> a;
        --a;
        
        if(mark == "S")
        { S[a] = 1; }
        else if(mark == "C")
        { C[a] = 1; }
        else if(mark == "H")
        { H[a] = 1; }
        else if(mark == "D")
        { D[a] = 1; }
    }
   
    find_card("S", S);
    find_card("H", H);
    find_card("C", C);
    find_card("D", D);
    
    return 0;
}


Measured memory_bytes: 3152
n,m = map(int,input().split())
ka = [list(map(int,input().split())) for _ in range(n)]

L = [0] * m
for i in ka:
    for j in i[1:]:
        L[j-1] += 1

ans = 0
for i in L:
    if i == n:
        ans += 1
print(ans)

Measured memory_bytes: 3068
import math
from bisect import bisect
N=101000
prime=[1]*(N+1)
prime[0]=0
prime[1]=0
for i in range(2,int(math.sqrt(N))):
    if prime[i]==1:
        j=i
        while i*j<=N:
            prime[i*j]=0
            j+=1
prime=[i for i in range(N+1) if prime[i]==1]
while True:
    n,p=map(int,raw_input().split())
    if n==p==-1:break
    idx=bisect(prime,n)
    S=set()
    for i in prime[idx:idx+p+1]:
        for j in prime[idx:idx+p+1]:
            if i>j:
                S.add((j,i))
            else:
                S.add((i,j))
    L=[i+j for i,j in S]
    L.sort()
    print L[p-1]

Measured memory_bytes: 8484
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
 
 
vector<int> rows[10000];
 
int main(){
    int an,bn,r;
    while(cin>>an>>bn>>r,an|bn|r){
        vector<int> xs(an),ys(an);   
        for(int i=0;i<an;i++){
            cin>>xs[i]>>ys[i];
        }
        for(int i=0;i<10000;i++)rows[i].clear();
        for(int i=0;i<bn;i++){
            int x,y;
            cin>>x>>y;
            rows[y].push_back(x);
        }
        for(int i=0;i<10000;i++)sort(rows[i].begin(),rows[i].end());
        int ans=0;
        for(int i=0;i<an;i++){
            for(int y=max(0,ys[i]-4*r);y<min(10000,ys[i]+4*r+1);y++){
                int d=16*r*r-(ys[i]-y)*(ys[i]-y);
                int w=sqrt(d);
                ans+=upper_bound(rows[y].begin(),rows[y].end(),xs[i]+w)
                    -lower_bound(rows[y].begin(),rows[y].end(),xs[i]-w);
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3476
C=[list(map(int,input().split())) for _ in range(3)]

t1=list(map(lambda x: x-min(C[0]),C[0]))
t2=list(map(lambda x: x-min(C[1]),C[1]))
t3=list(map(lambda x: x-min(C[2]),C[2]))
s1=list(map(lambda x: x-min([C[0][0],C[1][0],C[2][0]]),[C[0][0],C[1][0],C[2][0]]))
s2=list(map(lambda x: x-min([C[0][1],C[1][1],C[2][1]]),[C[0][1],C[1][1],C[2][1]]))
s3=list(map(lambda x: x-min([C[0][2],C[1][2],C[2][2]]),[C[0][2],C[1][2],C[2][2]]))

arr=[]
for i,j,k in zip(t1+s1,t2+s2,t3+s3):
    arr.append(i==j==k)

print('Yes' if all(arr) else 'No')

Measured memory_bytes: 3064
fn main() {
    proconio::input! {
        d: usize,
        c: [i64; 26],
        s: [[i64; 26]; d],
        t: [usize; d],
    }

    let v = calc(d, &c, &s, &t);
    for i in 0..d {
        println!("{}", v[i]);
    }
}

fn calc(d: usize,
    c: &Vec<i64>,
    s: &Vec<Vec<i64>>,
    t: &Vec<usize>,
) -> Vec<i64> {
    let mut last_d = vec![0; 26];

    let mut prev = 0;
    let mut v = vec![0; 365];
    for di in 0..d {
        last_d[t[di] - 1] = di + 1;
        prev += s[di][t[di] - 1];
        for i in 0..26 {
            prev -= c[i] * ((di + 1 - last_d[i]) as i64);
        }
        v[di] = prev;
    }
    v
}


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

int f(int x){
	if(x%10 == 0) return x;
	else return ((x/10)+1)*10;
}

int main(){
	vector<int> a(5);
	rep(i,5) cin >> a[i];
	int min_num = 5;
	int min_minu = 10;
	rep(i,5){
		if(a[i] % 10 == 0) continue;
		if(min_minu > a[i] % 10){
			min_minu = a[i] % 10;
			min_num = i;
		}
	}
	int time = 0;
	rep(i,5){
		if(i == min_num) time += a[i];
		else time += f(a[i]);
	}
	cout << time << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919810364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

typedef unsigned long long ull;
const ull B = 1000000007;

int n;
string s;

bool contain(string a, string b) {
	int al = (int)a.size(), bl = (int)b.size();
	ull t = 1;
	for (int i = 0; i < al; i++)t *= B;
	ull ah = 0, bh = 0;
	for (int i = 0; i < al; i++) {
		ah = ah * B + a[i];
		bh = bh * B + b[i];
	}
	for (int i = 0; i + al <= bl; i++) {
		if (ah == bh)return true;
		if (i + al < bl)bh = bh * B + b[i + al] - b[i] * t;
	}
	return false;
}

signed main() {
	cin >> n >> s;
	int mi = 0, ma = n / 2 + 1;
	while (ma - mi > 1) {
		int md = (mi + ma) / 2;
		bool bl = false;
		for (int i = 0; i + 2 * md <= n; i++) {
			if (contain(s.substr(i, md), s.substr(i + md, n - i - md))) {
				bl = true;
				break;
			}
		}
		if (bl)mi = md;
		else ma = md;
	}
	cout << mi << endl;
}

Measured memory_bytes: 384
#include <cstring>
#include <string>
#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
string s,t,las;
int n,ans;
int main()
{
	cin>>s;
	n=s.size();
	las=s[0];
	for(int i=1;i<n;i++)
	{
		t.push_back(s[i]);
		if(t!=las) las=t,t.clear(),ans++;
	}
	printf("%d",ans+1);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

ll dfs(const vector<vecint>& g, vecint& a, int i, int p=-1) {
  ll csum = 0;
  ll cmax = 0;
  for(auto&& to:g[i]) {
    if (to == p) continue;
    ll child = dfs(g, a, to, i);
    if (child < 0) return -1;
    csum += child;
    cmax = max(cmax, child);
  }
  ll q = g[i].size() == 1 ? a[i] - csum : 2*a[i] - csum;
  if (q < 0) return -1;
  cmax = max(cmax, q);
  if (cmax > a[i]) return -1;
  return q;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin>>n;
  vecint a(n);
  for(auto&& e:a)cin>>e;
  vector<vecint> g(n);
  REP(i,n-1) {
    int a,b;
    cin>>a>>b;
    --a;--b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  auto res = dfs(g, a, 0);
  if (res == 0) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
  return 0;
}


Measured memory_bytes: 14080
package main

import (
  "fmt"
)

func main() {
  var n rune
  var s string 
  fmt.Scan(&n, &s)
  rs := []rune(s)
  for i := 0; i < len(s); i++ {
    rs[i] = (rs[i] - 'A' + n) % 26 + 'A'
  }
  fmt.Println(string(rs))
}

Measured memory_bytes: 768
k,n = map(int,input().split())
a = list(map(int,input().split()))
a.append(a[0]+k-a[n-1])
counter = 0

for i in range(n):
  if counter < a[i+1]-a[i]:
    counter = a[i+1]-a[i]

print(min(k-counter,a[n-1]-a[0]))

Measured memory_bytes: 77260
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7;
const ll LINF=1e18;
using namespace std;
#define int long long
//template

double e[1005][1005];
double d[10000];

//main
signed main(){
  double xs,ys,xt,yt;cin>>xs>>ys>>xt>>yt;
  int N;cin>>N;
  std::vector<double> x(N+2),y(N+2),r(N+2);
  for(int i=0;i<N;i++)cin>>x[i+1]>>y[i+1]>>r[i+1];
  x[0]=xs;y[0]=ys;x[N+1]=xt;y[N+1]=yt;r[0]=r[N+1]=0;
  for(int i=0;i<N+2;i++){
    for(int j=0;j<N+2;j++){
      e[i][j]=max(sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))-r[i]-r[j],0.0);
    }
  }
  fill(d,d+5000,LINF);
  typedef pair<double,int> P;
  priority_queue<P,vector<P>,greater<P>> que;
  d[0]=0;
  que.push(P(0,0));
  while(que.size()){
    P p=que.top();que.pop();
    int v=p.second;
    if(d[v]<p.first)continue;
    for(int i=0;i<N+2;i++){
      if(e[v][i]+d[v]<d[i]){
        d[i]=e[v][i]+d[v];
        que.push(P(d[i],i));
      }
    }
  }
  cout<<fixed<<setprecision(12)<<d[N+1]<<endl;
}


Measured memory_bytes: 14452
h, w = map(int, input().split())
# H行受け取る
ab = list(input() for _ in range(h))
# (h+2)*(w+2)、indexは0,1,...,h+1(or w+1)で、考えるのは1,2,...,h(or w)
dp = [["_" for i in range(w + 2)] for j in range(h + 2)]

for i in range(h):
    for j in range(w):
        dp[i + 1][j + 1] = ab[i][j]

for i in range(h):
    for j in range(w):
        if dp[i + 1][j + 1] == "#":
            # 四方の少なくとも一つが#ならOK
            if dp[i][j + 1] == "#" or dp[i + 2][j + 1] == "#" or dp[i + 1][j] == "#" or dp[i + 1][j + 2] == "#":
                pass
            # そうでない場合は塗ることはできない
            else:
                print("No")
                exit()

print("Yes")


Measured memory_bytes: 9152
def cur(n):
    if ans[n]!=[]: return ans[n]
    for x in cur(n-1):
        tmp1=[0]+[x[i] for i in range(n-1)]
        tmp2=[0]+[x[i]+1 for i in range(n-1)]
        ans[n].append(tmp1)
        ans[n].append(tmp2)
        if max(x)!=0:
            for k in range(1,max(x)+1):
                tmp3=[0]+[x[i] for i in range(n-1)]
                for i in range(1,n):
                    if tmp3[i]==k: tmp3[i]=0
                    elif tmp3[i]<k: tmp3[i]+=1
                ans[n].append(tmp3)
    
    return ans[n]

def pri(x):
    s=""
    for i in range(p):
        s+=chr( ord("a")+x[i] )
    print(s)

p=int(input())
ans=[[] for i in range(11)]
ans[1]=[[0]]
ans[2]=[[0,0],[0,1]]
cur(p)

ans[p].sort()
pri(ans[p][0])
for i in range(1,len(ans[p])):
    if ans[p][i]!=ans[p][i-1]: pri(ans[p][i])


Measured memory_bytes: 86108
import sys
 
stdin = sys.stdin

mod = 1000000007
inf = 1 << 60
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

n = ni()
a = na()

m = 0
ans = 0
for i in range(n):
    m = max(m, a[i])
    if a[i] >= m:
        ans += 1

print(ans)

Measured memory_bytes: 38384
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	lint a, b, c, k;
	cin >> a >> b >> c >> k;

	if (a + b >= k) {
		cout << min(k, a) << "\n";
	}
	else {
		cout << a - (k - (a + b)) << "\n";
	}

	return 0;
}

Measured memory_bytes: 3652