akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  int n, m; cin >> n >> m;
  vector<int> v;
  set<int> set;
  rep(i, m) {
    int a, b; cin >> a >> b;
    if (a == 1) v.push_back(b);
    else if (b == n) set.insert(a);
  }
  for (int vi : v) {
    if (set.find(vi) != set.end()) {
      outl("POSSIBLE");
      return;
    }
  }
  outl("IMPOSSIBLE");
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 5368
(let ((s (read-line))
    (ans 0))
    (if (string= (char s 1) "R")
        (if (string= (char s 0) "R")
            (if (string= (char s 2) "R")
                (setq ans 3)
                (setq ans 2)
            )
            (if (string= (char s 2) "R")
                (setq ans 2)
                (setq ans 1)
            )
        )
        (if (or (string= (char s 0) "R") (string= (char s 2) "R"))
            (setq ans 1)
        )
    )
    (princ ans)
)

Measured memory_bytes: 24504
#include <iostream>

using namespace std;

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

    int ans = 0;
    for(int i = 0; i < s.size(); i++){
        if(i%2 == 0){
            if(s[i] != '1'){
                ans++;
            }
        }
        else{
            if(s[i] != '0'){
                ans++;
            }
        }
    }

    int ans2 = 0;
    for(int i = 0; i < s.size(); i++){
        if(i%2 == 0){
            if(s[i] != '0'){
                ans2++;
            }
        }
        else{
            if(s[i] != '1'){
                ans2++;
            }
        }
    }

    int cnt = min(ans, ans2);
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define DEBUG2(x, y) cerr << #x << ": " << x << " " << #y << ": " << y << "\n"
#define DEBUG3(x, y, z) cerr << #x << ": " << x << " " << #y << ": " << y << " " << #z << ": " << z << "\n"
#define PRINTALL(V)    \
  for (auto v : (V)) { \
    cerr << v << " ";  \
  }                    \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
#define pint pair<int, int>
#define ld long double
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;
}
template <class T> using vec = std::vector<T>;
template <class T> void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vec<int> a(N);
  REP(i, N) cin >> a[i];
  int ans = 0;
  REP(i, N - 1) {
    ans += a[i] / 2;
    a[i] = a[i] % 2;
    int mina = min(a[i], a[i + 1]);
    a[i] -= mina;
    a[i + 1] -= mina;
    ans += mina;
  }
  REP(i, N) ans += a[i] / 2;

  print(ans);
}

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

using namespace std;
vector<int>v[4];
bool visit[4];
bool dfs(int a,int cnt){
	if(cnt==4)return true;
	bool flag=1;
	for(int i=0;i<v[a].size();i++){
		if(!visit[v[a][i]]){
			visit[v[a][i]]=1;
			flag=0;
			cnt++;
			return dfs(v[a][i],cnt);
		}
	}
	if(flag==1)return false;
}
int main(){
	int a1,a2,a3,b1,b2,b3;
	cin>>a1>>b1>>a2>>b2>>a3>>b3;
	a1--,b1--,a2--,b2--,a3--,b3--;
	v[a1].push_back(b1),v[b1].push_back(a1);
	v[a2].push_back(b2),v[b2].push_back(a2);
	v[a3].push_back(b3),v[b3].push_back(a3);
	for(int i=0;i<4;i++){
		if(!visit[i]){
			visit[i]=1;
			if(dfs(i,1)){
				cout<<"YES";
				return 0;
			}
		}
	}
	cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
# ABC172　C - Walking Takahashi
X,K,D=map(int,input().split())

X=abs(X)
q=X//D
if q>K:
    print(X-K*D)
else:
    if (K-q)%2==0:
        print(X-q*D)
    else:
        print(-X+(q+1)*D)

Measured memory_bytes: 9088
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;
using System.Text;

namespace ABC097C_2
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            int K = ReadInt;

            List<string> cand = new List<string>();
            for (int i = 0; i < s.Length; i++)
            {
                for (int j = 0; j + i < s.Length && j < 5; j++)
                {
                    cand.Add(s.Substring(i, j + 1));
                }
            }

            string[] ans = cand.Distinct().ToArray();
            Array.Sort(ans);

            Console.WriteLine(ans[K - 1]);
        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String ReadNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int ReadInt => int.Parse(ReadNext());
        public static long ReadLong => long.Parse(ReadNext());
        public static int[] ReadInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] ReadLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    static class Debug
    {
        static public void Draw2D(int[,] map, int mode = 1)
        {
#if DEBUG
            int W = map.GetLength(0);
            int H = map.GetLength(1);

            int[,] map2 = new int[W + 1, H + 1];
            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (i == 0 && j == 0) map2[i, j] = 0;
                    else if (i == 0) map2[i, j] = j - 1;
                    else if (j == 0) map2[i, j] = i - 1;
                    else map2[i, j] = map[i - 1, j - 1];
                }
            }

            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (mode == 0) Console.Write(map2[i, j] % 10);
                    if (mode == 1) Console.Write(map2[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
#endif
        }

        public static void Draw1D(int[] array, int mode = 0)
        {
#if DEBUG
            Console.WriteLine(string.Join(" ", array));
#endif
        }
    }
}


Measured memory_bytes: 15328
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <algorithm>
#include <vector>
#define mp make_pair
#define x first
#define y second
#define Debug(...) fprintf(stdout, __VA_ARGS__)

using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, LL> pil;

const int MAXN = 400;
const int MOD = 1e9 + 7;

template<typename T> inline T read() {
	T res = 0, flag = 1; char in = getchar();
	while(!isdigit(in)) { if(in == '-') flag = -1; in = getchar(); }
	while(isdigit(in)) { res = (res << 1) + (res << 3) + in - '0'; in = getchar(); }
	return res * flag;
}

template<typename T> inline void chkmax(T &a, T b) { if(a < b) a = b; }
template<typename T> inline void chkmin(T &a, T b) { if(a > b) a = b; }

int n, m, ans;
int f[MAXN][MAXN][MAXN];
vector<pii> p[MAXN];

inline int max(int a, int b, int c) { return max(a, max(b, c)); }

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

inline bool check(int t, int a, int b, int c) {
	int len = p[t].size();
	for(int i = 0; i < len; ++i) {
		int ban = p[t][i].x;
		int tmp = (a >= ban) + (b >= ban) + (c >= ban);
		if(tmp != p[t][i].y) return false;
	}
	return true;
}

inline void init() {
	n = read<int>(); m = read<int>();
	for(int i = 1; i <= m; ++i) {
		int l = read<int>();
		int r = read<int>();
		int b = read<int>();
		p[r].push_back(mp(l, b));
	}
}

inline void solve() {
	f[0][0][0] = 1;
	for(int i = 0; i <= n; ++i) {
		for(int j = 0; j <= n; ++j) {
			for(int k = 0; k <= n; ++k)  {
				if(!f[i][j][k]) continue;
				if((i && j && i == j) || (i && k && i == k) || (j && k && j == k)) continue;
				int t = max(i, j, k);
				if(!check(t, i, j, k)) { f[i][j][k] = 0; continue; }
//				printf("%d %d %d %d\n", i, j, k, f[i][j][k]);
				add(f[t + 1][j][k], f[i][j][k]);
				add(f[i][t + 1][k], f[i][j][k]);
				add(f[i][j][t + 1], f[i][j][k]);
				if(t == n) add(ans, f[i][j][k]);
			}
		}
	}
	printf("%d\n", ans);
}

int main() {

	init();
	solve();

	return 0;
}



Measured memory_bytes: 190208
n, k, q = [int(x) for x in input().split()]
xs      = [0] * (n + 1)

for _ in range(0, q):
	xs[int(input())] += 1

for i in range(1, n + 1):
	if 0 < k - q + xs[i]:
		print("Yes")
	else:
		print("No")


Measured memory_bytes: 4680
//rectangle2.cpp
#include<iostream>
using namespace std;

int main()
{
    int h,w,flag,i,j;
    flag=0;
    while (flag==0)
    {
        cin>>h>>w;
        if (h==0 && w==0)
        {
            flag=1;
        }
        else
        {
            for ( i = 0; i < h; i++)
            {
                for ( j = 0; j < w; j++) cout<<"#";
                cout<<endl;
            }
            cout<<endl;
        }
    }
}


Measured memory_bytes: 3088
#include <stdio.h>

int main(){
    int n, d;
    int cont = 0, total = 0;
    scanf("%d", &n);

    for(int i = 1; i <= n; ++i){
        if(i%2 != 0){
            for(int j = 1; j <= i; ++j){
                if(i%j == 0)
                    ++cont;
            }
        }
        if(cont == 8)
            ++total;
        cont = 0;
    }
    printf("%d\n", total);
    return 0;
}


Measured memory_bytes: 128
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <bits/stdc++.h>
#include<algorithm>
using namespace std;

int main()
{   
    int i,len,lent,a,j,k,m=0,saisyou=10000,c=0;
    char s[10000];
    char t[10000];
    scanf("%s",s);
    scanf("%s",t);
    len=strlen(s);
    lent=strlen(t);
    a=(len-lent)+1;
    
    for(i=0;i<a;i++)
    {
        m=i;
        for(j=0;j<lent;j++)
        {
            if(s[m]!=t[j])
            {
                c++;
            }
         m++;
         
        }
        if(saisyou>c)
        saisyou=c;
        c=0;
        
    }
    cout << saisyou << endl;

    
  return 0;
}


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

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N), memo(N+1,0),c(N+1,0),S(N+2,0);
    rep(i,N){
        cin >> A[i];
        memo[A[i]]++;
    }
    ll sum=0;
    for(int i=1;i<=N;i++){
        if(memo[i] >= 2){
            c[i] = memo[i]*(memo[i]-1)/2;
            sum += c[i];// + S[i];
        }
    }
    
    rep(i,N){
        ll tmp = sum - c[A[i]];
        if(memo[A[i]] >= 2){
            tmp += (memo[A[i]]-1)*(memo[A[i]]-2)/2;
        }
        cout << tmp << endl;
    }


//    cout <<  << endl;
    
}


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

const int N = 2e5+5;
string a;
int n;
vector<int> b[26];
int dp[N][26];

void fn(int x,int y) {
    //printf("%d %d\n",x,y);
    auto it = lower_bound(b[y].begin(),b[y].end(),x);
    if(it == b[y].end()) {
        dp[x][y] = 1;
        return;
    }
    for(int i=0;i<26;i++) {
        if(dp[*it+1][i] == N) fn(*it+1,i);
        dp[x][y] = min(dp[x][y],dp[*it+1][i]+1);
    }
}

void construct(int x,string& ans) {
    int ix = 0;
    for(int i=0;i<26;i++) if(dp[x][i] < dp[x][ix]) ix = i;
    ans += 'a'+ix;
    if(dp[x][ix] == 1) return;
    else construct(*lower_bound(b[ix].begin(),b[ix].end(),x)+1,ans);
}

int main() {
    cin >> a;
    n = a.length();
    for(int i=0;i<n;i++) b[a[i]-'a'].push_back(i);
    for(int i=0;i<N;i++) for(int j=0;j<26;j++) dp[i][j] = N;
    for(int i=0;i<26;i++) fn(0,i);
    string ans;
    construct(0,ans);
    cout << ans;
    return 0;
}


Measured memory_bytes: 22020
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    string s; cin >> s;
    string t; cin >> t;
    int n = s.size();
    s += s;
    vector<vector<int>> nexts(n, vector<int>(26));
    vector<int> prevs(26, -1);
    for(int i = 2 * n - 1; i >= 0; i--){
        if(i < n){
            // printde(i, nexts, prevs);
            for(int j = 0; j < 26; j++){
                nexts[i][j] = prevs[j] == -1 ? -1 : prevs[j] % n;
            }
            // printde(i, nexts, prevs);
        }
        prevs[s[i] - 'a'] = i;
    }
    printde(nexts);
    ll ans = 0;
    int pos = n - 1;
    for(auto& c : t){
        int next = nexts[pos][c - 'a'];
        if(next == -1){
            cout << -1 << '\n';
            return 0;
        }
        int diff = (next - pos + n) % n;
        if(diff == 0){
            diff = n;
        }
        ans += diff;
        pos = next;
    }
    // cout << ans + (s[0] == t[0] ? 0 : 1) << '\n';
    cout << ans << '\n';
}


Measured memory_bytes: 13852
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int n,m,c;
    int count = 0;
    cin >> n >> m >> c;
    int b[22];
    rep(i,m) cin >> b[i];
    rep(i,n){
        int ans = 0;
        rep(j,m){
            int x;
            cin >> x;
            ans += x*b[j];
        }
        if(ans + c > 0) count++;
    }
    cout << count << endl;
}

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

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

  vector<bool> checker(n, false);

  for(int i=0; i<k; i++){
    int d;
    cin >> d;
    for(int j=0; j<d; j++){
      int a;
      cin >> a;
      if(!checker.at(a-1)){
        checker.at(a-1) = true;
      }
    } 
  }

  int count=0;
  for(int i=0; i<n; i++){
    if(!checker.at(i)) count++;
  }

  cout << count;

}


Measured memory_bytes: 3624
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define MOD7 1000000007
#define LL_INF 1LL << 60
#define LL_MINF -1LL << 60
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const long double PI = (acos(-1));



int main(){
    vector<pair<int,int>> HW;
    while(true){
        int H, W;
        cin >> H >> W;
        if(H == 0 and W == 0) break;
        HW.emplace_back(H, W);
    }
    for(auto p : HW){
        int H = p.fi, W = p.se;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++) cout << '#';
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3080
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main()
{
    ll i,j,cc=0,mn=-1;
    string str;cin>>str;
    for(i=0;i<str.size();i++){
        if(str[i]=='A' || str[i]=='C' || str[i]=='G' || str[i]== 'T')cc++;
        else {
            mn=max(mn,cc);
            cc=0;
        }
    }
    mn=max(mn,cc);
    cout<<mn<<endl;
return 0;
}


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

namespace AtTest.ARC_C
{
    class _077
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int[] nm = ReadInts();
            int n = nm[0];
            int m = nm[1];
            int[] array = ReadInts();
            long res = long.MaxValue;
            long now = 0;
            int[] ups = new int[m];
            List<int>[] downs = new List<int>[m];
            for(int i = 0; i < m; i++)
            {
                downs[i] = new List<int>();
            }
            int cnt = 0;
            for(int i = 0; i < n-1; i++)
            {
                now += Min((m + array[i + 1] - array[i]) % m, array[i + 1] % m + 1);
                ups[(array[i] + 1) % m]++;
                downs[array[i + 1] % m].Add(i);

                if ((array[i + 1] + 1) % m < (array[i] + 1) % m)
                {
                    cnt++;
                }
            }
            res = now;

            for (int i = 1; i < m; i++)
            {
                for (int j = 0; j < downs[i - 1].Count; j++)
                {
                    int index = downs[i - 1][j];
                    now += (m + array[index + 1] - array[index]) % m - 1;
                    cnt--;
                }

                now -= cnt;
                res = Min(res, now);

                cnt += ups[i];
            }

            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

using namespace std;

int main()
{
    string s;
    int sMiddleSize;
    cin >> s;
    vector<char> v;

    for (int i = 0; i < s.length(); i++)
    {
        v.push_back(s[i]);
    }
    sMiddleSize = v.size() - 2;

    cout << v[0] << to_string(sMiddleSize) << v[v.size()-1];
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int D = Integer.parseInt(sc.next());

		if(D==25) {
			System.out.println("Christmas");
		}
		if(D==24) {
			System.out.println("Christmas Eve");
		}
		if(D==23) {
			System.out.println("Christmas Eve Eve");
		}
		if(D==22) {
			System.out.println("Christmas Eve Eve Eve");
		}


	}

}

Measured memory_bytes: 20948
/*                        
                            In the name of Almighty ALLAH
                                    ISLAM IS PEACE

   code from :::::::::::::::::::::
   ******************************* R E S H A D ********************************
   
   
   
    FREE PALESTINE           FREE PALESTINE            FREE PALESTINE           FREE PALESTINE
   
                 FREE PALESTINE           FREE PALESTINE            FREE PALESTINE 
                 
    FREE PALESTINE           FREE PALESTINE            FREE PALESTINE           FREE PALESTINE
   
                 FREE PALESTINE           FREE PALESTINE            FREE PALESTINE
                 
    FREE PALESTINE           FREE PALESTINE            FREE PALESTINE           FREE PALESTINE
   
 
*/
// 90 degree = acos(x)*180/acos(0.0)
/*
bool isPrime(ll n){
    ll sqrtN = (double)sqrt(n);
    for(ll i=3; i<=sqrtN; i+=2){
        if(n%i==0) return false;
    }
    return true;
}
*/

#include <bits/stdc++.h>

#define ll               long long int
#define db               double
#define Pi               2*acos(0.0)
#define pb(a)            push_back(a)
#define VI               vector <int>
#define FASTIO           ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ull              unsigned long long
#define all(v)           v.begin(),v.end()
#define loop(i,n)        for(int i=0;i<n;i++)
#define loop1(i,n)       for(int i=1;i<=n;i++)
#define TEST_CASE(t)     for(int z=1;z<=t;z++)

using namespace std;

int main() {
    
    FASTIO;
    
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll m1 = a*c, m2 = a*d, m3 = b*c, m4 = b*d;
    ll arr[4];
    arr[0]=m1; arr[1]=m2; arr[2]=m3; arr[3]=m4;
    sort(arr, arr+4);
    cout << arr[3] << endl;
    
    
	return 0;
}

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


using namespace std;

int main()
{
	long long a, b, x, ans = 0;
	cin >> a >> b >> x;
	
	if (a != 0)
	{
		a -= 1;
		ans = (b / x) - (a / x);
	}
	else
	{
		ans = (b / x) - (a / x);
		ans += 1;
	}
	
	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
const long long MAXN = 5e7+5;
long long a[5][5];
long long dp[MAXN];
long long m,ans;
int main() {
    long long n;
    cin>>n;
    for(long long i=0;i<2;i++){
        for(long long j=1;j<=3;j++){
            cin>>a[i][j];
        }
    }
    for(long long i=0;i<=n;i++){
        dp[i] = n;
    }
    m=n;
    for(long long i=1;i<=n;i++){
        for(long long j=1;j<=3;j++){
            if(a[1][j]>a[0][j] && i-a[0][j]>=0){
                dp[i] = max(dp[i],dp[i-a[0][j]]+a[1][j]-a[0][j]);
                
            }
            m=max(m,dp[i]);
        }
        
    }
    for(long long i=0;i<=m;i++){
        dp[i] = m;
    }
    
    for(long long i=1;i<=m;i++){
        for(long long j=1;j<=3;j++){
            if(a[0][j]>a[1][j] && i-a[1][j]>=0){
                dp[i] = max(dp[i],dp[i-a[1][j]]+a[0][j]-a[1][j]);
            }
            ans = max(ans,dp[i]);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 196864
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    if ( s=="ABC" ) {
        cout << "ARC" << '\n';
    }
    else {
        cout << "ABC" << '\n';
    }

    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define ll long long
using namespace std;
signed main(){
  ll  n,t,a[1000000],sum=0;
  cin>>n>>t;
  for(int i=1;i<=n;i++){
  cin>>a[i];
  }
  for(int i=1;i<=n;i++){
    if(a[i]-a[i-1]>t){
      sum += t;
    }else{
      sum += a[i]-a[i-1];
    }
  }
  cout<<sum+t<<"\n";
  return(0);
}


Measured memory_bytes: 3840
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int w = sc.nextInt();
		int[] ws = new int[n + 1];
		long[] vs = new long[n + 1];
		for (int i = 1; i < n + 1; i++) {
			ws[i] = sc.nextInt();
			vs[i] = sc.nextLong();
		}

		long[][] dp = new long[n + 1][w + 1];
		for (int i = 1; i < n + 1; i++) {
			for (int j = 0; j < w + 1; j++) {
				if (ws[i] > j) {
					dp[i][j] = dp[i - 1][j];
				} else {
					dp[i][j] = Math.max(dp[i - 1][j], dp[i - 1][j - ws[i]] + vs[i]);
				}
			}
		}

		//for (int i = 0; i < n + 1; i++) {
		//	for (int j = 0; j < w + 1; j++) {
		//		System.out.print(dp[i][j]);
		//		System.out.print(" ");
		//	}
		//	System.out.println();
		//}

		System.out.println(dp[n][w]);
	}
}


Measured memory_bytes: 127952
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"
 
using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;
 
const int MOD = 1e9 + 7;
const int INF = 1001001001;
 
int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
    int x, y, z;
    cin >> x >> y >> z;
 
    x -= z;
    x /= y+z;
    cout << x << endl;
 
    return 0;
}

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

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

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

int num;
int cnt;
int w, h;
bool choco[MAX_SIZE][MAX_SIZE];
bool used[MAX_SIZE][MAX_SIZE];

bool out(int x, int y) {
	return x < 0 || y < 0 || x >= w || y >= h;
}

bool dfs(int ax, int ay, int bx, int by, int dd, int sx) {
	if(++cnt == num / 2) return true;

	used[ay][ax] = true;
	used[by][bx] = true;

	rep(ad, 4) {
		const int nax = ax + dx[ad];
		const int nay = ay + dy[ad];

		const int bd = (ad + dd) % 4;
		const int nbx = bx + sx * dx[bd];
		const int nby = by + dy[bd];

		if(out(nax, nay) || out(nbx, nby)) continue;
		if(nax == nbx && nay == nby) continue;
		if(!choco[nay][nax] || !choco[nby][nbx]) continue;
		if(used[nay][nax] || used[nby][nbx]) continue;

		if(dfs(nax, nay, nbx, nby, dd, sx)) return true;
	}

	return false;
}

bool solve() {
	if(num & 1) return false;

	rep(ay, h) {
		rep(ax, w) {
			if(!choco[ay][ax]) continue;

			rep(by, h) {
				rep(bx, w) {
					if(!choco[by][bx] || (ax == bx && ay == by)) continue;

					rep(dd, 4) {
						for(const int &sx : {-1, 1}) {
							cnt = 0;
							memset(used, false, sizeof(used));
							if(dfs(ax, ay, bx, by, dd, sx)) return true;
						}
					}

				}
			}
			
		}
	}

	return false;
}

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

	while(cin >> w >> h && w) {
		num = 0;
		rep(i, h) {
			rep(j, w) {
				cin >> choco[i][j];
				if(choco[i][j]) ++num;
			}
		}

		cout << (solve() ? "YES" : "NO") << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1188
#include<stdio.h>

int main(void){
    int n,x,i,ans;
    int l[100],d[100];
    scanf("%d%d",&n,&x);
    for(i=1;i<=n;i++){
        scanf("%d",&l[i]);
    }
    d[1] = 0;
    for(i=1;i<=n;i++){
        d[i+1] = d[i]+l[i];
        if(d[i]<=x){
            ans = i;
        }
    }
    if(d[n+1]<=x){
            ans = i;
    }
    printf("%d\n",ans);


    return 0;
}

Measured memory_bytes: 128
using System;
using System.Linq;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            var inlist = input.Split(' ');
            if (inlist[0] == inlist[1] && inlist[1] == inlist[2])
            {
                Console.WriteLine("No");
            }
            else if (inlist[0] != inlist[1] && inlist[1] != inlist[2] && inlist[2] != inlist[0])
            {
                Console.WriteLine("No");
            }
            else 
            {
                Console.WriteLine("Yes");
            }
        }
    }
}

Measured memory_bytes: 13140
#include<iostream>
#include<string.h>
using namespace std;
int main(){
  int n,m;
  string f,s;
  cin >> n;
  getline(cin, f);
  while(n--){
    getline(cin, s);
    while(1){
      m = s.find("Hoshino");
      if(m==-1) break;
      s = s.substr(0,m)+"Hoshina"+s.substr(m+7);
    }
    cout << s << endl;
  }
  return 0;
}



Measured memory_bytes: 3148
#include <list>
#include <cstdio>

int main()
{
	int n, v;

	char c[12];

	std::list<int> l;

	scanf("%d", &n);

	for (int i = 0; i < n; i++)
	{
		scanf("%s", c);

		if (c[0] == 'i')
		{
			scanf("%d", &v);

			l.push_front(v);
		}
		else if (c[6] == 'F')
		{
			l.pop_front();
		}
		else if (c[6] == 'L')
		{
			l.pop_back();
		}
		else
		{
			scanf("%d", &v);

			std::list<int>::iterator it = l.begin();

			std::list<int>::iterator end_it = l.end();

			while (it != end_it)
			{
				if (*it == v)
				{
					l.erase(it); break;
				}

				it++;
			}
		}
	}

	std::list<int>::iterator it = l.begin();

	while (it != l.end())
	{
		if (it == l.begin())
		{
			printf("%d", *it);
		}
		else
		{
			printf(" %d", *it);
		}

		it++;
	}

	printf("\n");

	return 0;
}

Measured memory_bytes: 34036
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
//#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (10);   小数点以下１０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);

int main() {
  int a,b;
  cin >>a>>b;
  
  cout << 6-a-b << endl; 
  
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
   int N, M; cin >> N >> M;
   if(N == M) Yes;
   else No;
}
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int N;
  cin >> N;
  if (N%2==1){
    cout << "No";
    return 0;
  }

  char S1[N/2];
  char S2[N/2];
  for(int i=0; i<N/2;i++){
    cin >> S1[i];
  }

  for(int i=0; i<N/2;i++){
    cin >> S2[i];
    if(S1[i] != S2[i]){
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
}


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

// a^n mod を計算する
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
 
// a^{-1} mod を計算する
ll modinv(ll a, ll mod) {
    return modpow(a, mod - 2, mod);
}
 
const int MAX = 510000;
const ll MOD = 1000000007;
 
ll fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ll n, k;
    cin >> n >> k;
    COMinit();
    if (k >= n - 1) {
        cout << COM(2 * n - 1, n) << "\n";
    } else {
        ll ans = 0;
        for (int i = 1; i <= k; i++) {
            // H(n - i, i) = C(n - 1, i)
            ans += COM(n, i) * COM(n - 1, i);
            ans %= MOD;
        }
        ans++;
        cout << ans % MOD << "\n";
    }
    
    return 0;

}

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

int main(){
  int a,b;
  cin >> a >> b;
  if(a == 1 && b != 1){
    cout << "Alice";
  }else if(a != 1 && b == 1){
    cout << "Bob";
  }else if(a < b){
    cout << "Bob";
  }else if(a > b){
    cout << "Alice";
  }else{
    cout << "Draw";
  }
  cout << endl;

} 


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
int inf = 1e9;

int main() {

  string s;
  cin >> s;
  int n = s.size();
  int g = 0;
  int ans = 0;
  for(int i=0; i<n; i++){
    if( s[i] == 'g' ){
      if( g > 0 ){
        g--;
        ans++;
      }else{
        g++;
      }
    }else{
      if( g > 0 ){
        g--;
      }else{
        g++;
        ans--;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')

def main():
  s = input()
  t=input()
  ans = 0
  for i in range(3):
    if s[i]==t[i]:
      ans +=1
  print(ans)
  
  
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 5076
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<queue>

using namespace std;

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

typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pii;

class dii{
	public:
	int first;
	int second;
	dii(int f,int s):first(f),second(s){}
	bool operator<(const dii& d)const{
		if(d.first == first) return d.second<second;
		return d.first<first;
	}
};
int main(void){
	A:;
	
	int n,m;
	cin>>n>>m;
	if(n==0)return 0;
	
	vector<pii> edge[100];
	int st = -1;
	int stmin = 1000000000;
	rep(i,m){
		int a,b,c;
		cin>>a>>b>>c;
		edge[a].push_back(pii(b,c));
		edge[b].push_back(pii(a,c));
		
		if(c<stmin){
			stmin = c;
			st = a;
		}
	}
	
	priority_queue<dii> que;
	rep(i,edge[st].size()){
		que.push(dii(edge[st][i].second, edge[st][i].first));
	}
	
	int visit[101]={0};
	visit[st]=1;
	int ans = 0;
	while(1){
		if(que.empty())break;
		dii u = que.top();
		que.pop();
		
		if(visit[u.second]==1)continue;
		visit[u.second]=1;
		
		ans += u.first;
		
		rep(i,edge[u.second].size()){
			que.push(dii(edge[u.second][i].second, edge[u.second][i].first));
		}
	}
	
	printf("%d\n",ans);
	goto A;
}

Measured memory_bytes: 1184
import java.util.*;

class Main{
  static public void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt(),b=sc.nextInt();
    List<String>list=new ArrayList<>();
    for(int i=0;i<a;i++)
    list.add("#"+sc.next()+"#");
  
    for(int i=0;i<b+2;i++)System.out.print("#");
    System.out.println();
    for(int i=0;i<a;i++)System.out.println(list.get(i));
    for(int i=0;i<b+2;i++)System.out.print("#");
    
    sc.close();
  }
}


Measured memory_bytes: 39628
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<queue>
#include<algorithm>
#include<math.h>

using namespace std;
int main(){
	string S;
	cin>>S;
	reverse(S.begin(),S.end());
	while(S.size()!=0){
		if(S.substr(0,5)=="maerd"){
			S.erase(S.begin(),S.begin()+5);
			continue;
		}
		if(S.substr(0,7)=="remaerd"){
			S.erase(S.begin(),S.begin()+7);
			continue;
		}
		if(S.substr(0,5)=="esare"){
			S.erase(S.begin(),S.begin()+5);
			continue;
			cout<<S<<endl;
		}
		if(S.substr(0,6)=="resare"){
			S.erase(S.begin(),S.begin()+6);
			continue;
		}
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<"YES"<<endl;
}


Measured memory_bytes: 512
class Queue
  attr_accessor :head ,:tail ,:queue
  MAX = 50001

  def initialize()
    @queue = []
    @head  = 0
    @tail  = 0
  end

  def isEmpty?()
    return @head == @tail
  end

  def isFull?()
    return @head == (@tail + 1) % MAX
  end

  def enqueue(x)
    if isFull?
      puts "queue is full!"
      return -1
    end

    @queue[@tail] = x
    (@tail+1) == MAX ? @tail = 0 : @tail += 1
  end

  def dequeue()
    if isEmpty?
      puts "queue is empty!"
      return -1
    end
    x = @queue[@head]
    @queue[@head] = nil
    (@head+1) == MAX ? @head = 0 : @head += 1

    return x
  end
end

MyProcess = Struct.new(:name, :time)
n, q = gets.chop.split.map(&:to_i)
queue = Queue.new
elaps = 0

n.times do |i|
  name, time = gets.chop.split
  queue.enqueue(MyProcess.new(name, time.to_i))
end

while (queue.head != queue.tail)
  u = queue.dequeue()
  c = [q, u.time].min
  u.time -= c
  elaps += c
  if u.time > 0
    queue.enqueue(u)
  else
    puts "#{u.name} #{elaps}"
  end
end
  



Measured memory_bytes: 11672
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
using namespace std;

long long h, w;

int main(){
    //IO("input.txt", "output.txt");
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> h >> w;
    long long up = (long long)ceil((double)w / 2);
    long long down = w / 2;
    long long uup = (long long)ceil((double)h / 2);
    long long dwn = h / 2;
    if(h > 1 && w > 1) cout << up * uup + down * dwn << "\n";
    else cout << 1 << "\n";
    return 0;
}

Measured memory_bytes: 256
import os, sys, re, math

N,K = map(int,input().split(' '))

candle = list(map(int,input().split(' ')))
ret = float('inf')

for i in range(N-K+1):
    s = candle[i]
    e = candle[i+K-1]
    if e < 0:
        ret = min(-s, ret)
    elif s > 0:
        ret = min(e, ret)
    else:
        ret = min(-s*2+e, -s+e*2, ret)

print(ret)


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

int sum(int n) {
  string s = to_string(n);
  int sum = 0;
  rep(i, s.size()) {
    sum += s[i] - '0';
  }
  return sum;
}

int main() {
  int n;
  cin >> n;
  
  if (n % 10 == 0) {
    cout << 10 << endl;
  } else {
    cout << sum(n) << endl;
  }
  return 0;
}




Measured memory_bytes: 256
#include <string>
#include <iostream>
#include <vector>
int main(int argc, char const *argv[]) {
    std::vector<std::string> v(3);
    std::string a,b,c;
    std::cin >> v[0]>>v[1]>>v[2];
    if (v[0].back()==v[1].front() && v[1].back()==v[2].front()) {
        std::cout << "YES" << '\n';
    }
    else{
        std::cout << "NO" << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>

using namespace std;

typedef pair<double, double> vec2;

vec2 operator-(const vec2& lhs, const vec2& rhs) {
	vec2 r;
	r.first = lhs.first - rhs.first;
	r.second = lhs.second - rhs.second;
	return r;
}

vec2 operator*(const vec2& lhs, const double rhs) {
	vec2 r;
	r.first = lhs.first * rhs;
	r.second = lhs.second * rhs;
	return r;
}



int n;

void koch(vec2 start, vec2 end, int i) {
	if (i == n) return;

	vec2 s = { (2 * start.first + 1 * end.first) / 3, 
			   (2 * start.second + 1 * end.second) / 3};
	vec2 t = { (1 * start.first + 2 * end.first) / 3,
			   (1 * start.second + 2 * end.second) / 3};
	
	vec2 ts = t - s;
	double rad = M_PI * 60.0 / 180.0;
	vec2 u = {
		ts.first * cos(rad) - ts.second * sin(rad) + s.first,
		ts.first * sin(rad) + ts.second * cos(rad) + s.second,
	};

	koch(start, s, i + 1);

	printf("%.8f  %.8f\n", s.first, s.second);
	koch(s, u, i + 1);

	printf("%.8f  %.8f\n", u.first, u.second);
	koch(u, t, i + 1);

	printf("%.8f  %.8f\n", t.first, t.second);
	koch(t, end, i + 1);



}

int main() {
	cin >> n;

	vec2 start = { 0.0f, 0.0f };
	vec2 end = { 100.0f, 0.0f };

	printf("%.8f  %.8f\n", start.first, start.second);
	koch(start, end, 0);
	printf("%.8f  %.8f\n", end.first, end.second);


	return 0;
}


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

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    string S; cin >> S;
    if (S[2]==S[3] && S[4]==S[5]) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


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

int main()
{
  int a, b, ans = 0;
  cin >> a >> b;
  if (a >= 13)
  {
    ans = b;
  }
  else if (a >= 6)
  {
    ans = b / 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3640
# coding: utf-8
# Your code here!



for _ in range(1000):
    H, W = map(int, input().split())
    if H == 0 and W ==0:
        break
    else:
        for i in range(H):
            if i % 2 == 0:
                for j in range(W):
                    if j % 2 == 0:
                        print('#',end ="")
                    else:
                        print('.',end='')
                print('')
            else:
                for j in range(W):
                    if j % 2 == 0:
                        print('.',end ="")
                    else:
                        print('#',end='')
                print('')
    print('')
            


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

int main(){
    int N;
    cin >> N;
    int x[N],y[N];
    int i,j;
    double ans=0;
    double tmp;
    for(i=0;i<N;i++)cin >> x[i] >> y[i];
    for(i=0;i<N-1;i++){
        for(j=i+1;j<N;j++){
        tmp=sqrt((x[j]-x[i])*(x[j]-x[i])+(y[j]-y[i])*(y[j]-y[i]));
        ans+=tmp;
    }}
    cout << fixed << setprecision(16);
    cout << (double)ans*2.0/(N*1.0) << endl;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reve(a) reverse(a.begin(), a.end())
#define PI 3.14159265359
typedef long long ll;
const ll MOD = 1e9+7;

ll gcd(ll a, ll b){
  if(b==0) return a;
  return gcd(b, a%b);
}
/*ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}*/

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

//素数判定 O(√n)
bool is_prime(int64_t n){
  for(int64_t i = 2; i*i<=n; i++){
    if(n%i==0) return false;
  }
  return n!=1;
}

//約数の列挙 O(√n)
vector<int64_t> dividor(int64_t n){
  vector<int64_t> res;
  for(int64_t i=1; i*i<=n; i++){
    if(n%i==0){
      res.push_back(i);
      if(i != n/i) res.push_back(i);
    }
  }
  return res;
}

//素因数分解 O(√n)
map<int64_t, int64_t> prime_factor(int64_t n){
  map<int64_t, int64_t> res;
  for(int64_t i=2; i*i<=n; i++){
    while(n%i==0){
      res[i]++;
      n /= i;
    }
  }
  if(n != 1) res[n] = 1;
  return res;
}
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){ 
  int64_t n;
  cin >> n;
  int64_t i;
  int64_t count=0;
  for(i=1;i<n;i++){
    count +=  n/i;
    if(n%i==0) count--;
  }
  cout << count << endl;
}




Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	
	int n,k,m;
	
	while(cin>>n>>k>>m,n){
		int next,last,K;
		int st[10001][2];
		for(int i=1;i<=n;i++){
			st[i][0]=i-1;
			st[i][1]=i+1;
		}
		st[1][0]=n;
		st[n][1]=1;
		
		while(n>1){
			//cout<<"#"<<m<<endl;
			//除去の処理
			n--;
			next=st[m][1];
			last=st[m][0];
			st[last][1]=next;
			st[next][0]=last;
			m=last;
			//進める処理
			K=k;
			if(k>=n&&n!=1)K=k%n;
			for(int i=0;i<K;i++){
				m=st[m][1];
			}

		}
		cout<<m<<endl;
	}
	
	
	return 0;
}


Measured memory_bytes: 1236