akhauriyash/Code-Regression huggingface dataset:
//三叉路
#include <iostream>
#include <algorithm>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int INF = 1e+8;
int n, m, s, g1, g2;
int dist[100][100];

int main() {
	while (cin >> n >> m >> s >> g1 >> g2) {
		if (!n) break;
		s--; g1--; g2--;
		
		int i, j, k;
		rep(i, n) rep(j, n) dist[i][j] = INF;
		rep(i, n) dist[i][i] = 0;
		rep(i, m) {
			int u, v, c;
			cin >> u >> v >> c;
			u--; v--;
			dist[u][v] = c;
		}
		
		rep(k, n) rep(i, n) rep(j, n) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
		int ans = INF;
		rep(k, n) {
			int cst = dist[s][k] + dist[k][g1] + dist[k][g2];
			ans = min(ans, cst);
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3128
while True:
    list = input().split()
    a = int(list[0])
    op = list[1]
    b = int(list[2])
    if op == "+":
      print("%d"%(a+b))
    elif op == "-":
      print("%d"%(a-b))
    elif op == "*":
      print("%d"%(a*b))
    elif op == "/":
      print("%d"%(a/b))
    else:
        break


Measured memory_bytes: 5596
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x)  (long long)(x).size()
#define sqr(x) (x)*(x)
#define sof sizeof
#define resz resize
#define ins insert
#define lowerB lower_bound
#define upperB upper_bound
#define mkp make_pair
#define mkt make_tuple
#define act(a,v) (get<(long long)a>(v))
#define mod 1000000007
#define mod1 998244353
#define N 200003
#define inf 1e18
#define minf -1e18
#define min3(a,b,c) min(a,min(b,c));
#define max3(a,b,c) max(a,max(b,c));
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define sumall(v) accumulate(all(v),(ll)0)
#define suma accumulate
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION(n) std::cout.unsetf ( std::ios::floatfield );std::cout.precision((ll)n)
#define PI M_PI
#define fi first
#define se second
#define here cout<<"RSSB"<<endl
#define showzero cout<<std::showpoint
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define br "\n"
#define spac " "
#define zero (ll)0
using namespace  std ;
typedef double db;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
typedef vector<tuple<ll,ll,ll> >vtll;
typedef vector<bool>vbool ;
void READ(vll &v, ll n){ll a ;for(ll i=0 ; i<n ; i=i+1){cin>>a ;v.pb(a);}}
void PRINT(vll &v , ll a = 0){for(ll i=a ; i<v.size() ; i=i+1){/*v[i] = max((ll)0,v[i]);*/cout<<v[i]<<"\n" ;}cout<<"\n" ;}
double logy(ll n , ll b){if(b==0){return(-1);}if(n==1){return(0);}return((db)log10(n)/log10(b));}
long long power(long long k , long long n , long long m=mod){long long res = 1;while(n){if(n%2!=0){res = (res*k)%m ;}k = (k*k)%m ;n = n/2 ;}return(res) ;}
double power(double p , ll t){db q = 1;while(t){if(t%2){q*=p;}p*=p;t/=2;}return(q);}
ll dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
ll dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
vpll dr;
void call(){dr.pb(mkp(1,0));dr.pb(mkp(-1,0));dr.pb(mkp(0,1));dr.pb(mkp(0,-1));}
ll n,m,k;
bool ok = false;
int main()
{
    FastIO ;
    PRECISION(20) ;
    ll a,b,c,d,i,j,t,x,y,z,x1,y1,z1,e,f;
    db p,q,r,u,w ;
    char ch,chr ;
    string str,st,str1,str2,str3,str4;
    //ll a1=0,a2=0,b1=0,b2=0,c1=0 ;
    //cin>>str>>str1;
    //call();
    //Constructive is Weak!!
    cin>>n>>m;
    set<ll>s;
    x = 1;
    y = m+1;
    a = m+2;
    b = 2*m+1;
    while(true)
    {
        cout<<x<<" "<<y<<"\n";
        m--;
        x++;
        y--;
        if(m<=0)
        {
            break;
        }
        cout<<a<<" "<<b<<"\n";
        m--;
        a++;
        b--;
        if(m<=0)
        {
            break;
        }
    }
}

Measured memory_bytes: 3684
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

using std::min;
using std::max;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

inline int nextInt()
{
    int x = 0;
    char c = getchar();
    int mi = (c == '-');
    if (c == '-') c = getchar();
    while ('0' <= c && c <= '9')
    {
        x = 10 * x + c - '0';
        c = getchar();
    }
    if (mi) return x * -1;
    return x;
}

int n;
struct Point{
    int x, y, id;
};
struct Edge{
    int v, u, w;
};
int root[500000];
int sz[500000];

int Root(int x)
{
    return x == root[x] ? x : (root[x] = Root(root[x]));
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    vector<Point> a(n);
    vector<Edge> e(2 * n - 2);
    for (int i = 0; i < n; i++) root[i] = i;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i].x >> a[i].y;
        a[i].id = i;
    }
    sort(all(a), [&](Point a, Point b){
         return a.x < b.x;
         });
    for (int i = 0; i + 1 < n; i++)
    {
        e[i] = {a[i].id, a[i + 1].id, a[i + 1].x - a[i].x};
    }
    sort(all(a), [&](Point a, Point b){
         return a.y < b.y;
         });
    for (int i = 0; i + 1 < n; i++)
    {
        e[i + n - 1] = {a[i].id, a[i + 1].id, a[i + 1].y - a[i].y};
    }
    sort(all(e), [&](Edge a, Edge b){
         return a.w < b.w;
         });
    ll ans = 0;
    for (int i = 0; i < 2 * n - 2; i++)
    {
        int a = Root(e[i].v);
        int b = Root(e[i].u);
        if (a == b)
        {
            continue;
        }
        if (sz[a] == sz[b])
            sz[a]++;
        if (sz[a] < sz[b])
        {
            root[a] = b;
        }
        else
        {
            root[b] = a;
        }
        ans += e[i].w;
    }
    cout << ans;
}


Measured memory_bytes: 4608
# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

S = input()

## Logic

S = S[::-1]

i = 0 
while i < len(S):
    if S[i:i+7]=="remaerd":
        i = i + 7
    elif S[i:i+6]=="resare":
        i = i + 6
    elif S[i:i+5]=="maerd":
        i = i + 5
    elif S[i:i+5]=="esare":
        i = i + 5
    else:
        print("NO")
        sys.exit()
print("YES")

Measured memory_bytes: 66156
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define lu unsigned long long int
#define pi pair<ll, ll>
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mk make_pair
#define ve vector
#define lr(n) for (ll i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define be begin
#define sz(a) (ll)(a.size())
#define INF 1e18
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

ll gcd(ll a, ll b){
	return b == 0 ? a : gcd(b, a % b);
}

// ll mod = 1e9+7;

// ll mult(ll x, ll y){
//     ll rem=1;
//     while(y){
//         if(y&1){
//             rem=(rem*x)%mod;
//         }
//         x=(x*x)%mod;
//         y>>=1;
//     }
//     return rem;
// }


void solve(ll T){
	ll n,a,b;
	cin>>n>>a>>b;
	if((b-a-1)%2){
		cout << "Alice\n";
	}
	else{
		cout << "Borys\n";
	}
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	// std::cout << std::unitbuf;
	ll T=1;
	// cin>>T;
	for(ll t=1;t<=T;t++){
		solve(t);
	}
	return 0;
}

Measured memory_bytes: 3648
import "dart:io";

main(){
  int a = int.parse(stdin.readLineSync());
  int b = int.parse(stdin.readLineSync());
  int c = int.parse(stdin.readLineSync());
  int x = int.parse(stdin.readLineSync());

  int ans = 0;
  for (int i = 0; i <= a; i++){
    for (int j = 0; j <= b; j++){
      /*
      if ((x - 500 * i - 100 * j) % 50 == 0 && (x - 500 * i - 100 * j) / 50 <= c){
        ans++;
      }
      */
      for (int k = 0; k <= c; k++){
        if (500 * i + 100 * j + 50 * k == x) ans++;
      }
    }
  }
  print(ans);
}


Measured memory_bytes: 13120
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String b = sc.next();
		if(b.equals("A")) {
			System.out.println("T");
		}else if(b.equals("T")){
			System.out.println("A");
		}else if(b.equals("C")) {
			System.out.println("G");
		}else {
			System.out.println("C");
		}
	}
}



Measured memory_bytes: 22740
#include <iostream> 
#include <algorithm> 
#include <cstring> 
#include <cstdio>
#include <vector> 
#include <queue> 
#include <cstdlib> 
#include <iomanip>
#include <cmath>
#include <cassert>
#include <ctime> 
#include <map> 
#include <set> 
using namespace std; 
#define lowbit(x) (x&(-x)) 
#define max(x,y) (x>y?x:y) 
#define min(x,y) (x<y?x:y) 
#define MAX 100000000000000000 
#define MOD 1000000007
#define pi acos(-1.0) 
#define ei exp(1) 
#define PI 3.141592653589793238462
#define ios() ios::sync_with_stdio(false)
#define INF 1044266558
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
int a,b,c,d;
int main()
{
    while(cin>>a>>b>>c>>d)
    {
        int ans=0;
        for(int i=0;i<=100;i++)
        {
            if((i>=a && i<=b) && (i>=c && i<=d))ans++;
        }
        printf("%d\n",ans-1>=0?ans-1:0);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  rep(i,3) {
    string s;
    R s;
    cout << s[0];
  }
  ln;
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define sort_u(x) sort((x).begin(),(x).end())
#define sort_d(x) sort((x).begin(),(x).end(), greater<int>())
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cerr<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
int getInt(){int x;scanf("%d",&x);return x;}
template<typename T>istream& operator>>(istream&i,v(T)&v){rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v){stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const v(T)&v){if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.fi<<","<<v.se;}
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
template<typename T>ll suma(const v(T)&a){ll res(0);for(auto&&x:a)res+=x;return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1e9+7;
#define dame0 { puts("0"); return 0;}
#define dame1 { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define yn2 {puts("YES");}else{puts("NO");}
#define on {puts("ok");}else{puts("ng");}
#define on2 {puts("OK");}else{puts("NG");}
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define outa {cout << ans << endl;}
#define out(x) {cout << x << endl;}
//mins(ans,now);  ansに最小値が入る
//if(max(ans,now)) ansが小さければ更新して実行
//ll sum = suma(a);

int main(){
    int n; cin>>n;
    vector<int> a(n); rep(i, n) cin >> a[i];
    // 1を見つける。右に２を見つけるetc...
    int x=1;
    rep(i,n){
        if(a[i]==x) x++;
    }
    if(x==1) dame1; 
    out(n-x+1);
}


Measured memory_bytes: 4040
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool etmin(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//https://www.creativ.xyz/dump-cpp-652/
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
 
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

#ifdef DEBUG_
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

signed main(void) { cin.tie(0); ios::sync_with_stdio(false);
    int n; cin>>n;
    vector <int> a(n);
    rep(i,n) cin>>a[i]; 
    sort(a.begin(),a.end());
    //二分探索で全部食べれる最小の値を見つける
    int l = -1, r = n;
    while(abs(l-r)>1){
        int mid = (r+l)/2;
        bool ok = true;
        int now = a[mid];
        rep(i,n){
            if(i == mid) continue;
            if(now * 2 < a[i]) ok = false;
            now += a[i];
        }
        if(ok) r = mid;
        else l = mid;
    }
    dump(a);
    
    cout<<n - r<<endl;
}

Measured memory_bytes: 1664
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
using ll = long long;

int main() {
	ll n;
	cin >> n;
	vector<ll>v;
	map<ll, ll>num;
	for (ll i = 0; i < n; i++) {
		ll a;
		cin >> a;
		num[a]++;
		if (num[a] == 2)v.push_back(a);
		if (num[a] == 4)v.push_back(a);
	}
	if (v.size() < 2) {
		cout << 0 << endl;
		return 0;
	}
	sort(v.begin(), v.end());
	ll k = v.size();
	cout << v[k - 1] * v[k - 2] << endl;
}

Measured memory_bytes: 6528
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<vector>
#include<map>
#include<queue>

#define N 300005
#define M 8000005

#define ls (t<<1)
#define rs ((t<<1)|1)
#define mid ((l+r)>>1)

#define mk make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;

int i,j,m,n,p,k,A,B;

int main()
{
		scanf("%d%d%d",&n,&A,&B);
		if ((B-A)&1) puts("Borys");
		else puts("Alice"); 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int N,M;
vector<vector<int>> G;
vector<bool> visited;

int beki(int b,int p){
  if(p == 0) return 1;
    return b*beki(b,p-1);
}

int main() {
  int X; cin >> X;
  int ans = 0;
  for(int i = 1; i <= 32; i++){
    for(int j = 2; j < 11; j++){
      if(beki(i,j) <= X) ans = max(ans,beki(i,j));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iomanip>
#include <iostream>
#include <unordered_set>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  unordered_set<string> set;
  rep(i, N) {
    string s;
    cin >> s;
    set.emplace(s);
  }
  cout << set.size() << endl;
  return 0;
}


Measured memory_bytes: 17680
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(v, n) sort(v, v+n)
#define VSORT(v) sort(v.begin(), v.end())
#define REP(i, n) for(int i = 0;i < n;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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 999999999
#define MOD 1e9+7
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int N;cin>>N;
    VI a(N);
    REP(i,N)cin>>a[i];
    int now=1;
    int ans=0;
    REP(i,N){
        if(a[i]!=now){
            ans++;
        }else{
            now++;
        }
    }
    if(now==1){
        cout << -1 <<endl;
        return 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b) {if(a<b) {a=b; return true;} return false;}
template<typename T> bool chmin(T &a,T b) {if(a>b) {a=b; return true;} return false;}
#define itn int
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sortt(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=2e9;
const ll lnf=9e18;

ll kiri(ll a,ll b){return a%b==0?a/b:a/b+1;}

int main(){
  itn n; cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  reverse(all(a));
  if(a[0]!=2){
    cout << -1 << endl;
    return 0;
  }
  ll l=2,r=3;
  rep(i,n){
    l=a[i]*kiri(l,a[i]);
    r=a[i]*(r/a[i])+a[i]-1;
    if(l>r){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << l << " " << r << endl;
}

Measured memory_bytes: 4056
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

vector<int> Prime(100, 1);  // Prime[i] : iが素数のとき1、iが素数でないとき0

void Eratosthenes(int n) {  // n未満の素数を求める

    Prime[0] = Prime[1] = 0;
    for(int i = 2; i*i < n; i++) {
        if(Prime[i]) {
            for(int j = 2; i*j < n; j++) {
                Prime[i*j] = 0;
            }
        }
    }
}

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

    Eratosthenes(100);

    vector<int> e(100);  // e[i] : n!を素因数分解したときの素因数iの指数(iが素数でないとき0)
    for(int i = 2; i <= n; i++) {
        int a = i;
        for(int j = 2; j*j <= i; j++) {
            if(Prime[j]) {
                while(a%j == 0) {
                    a /= j;
                    e[j]++;
                }
            }
        }
        if(a != 1) {
            e[a]++;
        }
    }

    // p^74パターン
    int cnt1 = 0;
    for(int p = 2; p < 100; p++) {
        if(e[p] >= 74) {
            cnt1++;
        }
    }

    // p^24*q^2パターンとp^14*q^4パターン
    int cnt2 = 0, cnt3 = 0;
    for(int p = 2; p < 100; p++) {
        for(int q = 2; q < 100; q++) {

            if(p == q) {
                continue;
            }

            if(e[p] >= 24 && e[q] >= 2) {
                cnt2++;
            }

            if(e[p] >= 14 && e[q] >= 4) {
                cnt3++;
            }
        }
    }

    // p^4*q^4*r^2パターン
    int cnt4 = 0;
    for(int p = 2; p < 100; p++) {
        for(int q = 2; q < 100; q++) {
            for(int r = 2; r < 100; r++) {

                if(p == q || q == r || r == p) {
                    continue;
                }

                if(e[p] >= 4 && e[q] >= 4 && e[r] >= 2) {
                    cnt4++;
                }
            }
        }
    }
    
    cnt4 /= 2;  // pとqを入れ替えても同じ数になるのでその分を2で割る

    int ans = cnt1 + cnt2 + cnt3 + cnt4;

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

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
   int A,B,C;
   cin >> A >> B >> C;
   
   if(A>C){
       if(B<C){
           cout << "Yes" << endl;
       }else{
           cout << "No" << endl;
       }
   }else{
       if(B>C){
           cout << "Yes" << endl;
       }else{
           cout << "No" << endl;
       }
   }
   
   return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
    int n,ans = INT_MAX;
    cin >> n;
    vector<int>a(n);
    for(int i = 0;i<n;i++)cin >> a[i];
    for (int i = 1; i < n; i++) {
        long long s1=0ll,s2=0ll;
        for(int j = 0;j<n;j++){
            if(j <= i)s1+=a[j];
            else s2+=a[j];
        }
        if(abs(s2-s1) < ans)ans = abs(s2-s1);
    }
    cout << ans;
    return 0;
}

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

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


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
  
  int n;
  cin>>n;
  
  vector<int> p(n); 
for (int i = 0; i < n; i++) {
cin >> p.at(i);
}
  
  int ans=0;
  
  for(int i = 0; i < n-2; i++){
  if(p[i]<p[i+1]&&p[i+1]<p[i+2]){
    ans++;
  }
  
  else if(p[i]>p[i+1]&&p[i+1]>p[i+2]){
    ans++;
  }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[110];
int n,pos,maxn;
int main()
{
    scanf("%d%s",&n,s+1);
    for(int i=1;i<=n;++i)
    {
        if(s[i]=='I') ++pos;
        else --pos;
        maxn=max(maxn,pos);
    }
    printf("%d\n",maxn);
    return 0;
}

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define REP(idx, N) for (u64 idx = 0; idx < N; idx++)

int main() {
  string s;
  cin >> s;
  if (s == "ABC")
    cout << "ARC";
  else
    cout << "ABC";

  return 0;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	string s;
	cin >> s;
	N = s.size();
	int ans = 0;
	int pc = 0 , gc = 0;
	//(今までにパーを出した回数)≦(今までにグーを出した回数)
	for(int i=0;i<N;i++){
		if(s[i]=='g'){
			if(gc>pc){
				pc++;
				ans++;
			}else{
				gc++;
			}
		}else{
			if(gc>pc){
				pc++;
			}else{
				gc++;
				ans--;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <random>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
#define mod 1e9 + 7;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout.setf(ios::fixed);
	cout.precision(20);

	ll a, b, c, n,ans = 0, x = 0;
	string s;
	cin >> n;
	vll v(n);
	map<long long, long long> m;
	ll ma = 1, mi = 0;
	rep(i, n) {
		cin >> v[i];
		v[i] -= (i + 1);
		m[v[i]]++;
	}
	sort(all(v));
	rep(i, n) {
		ans += abs(v[i] - v[(n-1) / 2]);
	}
	//cout << ans << " " << ans1 << endl;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 14336
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>

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

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;

#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 

using namespace std;

typedef long long ll;

const long long int INF = 1 << 30; //10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

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

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

	vector<ll> a(n);
	rep(i,n) cin >> a[i];

	ll g = a[0];
	rep(i, n) {
		g = gcd(g, a[i]);
	}
  rep(i,n) {if (a[i] / g % 2 == 0) {cout << 0 << endl; return 0;}}

	ll l = (a[0] /= 2);
	rep(i,n-1){
	  a[i+1] /= 2;
		l = l*a[i+1] / gcd(a[i+1],l);
	}

	cout << (m/l + 1) / 2 << endl;
}


Measured memory_bytes: 1024
void main() {
  import std.stdio, std.string, std.conv, std.algorithm;

  int n;
  rd(n);
  int s = 0;
  foreach (_; 0 .. n) {
    int l, r;
    rd(l, r);
    s += (r - l + 1);
  }
  writeln(s);
}

void rd(T...)(ref T x) {
  import std.stdio : readln;
  import std.string : split;
  import std.conv : to;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}


Measured memory_bytes: 380
#include <stdio.h>
#include <stdlib.h>
 
void InsertionSort(int *a, int n);
void Nprint(int *a, int n);
 
int main(void){
  int i, n, *a;
 
  scanf("%d", &n);
  a = (int *)malloc(sizeof(int) * n);
  if(a == NULL){
    printf("?????¢????¢??????¨??????\n");
    return -1;
  }
  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }
  InsertionSort(a, n);
  return 0;
}
 
 
void InsertionSort(int *a, int n){
  int i, j, temp;
 
  Nprint(a, n);
 
  for(i = 1; i < n; i++){
    for(j = i-1; j >= 0; j--){
      if(a[j] < a[j+1])  break;
      temp = a[j];
      a[j] = a[j+1];
      a[j+1] = temp;
    }
    Nprint(a, n);
  }
}
 
 
void Nprint(int *a, int n){
  int i;
 
  for(i = 0; i < n; i++){
    printf("%d", a[i]);
    if(i < n-1){
      printf(" ");
    }
  }
  printf("\n");
}


Measured memory_bytes: 2124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    string s; cin >> s;
    int a_id, z_id;

    for(int i=0; i<s.size(); i++){
        if(s[i] == 'A'){
            a_id = i; break;
        }
    }

    for(int i=0; i<s.size(); i++){
        if(s[i] == 'Z') z_id = i;
    }

    cout << z_id - a_id + 1 << endl;
}

Measured memory_bytes: 768
#include<iostream>
#include<math.h>
#include<vector>
#include<stdio.h>
const double p = M_PI;
using namespace std;
int main(){
  double K,x,y;
  int tmpgo,tmprag;
  x = 0; y =0; K = 90;
  for(int count=0;;count++){
    scanf("%d,%d",&tmpgo,&tmprag);
    if(tmpgo == 0 && tmprag == 0){
      break;
    }
    x += tmpgo * cos(K*p /180);
    y += tmpgo * sin(K*p /180);
    K = K - tmprag;
  }
  cout << (int)x << endl << (int)y << endl;

}

Measured memory_bytes: 0
#                         author:  kagemeka 
#                         created: 2019-11-09 15:46:24(JST)
### modules
## from standard library
import sys
# import collections
import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## from external libraries
# import scipy.special   
# import scipy.misc      
# import numpy as np 
def divisors(n):
    divisors = []
    for i in range(1, n + 1):
        if n % i == 0:
            divisors.append(i)
    return divisors


def main():
    n = int(sys.stdin.readline().rstrip())
    
    count = 0
    for i in range(1, n + 1, 2):
        if len(divisors(i)) == 8:
            count += 1
    
    print(count)




if __name__ == "__main__":
    # execute only if run as a script
    main()


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

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

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

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

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

ll n,m;
vpll G[100005];
bool checked[100005];
ll dist[100005];

void dfs(ll v){
  
  for(auto np: G[v]){
    ll nv=np.first, nc=np.second;
    if(checked[nv]){
      if(dist[nv]!=dist[v]+nc){
        cout<<"No"<<endl;
        exit(0);
      }
      continue;
    }
    dist[nv]=dist[v]+nc;
    checked[nv]=true;
    dfs(nv);
  }
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  cin>>n>>m;
  rep(i,m){
    ll a,b,c; cin>>a>>b>>c;
    a--,b--;
    G[a].emplace_back(b,c);
    G[b].emplace_back(a,-c);
  }
  queue<pll> q;
  rep(i,n){
    if(checked[i]) continue;
    checked[i]=true;
    q.emplace(i,0);
    dist[i]=0;
    dfs(i);
  }
  cout<<"Yes"<<endl;
  
}

Measured memory_bytes: 15616
#include <iostream>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include <algorithm>
#include<string.h>
#define ll long long
#define ull unsigned long long
using namespace std;
/* 
struct edge{
	int to, nxt;
}e[100005];
int head[100005], tot = 1, x, num[100005];
void add(int v, int u)
{
	e[tot].to = u, e[tot].nxt = head[v], head[v] = tot++;
}*/
char s[105];
int k, ans, pos[3], num, len;
signed main() 
{
	while (~scanf("%s %d", s, &k))
	{
		len = strlen(s);
		memset(pos, -1, sizeof(pos));
		num = 0;
		for (int i = 0; i < len; i++)
		{
			if (s[i] > '0')
				pos[num++] = i;
			if (num == 3)	break;
		}
		if (k > len);
		else if (k == 1)
		{
			ans = s[0] - '0';
			ans += 9 * (len - 1);
		}
		else if (k == 2)
		{
			ans = (len - 1) * (len - 2) / 2 * 81;
			ans += (s[0] - '1') * (len - 1) * 9;
			if (pos[1] != -1 && pos[1] <= len - 1)
			{
				ans += (len - 1 - pos[1]) * 9 + s[pos[1]] - '0';
			}
		}
		else if (k == 3)
		{
			ans = (len - 1) * (len - 2) * (len - 3) / 6 * 81 * 9;
			ans += (s[0] - '1') * (len - 1) * (len - 2) / 2 * 81;
			if (pos[1] != -1 && pos[1] <= len - 2)
			{
				ans += (s[pos[1]] - '1') * (len - 1 - pos[1]) * 9;
				if (pos[1] <= len - 3)
					ans += (len - 1 - pos[1]) * (len - 2 - pos[1]) / 2 * 81;
				if (pos[2] != -1 && pos[2] <= len - 1)
				{
					ans += (len - 1 - pos[2]) * 9 + s[pos[2]] - '0';
				}
			}
		}
		printf("%d\n", ans);
	}
}


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

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


int main() {
  int A, B;
  cin >> A >> B;
  int c = 1;
  int ans = 0;
  while (c < B){

    c -= 1;
    c += A;
    ans++;
  
  }

  cout << ans << endl;


	return 0;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define ARRAY_LENGTH( array ) ( sizeof( array ) / sizeof( array[ 0 ] ))

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	int N;
	cin >> N;
	vector <int> vec( N );
	int mini_input = k_mod;
	rep( i, 0, N ){
		cin >> vec[ i ];
		mini_input = min( mini_input, vec[ i ] );
	}
	if (mini_input != 1){
		cout << -1 << endl;
		return 0;
	}
	int count = 0;
	rep( i, 0, N ){
		if (vec[ i ] == count + 1){
			count++;
		}
	}
	if (count == 0)
		cout << -1 << endl;
	else
		cout << N - count << endl;
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  bool flag = false;
  string s, t;
  cin >> s;
  cin >> t;
  for(int i = 1; i <= s.size(); i++){
    s += s.front();
    s.erase(s.begin());
    if(s == t){
      flag = true;
      break;
    }
  }
  cout << (flag?"Yes":"No");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    cin>>a>>b;
    if(a<b)cout<<"a < b"<<endl;
    else if(a>b)cout<<"a > b"<<endl;
    else if(a==b)cout<<"a == b"<<endl;
    return 0;
}



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

int main() {
    int H, W;
    cin >> H >> W;
    string s;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            cin >> s;
            if (s == "snuke") {
                cout << char(j + 'A') << i + 1 << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  
  bool a[n];
  
  for (int i = 0; i < n; i++){
    int t, t2;
    cin >> t >> t2;
    
    if (t == t2){ a[i] = true; }
    else { a[i] = false; }
    
  }
  
  for (int i = 2; i < n; i++){
    if (a[i] == true && a[i-1] == true && a[i-2] == true){
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  cout << "No" << endl;
  
  return 0;
  
}

Measured memory_bytes: 3632
/*
    AUTHOR : TANMAY SINHA
    INFORMATION TECHNOLOGY
    BIT MESRA ,RANCHI
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ld long double
#define ull unsigned long long int
#define ll long long int
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007ll
#define rep(i,L,R) for(i=L;i<R;i++)
#define DEBUG
#ifdef DEBUG
#define deb2(args...) {dbg,args; cerr<<endl;}
#else
#define deb2(args...)
#endif
struct debb{template<typename T> debb& operator,(const T &v){cerr<<v<<" ";return *this;}}dbg;
#define deb1(args...) do {cerr << #args << " : "; dbg,args; cerr << "\n";} while(0)
#define printa(a,L,R) rep(i,L,R) cout << a[i] <<' ';cout<<"\n";
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
template<typename T>T gcd(T a,T b){if(b==0)return a;else return gcd(b,a%b);}
template<typename T>T lcm(T a,T b){return a/gcd(a,b)*b;}
ll power(ll x,ll y,ll p){ll res=1;x=x%p;while(y>0){if(y&1)res=((res%p)*(x%p))%p;y=y>>1;x=(x*x)%p;}return res;}
ll pow1(ll x,ll y){ll res=1;while(y>0){if(y&1)res=(res*x);y=y>>1;x=x*x;}return res;}
const ll INF = 1e18l+10,N = 1e5+10,MAX = 5000000;
#define sq(X) ((X)*(X))

int main()
{
    string s;
    cin>>s;
    if(s[3]==s[2]&&s[4]==s[5])
    cout<<"Yes\n";
    else
    {
        cout<<"No\n";
    }
    
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int n,m; cin>>n;
	string id[n];
	for(int i = 0; i < n; ++i)
	{
		cin>>id[i];
	}
	cin>>m;
	bool isOpen=false;
	for(int i = 0; i < m; ++i)
	{
		string in; cin>>in;
		bool out=false;
		for(int j = 0; j < n; ++j)
		{
			if(in==id[j])
			{
				if(!isOpen) cout<<"Opened by "<<in<<endl;
				else cout<<"Closed by "<<in<<endl;
				isOpen=!isOpen;
				out=true;
				break;
			}
		}
		if(!out) cout<<"Unknown "<<in<<endl;
	}
  return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
#define ll long long
using namespace std;
typedef pair<ll,ll> pi;

int main(){
    ll x;
    scanf(" %lld",&x);
    ll ans = (x/500ll);
    x -= ans*500ll;
    ans *= 1000ll;
    ans += (x/5ll)*5ll;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256
M=1000000007

def normalize(v)
  return [0,0] if v[0].zero? && v[1].zero?
  d=v[0].abs.gcd(v[1].abs)
  x=v[0]/d
  y=v[1]/d
  x,y=-x,-y if y<0
  x=-x if y.zero? && x<0
  [x,y]
end

def orthogonal(v)
  normalize([-v[1],v[0]])
end

def pow(n,m)
  return 1 if m.zero?
  m.odd? ? (n*pow(n,m-1)%M) : pow(n*n%M,m/2)
end

zer=0
h=Hash.new{|h,k|h[k]=0}
gets.to_i.times.map{gets.split.map(&:to_i)}.each do |v|
  if v.all?{|i|i.zero?}
    zer+=1
  else
    h[normalize(v)]+=1
  end
end

ans=1
used={}
h.each do |v,_|
  n=orthogonal(v)
  next if used[v] || used[n]
  used[v] = used[n]=true
  ans *= (h.key?(n) ? pow(2,h[v])+pow(2,h[n])-1+M : pow(2,h[v]))
  ans %= M
end
p (zer + ans - 1 + M) % M


Measured memory_bytes: 59640
#include<iostream>
#include<cstdio>
using namespace std;
const int L=128,N=65;
const char ch[]={"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"};
int len;
int cnt[N];
int query(const string &s)
{
    cout<<"? "<<s<<endl; 
    int ans;
    cin>>ans;
    return ans;
}
bool check(const string &s)
{
    return query(s)==len-s.size();
}
string merge(int l,int r)
{
    if(l==r) return string(cnt[l],ch[l]);
    int mid=(l+r)/2;
    string a=merge(l,mid),b=merge(mid+1,r);
    string t;
    int i=0,j=0;
    while(i<a.size()&&j<b.size())
    {
        if(check(t+a[i]+b.substr(j))) t+=a[i],i++;
        else t+=b[j],j++;
    }
    while(i<a.size())
        t+=a[i],i++;
    while(j<b.size())
        t+=b[j],j++;
    return t;
}
int main()
{
    for(int i=0;i<62;i++)
        cnt[i]=L-query(string(L,ch[i])),len+=cnt[i];
    string ans=merge(0,62);
    cout<<"! "<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3732
#include<iostream>
using namespace std;
long long i,sum1,n1,n2;
long long chazhao(long long n1)
{
	if(n1==n2)
	{
		return 2;
	}
	else
	sum1=2*chazhao(n1+1)+2;
	return sum1;
}
int main(){
	cin>>n2;
	i=chazhao(0);
	cout<<i;
	return 0;
}

Measured memory_bytes: 256
from sys import stdin
import fractions

class SegmentTree():

    def __init__(self, n):
        self.n = 1
        # nに最も近い2のべき乗を計算
        while self.n < n:
            self.n *= 2

        self.N0 = 2**(n-1).bit_length()

        # ノードの個数は2n-1個
        # 初期化はモノイドで
        self.dat = [0] * (self.n * 2 - 1)
        
    def update(self, i, x):
        i = i + self.n - 1
        self.dat[i] = x

        while(i > 0):
            i = (i-1) // 2
            self.dat[i] = fractions.gcd(self.dat[i * 2 + 1], self.dat[i * 2 + 2])

    def query(self, l, r):
        L = l + self.N0
        R = r + self.N0
        ret = 0
        
        while L < R:
            if R & 1:
                R -= 1
                ret = fractions.gcd(ret, self.dat[R-1])
                
            if L & 1:
                ret = fractions.gcd(ret, self.dat[L-1])
                L += 1
                
            L >>= 1; R >>= 1
        return ret


if __name__ == "__main__":
    N = int(stdin.readline().rstrip())
    A = [int(x) for x in stdin.readline().rstrip().split()]

    st = SegmentTree(N)
    for i in range(N):
        st.update(i, A[i])
    
    ans = - (10 ** 10)
    for i in range(N):
        leftv = st.query(0, i)
        rightv = st.query(i+1, N)

        # for Debug    
        #print("**{0}** | {1} {2}".format(i, leftv, rightv))
        ans = max(ans, fractions.gcd(leftv, rightv)) 

    # for Debug
    #print(st.dat)

    print(ans)

Measured memory_bytes: 91300
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int sum=0,t=0;
	for(int i=1;i<=s.size();i++)
	{
		if(s[i-1]=='S') sum++;
		if(sum && s[i-1]=='T')
		{
			sum--;
			t+=2;
		}
	}
	cout<<s.size()-t<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>
#include<functional>
#include<unordered_set>
#include<unordered_map>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;
const long long ll_max = 9223372036854775807;
const long long ll_min = -9223372036854775807;
const int int_max = 2147483647;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> ret;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			ret[i] ++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

template<typename T>
T modinv(T a, T m) {
	T b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}



// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}


#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {
	ll N;
	cin >> N;
	vll sum(N + 1, 0);
	rep(i, 0, N) {
		ll W;
		cin >> W;
		sum[i + 1] = sum[i] + W;
	}


	auto itr = upper_bound(sum.begin(), sum.end(), sum[N] / 2);
	ll ans = abs(sum[N] - 2 * (*itr));
	itr--;
	ans = min(ans,abs(sum[N] - 2 * (*itr)));

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


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

using namespace std;

int main(){
    int a, b;
    cin >> a;
    b = a % 10;
    if(b == 2 || b == 4 || b == 5 || b == 7 || b == 9){
        cout << "hon" << endl;
    }
    else if(b == 3){
        cout << "bon" << endl;
    }
    else{
        cout << "pon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3612