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

int main()
{
    string s;
    cin >> s;
    int a = 0;
    a = s.size();

    if (s[a - 1] == 's')
    {
        s.append("es");
    }
    else
    {
        s.append("s");
    }
    cout << s << endl;
    
} 

Measured memory_bytes: 3588
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <deque>
#include <queue>

#define pb push_back
#define mp make_pair
#define x first
#define y second
#define FOR(i, a, b) for(int i=a, loop=b; i<=loop; ++i)
#define REV(i, a, b) for(int i=a, loop=b; i>=loop; --i)
#define mize(a, b) a = min(a, b)
#define maxi(a, b) a = max(a, b)
#define shl(k) ((k) << 1)
using namespace std;

const int N = 105;
int n, L;
vector<pair<pair<int, int>, int> > E;

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

    cin >> L;
    FOR(i, 0, 19) if ((L>>i) & 1) n = i;

    int k = 1<<n;
    FOR(i, 0, n-1){
        E.pb(mp(mp(i+1, i+2), 0));
        E.pb(mp(mp(i+1, i+2), 1<<i));
        if ((L>>i) & 1) {
            E.pb(mp(mp(i+1, n+1), k));
            k = k + (1 << i);
        }
    }

    cout << n+1 <<' ' << E.size() << '\n';
    for(auto e: E) cout << e.x.x <<' ' << e.x.y <<' ' << e.y << '\n';
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(200000000)

def kane(l,n,m):
    l *= 1.01
    l = l // 1
    n += 1
    if l >= m:
        print(n)
        exit()
    kane(l,n,m)

X = int(input())
kane(100,0,X)


Measured memory_bytes: 12224
#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 pu push_back
#define po pop_back
#define EPS (1e-7)
#define INF (1e9)
#define pi (acos(-1))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vec vector
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
//const int INF = 1001001001;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//gcd & lcm
ll gcd (ll a, ll b) {
  return b ? gcd(b, a%b) : a;
}
ll lcm (ll a, ll b) {
  return a/gcd(a,b)*b;
}

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //FROM HERE//
  string t;
  cin >> t;
  for (int i=0; i<t.length(); i++) {
    if(t[i]=='?') {
      t.replace(i,1,"D");
    }
  }
  cout << t << endl;
  return 0;
}



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

int main(){
  long long int a,b,n;
  cin >> a >> b >> n;
  
  long long int x=min(n,b-1);
  long long int i=a*x/b;
  long long int j=x/b;
  cout << i-a*j << endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int X, Y;
  cin>>X>>Y;

  Int ans = 0;
  for(Int i=0;i<=X;i++){
    Int j = X - i;
    if(i * 2 + j * 4 == Y) ans = 1;
  }

  cout<<(ans? "Yes":"No")<<endl;

  return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string.h>

using namespace std;
int main(){
	int N;
	char s[100], t[100];

	cin >> N;
	cin >> s >> t;

	for(int i = 0; i < N; i++){
		char *ss = s + i;
		if(strstr(t, ss) == t){
			cout << 2*N - (N-i) << endl;
			return 0;
		}
	}

	cout << 2*N << endl;
	return 0;
}

Measured memory_bytes: 256
while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    for i in range(H):
        for j in range(W):
            if (i+j)%2==0:
                print('#',end='')
            else:
                print('.',end='')
        print()
    print()


Measured memory_bytes: 7000
import java.util.Scanner;

class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int a = sc.nextInt();
   int b = sc.nextInt();
   int c = sc.nextInt();
   boolean flag=false;
   
   if((a==b&&a!=c)||(a==c&&a!=b)||(c==b&&a!=c)){
   flag=true;
   }

   if(flag){
     System.out.println("Yes");
   }else{
     System.out.println("No");
   }
 
 }
}


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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<string, vector<string>, greater<string> > PQ_ASK;

#include <iostream>
#include <vector>

using namespace std;

vector<int> dfs_start_goal(int now, int goal, int prev, vector<vector<int>> &edges) {
    if (now == goal) return vector<int>{now};
    for (int next : edges[now]) {
        if (next == prev) continue;
        vector<int> r = dfs_start_goal(next, goal, now, edges);
        if (r.empty()) continue;
        r.push_back(now);
        return r;
    }
    return vector<int>{};
}

int dfs_depth_max(int now, int prev, vector<vector<int>> &edges, int depth) {
    int res = depth;
    for (int next : edges[now]) {
        if (next == prev) continue;
        int nd = dfs_depth_max(next, now, edges, depth + 1);
        cmax(res, nd);
    }
    return res;
}

int main() {
    int n, u, v;
    cin >> n >> u >> v;
    u--;
    v--;
    vector<vector<int>> edges(n);
    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    vector<int> r = dfs_start_goal(u, v, -1, edges);
    reverse(r.begin(), r.end());
    int center = r[r.size() / 2 - 1];
    int center_next = r[r.size() / 2];
    int max_depth = dfs_depth_max(center, center_next, edges, 0);
    int as = (r.size() + 1) / 2;
    cout << as + max_depth - 1 << endl;
}

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

int n, x;
int a[110];

int main () {

	cin >> n >> x;
	for (int i = 0; i < n; i ++) cin >> a[i];
	sort(a, a + n);
	for (int i = 0; i < n; i ++) {
		if (x < a[i]) {
			cout << i;
			return 0;
		}
		
		x -= a[i];
	}
	
	if (x > 0) cout << n-1;
	else cout << n;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int k = sc.nextInt();
      int[] arr = new int[n];
      int idx = -1;
      for(int i = 0; i < n; i++) {
        arr[i] = sc.nextInt();
        if(arr[i] == 1) idx = i;
      }

      int cnt = 0;
      int i = 0;
      while(i < n - 1) {
        cnt++;
        i = i + k - 1;
      }
     
      int cnt2 = 0;
      i = idx;
      while(i > 0) {
        cnt2++;
        i = i - k + 1;
      }
      i = idx;
      while(i < n-1) {
        i = i + k - 1;
        cnt2++;
      }
      System.out.println(Math.min(cnt, cnt2));
  }
}

Measured memory_bytes: 57952
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int N = 16;
const int M = 1<<N;
const ll Inf = 1e18;


ll a[N][N];
ll Dp[M];
ll Cost[1<<N];
vector <int> Not_Taken[1<<N];

void Max_Self(ll& x,ll y)   {
    x = max(x,y);
}

void Rec(int Mask,int j,int Mask2)
{
    if(j==Not_Taken[Mask].size())
        return Max_Self(Dp[Mask],Cost[Mask2]+Dp[Mask|Mask2]);

    Rec(Mask,j+1,Mask2);
    Rec(Mask,j+1,Mask2|(1<<Not_Taken[Mask][j]));
}

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

    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            scanf("%lld",&a[i][j]);

    for(int Mask=0;Mask<(1<<n);Mask++)
        for(int i=0;i<n;i++)
            for(int j=i+1;j<n;j++)
                if( ( Mask&(1<<i) ) && ( Mask&(1<<j) ) )
                    Cost[Mask] += a[i][j];

    for(int Mask=0;Mask<(1<<N);Mask++)
        for(int i=0;i<N;i++)
            if(!(Mask&(1<<i)))
                Not_Taken[Mask].push_back(i);

    for(int i=0;i<M;i++)   Dp[i] = -Inf;

    Dp[(1<<n)-1] = 0;

    for( int Mask = (1<<n)-2 ; Mask >= 0 ; Mask-- )
        Rec(Mask,0,0);

    cout<<Dp[0];
}


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

int main(){
    int N, K, S;
    cin >> N >> K >> S;
    rep(i, K){
        cout << S;
        if(i+1 < K) cout << " ";
    }
    if(K != 0) cout << " ";
    int el = S+1;
    if(S == 1000000000) el -= 2;
    rep(i, N-K){
        cout << el;
        if(i+1 < N-K) cout << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1280
#include <iostream>
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;
  }
}


Measured memory_bytes: 3552
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <utility>
#include <string>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>

using namespace std;

int evaluate_no_merge(const vector<int>& ls, const vector<int>& required)
{
	int min_diff = INT_MAX;
	for (int a_pos = 0; a_pos < ls.size(); a_pos++) {
		for (int b_pos = 0; b_pos < ls.size(); b_pos++) {
			for (int c_pos = 0; c_pos < ls.size(); c_pos++) {
				if (a_pos == b_pos) continue;
				if (a_pos == c_pos) continue;
				if (b_pos == c_pos) continue;

				int a_diff = abs(required[0] - ls[a_pos]);
				int b_diff = abs(required[1] - ls[b_pos]);
				int c_diff = abs(required[2] - ls[c_pos]);

				int diff = a_diff + b_diff + c_diff;

				min_diff = min(diff, min_diff);
			}
		}
	}
	return min_diff;
}

int evaluate(const vector<int>& ls, const vector<int>& requried) {
	int no_merge_result = evaluate_no_merge(ls, requried);
	if (ls.size() == 3) return no_merge_result;

	int  min_result = no_merge_result;
	for (int i = 0; i < ls.size() - 1; i++) {
		for (int j = i + 1; j < ls.size(); j++) {
			vector<int> new_ls = ls;
			new_ls[i] = new_ls[i] + new_ls[j];
			new_ls.erase(new_ls.begin() + j);

			int new_result = evaluate(new_ls, requried) + 10;
			min_result     = min(min_result, new_result);
		}
	}

	return min_result;
}

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

	vector<int> required(3);
	required[0] = a;
	required[1] = b;
	required[2] = c;

	vector<int> ls(n);
	for (int& l : ls) {
		cin >> l;
	}

	int result = evaluate(ls, required);

	cout << result << endl;

	return 0;
}


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

int main() {
  int H,W;
  while(cin>>H&&cin>>W&&(H!=0&&W!=0)){
    for(int i=0;i<H;i++){ 
      for(int j=0;j<W;j++){
        if(i>0&&j>0&&j<W-1&&i<H-1){cout<<'.';}
        else{cout<<'#';}
        if(j==W-1){cout<<endl;}}
       if(i==H-1){cout<<endl;}
                  }       
      }
  return 0;
}


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

int main(){
  int D, N; cin >> D >> N;
 
	//int S = pow(100,D);
    //for (int i = 0; i < D; i++) S *= 100;
	if(N == 100){
      N ++;
    }
   cout << (long int) (N *pow(100,D)) << endl;
	return 0;
}

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

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

template <typename T>
inline void chkmax(T &x, T y) { if (x < y) x = y; }

template <typename T>
inline void chkmin(T &x, T y) { if (x > y) x = y; }

inline int read() {
  #define nc getchar()
  int x = 0;
  char c = nc;
  while (c < 48) c = nc;
  while (c > 47) x = x * 10 + (c ^ 48), c = nc;
  return x;
  #undef nc
}

typedef long long ll;

int main() {
  int x = read();
  double tmp = acos(-1);
  printf("%lf", 2.0 * tmp * x);
  return 0;
}

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

int main() {
 int long long A,B,K;
  cin >>A >> B >> K ;
  if (K<=A){
    cout << A-K << " "<< B ;
  }
  else if (K>=(A+B)){
    cout << 0 << " "<<0;
    
  }
  else {
    cout << 0 << " "<< B+A-K;
  }
 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve() {
		UL N, A, B; cin >> N >> A >> B;
		UL D = B - A;
		if (D % 2 == 0) cout << "Alice" << endl;
		else cout << "Borys" << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}

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

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

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            long[] array = ReadLongs();
            long money = 1000;
            long stock = 0;
            for (int i = 0; i < n - 1; i++)
            {
                money += stock * array[i];
                stock = 0;
                if (array[i] < array[i + 1])
                {
                    stock += money / array[i];
                    money %= array[i];
                }
            }
            money += stock * array[n - 1];
            WriteLine(money);
        }

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


Measured memory_bytes: 27512
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int i,b[256]={0},l;
    int p,q,r;
    char s[131072];
    scanf("%s",s);
    l=strlen(s);
    for(i=0;i<l;i++){b[s[i]]++;}
    p=b['a'];
    q=b['b'];
    r=b['c'];
    if(max(zt(p,q),max(zt(p,r),zt(q,r))) >= 2){printf("NO\n");}else{printf("YES\n");}
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)

#include <algorithm>
using namespace std;
#include <cmath>
#include <string>
#include<vector>
#define elif else if
#define pb push_back
typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 200005
// #define int long long

signed main(){
    int N;
    int M;
    cin>>N>>M;
    ll diff[TENFIVE]={0};
    int X[TENFIVE]={0};
    rep(i,M){
        cin>>X[i];
       
    }
    

    ll ans = 0;
    if(N<M){
    
        sort(X,X+M);
        rep1(i,M){
            diff[i] = abs(X[i]-X[i-1]);
        }

        sort(diff,diff+M);
        rep(i,M-N+1)ans+=diff[i];

    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 2560
// ABC146-D
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
namespace you {
    std::string to_string(char val) {
        return std::string(1, val);
        // return std::string{val};
        // you::to_string(char)
    }
}

int num=pow(10,5)+2;
vector<vector<int>> node(num+1);
vector<vector<int>> hen(num+1);
vector<int> col(num);
vector<int> seen(num+1);
vector<int> setu(num+1,0);

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int n;
    cin>>n;
    struct local{
        static void dfs(int x,int c){
            seen[x]=1;
            int color=1;
            //int kaburi=0;
            for(int i=0;i<setu[x];i++){
                if(seen[node[x][i]]==1){
                    continue;
                }
                if(color==c) color+=1;
                col[hen[x][i]]=color;
                dfs(node[x][i],color);
                color+=1;
            }
        }
    };
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        node[a].push_back(b);
        node[b].push_back(a);
        hen[a].push_back(i);
        hen[b].push_back(i);
        setu[a]+=1;
        setu[b]+=1;
    }
    //cout<<node<<endl;
    int max_=0;
    rep(i,n+1){
        if(max_<setu[i]) max_=setu[i];
    }
    //cout<<max_<<endl;
    local::dfs(1,0);
    cout<<max_<<endl;
    for(int i=0;i<n-1;i++){
        cout<<col[i]<<endl;
        //cout<<node[i]<<endl;
    }
    return 0;
}

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

int main(void){
  int n; cin >> n;
  vector<int> h(n);
  rep(i,n) cin >> h[i];

  vector<int> dp(n,0);
  rep(i,n){
    if(i>=2) dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]));
    else if(i==1) dp[1] = dp[0]+abs(h[1]-h[0]);
  }

  cout << dp[n-1] << endl;
  
  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

class Main {
  public static void main(String[] args){
    int A;
    int B;
//ここから標準入力のやつ
    Scanner sc = new Scanner(System.in);

    A = sc.nextInt();
    B = sc.nextInt();
//ここまで標準入力のやつ
    if(A > 8 || B >8){
      System.out.println(":("); //AかBのどっちかが8より大きいとダメ
    }else{
      System.out.println("Yay!"); //そうでなければ大丈夫
    }
  }
}


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

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

  int n = 0, max_n = 0;
  for (int i = 0; i < 3; i++) {
    if (s[i] == 'R' && n == 2)
      max_n = 3;
    else if (s[i] == 'R' && n != 2) {
      n++;
      max_n = n;
    } else if (s[i] != 'R') {
      max_n = max(max_n, n);
      n = 0;
    }
  }
  cout << max_n << endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> arr(n);
  bool judge = true;
  for (int i = 0; i < n; i++)
    cin >> arr.at(i);
  sort(arr.begin(), arr.end());
  for (int i = 1; i < n; i++){
    if (arr.at(i) == arr.at(i-1)){
      judge = false;
      break;
    }
  }
  
  if (judge)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
    
}


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

#define rep(i, j, n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
#define Puts(x) puts(x? "Yes":"No")
const int mod = 1e9 + 7;

typedef long long i64;
typedef pair<int, int> pi;

template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;

i64 gcd(int n, int m) {return (m == 0? n : gcd(m, n % m));}
i64 lcm(int n, int m) {return (n / gcd(n, m) * m);}
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
int dy[] = {1, 0, -1, 0, 1, -1, 1, -1};

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

  int n;
  cin >> n;
  vvt<i64> a(n, vt<i64>(n));
  rep(i, 0, n) rep(j, 0, n) cin >> a[i][j];

  vvt<bool> b(n, vt<bool>(n, true));
  rep(k, 0, n) {
    rep(i, 0, n) {
      rep(j, 0, n) {
        if(a[i][j] > a[i][k] + a[k][j]) return cout << -1 << endl, 0;
        if(a[i][j] == a[i][k] + a[k][j] && i != k && j != k) b[i][j] = false;
      }
    }
  }

  i64 ans = 0;
  rep(i, 0, n) {
    rep(j, i + 1, n) {
      if(b[i][j]) ans += a[i][j];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
       
using namespace std;
       
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
 
// #define MAX 100010
 
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES


int n,m;
int zz[30];
long long int total_sum = -1;
long long int ans = -1;
void solve(int a,int b,int c)
{
    if(a>n)
        return;
    if(a>total_sum)
    {
        total_sum = a;
        ans = b;
    }
    if(c>=m)
        return;
    solve(a+zz[c],b|(1<<c),c+1);
    solve(a,b,c+1);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // #ifndef ONLINE_JUDGE
        // freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    // #endif
    int n,m;
    cin>>n>>m;
    char a[n][n];
    char b[m][m];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            char c;
            cin>>c;
            a[i][j]=c;
        }
    }
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>b[i][j];
        }
    }
    bool poss = false;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            int c= 0;
            if(a[i][j]==b[0][0])
            {
                for(int k=0;k<m;k++)
                {
                    for(int l=0;l<m;l++)
                    {
                        if(i+k>=n||j+l>=n)
                            break;
                        if(b[k][l]==a[i+k][j+l])
                            c++;
                    }
                    if(i+k>=n)
                        break;
                }
            }
            if(c==m*m)
                poss = true;
            if(poss)
                break;
        }
        if(poss)
            break;
    }
    if(poss)
        cout<<"Yes";
    else
        cout<<"No";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
const int dy[] = { 1,  1,  1,  1,  1,  2,  2,  2,  3};
const int dx[] = {-2, -1,  0,  1,  2, -1,  0,  1,  0};
const int INF = 1001001001;
const int K = 3;
typedef pair<int, int> P;
struct STATE
{
	int x, y, a, d;
	bool operator <(const STATE &t) const{
		return d > t.d;
	}
};

char grid[256][256];
int d[256][256][2];
void init();

int main()
{
	int w, h;
	while (scanf("%d %d", &w, &h), w + h){
		init();
		w += K; h += K;
		
		vector<P> start;
		for (int i = K; i < h; i++){
			for (int j = K; j < w; j++){
				scanf(" %c", &grid[i][j]);
				if (grid[i][j] == 'S'){
					start.PB(P(i, j));
					grid[i][j] = 127;
				}
				else if (grid[i][j] == 'T'){
					grid[i][j] = 0;
				}
				else if (grid[i][j] >= '1' && grid[i][j] <= '9'){
					grid[i][j] -= '0';
				}
			}
		}
		
		int res = INF;
		priority_queue<STATE> que;
		for (int i = 0; i < start.size(); i++){
			que.push({start[i].first, start[i].second, 1, 0});
			que.push({start[i].first, start[i].second, -1, 0});
		}
		for (; que.size(); que.pop()){
			STATE st = que.top();
			if (d[st.x][st.y][st.a == 1] <= st.d) continue;
			d[st.x][st.y][st.a == 1] = st.d;
			if (st.d >= res) continue;
			if (grid[st.x][st.y] == 0){
				res = st.d;
				break;
			}
			
			//cout << st.x << " " << st.y << endl;
			
			for (int dir = 0; dir < 9; dir++){
				int tx = st.x + dx[dir] * st.a;
				int ty = st.y + dy[dir] * st.a;
				int ta = -st.a;
				int td = st.d + grid[tx][ty];
				if (grid[tx][ty] == 'X') continue;
				que.push({tx, ty, -st.a, td});
			}
		}
		
		if (res != INF) cout << res << endl;
		else cout << "-1" << endl;
	}
	
	return 0;
}

void init()
{
	memset(grid, 'X', sizeof(grid));
	for (int i = 0; i < 256; i++){
		for (int j = 0; j < 256; j++){
			for (int k = 0; k < 2; k++){
				d[i][j][k] = INF;
			}
		}
	}
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
#define mod 1000000007

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

  ll N, M; cin >> N >> M;

  if( abs(N - M) >= 2 ) {
    cout << 0 << endl;
    return 0;
  }

  ll Nfact = 1, Mfact = 1;
  for (int i = 2; i <= N; ++i) {
    Nfact *= i;
    Nfact %= mod;
  }

  for (int i = 2; i <= M; ++i) {
    Mfact *= i;
    Mfact %= mod;
  }

  ll ans;
  if( N == M ) ans = Nfact * Mfact % mod * 2 % mod;
  else ans = Nfact * Mfact % mod;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n;
    cin>>n;
    int ans=0,cnt=0,nxt=1;
    long long temp=n;
    for(long long i=2;i*i<=n;i++){
        while(temp%i==0){
            temp/=i;
            cnt++;
            if(cnt>=nxt){
                ans++;
                cnt=0;
                nxt++;
            }
        }
        cnt=0;
        nxt=1;
    }
    if(temp>1)ans++;
    cout<<ans;
}


Measured memory_bytes: 3636
let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});

let numComp = 0;
process.stdin.on('end', () => {
  const [nums] = content
    .trim()
    .split('\n')
    .slice(1)
    .map(nums => nums.split(' ').map(n => +n));
  mergeSort(nums, 0, nums.length);
  console.log(numComp);
});

// merge in-place
const merge = (nums, left, mid, right) => {
  const l = nums.slice(left, mid);
  const r = nums.slice(mid, right);
  l.push(Infinity);
  r.push(Infinity);
  let i = j = 0;
  for (let k = left; k < right; k++) {
    if (l[i] < r[j]) {
      nums[k] = l[i++];
    } else {
      nums[k] = r[j++];
      numComp += l.length - 1 - i;
    }
  }
};

const mergeSort = (nums, left, right) => {
  if (left + 1 < right) {
    const mid = Math.floor((left + right) / 2);
    mergeSort(nums, left, mid);
    mergeSort(nums, mid, right);
    merge(nums, left, mid, right);
  }
};



Measured memory_bytes: 60852
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    cin>>N;
    int x[N],y[N],h[N];
    int w;
    rep(i,N){
        cin>>x[i]>>y[i]>>h[i];
        if(h[i]>0) w=i;
    }
    for(int i=0;i<=100;i++){
        for(int j=0;j<=100;j++){
            bool z=true;
            int H=h[w]+abs(i-x[w])+abs(j-y[w]);
            rep(k,N){
                if(h[k]!=max(H-abs(i-x[k])-abs(j-y[k]),0LL)){
                    z=false;
                    break;
                }
            }
            if(z){
                cout << i << " " << j << " " << H << endl;
                return 0;
            }
        }
    }



}


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

int main()
{
	vector<int> co(5);
	cin >> co[0] >> co[1] >> co[2] >> co[3] >> co[4];
	int sum = 0;
	int a = 0;
	int max = 0;
	for (int i = 0; i < 5; i++) {
		if (co[i] % 10 != 0) {
			sum += co[i] + (10 - (co[i] % 10));
			a = 10 - (co[i] % 10);
			if (a > max) max = a;
			a = 0;
		}
		else {
			sum += co[i];
		}
	}
	cout << sum - max << endl;

}

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

int main() {
    int w,h,n;
    cin >> w >> h >> n;

    int x,y,a;
    int new_x,new_y;


    for (int i = 0; i < n; i++)
    {
        cin >> x >> y >> a;
        if(a == 1) new_x = max(new_x, x);
        else if(a == 2) w = min(w, x);
        else if(a == 3) new_y = max(new_y, y);
        else if(a == 4) h = min(h, y);
    }

    

    if(w-new_x<0 || h-new_y<0) {
        cout << 0 << endl;
        return 0;
    } 

    int ans = (w-new_x)*(h-new_y);
    cout << ans << endl;
    return 0;

}

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

int main() {
  int N,K;
  cin >> N >> K;
  string S;
  cin >> S;
    if(S.at(K-1) == 'A'){
      S.at(K-1) = 'a';
    }
    if(S.at(K-1) == 'B'){
      S.at(K-1) = 'b';
    }
   if(S.at(K-1)== 'C'){
     S.at(K-1) ='c';
   }
   cout << S;
  
  
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

s = input()
K = INT()


substr = []

for l in range(len(s)):
	r = l+1
	while r < len(s)+1:
		#print(l, r, substr)
		if bisect(substr, s[l:r]) == 5:
			break
		elif s[l:r] in substr:
			r += 1
		elif s[l:r] not in substr:
			insort(substr, s[l:r])
			substr = substr[:5]
			if s[l:r] in substr:
				r += 1


#print(substr)
print(substr[K-1])


Measured memory_bytes: 5200
#include<stdio.h>
#include<string.h>
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define L 1001

int get_LCS(char str1[],char str2[]){
	int L1=strlen(str1); int L2=strlen(str2);
	
	int dp[L1+1][L2+1];
	
	for(int i=0;i<=L1;i++)
		dp[i][0]=0;
	for(int i=0;i<=L2;i++)
		dp[0][i]=0;
	
	for(int i=1;i<=L1;i++){
		for(int j=1;j<=L2;j++){
			if(str1[i-1]==str2[j-1])
				dp[i][j]=dp[i-1][j-1]+1;
			else 
				dp[i][j]=MAX(dp[i-1][j],dp[i][j-1]);
		}
	}
	
	return dp[L1][L2];
}

int main(){
	int n,i;
	char str1[L];
	char str2[L];
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%s",str1);
		scanf("%s",str2);
		
		printf("%d\n",get_LCS(str1,str2));
	}
	
	return 0;
	
}


Measured memory_bytes: 5644
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <string>
#include <cctype>
#include <cstring>
#include <string>
#include <numeric>
#include <functional>
#include <iomanip>
#include <ctime>

using namespace std;

typedef long long LL;
typedef unsigned long long uLL;


int day[33];

double low,high;
LL sum=0;

double P,E,T;
double Tp;
int K;
double res;
void  gao(int u,int ntp,int tp,double R,double L)
{
    double H=(R+L)/2;
    //printf("H=%lf\n",H);

    if(R>=low&&L<=high)
    {
        res+=pow(1-P,ntp)*pow(P,tp);
        return ;
    }
    if(R>high||L<low)return ;

    if(u==K)
    {
        Tp=H;
        if(low<=Tp&&Tp<=high)
        {
            //printf("%d  %d\n", K-tp,tp);
            res+=pow(1-P,ntp)*pow(P,tp);
        }
        return ;
    }
    if( H>=T )
    {
        gao(u+1,ntp+1,tp,R,H);

        gao(u+1,ntp,tp+1,H,L);
    }
    else
    {
        gao(u+1,ntp,tp+1,R,H);

        gao(u+1,ntp+1,tp,H,L);
    }
}
double R,L;
int main()
{


    while(~scanf("%d%lf%lf",&K,&R,&L))
    {
        scanf("%lf%lf%lf",&P,&E,&T);


        low=max(0.0,T-E);
        high=T+E;
        res=0;
        gao(0,0,0,R,L);

        printf("%lf\n",res);
    }

    return 0;
}

Measured memory_bytes: 0
n = gets.to_i

s={}
n.times do
 str = gets.strip
 s[str] = s[str] ? s[str]+1 : 1
end

m = gets.to_i
m.times do
 str = gets.strip
 s[str] = s[str] ? s[str]-1 : -1
end

res = s.sort_by{ |_, v| v }.reverse
if res[0][1] > 0 then
  puts res[0][1].to_s
else
  puts "0"
end


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <tuple>
#include <algorithm>
#include <array>
using namespace std;
using ll = long long;
#define rep(i,n) for(decltype(n) i=0; i<n; ++i)
inline constexpr ll Inf = (1ULL << 62) -1;

template <class T>
void updatemax(T& a, T b) { if (b > a) a = b; }

int main() {
    ll N;
    string c;
    cin >> N >> c;
    ll red = count(c.begin(), c.end(), 'R');
    ll white = 0;
    ll ans=N;
    rep(s, N+1) {
        ans = min(ans, max(white,red));
        if (s == N)
            break;
        if (c[s] == 'R') {
            --red;
        } else {
            ++white;
        }
    }

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


Measured memory_bytes: 3448
#include<stdio.h>
#include<stdlib.h>
int main(){
  int n,m,i,j;
  scanf("%d%d",&n,&m);
  int a[n+1][2],c[m+1][2],num[n+1][2];
  for(i=0;i<n;i++)
    scanf("%d%d",&a[i][0],&a[i][1]);
  for(i=0;i<m;i++)
    scanf("%d%d",&c[i][0],&c[i][1]);
  for(i=0;i<n;i++){
    num[i][0]=1;
    num[i][1]=abs(a[i][0]-c[0][0])+abs(a[i][1]-c[0][1]);
    for(j=1;j<m;j++){
      if(num[i][1]>abs(a[i][0]-c[j][0])+abs(a[i][1]-c[j][1])){
        num[i][0]=j+1;
        num[i][1]=abs(a[i][0]-c[j][0])+abs(a[i][1]-c[j][1]);
      }
    }
  }
  for(i=0;i<n;i++)
    printf("%d\n",num[i][0]);
  return 0;
}

Measured memory_bytes: 1732
#include<iostream>
#include<vector>
#include<queue>

using namespace std;

int n;
int in_degree[100009];
vector<int> N[100009];


void topological_sort(){
    queue<int> Q;
    for(int i=0;i<n;i++){
        if(in_degree[i]==0){
            Q.push(i);
        }
    }
    while(!Q.empty()){
        int fr=Q.front();Q.pop();
        cout << fr << endl;
        for(int i=0;i<N[fr].size();i++){
            in_degree[N[fr][i]]--;
            if(in_degree[N[fr][i]]==0){
                Q.push(N[fr][i]);
            }
        }
    }

}

int main(){
    int e, s, t;
    cin >> n >> e;
    for(int i=0;i<e;i++){
        cin >> s >> t;
        N[s].push_back(t);
        in_degree[t]++;
    }
    topological_sort();
}


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

using namespace std;

typedef long long ll;

int solve(){
    string s;
    cin >> s;
    int l = s.size();
    for(int i = 0; i < l - 1; i++){
        if(s[i] == s[i + 1]){
            return cout << i + 1 << " " << i + 2 << "\n", 0;
        }
    }
    for(int i = 0; i < l - 2; i++){
        if(s[i] == s[i + 2]){
            return cout << i + 1 << " " << i + 3 << "\n", 0;
        }
    }
    cout << -1 << " " << -1 << "\n";
 }

int main() {
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}



Measured memory_bytes: 512
# Try AtCoder
# author: Leonardone @ NEETSDKASU

a, b, c = gets.strip.split.map &:to_i


cnt = 0
while a.even? && b.even? && c.even?
    a2 = a / 2
    b2 = b / 2
    c2 = c / 2
    a = b2 + c2
    b = a2 + c2
    c = a2 + b2
    cnt += 1
    if cnt > 1000
        puts -1
        exit
    end
end

puts cnt

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <stack>

using ll = long long;

int main() {
    int N;
    ll K;
    std::cin >> N >> K;
    std::map<ll, ll> arr;
    for (int i = 0; i < N; i++) {
        int A, B;
        std::cin >> A >> B;
        arr[A] += B;
    }

    ll cnt = 0;
    for (auto& it : arr) {
        cnt += it.second;
        if (cnt >= K) {
            std::cout << it.first << std::endl;
            return 0;
        }
    }

}

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

int main(){
    int A, B, ans;
  	cin >> A >> B;
    if(A>B){
      ans = 2*A -1;
    }else if(B>A){
      ans = 2*B -1;
    }else{
      ans = A+B;
    }
  cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

class InversionCount {
public:
    InversionCount(vector<ll> target) : target_(target) {}
    ll count(ll left = 0, ll right = -1) {
        if (right < 0) {
            //rはtarget_.size()で初期化
            right = target_.size();
        }
        if (right <= left + 1) {
            return 0;
        }
        ll mid = (left + right) / 2;
        ll result = 0;
        //左半分を数える
        result += count(left, mid);

        //右半分を数える
        result += count(mid, right);

        //左右またぐ数を数える
        result += merge(left, mid, right);

        return result;
    }
private:
    ll merge(ll left, ll mid, ll right) {
        vector<ll> l, r;
        for (ll i = left; i < mid; i++) {
            l.push_back(target_[i]);
        }
        for (ll i = mid; i < right; i++) {
            r.push_back(target_[i]);
        }
        //番兵
        l.push_back(LLONG_MAX);
        r.push_back(LLONG_MAX);

        ll left_index = 0;
        ll right_index = 0;
        ll result = 0;
        for (ll i = left; i < right; i++) {
            if (l[left_index] <= r[right_index]) {
                target_[i] = l[left_index];
                left_index++;
            } else {
                target_[i] = r[right_index];
                right_index++;
                result += ((mid - left) - left_index);
            }
        }
        return result;
    }

    vector<ll> target_;
};

int main() {
    ll N;
    cin >> N;
    vector<ll> a(N);
    for (ll i = 0; i < N; i++) {
        cin >> a[i];
    }

    auto medianNum = [&](ll x) {
        vector<ll> b(N + 1, 0);
        for (ll i = 0; i < N; i++) {
            b[i + 1] = (a[i] >= x ? 1 : -1) + b[i];
        }
        InversionCount ic(b);
        return N * (N + 1) / 2 - ic.count();
    };

    ll ok = 0, ng = INT_MAX;
    while (ok + 1 != ng) {
        ll mid = (ok + ng) / 2;
        ll num = medianNum(mid);
        (2 * num >= N * (N + 1) / 2 ? ok = mid : ng = mid);
    }
    cout << ok << endl;
}

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

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if((a == b && b == c ) || (a!= b && b != c && c != a))
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
n,m = map(int, input().split())
abl = []
cdl = []
for _ in range(n):
    a,b = map(int, input().split())
    abl.append((a,b))

for _ in range(m):
    c,d = map(int, input().split())
    cdl.append((c,d))


for a,b in abl:
    cmin = 10**10
    mini = -1
    for i,(c,d) in enumerate(cdl):
        v = abs(a-c)+abs(b-d)
        if v < cmin:
            cmin = v
            minc,mind = c,d
            mini = i+1
    print(mini) 

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

int imax=2147483647;
long long int llimax=9223372036854775807;

//int型vectorを出力
void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

//LLi型vectorを出力
void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

int main(){

	int d, ans=0;
	vector<int> c, t, ld, at;
	vector< vector<int> >s;

	cin>> d;

	c.resize(26);
	rep(i, 26) cin>> c[i];
	s.resize(d);
	rep(i, d){
		s[i].resize(26);
		rep(j, 26) cin>> s[i][j];
	}
	t.resize(d);
	at.resize(d);
	rep(i, d){
		int tmp=1, ma=-1;
		rep(j, 26){
			if(ma<s[i][j]){
				tmp=j;
				ma=s[i][j];
			}
		}
		t[i]=tmp+1;
	}

	rep(i, 364){
		cout<< t[i] <<endl;
	}
	cout<< t[364];

	return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
using in = int64_t;

int main(){
string a;
  int n;
  cin>>n>>a;
  
  int x= a.size();
  vector<char> b(x);
  rep(i,x) b.at(i)=a.at(i)+n;
  
  rep(i,x)
    if(b.at(i)>'Z') b.at(i) -='Z'-'A'+1;
  
  rep(i,x) cout<<b.at(i);
  
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

int main() {
	int N;
	cin >> N;
	string S;
	cin >> S;
	int ans = 0;
	for (int i = 0; i < N - 2; i++) {
		if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C') {
			ans++;
		}
		else continue;
	}
	cout << ans << endl;
}

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

typedef long long ll;

#define pb push_back
#define mp make_pair
#define forn(n) for(int i=0; i < n; i++)
#define MOD 1000000007
#define endl '\n'

template<typename T>
void max_self(T& a, T b) { a=a>b?a:b; }
template<typename T>
void min_self(T& a, T b) { a=a<b?a:b; }

using namespace std;
#define int long long

const int mxN = 100005;
int n;
int w;

int temp_weight, temp_value;

int min_weight[100005]; // the min_weight[i] = minimum weight to achieve value i
// min_weight[val+temp_value] = min(itself, min_weight[val]+temp_weight);

#undef int
int main() {
#define int long long
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> w;

    memset(min_weight, 0x3f, sizeof(min_weight));
    min_weight[0]=0;
    min_weight[0]=0;
    while(n--) {
        cin >> temp_weight >> temp_value;
        for(int i=mxN-1-temp_value; i>=0; --i)
            min_self(min_weight[i+temp_value], min_weight[i]+temp_weight);
    }

    int curr_max = 0;
    for(int i=0; i<mxN; ++i)
        if(min_weight[i]<=w&&i>curr_max) curr_max = i;

    cout << curr_max << endl;

    return 0;

}



Measured memory_bytes: 1024
#include <stdio.h>

int main(){
  int day;
  int i, j, k;
  int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
  char week[7][20] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};
  while(scanf("%d %d", &i, &j) != EOF){
    if(i == 0 && j == 0){
      break;
    }
    day = 0;
    for(k=0;k<i-1;k++){
      day += month[k];
    }
    day += j;
    day = day % 7;
    printf("%s\n", week[day]);
  }
  return 0;
}

Measured memory_bytes: 584
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

diff = [0] * N
for n in range(N):
    ave_temperature = T - H[n] * 0.006
    diff[n] = abs(A - ave_temperature)

print(diff.index(min(diff)) + 1)


Measured memory_bytes: 3060