akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Vector;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            Vector<Integer> a = new Vector<>();
            Vector<Integer> b = new Vector<>();
            int x = in.nextInt();
            int y = in.nextInt();

            if (x == 2 || y == 2) {
                out.print("No");
                return;
            }

            a.add(1);
            a.add(3);
            a.add(5);
            a.add(7);
            a.add(8);
            a.add(10);
            a.add(12);

            b.add(4);
            b.add(6);
            b.add(9);
            b.add(11);

            if (Collections.binarySearch(a, x) >= 0 && Collections.binarySearch(a, y) >= 0) {
                out.println("Yes");
                return;
            }
            if (Collections.binarySearch(b, x) >= 0 && Collections.binarySearch(b, y) >= 0) {
                out.println("Yes");
                return;
            }

            out.println("No");
            return;
        }

    }

    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar;
        private int snumChars;

        public InputReader(InputStream st) {
            this.stream = st;
        }

        public int read() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
int a[102],dp[102][100004],s[102][100005];
signed main()
{
	int n,i,j,k,w=0,t;
	cin>>n>>k;
	for(i=1;i<=n;i++)
	cin>>a[i];
	dp[0][0]=1;
	for(i=1;i<=k+1;i++)
	s[0][i]=1;
	for(i=1;i<=n;i++)
	for(j=0;j<=k;j++)
	{   
	    int v=s[i-1][j+1]-s[i-1][max(w,j-a[i])];
	    if(v<0)
	    v=v+1000000007;
	    dp[i][j]=(v+dp[i][j])%1000000007;
	    s[i][j+1]=(s[i][j]+dp[i][j])%1000000007;
	    
	}
	cout<<dp[n][k]<<"\n";
}

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


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

	vector <string> substrs;
	int slen = s.length();
	for (int st = 0; st < slen; st++) {
		for (int len = 1; (len <= K) && ((st+len)<=slen); len++) {
			substrs.push_back(s.substr(st, len));
		}
	}

	std::sort(substrs.begin(), substrs.end());
	int pos = 0;
	string prestr = "";
	for (int i = 0; i < substrs.size(); i++) {
		if (prestr != substrs.at(i)) {
			prestr  = substrs.at(i);
			pos++;
			if (pos == K) {
				cout << substrs.at(i);
				break;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 1660
#include <array>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

int main()
{
    const int inf = 100000000;

    int n, m;
    cin >> n >> m;

    int a[1000], b[1000], c[1000], dist[100][100];

    REP(i, m)
    {
        cin >> a[i] >> b[i] >> c[i];
        --a[i]; --b[i];
    }

    REP(i, n)
    {
        REP(j, n)
        {
            if (i == j)
            {
                dist[i][j] = 0;
            }
            else
            {
                dist[i][j] = inf;
            }
        }
    }

    REP(i, m)
    {
        dist[a[i]][b[i]] = c[i];
        dist[b[i]][a[i]] = c[i];
    }

    REP(k, n) REP(i, n) REP(j, n)
    {
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
    }

    int ans = m;
    REP(i, m)
    {
        bool shortest = false;
        REP(j, n)
        {
            if(dist[j][a[i]]+c[i] == dist[j][b[i]]) shortest = true;
        }
        if (shortest)
        {
            --ans;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//答え見ました
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll calc(ll c){
  if (c<=0) return 0;
  c++;
  ll ans = 0;
  for(int i=0; i<50; i++){
    ll loop = (1LL << (i+1));
    ll count=(c/loop)*(loop/2);
    count += max(0LL,(c%loop)-(loop/2));
    
    if(count%2==1) ans+=1LL << i;
  } 
  return ans;
}

int main(){
  ll a,b;
  cin >> a >> b;
  ll ans = calc(b) ^ calc(a-1);
  cout << ans << endl;
}

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

using namespace std;

int main()
{
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  if (a == 0)
    cout << 1 << endl;
  else if (b == 0)
    cout << 2 << endl;
  else if (c == 0 )
    cout << 3 << endl;
  else if (d == 0)
    cout << 4 << endl;
  else if (e ==0 )
    cout << 5 << endl;
  return 0;
}

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


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

    bool flg = true;
    int n = s.size();
    
    string temp = s;
    reverse(temp.begin(), temp.end());
    if (s != temp) flg = false;

    string s1 = s.substr(0,(n-1)/2);
    temp = s1;
    reverse(temp.begin(), temp.end());
    if (s1 != temp) flg = false;

    string s2 = s.substr((n+1)/2,(n-1)/2);
    temp = s2;
    reverse(temp.begin(), temp.end());
    if (s2 != temp) flg = false;

    if (flg) cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define reps(i,n) for (int i=1;i<=(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rreps(i,n) for (int i=(n);i>0;i--)
#define all(v) (v).begin(),(v).end()
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>
template<class T> inline bool chmin(T &a, T b) {if (a>b) {a = b; return 1;} return 0;};
template<class T> inline bool chmax(T &a, T b) {if (a<b) {a = b; return 1;} return 0;};
typedef long long int ll;
const long long INF = 1LL << 60;


int main(){
  int N; cin >> N;
  bool F[N][5][2]; rep(i,N) rep(j,5) rep(k,2) cin >> F[i][j][k];
  ll P[N][11]; rep(i,N) rep(j,11) cin >> P[i][j];

  ll ans = -INF;
  for (ll tmp=1;tmp<(1LL<<10);tmp++){
    bitset<10> s(tmp);
    
    vector<int> c(N,0);
    rep(j,N) rep(d,5) rep(t,2){
      int i = 2*d + t;
      if (s.test(i) && F[j][d][t]==1) c[j]++;
    }
    ll b = 0;
    rep(j,N) b += P[j][c[j]];
    ans = max(ans, b);
  }
  cout << ans << endl;




  // cout << fixed << setprecision(10);
  
  return 0;
}


Measured memory_bytes: 3568
#include <stdio.h>
#include <math.h>
#include <string.h>

int main() {

    int n, x, m;
    scanf("%d %d", &n, &x);

    int mindata = 1001;
    for (int i = 0; i < n; i++) {
        scanf("%d", &m);
        x -= m;
        mindata = (m < mindata ? m : mindata);
    }

    printf("%d", n + (x / mindata));



    return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=1000000000000000000;
const long double PI=3.14159265358979;
const ll MAX=100010;

int main() {
  string s;
  cin>>s;
  ll N=s.size();
  vector<ll> A(0);
  sort(s.begin(),s.end());
  ll cnt=1;
  for(int i=0;i<N;i++){
    if(i==N-1||s[i]!=s[i+1]){
      A.push_back(cnt);
      cnt=1;
    }
    else{
      cnt++;
    }
  }
  ll ans=N*(N-1)/2+1;
  for(ll x:A){
    ans-=x*(x-1)/2;
  }
  cout<<ans;
}


Measured memory_bytes: 640
s = input()
len_s = len(s)
even_zero, even_one, odd_zero, odd_one = 0, 0, 0, 0

for i in range(len_s):

    if i % 2 == 0:
        if s[i] == "0":
            even_zero += 1
        else:
             even_one += 1
    else:
        if s[i] == "0":
            odd_zero += 1
        else:
             odd_one += 1

print(min(len_s - even_zero - odd_one, len_s - even_one - odd_zero))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll
#define INF 1e16
#define mod 1000000007
vector< vector<P> > G;
vector<ll> color;
ll n,m,u,v,w;
void dfs(ll num){
    // cout<<num<<endl;
    for(auto nv:G[num]){
        if(color[nv.fi]==-1){
            if(nv.se%2==0){
                color[nv.fi]=color[num];
                 dfs(nv.fi);
            } else {
                color[nv.fi] = (color[num]==0?1:0);
                 dfs(nv.fi);
            }
        }
    }
}

int main(){
    cin>>n>>m;
    G.assign(n,vector<P>());
    color.assign(n,-1);
    rep(i,m){
        cin>>u>>v>>w;
        u--;v--;
        G[u].push_back({v,w%2});
        G[v].push_back({u,w%2});
    }
    ll ans = 0;
    rep(i,n){
        if(color[i]==-1) {
            color[i]=0;
            dfs(i);
            ans++;
        }
    }
    cout<<ans<<endl;
    // rep(i,n) cout<<color[i]<<endl;
    return 0;
}

Measured memory_bytes: 11776
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=4e2;
int n,aa[N+2];long qm[N+2],dp[N+2][N+2];
long dfs(int lo,int hi)
{
  if(lo==hi)return 0;
  if(dp[lo][hi]!=-1)return dp[lo][hi];
  long now=1e18;
  for(int i=lo;i<hi;i++)
    now=min(now,dfs(lo,i)+dfs(i+1,hi));
  return dp[lo][hi]=now+qm[hi]-qm[lo-1];
}
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  cin>>n;
  for(int i=1;i<=n;i++)
  {
    cin>>aa[i];
    qm[i]=aa[i]+qm[i-1];
  }
  memset(dp,-1,sizeof(dp));
  cout<<dfs(1,n)<<endl;

  return 0;
}

Measured memory_bytes: 1536
#include "bits/stdc++.h"
using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    if(a==1)a+=13;
    if(b==1)b+=13;
    if(a>b){
        cout << "Alice" << endl;
    }else if(b>a){
        cout << "Bob" << endl;
    }else{
        cout << "Draw" << endl;
    }
    return 0;
}


Measured memory_bytes: 384
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_B
# Binary Search
# Result:
import sys

NO_ANSWER = -1

def binary_sarch(target, ary, start, end):
    if start == end:
        if target == ary[start]:
            return start
        else:
            return NO_ANSWER

    mid = (start + end) / 2
    if target < ary[mid]:
        return binary_sarch(target, ary, start, mid)
    elif target > ary[mid]:
        return binary_sarch(target, ary, mid + 1, end)
    else: # target == ary[mid]
        return mid


### main
ary_s_len = int(sys.stdin.readline().rstrip())
ary_s = [int(x) for x in sys.stdin.readline().rstrip().split(' ')]
ary_t_len = int(sys.stdin.readline().rstrip())
ary_t = [int(x) for x in sys.stdin.readline().rstrip().split(' ')]
assert len(ary_s) == ary_s_len
assert len(ary_t) == ary_t_len

count = 0
for e in ary_t:
    idx = binary_sarch(e, ary_s, 0, ary_s_len - 1)
    if idx >= 0:
        count += 1
print count

Measured memory_bytes: 12716
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1000000000000000000

using namespace std;

int ans(string s){
  if (s == "SSS")
    return 0;
  if (s == "SSR")
    return 1;
  if (s == "SRS")
    return 1;
  if (s == "SRR")
    return 2;
  if (s == "RSS")
    return 1;
  if (s == "RSR")
    return 1;
  if (s == "RRS")
    return 2;
  if (s == "RRR")
    return 3;
}

int main(void){
  string s;
  cin >> s;
  
  cout << ans(s) << endl;

  return 0;
}


Measured memory_bytes: 3628
N = int(input())
ABC = [input() for i in range(3)]
ans = 0
for i in range(N):
    a = ABC[0][i]
    b = ABC[1][i]
    c = ABC[2][i]
    if a == b and b == c:
        continue
    if a != b and a != c and b != c:
        ans += 2
        continue
    ans += 1
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1LL << 60;
#define LLINF 1e12
#define PI 3.14159265359
#define ALL(a) (a).begin(), (a).end()
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int ny, nx;
typedef long long ll;
using namespace std;

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

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

ll llmin(ll x, ll y) { return x < y ? x : y; }
ll llmax(ll x, ll y) { return x > y ? x : y; }

unsigned GetDigit(unsigned num) { return to_string(num).length(); }

template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
    return (c.end() != std::find(c.begin(), c.end(), v));
}

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

ll nCr(int n, int r)
{
    if (n == r or n == 0)
        return 1;
    if (n < r)
        return 0;
    if (r == 1)
        return n;
    return nCr(n - 1, r - 1) + nCr(n - 1, r);
}

//std::cout << std::defaultfloat << std::setprecision(10);
////////////////////////////////////////
int N, M;
using Graph = vector<vector<int>>;

int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    cin >> N >> M;
    Graph G(N);
    REP(i,M){
        int a,b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<int> dist(N, -1);
    vector<int> pos(N, -1);
    queue<int> que;
    dist[0] = 0, que.push(0);
    while(!que.empty()){
        int v = que.front(); que.pop();
        for(auto nv: G[v]){
            if(dist[nv]==-1){
                dist[nv] = dist[v] + 1;
                pos[nv] = v;
                que.push(nv);
            }
        }
    }

    REP(i,N){
        if(dist[i]==-1){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    FOR(i,1,N){
        cout << pos[i]+1 << endl;
    }

    return 0;
}


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

public class Main {

	public static void main(String[] a){

		String str;
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		try {
			while(null != ( str = bf.readLine() )){
				int n = Integer.parseInt(str);
				if(n > 36){
					System.out.println(0);
				} else {
					System.out.println( calc(n) );
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				bf.close();
			} catch (IOException e) {
			}
		}
	}

	private static int calc(int number){
		int count = 0;
		for(int i1 = 0; i1 < 10; i1++){
			for(int i2 = 0; i2 < 10; i2++){
				for(int i3 = 0; i3 < 10; i3++){
					for(int i4 = 0; i4 < 10; i4++){
						if(i1 + i2 + i3 + i4 == number)count++;
					}
				}
			}
		}
		return count;
	}

}

Measured memory_bytes: 9464
using System;
using System.Collections.Generic;
using System.Linq;
using static AtCoder.Io;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var a = ReadString();
            Console.WriteLine($"{a.Count() / 2 - a.Count(v => v == 'p')}");
        }
    }

    public static class Io
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static long ReadLong() => long.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static long[] ReadLongArray() => ReadStringArray().ParseLong().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(int.Parse);
        public static IEnumerable<long> ParseLong(this IEnumerable<string> source) => source.Select(long.Parse);
    }
}


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

int main() {
  string C1,C2;
  cin>>C1>>C2;
  if(C1.at(0)==C2.at(2)&&C1.at(1)==C2.at(1)&&C1.at(2)==C2.at(0))
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

typedef long long ll;
typedef long double ld;
//typedef unsigned long long uint;
typedef pair<long long, long long> pint;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef vector<pair<int,int> > vii;
typedef vector<long long> vint;
typedef vector<vint> vvint;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<pair<long long,long long> > vpint;
typedef vector<bool> vb;
typedef vector<vb> vvb;

#define PI 3.141592653589793
#define mod 1000000009
#define M 1000006
# define N 100006
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, int m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }
# define inf (ll)1e18
# define A 1000006



int main()
{ 
    string s;
    cin >> s;
    if(s.length()==1)
    {
        cout << "-1"<<" "<<"-1";
        return 0;
    }
    for(int i=0;i<s.length();i++)
    {
        if(s[i]==s[i+1])
        {
            cout << i+1 <<" "<<i+2;
            return 0;
        }
    }
    for(int i=0;i<s.length();i+=2)
    {
        if(s[i]==s[i+2])
        {
            cout << i+1<<" "<<i+3;
            return 0;
        }
    }
    for(int i=1;i<s.length();i+=2)
    {
        if(s[i]==s[i+2])
        {
            cout << i+1<<" "<<i+3;
            return 0;
        }
    }
    cout << "-1"<<" "<<"-1";


}

Measured memory_bytes: 512
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

int main(){
    string s,t;
    cin >> s;
    cin >> t;
    
    int n = s.length();
    int nCount = 0;
    for(int i = 0; i < n; i++){
        if(s[i] != t[i]){
            nCount++;
        }
    }
    printf("%d", nCount);
    
    return 0;
}


Measured memory_bytes: 3320
#include "bits/stdc++.h"
using namespace std;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define ph push
#define f first
#define s second
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return (rng() % (y+1-x)) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

typedef long long ll; 
typedef long double ld;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
typedef pair<ll,ll>pi; typedef pair<ll,pi>spi; typedef pair<pi,pi>dpi;

#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
// #define cerr if(0)cout
#define MAXN (10006)
ll h, n, dp[MAXN];
pi A[MAXN]; // value, cost
int main()
{
	FAST
	cin>>h>>n;
	FOR(i,0,n-1) cin>>A[i].f>>A[i].s;
	FOR(j,0,MAXN-1) dp[j]=LLINF;
	dp[0]=0;
	FOR(i,0,n-1) {
		for(ll j=0; j<=h; ++j) {
			dp[j]=min(dp[j],(j>=A[i].f?dp[j-A[i].f]:0)+A[i].s);
		}
	}
	cout<<dp[h];
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    int a2, b2, c2;
    int cnt = 0;
    while(a%2==0 && b%2==0 && c%2==0){
        a2 = b/2 + c/2;
        b2 = a/2 + c/2;
        c2 = a/2 + b/2;
        if(a==a2 && b==b2 && c==c2){
            cout << "-1" << endl;
            return 0;
        }
        a = a2; b= b2; c= c2;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

int flag[15];

bool check(int x) {
	while(x) {
		if(flag[x % 10]) return false;
		x /= 10;
	}
	return true;
}

void hora(int tc) {
	int n,k;
	cin>>n>>k;
	for(int i = 1;i <= k;i++) {
		int x;
		cin>>x;
		flag[x] = 1;
	}
	while(1) {
		if(check(n) == true) break;
		n++;
	}
	cout<<n<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
using namespace std;

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

    int A[N];
    int max = 0;
    int maxIndex = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        if (max < A[i]) {
            max = A[i];
            maxIndex = i;
        }
    }

    for (int i = 0; i < N; i++) {
        if (i == maxIndex) {
            int max2 = 0;
            for (int j = 0; j < N; j++) {
                if (j == maxIndex) {
                    continue;
                }
                if (max2 < A[j]) {
                    max2 = A[j];
                }
            }
            cout << max2 << endl;
        }
        else {
            cout << max << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 2432
#include <stdio.h>
int main()
{
	int m, f, r, a;
	while(1){
		scanf("%d %d %d", &m, &f, &r);
		if(m==-1 && f==-1 && r==-1){
			break;
		}
		a=m+f;
		if(m==-1 || f==-1 || a<30){
			printf("F");
		} else if(a>=80){
			printf("A");
		} else if(a<80 && a>=65){
			printf("B");
		} else if((a<65 && a>=50) || (a<50 && a>=30 && r>=50)){
			printf("C");
		} else if(a<50 && a>=30){
			printf("D");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
X = int(input())

if 400 <= X <= 599:
    print(8)
elif 600 <= X <= 799:
    print(7) 
elif 800 <= X <= 999:
    print(6) 
elif 1000 <= X <= 1199:
    print(5) 
elif 1200 <= X <= 1399:
    print(4)
elif 1400 <= X <= 1599:
    print(3) 
elif 1600 <= X <= 1799:
    print(2)
elif 1800 <= X <= 1999:
    print(1) 

Measured memory_bytes: 9184
/*بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم*/

#include <bits/stdc++.h>
#define ll long long
using namespace std;

const int mx=2e5+5;
char str[mx];
vector <int> idx[26];
int ara[mx],temp[mx];
ll ans;

void inversion_count(int lo,int hi)
{
    if (lo==hi) return;
    int mid=(lo+hi)/2;

    inversion_count(lo,mid);
    inversion_count(mid+1,hi);

    int i,j,k;
    for (i=lo,j=mid+1,k=lo;k<=hi;k++) {
        if (i==mid+1) temp[k]=ara[j++];
        else if (j==hi+1) temp[k]=ara[i++];
        else if (ara[i]<=ara[j]) temp[k]=ara[i++];
        else {
            ans+=mid-i+1;
            temp[k]=ara[j++];
        }
    }
    for (i=lo;i<=hi;i++) ara[i]=temp[i];
}

int main ()
{
    int i,n;

    scanf ("%s",str);
    n=strlen(str);
    for (i=0;i<n;i++) {
        idx[str[i]-'a'].push_back(i);
    }
    int cnt=0;
    for (i=0;i<26;i++) cnt+=idx[i].size()%2;
    if (cnt>1) {
        printf("-1\n");
        return 0;
    }

    cnt=0;
    for (i=0;i<26;i++) {
        if (idx[i].size()%2) {
            ara[idx[i][idx[i].size()/2]]=n/2+1;
            break;
        }
    }
    for (i=0;i<n;i++) {
        if (ara[i]) continue;
        ara[idx[str[i]-'a'].back()]=n-cnt;
        ara[i]=++cnt;
        idx[str[i]-'a'].pop_back();
    }
  //  for (i=0;i<n;i++) printf ("%d ",ara[i]);cout<<endl<<ans<<endl;
    inversion_count(0,n-1);
    printf ("%lld\n",ans);

    return 0;
}



Measured memory_bytes: 3064
N = int(input())
A = [int(n) for n in input().split()]

if N == 0:
    if A[0] == 1:
        print(1)
    else:
        print(-1)
    exit()

if A[0] != 0:
    print(-1)
    exit()
    
B = [1 for _ in range(N+1)]
for i in range(1, N+1):
    B[i] = B[i-1] * 2 - A[i]
    if B[i] < 0:
        print(-1)
        exit()

ans = 0

n_prev = 0
for a, b in zip(A[::-1], B[::-1]):
    B_low = (n_prev + 1) // 2
    B_high = n_prev

    #print('{} {} {}'.format(B_low, B_high, b))

    if B_low > b:
        print(-1)
        exit()

    n_cur = a + min(B_high, b)
    #print(a, n_cur)
    ans += n_cur
    n_prev = n_cur
    
print(ans)


Measured memory_bytes: 669988
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#include<map>

#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 VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

int main() {
	string str;
	cin >> str;
	REP(i, str.size()) {
		if (i % 2 == 0) {
			if (str[i] == 'L') {
				cout << "No" << endl;
				return 0;
			}
		}
		else {
			if (str[i] == 'R') {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
N, K = gets.split(' ').take(2).map(&:to_i)
height_list = gets.split(' ').take(N).map(&:to_i)

dp = Array.new(N, Float::INFINITY)
dp[0] = 0

(0...(N - 1)).each do |i|
  height = height_list[i]
  k = [N - (i + 1), K].min
  (1..k).each do |j|
    cost = dp[i] + (height - height_list[i + j]).abs
    dp[i + j] = cost if cost < dp[i + j]
  end
end

puts dp[N - 1]


Measured memory_bytes: 11660
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;

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

  cout << (n >= 30 ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int p[55];
int s[55];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>p[i];
		s[i]=p[i];
	}
	sort(s,s+n);
	bool tt=1;
	for(int i=0;i<n;i++){
		if(p[i]!=s[i]){
			tt=0;
			break;
		} 
	}
	if(tt==1){
		cout<<"YES";
		return 0;
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			bool tf=1;
			swap(p[i],p[j]);
			for(int k=0;k<n;k++){
				if(s[k]!=p[k]){
					tf=0;
					break;
				}
			}
			swap(p[i],p[j]);
			if(tf==1){
				cout<<"YES";
				return 0;
			}
		}
	}
	cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   string ans = "Yes";
   int n, prev, cur;
   cin >> n >> prev;
   prev --;
   for (int i = 1; i < n; i++)
   {
      cin >> cur;
      if(prev > cur)
      {
         ans = "No";
         break;
      }
      if(prev <= cur -1)
         prev  = cur -1;
      else
         prev = cur;
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   char a;
   cin>>a;
   if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u')
   {
     cout<<"vowel";
   }
   else
   {
       cout<<"consonant";
   }


    return 0;
}


Measured memory_bytes: 764
n = int(input())
d = [int(input()) for i in range(n)]

if sum(d)%2 > 0:
    print(-1)
    exit()

d = sorted([(dd, i) for i, dd in enumerate(d)], reverse = True)
d_to_i = {dd:i for dd, i in d}
n_child = [1]*n
d_child = [0]*n
ans = []
for dd, i in d:
    d_i = dd+2*n_child[i]-n
    if d_i in d_to_i.keys():
        i_next = d_to_i[d_i]
        ans.append((i+1, i_next+1))
        n_child[i_next] += n_child[i]
        d_child[i_next] += d_child[i] + n_child[i]
        if n_child[i_next] == n:
            break
    else:
        print(-1)
        exit()

d_min, i_min = d[-1]
if d_min == d_child[i_min]:
    for a in ans:
        print(*a)
else:
     print(-1)


Measured memory_bytes: 45512
N,M= map(int,(input().split()))
line = []
for i in range(M):
    a,b,c = map(int,(input().split()))
    line.append([a-1,b-1,-c])

def Bellman_Ford(S,V,E,distance):
    min_distance = [float("inf")]*V # min_distance[i] は始点から街iまでの最短距離
    min_distance[S-1] = 0 # 始点から始点への最短距離は0とする
    count = 1
    while count < 2*V:
        if count == V:
            tmp = min_distance[N-1]
        count += 1
        for s,g,d in distance: # [s,g,d] = [道路の始点,道路の終点,道路の長さ] について、すべての道路を見る
            if min_distance[s] != float("inf") and min_distance[s] + d < min_distance[g]: # 最短経路が確立されている街から伸びる道路を通ることで、距離を短くできるならば、
                min_distance[g] = min_distance[s] + d # 最短距離を上書きする
    return min_distance,tmp

min_distance,ansN = Bellman_Ford(1,N,M,line)
ans2N = min_distance[N-1]
if ansN == ans2N:
    print(-ansN)
else:
    print("inf")

Measured memory_bytes: 45912
#include <bits/stdc++.h>
#define INF 1ll<<60
#define int long long
using namespace std;
#define vini 1000000007
long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
signed main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  int N,K;
  cin>>N>>K;
  int ult;
  vector<int>vet(N);
  for(int i=0;i<N;i++)
    cin>>vet[i];
  int soma;
  int res=0;
  for(int i=0;i<N;i++){
    soma=0;
    for(int j=i+1;j<N;j++){
      if(vet[i]>vet[j]){
        soma++;
      }
    }
    ult=K*soma%1000000007;
    res+=((((ult+soma)*K)%vini)*binpow(2,vini-2,vini))%1000000007;
    soma=0;
    for(int j=0;j<i;j++){
      if(vet[i]>vet[j]){
        soma++;
      }
    }
    ult=(K-1)*soma%1000000007;
    res+=(((soma+ult)*(K-1)%vini)*binpow(2,vini-2,vini))%1000000007;
  }
  cout<<res%1000000007<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(X: int, A: int, B: int):
    if B > X + A:
        ret = 'dangerous'
    elif B <= A:
        ret = 'delicious'
    else:
        ret = 'safe'
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(X, A, B)

if __name__ == '__main__':
    main()


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

int main() {
	string s;
	cin >> s;
	int ans = 0;
	if (s[0] == '1') {
		ans++;
	}
	if (s[1] == '1') {
		ans++;
	}
	if (s[2] == '1') {
		ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
    int x;
    cin >> x;
    if (x == 3 || x == 5 || x == 7)
        cout << "YES";
    else cout << "NO";
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define in(j,n) for(j=0;j<n;j++)
#define inp(j,n) for(j=1;j<=n;j++)
#define lo(i,st,n) for(i=st;i<n;i++)
#define pb push_back
#define csbits(n) __builtin_popcount(n)
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false)
int main()
{
	fastio;
	ll i,j,t,n;
	cin>>n;
	ll a[n][3];
	ll dp[n][3];
	in(i,n){
		in(j,3){
			cin>>a[i][j];
			dp[i][j]=0;
		}
	}
	in(j,3)
		dp[0][j]=a[0][j];
	inp(i,n-1){
		in(j,3){
			if(j==0){
				dp[i][1]=max(dp[i][1],dp[i-1][0]+a[i][1]);
				dp[i][2]=max(dp[i][2],dp[i-1][0]+a[i][2]);
			}
			else if(j==1){
				dp[i][0]=max(dp[i][0],dp[i-1][1]+a[i][0]);
				dp[i][2]=max(dp[i][2],dp[i-1][1]+a[i][2]);
			}
			else if(j==2){
				dp[i][1]=max(dp[i][1],dp[i-1][2]+a[i][1]);
				dp[i][0]=max(dp[i][0],dp[i-1][2]+a[i][0]);
			}
		}
	}
	ll ma=dp[n-1][0];
	inp(j,2)
		ma=max(ma,dp[n-1][j]);
	cout<<ma<<endl;
	return 0;
}

Measured memory_bytes: 8240
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {

	int X;
	cin >> X;

	int num = 1800;

	for (int i = 1; i <= 8; i++) {
		if (X >= 2000 - 200 * i) { cout << i << endl; return 0; }
	}

	return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1000000007;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};
int dyy[]={0,-1,0,1};
int dxx[]={-1,0,1,0};

/*#define int ll*/
signed main(){
    
    int n;
    cin>>n;
    bool can=false;
    rep(i,0,26){
        rep(j,0,16){
            if(i*4+j*7==n)can=true;
        }
    }
    if(can)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

int main(void){
  int N;
  vector<int> A;

  cin >> N;
  A.resize(N);
  for (auto &val : A){
    cin >> val;
  }

  int max = 0, min = 0;
  for(auto val : A){
    if(max==0 || max<val){
      max = val;
    }
    if(min==0 || min>val){
      min = val;
    }
  }

  cout << max - min << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout<<(a-1)*(b-1);
system("pause");
return 0;
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
int main(){
  int sum = 0;
  string a,ans = "Yes";
  
  cin >> a;
  
  for(int i = 0;i < a.length();i++){
    sum += (int)(a.at(i) - '0');
  }
  
  if(sum % 9)
    ans = "No";
  
  cout << ans << endl;
}

Measured memory_bytes: 3748
using System;
using System.Collections.Generic;

namespace ABC_045
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            bool[] pExists = new bool[S.Length];
            for (int i = 0; i < pExists.Length; i++)
            {
                pExists[i] = false;
            }

            Console.WriteLine(insertPlus(pExists, 1, S));

        }

        public static long insertPlus(bool[] pExists, int target, string S)
        {
            long ans = 0;
            if(pExists.Length <= target)
            {
                string s = S;
                for(int i= (pExists.Length - 1); i > 0; i--)
                {
                    if(pExists[i] == true)
                    {
                        string A = s.Substring(0, i);
                        string B = s.Substring(i);
                        s = A + "+" + B;
                    }
                }

                string[] num = s.Split('+');
                for(int i = 0; i < num.Length; i++)
                {
                    ans += long.Parse(num[i]);
                }

            }else
            {
                /* +無し */
                bool[] tmp = new bool[pExists.Length];
                Array.Copy(pExists, tmp, pExists.Length);

                ans = insertPlus(tmp, target + 1, S);

                /* +有り */
                tmp[target] = true;
                ans += insertPlus(tmp, target + 1, S);
            }

            return ans;
        }
    }
}


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

int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    
    double T, X;
    cin >> T >> X;

    double ans = T / X;

    cout << setprecision(10) << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int K,A,B;
    int i=1,n=1;

    scanf("%d %d %d",&K,&A,&B);

    while(1){
        n=K*i;
        i++;
        if(n>=A && n<=B){
            printf("OK");
            break;
        }else if(n>B){
            printf("NG");
            break;
        }
    }

    return 0;
}

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 1e9 + 1
#define INF_LL 1LL<<60
#define ll long long

#define MAX_V 105

#define MAX_N 100
#define MAX_M 100

int main(){
    int a, b, k;
    cin >> a >> b >> k;
    int idx = 0;
    REP(i, k) {
        if(idx % 2 == 0) {
            /* 高橋 */
            a /= 2;
            b += a;
        } else {
            /* 青木 */
            b /= 2;
            a += b;
        }
        idx++;
    }

    cout << a << " " << b << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#pragma GCC target("avx,tune=native")
#include "bits/stdc++.h"
using namespace std;
const int maxn = 200200;
const int magic = 55;
int dist[magic][maxn];
int main(){
    int k;
    cin >> k;
    queue<pair<int, int> > q;
    for(int e = 1; e < 10; e++){
        dist[e][e % k] = 1;
        q.push({e, e % k});
    }
    while(!q.empty()){
        int su, mo;
        tie(su, mo) = q.front(); q.pop();
        for(int f = 0; f <= 9; f++){
            int nx = (mo * 10 + f) % k;
            int ns = (su + f);
            if(ns >= magic) continue;
            if(!dist[ns][nx]){
                dist[ns][nx] = 1;
                q.push({ns, nx});
            }
        }
    }
    int cur = 0;
    while(!dist[cur][0]) cur++;
    cout << cur << endl;
	return 0;
}


Measured memory_bytes: 58296
#include<stdio.h>

int main() {
	int a = 0;
	int b = 0;
	int d = 0;
	int e = 0;
	int i;
	scanf("%d%d",&a, &b);
	for (int i = 1; i < 1252; i++) {
		d = i * 2/25;
		e = i * 1/10;
		if ( d == a &&  e == b) {
			if (i != 1251) {
				printf("%d", i);
				break;
			}
		}
		if (i == 1251) {
			printf("-1");
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <vector>
#include <map>


using namespace std;

int main() {
    long long N;
    scanf("%lld", &N);
    long long x = N%2 == 0 ? N : 2*N;
    printf("%lld\n", x);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
using P=pair<int,int>;
typedef unsigned long long ull;
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; }

const ll MOD=1e9+7;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll gcd( ll x ,ll y){
  if(x%y==0)return y;
  return gcd(y,x%y);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  int n;
  ll x;
  cin >> n >> x;;
  vector<ll>a(n);
  rep(i,n){
    cin >> a[i];
    a[i]=abs(x-a[i]);
  }
  ll G=a[0];
  rep(i,n){
    G=gcd(G,a[i]);
  }
  cout << G << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, X=0;
  cin >> A >> B;
  for (int i=0; i<2; i++){
    if (A <= B){
      X+=B;
      B--;
    }
    else {
      X+=A;
      A--;
    }
  }
  cout << X << endl;
 }

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

#define SENTINEL 1000000000

int count=0;

void merge(int A[],int left,int mid,int right){
  int n1,n2,i,j,k;
  int *L,*R;
  n1=mid-left;
  n2=right-mid;
  L=(int *)malloc(sizeof(int)*(n1+1));
  R=(int *)malloc(sizeof(int)*(n2+1));
  for(i=0;i<=n1-1;i++){
    L[i]=A[left+i];
  }
  for(j=0;j<=n2-1;j++){
    R[j]=A[mid+j];
  }
  L[n1]=SENTINEL;
  R[n2]=SENTINEL;
  i=0;
  j=0;
  for(k=left;k<=right-1;k++){
   if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
      count++;
    }
    else{
      A[k]=R[j];
      j++;
      count++;
    }
  }
  free(L);
  free(R);
}

void mergeSort(int A[],int left,int right){
  int i,mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}


int main(){
  int A[500000];
  int n,i;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  mergeSort(A,0,n);
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i<n-1){
      printf(" ");
    }
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 5416
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
int k,a,b;
int main(){
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
		if((i%k==0))
		{
			cout<<"OK";
			return 0;
		}
	cout<<"NG";
	return 0;
}

Measured memory_bytes: 3132
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>

using namespace std;

int main(){

    long double ans=0;
    vector<long double> a;

    int n;
    cin>>n;

    for(int i=0;i<n;i++){
        long double b=0;
        cin>>b;
        a.push_back(b);
    }

    long double sum=0;
    for(int i=0;i<n;i++){
        sum+=(1.0/a[i]);
    }
    ans=1/sum;

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
//
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n, a, b, count = 0;
  cin >> n;
  for (a = 1; a <= n - 1; a++)
  {
    for (b = 1; b <= n - 1; b++)
    {
      if (a * b >= n)
      {
        break;
      }
      else
      {
        count++;
      }
    }
  }
  cout << count << " " << endl;
  return 0;
}

Measured memory_bytes: 3636
import java.util.*;
class Main {
    public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);
      String str = sc.nextLine();
      
      if(str.charAt(str.length() - 1) == 's') {
          str += "es";
      }
      else {
          str += "s";
      }
      
      System.out.print(str);
    }
}

Measured memory_bytes: 38528
#include <stdio.h>

int main(void)
{
    int K;
    char S[100];
    int count = 0;

    scanf("%d", &K);
    scanf("%s", S);


    for (int i = 0; S[i] != '\0'; i++){
        count++;
    }

    if (count > K){
        for (int i = 0; i < K; i++){
            printf("%c", S[i]);
        }

        printf("...\n");
    }
    else {
        printf("%s", S);
    }

    return 0;
}


Measured memory_bytes: 1732