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

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

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

int main() {
	string s;
	cin >> s;
	int n = s.length()+1;
	vector<int> t(n);
	t[0] = 0;
	rep(i,n) {
		if(i == 0) {
			if(s[0] == '<') {
				t[0] = 0;
			}
			continue;
		}
		if(i == n-1) {
			if(s[n-2] == '<') {
				t[i] = t[i-1]+1;
			}
			continue;
		}
		if(s[i-1] == '>' && s[i] == '<') {
			t[i] = 0;
		}
		else if (s[i-1] == '<') {
			t[i] = t[i-1] + 1;
		}
	}
	/*rep(i,n) {
		cout << t[i] << " ";
	}
	cout << endl;*/
	for(int i=n-1; i >= 0; i--) {
		if(i == n-1) {
			if(s[i-1] == '>') {
				t[i] = 0;
				continue;
			}
			else continue;
		}
		if(i == 0) {
			if(s[0] == '>') t[0] = t[1] + 1;
			continue;
		}
		if(s[i-1] == '<' && s[i] == '>') {
			t[i] = max(t[i], t[i+1]+1);
		}
		else if(s[i] == '>') {
			t[i] = t[i+1]+1;
		}
	}
	/*rep(i,n) {
		cout << t[i] << " ";
	}
	cout << endl;*/
	ll ans = 0;
	rep(i,n) ans += t[i];
	/*int mtmaxi = -1, ltmaxi = -1;
	rep(i,n) {
		chmax(mtmaxi, mt[i]);
		chmax(ltmaxi, lt[i]);
	}
	bool flag = mtmaxi > ltmaxi;
	if(flag) {

	}*/
	/*cout << "mini " << mini<< endl;
	rep(i,n) {
		cout << t[i] << " ";
	}
	cout << endl; */
	/*rep(i,n) {
		t[i] -= mini;
	}
	ll ans = 0;
	rep(i,n) {
		ans += t[i];
	}*/
	cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2820
NN=raw_input()
N=raw_input()
N = [int(i) for i in N.split()]
print ' '.join([str(k) for k in N])

for i in range(1,int(NN)):
    key = N[i]
    j = i - 1
    while (j >= 0) and (N[j] > key):
        N[j+1] = N[j]
        j=j-1
    N[j+1] = key
    print ' '.join([str(k) for k in N])

Measured memory_bytes: 4652
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int n=in();
  vi d(n);
  rep(i,n) cin >> d[i];
  sort(all(d));
  int a=d[d.size()/2-1];
  int b=d[d.size()/2];
  int ret;
  if(a==b) ret = 0;
  else ret = b-a;
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 640
/*
SHERAJUL ARIFIN
Dept. of CSE,
IUT.
*/

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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    long long int n,b,r;
    cin>>n>>b;
    vector<int>v;
    while(n!=0)
    {
        r=n%b;
        v.push_back(r);
        n/=b;
    }
    cout<<v.size();




    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include <math.h> 

using namespace std;

#define ll long long int
#define rep(i, n) for(int i = 0; i < n; i++)
#define repp(i, n) for(int i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
using vi = vector<int>;
const int MOD = 1e9 + 7;

bool IsPrime(int num){
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) return false; }
    return true;
}


int main() {
    ll x;
    cin >> x;
    ll a, b;
    a = x / 11;
    b = x % 11;
    if (b == 0) cout << 2 * a << endl;
    else if (b > 0 && b <= 6) cout << 2 * a + 1 << endl;
    else if (b>6) cout << 2 * a + 2 << endl;

}

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

long long n, ans=0;
vector<pair<long long, long long> >a[16];

int main(){
	cin >> n;
	for (int i=0;i<n;i++){
		long long s;
		cin >> s;
		for (int j=0;j<s;j++){
			long long tmp1, tmp2;
			cin >> tmp1 >> tmp2;
			a[i].push_back({tmp1, tmp2});
		}
	}
	for (long long i=0;i<(1<<n);i++){
		bool cek=1;
		for (long long j=0;j<n;j++){
			if (i&((long long)1<<j)){
				for (int k=0;k<(int)a[j].size();k++){
					if (a[j][k].second!=((i&(long long)1<<(a[j][k].first-1))>0 ? 1 : 0)) cek=0;
				}
			}
		}
		if (cek) ans=max(ans,(long long)__builtin_popcount(i));
	}
	cout << ans << "\n";
}

Measured memory_bytes: 256
n = int(raw_input())
out_str = ""
for i in range(1,n+1):
    x = i
    if x % 3 == 0:
        out_str += " " + str(i)
        continue
    while x:
        if x % 10 == 3:
            out_str += " " + str(i)
            break
        x /= 10
print out_str

Measured memory_bytes: 6616
from collections import *
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

class Dinic():
    def __init__(self, n, s, t):
        self.n, self.s, self.t = n, s, t
        self.to = defaultdict(list)
        self.level = [-1]
        self.max_flow = -1

    def add_edge(self, u, v, cap):
        u_index_in_to_v = len(self.to[v])
        v_index_in_to_u = len(self.to[u])
        self.to[u].append([v, cap, u_index_in_to_v])
        self.to[v].append([u, 0, v_index_in_to_u])

    # 無向辺の追加
    def add_undir_edge(self, u, v, cap):
        u_index_in_to_v = len(self.to[v])
        v_index_in_to_u = len(self.to[u])
        self.to[u].append([v, cap, u_index_in_to_v])
        self.to[v].append([u, cap, v_index_in_to_u])

    def set_level(self):
        s = self.s
        level = [-1] * self.n
        level[s] = 0
        q = deque()
        q.append([s, 0])
        while q:
            u, u_level = q.popleft()
            for v, cap, _ in self.to[u]:
                if cap == 0: continue
                if level[v] != -1: continue
                level[v] = u_level + 1
                if v == self.t:
                    self.level = level
                    return True
                q.append([v, u_level + 1])
        return False

    def dfs(self, u=-1, flow_to_me=10 ** 16):
        if u == -1: u = self.s
        if u == self.t: return flow_to_me
        flow_from_me = 0
        u_level = self.level[u]
        for utov_i, (v, cap, vtou_i) in enumerate(self.to[u]):
            if self.level[v] != u_level + 1: continue
            if cap == 0: continue
            flow_to_v = self.dfs(v, min(cap, flow_to_me - flow_from_me))
            if not flow_to_v: continue
            flow_from_me += flow_to_v
            self.to[u][utov_i][1] -= flow_to_v
            self.to[v][vtou_i][1] += flow_to_v
        return flow_from_me

    def calculation(self):
        res = 0
        while self.set_level():
            res += self.dfs()
        return res

    # これが出力用
    def get_max_flow(self):
        if self.max_flow == -1:
            self.max_flow = self.calculation()
        return self.max_flow

h,w=MI()
aa=[input() for _ in range(h)]

def main():
    inf=10**9+7
    s=h+w
    t=h+w+1
    mc=Dinic(h+w+2,s,t)
    si,sj,ti,tj=-1,-2,-3,-4
    for i,row in enumerate(aa):
        for j,a in enumerate(row):
            if a=="S":
                if i==ti or j==tj:
                    print(-1)
                    exit()
                si,sj=i,j
                mc.add_edge(s,i,inf)
                mc.add_edge(s,j+h,inf)
            elif a=="T":
                if i==si or j==sj:
                    print(-1)
                    exit()
                ti,tj=i,j
                mc.add_edge(i,t,inf)
                mc.add_edge(j+h,t,inf)
            elif a=="o":
                mc.add_undir_edge(i,j+h,1)
    print(mc.get_max_flow())

main()

Measured memory_bytes: 5492
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.Map.Entry;

public class Main{
	
	public static void main(String[] args) throws IOException{
		//File file = new File("input.txt");
		//Scanner in = new Scanner(file);
		Scanner in = new Scanner(System.in);
		
		int N = in.nextInt();
		ArrayList<int[]> list1 = new ArrayList<>();
		for(int i = 0; i < N; i++){
			int index = i;
			int x = in.nextInt();
			int[] p = {index, x};
			list1.add(p);
		}
		Collections.sort(list1, (p1,p2)->Integer.compare(p1[1],p2[1]));
		
		ArrayList<int[]> list2 = new ArrayList<>();
		int m1 = list1.get(N / 2 - 1)[1], m2 = list1.get(N / 2)[1];
		
		for(int i = 0; i < N; i++){
			int[] p = list1.get(i);
			int index = p[0];
			int mx;
			if(i <= N / 2 - 1) mx = m2;
			else mx = m1;
			int[] pp = {index, mx};
			list2.add(pp);
		}
		Collections.sort(list2, (p1,p2)->Integer.compare(p1[0],p2[0]));
		
		for(int[] p : list2) System.out.println(p[1]);
	}
}


Measured memory_bytes: 102984
#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <set>

#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define MOD 1000000007

using namespace std;

int pow_mod(int a, int b, int p) {
	if (b == 0)return 1;
	else if (b % 2 == 0)return (pow_mod(a*a, b / 2, p) % p);
	else return (pow_mod(a, b - 1, p)*a%p);
}

int factorial_mod(int a, int p) {
	if (!a)return 1;
	else return a * factorial_mod(a - 1, p) % p;
}

int sum_digit(int N) {
	int ans = 0;
	for (; N != 0;) {
		ans += N % 10;
		N /= 10;
	}
	return ans;
}

int N;
string s;

int cnt_e[300300] = { 0 };

int main(){
	scanf("%d", &N);
	cin >> s;
	rep(i, N) {
		if (i)cnt_e[i] = cnt_e[i - 1];
		if (s[i] == 'E')cnt_e[i]++;
	}
	int ans = cnt_e[N - 1] - cnt_e[0];
	for (int i = 1; i < N; i++) {
		ans = min(ans, i + cnt_e[N - 1] - cnt_e[i] - cnt_e[i - 1]);
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 1796
#include <bits/stdc++.h>
using namespace std;
int main()
{
	map<string,int> m;
	int n;
	cin>>n;
	for(int i = 0; i < n; i++){
		string str;
		cin>>str;
		m[str]++;
	}
	cout<<m.size()<<endl;
	return 0;
}

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

//Made with <3 by MinumCoklatPanas
typedef long long ll;
const int INF = 1e9;
const ll INFF = 1e18;
const int MAXN = 510;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double INFD = 1E9;
const double EPS = 1e-9;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;
    return 0;
}

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

long long int mod = 1000000007;

void Main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n + 1, 1);
  for (int i = 0; i < m; i++) {
    int tmp;
    cin >> tmp;
    a[tmp] = 0;
  }

  vector<long long> dp(n + 1);
  dp[0] = 1;
  for (int now = 0; now < n; now++) {
    for (int next = now + 1; next <= min(n, now + 2); next++) {
      if (a[next]) {
        dp[next] += dp[now];
        dp[next] %= mod;
      }
    }
  }
  cout << dp[n] << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node {
  int parent,left,right;
};

void setdepth(int,int);
int setheight(int);
int sibling(int);
void print(int);


struct Node A[MAX];
int n,B[MAX],C[MAX];

int main(){
  int i,a,b,c,root;
  root=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    A[i].parent=NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d %d %d",&a,&b,&c);
    A[a].left = b;
    A[a].right=c;
    if(b != NIL){
      A[b].parent=a;
    }
    if(c != NIL){
      A[c].parent = a;
    }
  }
 for(i=0;i<n;i++){
      if(A[i].parent == NIL){
        root = i;
      }
    }
    setdepth(root,0);
    setheight(root);
    for(i=0;i<n;i++){
      print(i);
    }
 return 0;
  }


void setdepth(int p,int q){
  if(p == NIL){
    return;
  }
  B[p]=q;
  setdepth(A[p].left,q+1);
  setdepth(A[p].right,q+1);
}
int setheight(int r){
  int l,m;
  l=0;
  m=0;
  if(A[r].left != NIL){
    l = setheight(A[r].left) + 1;
}
  if( A[r].right != NIL){
    m = setheight(A[r].right) + 1;
  }
  return C[r] = (l > m ? l : m);
}

int sibling(int s){
  if(A[s].parent == NIL)return NIL;
  if(A[A[s].parent].left != s && A[A[s].parent].left != NIL)return A[A[s].paren\
t].left;
  if(A[A[s].parent].right != s && A[A[s].parent].right != NIL)return A[A[s].par\
ent].right;
  return NIL;
}
void print(int t){
  int d;
  d=0;
  printf("node %d: ", t);
  printf("parent = %d, ", A[t].parent);
  printf("sibling = %d, ",sibling(t));
  if(A[t].left != NIL)d++;
  if(A[t].right != NIL)d++;
  printf("degree = %d, ", d);
  printf("depth = %d, ", B[t]);
  printf("height = %d, ", C[t]);
  if(A[t].parent == NIL){
 printf("root\n");
  }  else if(A[t].left == NIL && A[t].right == NIL){
    printf("leaf\n");
  }
  else{
    printf("internal node\n");
  }
}




Measured memory_bytes: 2148
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e8;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用


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

	int a, b;
	cin >> a >> b;

	int kuti = 1;
	int ko = 0;
	while (true)
	{
		if (kuti >= b)
		{
			break;
		}
		kuti--;
		kuti += a;
		ko++;
	}

	cout << ko << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll n;
  cin >> n;
  vector<ll> vec(n+1, 0);
  ll ans = 0;
  for(ll i = 1; i <= n; i++) {
    for(ll j = i; j <= n; j += i) {
      vec.at(j)++;
    }
  }
  
  for(ll i = 1; i <= n; i++) {
    ans += i * vec.at(i);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 81392
n = int(input())
l_list = list(map(int,input().split()))
#sorted_list = sorted(l_list,reverse = True)
num_len = len(l_list)
count = 0
for i in range(num_len):
    for j in range(i+1,num_len):
        for k in range(j+1,num_len):
            temp_list = sorted([l_list[i],l_list[j],l_list[k]])
            if len(set(temp_list))<3:
                continue
            elif temp_list[2]-temp_list[1]-temp_list[0]<0:
                count+=1
                #print((i,j,k))
print(count)

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

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

int pre[100005];
vector<int> elist[100005];

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, m; gi(n), gi(m);
	rep(i, m) {
		int u, v; gi(u), gi(v);
		elist[u].pb(v);
		elist[v].pb(u);
	}
	memset(pre, -1, sizeof pre);
	pre[1] = 0;
	queue<int> bq; bq.push(1);
	while(!bq.empty()) {
		int u = bq.front(); bq.pop();
		for(int& v:elist[u]) if(pre[v] == -1) {
			pre[v] = u;
			bq.push(v);
		}
	}
	pstr("Yes\n");
	iter(i, 2, n+1) print(pre[i]), pc('\n');
}


Measured memory_bytes: 13024
#include <bits/stdc++.h>
using namespace std;
int n,p[30],ans;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin >> n;
    for(int i = 0;i < n; ++i) cin >> p[i];
    for(int i = 1;i < n-1; ++i){
        if(p[i] > p[i-1] && p[i] < p[i+1]
            || p[i] < p[i-1] && p[i] > p[i+1]) ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)

function main()
  R, G, B, N = map(parseInt, split(readline()))

  R, G, B = sort([R,G,B],rev=true)
  GB=lcm(G,B)
  # RGB=lcm(R,GB)

  c = 0
  for r=0:div(N,R)
    c′=0
    N′=N-R*r
    gb′ =0
    for gb=div(N′,GB):-1:0
      N″=N′-GB*gb
      for g=0:div(N″,G)
        if (N″-G*g)%B==0
          c′+=1
        end
      end
      if c′>0
        gb′=gb
        break
      end
    end
    c+=c′*(gb′+1)
  end
  println(c)
end

main()


Measured memory_bytes: 173860
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <stack>
#include <map>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<string> da(n);
    for(int i=0;i<n;i++){
        cin >> da[i];
    }
    vector<vector<int>> co(n,vector<int>(26,0));
    for(int i=0;i<n;i++){
        for(int j=0;j<10;j++){
            co[i][da[i][j]-'a']++;
        }
    }
    map<vector<int>,long long> m;
    long long ans=0;
    for(int i=0;i<n;i++){
        if(m.count(co[i])){
            m[co[i]]++;
        }
        else{
            m[co[i]]=1;
        }
    }
    for(auto i:m){
        ans=(long long)ans+i.second*(i.second-1)/2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 39296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N;
vector<ll> c(500);
vector<ll> s(500);
vector<ll> f(500);

ll dfs(ll t, ll n){
  if(n+1==N)return t;
  ll tmp;
  if(t%f[n]==0)tmp=0;
  else tmp = (f[n]-t%f[n]);
  if(s[n]<=t)t += tmp+c[n];
  else t += s[n]-t+c[n];
  return dfs(t, n+1);
}

int main(){
  cin>>N;
  for(ll i=0;i<N;i++){
    cin >> c[i] >> s[i] >> f[i];
  }
  for(ll i=0; i<N; i++){
    cout << dfs(0,i) << endl;
  }
}

Measured memory_bytes: 256
/*
 *Author : zsenshi
 DP 
 */
#include <bits/stdc++.h> //Only for gcc compilers
#define mt make_tuple
#define eb emplace_back
#define pb push_back
#define dg(x) cout << #x << ":"<<x<<endl
#define dg2(x,y) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<endl
#define dg3(x,y,z) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<endl
#define dg4(x,y,z,zz) cout<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<' '<<#zz<<':'<<zz<<endl
#define rep(i,begin,end) for(__typeof(end) i = (begin)-((begin) > (end)); i != (end) - ((begin) > (end)); i += 1-2*((begin) > (end)))
using namespace std;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vector<pii>> vvpi;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> a(n-1);
  for(int i = 0; i < n-1; i++){
    cin >> a[i];
  }
  int sum = a[0];
  for(int i = 1; i < n-1; i++){
    sum += min(a[i],a[i-1]);
  }
  sum += a[n-2];
  cout << sum << "\n";
}


Measured memory_bytes: 256
import numpy as np

n = int(input())
A = list(map(int, input().split()))

dp = [[0, 0] for i in range(n+1)]
dp[0][1] = -np.inf

for i in range(n):
    dp[i+1][0] = max(dp[i][0] + A[i], dp[i][1] - A[i])
    dp[i+1][1] = max(dp[i][0] - A[i], dp[i][1] + A[i])

print(dp[n][0])


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

#define ll long long
int n,mx=-1,ans;
map<int,int> m;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	for(int i=1;i<=100;i++){
		int temp = i, cnt = 0;
		while(temp % 2 == 0){
			temp /= 2;
			cnt++;
		}
		m[i] = cnt;
	}
	cin>>n;
	for(int i=1;i<=n;i++){
		if(m[i] > mx){
			mx = m[i];
			ans = i;
		}
	}
	cout<<ans;
	return 0;
}

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

int main() {
	int n=0;
	cin >> n;
	if (n % 10 == 2 || n % 10 == 4 || n % 10 == 5 || n % 10 == 7 || n % 10 == 9) {
		cout << "hon" << endl;
	}
	else if (n % 10 == 0 || n % 10 == 1 ||  n % 10 == 6 || n % 10 == 8) {
		cout << "pon" << endl;
	}
	else {
		cout << "bon" << endl;
	}
}

Measured memory_bytes: 3632
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  int n,r;
  cin >> n >> r;

  if(n>=10){
    cout << r << endl;
  }
  else {
    cout << (r + 100*(10-n)) << endl;
  }


return 0;
}
///....


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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

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

	vector<int> unhappy;
	rep(i, 26){
		int a;
		cin >> a;
		unhappy.push_back(a);
	}

	vector<vector<int>> input;
	rep(i, D){
		vector<int> v;
		rep(i, 26){
			int a;
			cin >> a;
			v.push_back(a);
		}
		input.push_back(v);
	}

	vector<int> last(D, 0);
	vector<int> ans;

	rep(i, D){
		long long int hmax = LONG_MIN;
		int tmp = 0;

		rep(j, 26){
			long long int unh = 0;

			rep(k, 26){
				if(k == j) continue;
				unh += unhappy[k] * (i + 1 - last[k]);
			}

			if(hmax < input[i][j] - unh){
				hmax = input[i][j] - unh;
				tmp = j;
			}
		}

		ans.push_back(tmp);
		last[tmp] = i;
	}

	rep(i, D){
		cout << ans[i] + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 3696
let () = Scanf.scanf "%d %d %d\n" @@ fun r c k ->
  let vss = Array.make_matrix (r + 1) (c + 1) 0 in
  for i = 0 to k - 1 do
    Scanf.scanf "%d %d %d\n" @@ fun r c v ->
      vss.(r).(c) <- v
  done;
  let dp =
    Array.init (r + 1) @@ fun _ ->
      Array.init (c + 1) @@ fun _ ->
        Array.init 4 @@ fun _ -> min_int in
  dp.(1).(1).(0) <- 0;
  for i = 1 to r do
    for j = 1 to c do
      for k = 0 to 3 do
        dp.(i).(j).(0) <- max dp.(i).(j).(0) dp.(i - 1).(j).(k);
        dp.(i).(j).(k) <- max dp.(i).(j).(k) dp.(i).(j - 1).(k)
      done;
      for k = 3 downto 1 do
        dp.(i).(j).(k) <- max dp.(i).(j).(k) (dp.(i).(j).(k - 1) + vss.(i).(j))
      done;
    done
  done;
  Printf.printf "%d\n" @@ Array.fold_left max min_int dp.(r).(c)


Measured memory_bytes: 500748
#include <iostream>
#include <vector>
#define MAX 1e5 + 1

int main() {
    int n, q, temp;
    long long sum = 0;
    std::cin >> n;
    std::vector<int> a(MAX, 0);

    for (int i = 0; i < n; i++) {
        std::cin >> temp;
        a.at(temp)++;
        sum += temp;
    }
    std::cin >> q;
    std::vector<long long> b(q), c(q);
    int x, y;
    for (int i = 0; i < q; i++) {
        std::cin >> b[i] >> c[i];
        // std::cin >> x >> y;
        // b[i] = x;
        // c[i] = y;
    }

    for (int j = 0; j < q; j++) {
        sum -= b[j] * a.at(b[j]);
        sum += c[j] * a.at(b[j]);
        a.at(c[j]) += a.at(b[j]);
        a.at(b[j]) = 0;

        std::cout << sum << std::endl;
    }

    return 0;
}

Measured memory_bytes: 5104
#include <iostream>
#include <algorithm>


using namespace std;

int main(int argc, char** argv) {
    int a, b;
    cin >> a >> b;
    int m = max(a, b);
    if (a == b) cout << a *2 << endl;
    else cout << (m + (m-1)) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define rep(i,n) for(int i=0;i<n;i++)

const int MAX = 1500000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {
	int X,Y;
  	cin>>X>>Y;
  	COMinit();
  
  	if((2*Y-X)%3!=0||(2*X-Y)%3!=0||2*Y-X<0||2*X-Y<0){
     	cout<<0<<endl;
      	return 0;
    }
  
	int a=(2*Y-X)/3;
  	int b=(2*X-Y)/3;
  
  	cout<<COM(a+b,b)<<endl;
  
  	
  	
}

Measured memory_bytes: 38792
//abc047_b.cpp
//Sun Oct 21 11:15:12 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	int x[n],y[n],a[n];
	int xstart = 0;
	int xend = w;
	int ystart = 0;
	int yend = h;
	for (int i=0;i<n;i++){
		cin >> x[i] >> y[i] >> a[i];
		if (a[i] == 1 && xstart < x[i]){
			xstart = x[i];
		}else if (a[i] == 2 && xend > x[i]){
			xend = x[i];
		}else if (a[i] == 3 && ystart < y[i]){
			ystart = y[i];
		}else if (a[i] == 4 && yend > y[i]){
			yend = y[i];
		}
	}
	int ans = 0;
	if (xstart < xend && ystart < yend){
		ans = (xend-xstart)*(yend-ystart);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
N = int( input() )
place = []
for i in range(N):
    place.append( list( map( int,input().split() ) ) )
    
total = 0
for i in range(N):
    for j in range(i+1,N):
        total += ( ( place[i][0] - place[j][0] ) ** 2 + ( place[i][1] - place[j][1] ) ** 2 ) ** 0.5
c = N * (N-1) // 2 
print( total * (N-1) / c)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
#define rep(i,n)for(int i=0;i<n;i++);
int main(){
  int A,B;
  int count=0,plug=0;
  cin >> A >> B;
  if(B==1)cout << 0 << endl;
  else if(B>1){
    while(true){
      count++;
      plug+=A;
      if(plug>=B){
        cout << count << endl;
        break;
      }else{
        plug-=1;
      }
    }
  }
}

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

#define M 1000003 /* your task 1000003 or 999983 */
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key%M; }
int h2(int key){ return 1+key%(M-1); }

int find(char str[]){
  int i=0,j=0;
  int he1,he2,key=0;
  key=getKey(str);
  he1=h1(key);
  he2=h2(key);
  for(i=he1;j<M;i+=he2)
    {
      if(i>=M) i=i%M;
      if(strcmp(H[i],"")==0) return 0;
      else if(strcmp(H[i],str)== 0)return 1;
      j++;
    }
  return 0;
}

int insert(char str[]){
  int i=0,j=0,he1=0,he2=0;
  he1=h1(getKey(str));
  he2=h2(getKey(str));

  for(i=he1;j<M;i+=he2)
    {
      if(i>=M) i=i%M;
      if(strcmp(H[i],"")==0)
	{
	  strcpy(H[i],str);
	  return 1;
	}
      j++;
    }
  return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}

Measured memory_bytes: 14280
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define RALL(x) (x).rbegin(), (x).rend()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define debug(x) std::cerr<<#x<<": "<<(x)<<endl;
using namespace std;
using lint = long long;
template<class T> using grid = vector<vector<T>>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
static const lint MOD = (lint)1e9+7;

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

    vector<int> A(N);
    for (int i = 0; i < N; ++i)
    {
        A[i] = i + 1;
    }

    int cnt = 0;
    for (int i = 0; i < N; ++i)
    {
        if (A[i] & 1)
        {
            cnt++;
        }
    }

    cout << (double) cnt / N << endl;

    return 0;
}


Measured memory_bytes: 256
#ifdef LOCAL
#include "libs/debug/print_list.hpp"
#define debug(x) (cout << # x ": " << x << endl)
#define dev(v, m, n) for(int i=0;i<n;++i){for(int j=0;j<m;++j){cout<<"|"<<v[j][i];}cout<<"|"<<endl;}
#else
#define debug(x) ;
#define dev(v, m, n) ;
#endif

// :----------------------------------------

#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using vi = vector<int>;
using pi = pair<int, int>;
using vp = vector<pi>;

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

#define P (1'000'000'007)

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

    int t[500][500] = {0};

    rep(i, m) {
        int l, r;
        cin >> l >> r;
        --l; --r;

        ++t[l][r];
    }

    int c[500][500] = {0};

    rep(i, n) {
        int res = 0;
        rep(j, n) {
            res += t[i][j];
            c[i][j] = res;
        }
    }

    rep(i, q) {
        int l, r;
        cin >> l >> r;
        --l; --r;

        int ans = 0;
        for (int j = l; j <= r; ++j) {
            ans += c[j][r] - (l > 0 ? c[j][l - 1] : 0);
        }

        cout << ans << endl;
    }

    return 0;
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;
using vii=vector<vector<int>>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const int MOD=1e9+7;

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


int main(){
    string n; cin >> n;
    ll sum=0;
    for(int i=0; i<n.size(); i++){
        sum=(sum+n[i]-'0')%9;
    }
    if(sum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3712
from collections import deque

def mapinput():
    return map(int,input().split())

n,m = mapinput()
rootlist = [[] for i in range(n)]
flag = [False for i in range(n)]

for i in range(m):
    a,b= mapinput()
    rootlist[a-1].append(b)
    rootlist[b-1].append(a)

que = deque()
que.append(1)
while len(que) !=0:
    now = que.popleft()
    for room in rootlist[now-1]:
        if flag[room-1] == False:
            flag[room-1] = now
            que.append(room)

print('Yes')
for i,root in enumerate(flag):#スライスで実装
    if i == 0:
        continue
    print(root)


Measured memory_bytes: 34044
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

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

#define PUTS(x) cout << (x) << endl;

vector<PLL> xy;
map<LL,VL> xlink, ylink;
set<LL> xset,yset;
VL visited;
LL cnt = 0;

void dfs(int i){
    if(visited[i])return;
    visited[i] = 1;
    cnt++;
    LL x = xy[i].first;
    LL y = xy[i].second;
    xset.insert(x);
    yset.insert(y);
    EACH(it, xlink[x])dfs(*it);
    EACH(it, ylink[y])dfs(*it);
}

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL n;
    cin>>n;
    REP(i,n){
        LL x,y;
        cin>>x>>y;
        xy.PB(MP(x,y));
        xlink[x].PB(i);
        ylink[y].PB(i);
    }

    LL ans = 0;
    REP(i,n)visited.PB(0);
    REP(i,n){
        if(visited[i])continue;
        xset.clear();
        yset.clear();
        cnt = 0;
        dfs(i);
        ans += xset.size() * yset.size();
        ans -= cnt;
    }

    PUTS(ans);
}

Measured memory_bytes: 25968
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String b = "aiueo";
        if(b.indexOf(s) == -1) System.out.println("consonant");
        else System.out.println("vowel");
    }
}


Measured memory_bytes: 23636
def check(x):
    count = 0
    for num in range(1,x+1,2):
        if x % num == 0:
            count += 1
    return count

N = int(input())
ans = 0
for x in range(1,N+1):
    if check(x) == 8:
        ans += 1
print(ans)

Measured memory_bytes: 3060
s = list(input())
n = len(s)
ans = [-1, -1]
if n == 2:
    if s[0] == s[1]:
        ans = [1, 2]
else:
    for i in range(n - 2):
        if s[i] == s[i + 1] or s[i + 1] == s[i + 2] or s[i + 2] == s[i]:
            ans = [i + 1, i + 3]
            break
print(ans[0], ans[1])

Measured memory_bytes: 3956
n=[int(s) for s in input().split()]
p=[int(s) for s in input().split()]
count=0
expected=0
a=0
f=0
for i in p:
  if i==a+1:
    a+=1
  else:
    if count>0:
      f=1
    if expected==0:
      expected=i
      a+=1
    else:
      if expected==a+1:
        count+=1
        a+=1
      else:
        f=1

if f==0:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 9232
#include<iostream>
#include<algorithm>

int main(){
	int W[10], K[10];
	for (int i = 0; i < 10; ++i)std::cin >> W[i];
	for (int i = 0; i < 10; ++i)std::cin >> K[i];
	std::sort(W, W + 10);
	std::sort(K, K + 10);
	std::cout << W[7] + W[8] + W[9] << " " << K[7] + K[8] + K[9] << std::endl;
	return 0;
}

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

int main(){
  int n, t;
  cin >> n;
  int pm[200000][2] = {};
  for (int i = 1; i <= n; ++i) {
    cin >> t;
    if (i + t < 200000)
      pm[i + t][0]++;
    if (i - t > 0)
      pm[i - t][1]++;
  }
  
  long long c(0);
  for (int i = 1; i < 200000; ++i)
    c += (long long) pm[i][0] * pm[i][1];
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 5152
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  bool hantei = false;
  for(int i=0 ;i<3;i++){
    if(S.at(i) ==S.at(i+1)){
      hantei = true;
      break;
    }
  }
  if(hantei){
    cout << "Bad" <<endl;
  }
  else{
    cout<< "Good" <<endl;
  }
}
  

Measured memory_bytes: 256
#pragma GCC optimize("O3")

#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define sz size
#define f first
#define s second

int A[100001];
pair<int, int> arr[100001];

bool sortFirst(const pair<int, int> &a, pair<int, int> &b)
{
    return a.f > b.f;
}

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N, M;

    cin >> N >> M;

    F0R (i, N)
        cin >> A[i];

    sort(A, A + N);

    int B, C;

    F0R (i, M)
    {
        cin >> B >> C;

        arr[i].f = C;
        arr[i].s = B;
    }

    sort(arr, arr + M, sortFirst);

    int index = 0;
    
    // cout << "REACHED HERE..." << endl;
    // cout << N << " " << M << endl;
    // cout << "arr2 s: " << arr[2].s << endl;
    

    F0R (i, N)
    {
        while (index < M && arr[index].s == 0)
            index++;
        
        // cout << "FINISHED THIS..." << endl;

        if (index == M)
            break;

        if (A[i] < arr[index].f)
        {
            A[i] = arr[index].f;
            arr[index].s--;
        }
        else
            break;

        // cout << "i: " << i << endl;
        // cout << "index: " << index << endl;
        //

        // cout << "A: " << A[i] << endl;
    }

    ll sum = 0;

    F0R (i, N)
        sum += A[i];

    cout << sum;

    return 0;
}


Measured memory_bytes: 1408
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
   		int x = sc.nextInt();	
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c;
		c=x-a;
		System.out.print(c%b);
    }
}

Measured memory_bytes: 21844
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

struct node{
	int left;
	int right;
	int id_parent;
	int sibling;
	int degree;
	int depth;
	int height;
	char type[15];
};

struct tree{
	int n_nodes;
	node *nodes;
};

void link(tree t, int i){
	if (t.nodes[i].id_parent == -1){
		strcpy(t.nodes[i].type, "root");
	}
	else{
		if (t.nodes[i].degree == 0){
			strcpy(t.nodes[i].type, "leaf");
		}
		else{
			strcpy(t.nodes[i].type, "internal node");
		}
	}
}

void printNodes(tree t){
	int i,j,n;
	n = t.n_nodes;
	for(i=0;i<n;i++){
		printf("node %d: ", i);
		printf("parent = %d, ", t.nodes[i].id_parent);
		printf("sibling = %d, ", t.nodes[i].sibling);
		printf("degree = %d, ", t.nodes[i].degree);
		printf("depth = %d, ", t.nodes[i].depth);
		printf("height = %d, ", t.nodes[i].height);
		printf("%s\n", t.nodes[i].type);
	}
}

int setDepthHeight(tree t, int id, int d){
	int left, right;
	left = t.nodes[id].left;
	right = t.nodes[id].right;
	t.nodes[id].depth = d;
	if(left == -1 && right==-1){
		t.nodes[id].height = 0;
	}
	else if (left == -1 && right != -1){
		t.nodes[id].height = setDepthHeight(t, right, d+1);
	}
	else if (left != -1 && right == -1){
		t.nodes[id].height = setDepthHeight(t, left, d+1);
	}
	else{
		t.nodes[id].height = std::max(setDepthHeight(t, left, d+1), setDepthHeight(t, right, d+1));
	}
	
	return t.nodes[id].height + 1;
}

int main(void){
	tree t;
	int i,id, degree, n, left, right;
	scanf("%d", &t.n_nodes);
	t.nodes = new node[t.n_nodes];
	
	for(i=0;i<t.n_nodes;i++){
		t.nodes[i].id_parent = -1;
	}
	for(i=0;i<t.n_nodes;i++){
		degree = 0;
		scanf("%d %d %d",&id, &left, &right);
		t.nodes[id].left = left;
		t.nodes[id].right = right;

		if(left != -1){
			t.nodes[left].id_parent = id;
			t.nodes[left].sibling = right;
			degree ++;
		}
		if(right != -1){
			t.nodes[right].id_parent = id;
			t.nodes[right].sibling = left;
			degree ++;
		}
		t.nodes[id].degree = degree;
	}

	for (i=0;i<t.n_nodes;i++){
		link(t, i);
	}

	for (i=0;i<t.n_nodes;i++){
		if(t.nodes[i].id_parent == -1){
			id = i;
			t.nodes[i].sibling = -1;
			break;
		}
	}
	setDepthHeight(t, id, 0);

	printNodes(t);
	delete []t.nodes;

	return 0;
}

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

typedef long long ll;

ll f(ll x){
    if(x == 1)  return 1;
    return f(x/2)*2+1;
}

int main(){
    string s;
    cin >> s;
    
    int ans(1000);
    for(int i=0;i<s.size()-2;i++){
        string t = s.substr(i,3);
        int num = atoi(t.c_str());
        ans = min(ans,abs(num-753));
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3572
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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


struct edge{
    int from, to, cost;
    edge(int From, int To, int Cost): from(From), to(To), cost(Cost){}
};

void bellmanFord_Cost(int V, std::vector<edge>& es, std::vector<long long>& d, int s){
    d.resize(V, LINF);
    d[s] = 0;
    while(1){
        bool update = false;
        for(auto &e : es){
            if(d[e.from] != LINF && d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                update = true;
            }
        }
        if(!update) break;
    }
}

bool find_negative_loop_Cost(int V, std::vector<edge>& es, std::vector<long long>& d, int s){
    d.resize(V, LINF);
    d[s] = 0;
    for(int i(0); i < V; ++i){
        for(auto &e : es){
            if(d[e.from] != LINF && d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                
                //V回目に更新なら負閉路あり
                if(i == V-1) return true;
            }
        }
    }
    return false;
}


int main(){
    int N, M; std::cin >> N >> M;
    std::vector<edge> es;
    {
        int a, b, c;
        for(int i(0); i < M; ++i){
            std::cin >> a >> b >> c;
            --a; --b;
            es.emplace_back(a, b, -c);
        }
    }
    std::vector<long long> d;
    find_negative_loop_Cost(N, es, d, 0);
    std::vector<bool> negativeloop(N, false);
    for(int i(0); i < N; ++i){
        for(auto &e : es){
            if(d[e.from] != LINF && d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                negativeloop[e.to] = true;
            }
            if(negativeloop[e.from]) negativeloop[e.to] = true;
        }
    }
    if(negativeloop[N-1]){
        std::cout << "inf" << std::endl;
    }else{
        std::cout << -d[N-1] << std::endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const int MOD = 1000000007; 


int main() {
    int n;
    cin >> n;
    unordered_set<string> buf;
    rep(i, n) {
        string s; cin >> s;
        buf.insert(move(s));
    }
    cout << buf.size() << endl;
    return 0;
}

Measured memory_bytes: 17728