akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()


int main(){
    ll n;
    cin >> n;
    vector<ll> a(n + 1);
    REP(i, n + 1){
        cin >> a.at(i);
    }

    vector<ll> lb(n + 1, 0), ub(n + 1);
    for(ll i = n; i >= 0; --i){
        ub.at(i) = a.at(i);
        if(i + 1 <= n){
            ub.at(i) += ub.at(i + 1);
        }
        if(i <= 60){
            ub.at(i) = min(ub.at(i), 1LL << i);
        }

        if(i == n){
            lb.at(i) = a.at(i);
        }else{
            lb.at(i) = a.at(i) + 1;
        }
    }

    for(ll i = n - 1; i >= 0; --i){
        lb.at(i) = max(lb.at(i), a.at(i) + lb.at(i + 1) / 2);
        ub.at(i) = min(ub.at(i), a.at(i) + ub.at(i + 1));
    }
    for(ll i = 1; i <= n; ++i){
        lb.at(i) = max(lb.at(i), lb.at(i - 1) - a.at(i - 1));
        ub.at(i) = min(ub.at(i), 2 * (ub.at(i - 1) - a.at(i - 1)));
    }

    ll ans = 0;
    REP(i, n + 1){
        if(lb.at(i) > ub.at(i)){
            cout << -1 << endl;
            return 0;
        }
        ans += ub.at(i);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5584
package main

import "fmt"

var N string

func main() {
  fmt.Scanf("%s", &N)
  res := 0
  for i := range N {
    res += int(N[i]) - 48
    res %= 9
  }
  if res%9 == 0 {
    fmt.Println("Yes")
    return
  }
  fmt.Println("No")
}


Measured memory_bytes: 3272
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [A, B] = input[0].map(Number);

  return Math.max(A + B, A - B, A * B) + 0;
};

console.log(main(read()));


Measured memory_bytes: 29648
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a < b) {
			System.out.println("a < b");
		} else if(a > b) {
			System.out.println("a > b");
		} else {
			System.out.println("a == b");
		}
		sc.close();
	}
}


Measured memory_bytes: 26340
#include <iostream>
#include <string>
long long gcd(int a, int b) {
    if(a%b) {
        return gcd(b, a % b);
    } else {
        return b;
    }
}

long long lcm(int a, int b) {
    return (a / gcd(a, b)) * b;
}
int main()
{
    int a, b;
    std::cin >> a >> b;

    std::cout << lcm(a, b) << "\n";
}

Measured memory_bytes: 256
N = int(input())
As = input()
Bs = input()
Cs = input()

ans = 0
for A, B, C in zip(As, Bs, Cs):
    if A == B == C:
        pass
    elif A == B or B == C or C == A:
        ans += 1
    else:
        ans += 2
print(ans)


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

int main()
{
    int a,c,d;
    cin>>a>>c;
    d = a + c;
    if(a%3==0 || c % 3 == 0 || d%3==0)
        cout<<"Possible"<<endl;
    else
        cout<<"Impossible"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <iomanip>

using namespace std;

int main()
{
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  cout << fixed << setprecision(10) << sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) << endl;
  return 0;
}

Measured memory_bytes: 3280
#include <iostream>
#include <bits/stdc++.h>
#define ll long long int
using namespace std;

const int nax=1e5+5;
int n;
ll a[nax];

int main()
{
    cin>>n;
    ll x; cin>>x;
    for(int i=1;i<=n;i++) cin>>a[i];
    ll sum=0;
    if(a[1]>x)
    {
        sum+=a[1]-x;
        a[1]=x;
    }
    for(int i=2;i<=n;i++)
    {
        ll tot=a[i]+a[i-1];
        if(tot<=x) continue;
        ll res=tot-x;
        a[i]-=res;
        sum+=res;
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void) {
  int N;
  char S[200001];
  scanf("%d", &N);
  scanf("%s", S);

  int B = 0;
  int W = 0;
  for(int i = 0; i < N; i++) {
    if(S[i] == '.') W++;
  }

  int X = W;
  for(int i = 0; i < N; i++) {
    if(S[i] == '#') B++;
    if(S[i] == '.') W--;
    if((B+W) < X) X = B+W;
  }

  printf("%d\n", X);
  return 0;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	int r,g,b;
	cin >> r >> g >> b;
	string s = to_string(r) + to_string(g) + to_string(b);
	if(stoi(s) % 4 == 0) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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

typedef long long ll;


int main(){
    int N, X, Y;
    cin >> N >> X >>Y;

    vector<int> cnt(N, 0);
    for(int i=1; i<=N-1; i++){
        for(int j=i+1; j<=N; j++){
            cnt[min(abs(i-j), min(abs(X-i)+1+abs(Y-j), abs(Y-i)+1+abs(X-j)))]++;
            //cout<<min(abs(i-j), min(abs(X-i)+1+abs(Y-j), abs(Y-i)+1+abs(X-j)))<<" : "<<i<<" --> "<<j<<endl; 
        }
    }

    for(int i=1; i<N; i++){
        cout<<cnt[i]<<endl;
    }

    return 0;

}

Measured memory_bytes: 3628
// Don't place your source in a package
import java.util.*;
import java.io.*;

class Main {
	public static void main (String[] args) throws IOException {
	    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    String s = in.readLine();
	    
	    String res = "";
	    
	    for (int i = 0; i < s.length(); i++) {
	        char c = s.charAt(i);
	        if (c == '0') {
	            res += "0";
	        }
	        if (c == '1') {
	            res += "1";
	        }
	        if (c == 'B' && res.length() > 0) {
	            res = res.substring(0, res.length() - 1);
	        }
	    }
	    System.out.println(res);
	    
	    in.close();
	}
}

Measured memory_bytes: 21076
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	a, b, c, d = LI()
	print(max(a*b,c*d))


if __name__ == '__main__':
    main()

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

int h, w, n;
vector<int> a;

int main() {
	cin >> h >> w >> n;
	a.resize(n);
	for (int i = 0; i < n; ++i) cin >> a.at(i);

	vector<int> c(h*w);
	
	int s=0;

	for (int i = 0; i < n; ++i)
	{
		for (int cell = s; cell < s+a.at(i); ++cell)
		{
			c.at(cell) = i+1;
		}
		s += a.at(i);
	}

	for (int i = 0; i < h; ++i)
	{
		for (int j = 0; j < w; ++j)
		{
			if (i%2==0)
			{
				cout << c.at(i*w + j) << " ";
			} else {
				cout << c.at((i+1)*w-1 - j) << " ";
			}
		}
		cout << endl;
	}
}

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

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

    int cnt = 1, ans = 0;

    while (true) {
        if (cnt >= b) {
            cout << ans << endl;
            return 0;
        } else if (cnt-1+a >= b) {
            cout << ans+1 << endl;
            return 0;
        } else cnt += a-1, ans++;
    }

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	ss := strings.Split(s, "")

	ans := make([]string, len(s))
	for _, v := range ss {
		if v == "B" {
			ans = ans[:len(ans)-1]
		} else {
			ans = append(ans, v)
		}
	}

	fmt.Println(strings.Join(ans, ""))
}


Measured memory_bytes: 1828
#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair
#include <cmath>

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

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

template <class InputIterator, class T>
bool contains_itr(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class T>
bool contains_set(set<T> st, const T &value)
{
    if (st.find(value) == st.end())
    {
        return false;
    }
    else
    {
        return true;
    }
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// endは排他的(exclusive)なので注意
vector<ll> range(ll begin, ll end)
{
    vector<ll> result;
    for (ll i = begin; i < end; ++i)
    {
        result.push_back(i);
    }
    return result;
}

// =========ここまでテンプレ============

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll result = 0;
    rep(i, n)
    {
        if ((i + 1) % 2 == 1 && a[i] % 2 == 1)
        {
            ++result;
        }
    }
    cout << result << endl;
}

Measured memory_bytes: 3144
N = int(input())
A = list(input())
B = list(input())
C = list(input())
cnt = 0
for i in range(N):
    l = [A[i], B[i], C[i]]
    
    s = set(l)
    c = [l.count(s_) for s_ in s]
    cnt += 3- max(c)
print(cnt)


Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
#define ll long long
ll n;int cnt;
deque<int> Q1,Q2;
void Work(ll n)
{
	if(n==1)return;
	Work(n>>1);++cnt;
	Q1.push_front(cnt);Q2.push_front(cnt);
	if(n&1)++cnt,Q1.push_front(cnt),Q2.push_back(cnt); 
}
int main()
{
	cin>>n;Work(n+1);
	printf("%d\n",(int)(Q1.size()+Q2.size()));
	while(!Q1.empty())printf("%d ",Q1.front()),Q1.pop_front();
	while(!Q2.empty())printf("%d ",Q2.front()),Q2.pop_front();
	puts("");return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int a,b;

int main()
{
    cin >> a >> b;
    if(a==b)
        cout << a;
    else if((a+b)%2==0)
        cout << (a+b)/2;
    else
        cout << (a+b)/2+1;
    return 0;
}


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

int main() {
  int n; cin>>n;
  vector<ll> a(n+1);
  a[0]=2;
  a[1]=1;
  rep(i, n-1) a[i+2] = a[i+1]+a[i];
  cout<<a[n]<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVVld = vector<VVld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


int main() {
  int N; cin >> N;
  V cnt(4);
  rep(i, N) {
    int x; cin >> x;
    cnt[x]++;
  }
  
  VVVld dp(N+1, VVld(N+1, Vld(N+1)));

  for (int k = 0; k <= N; ++k)
    for (int j = 0; j + k <= N; ++j) 
      for (int i = 0; i + j + k <= N; ++i) {
        if (i == 0 && j == 0 && k == 0) continue;
        ld &r = dp[i][j][k];
        r = ld(N);
        if (i) r += ld(i) * dp[i-1][j][k];
        if (j) r += ld(j) * dp[i+1][j-1][k];
        if (k) r += ld(k) * dp[i][j+1][k-1];
        r /= i+j+k;
  }

  ld ans = dp[cnt[1]][cnt[2]][cnt[3]];
  cout << setprecision(12);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 431360
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<complex>
#include<unordered_map>
#define deg(x) cout<<#x<<"="<<x<<endl;
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define fx(x,n) for(int i=n-1;i>=x;i--)
#define mst(x) memset(x,0,sizeof(x));
#define fi first
#define se second
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ok "ok"
#define HH puts("");
#define ls rt<<1
#define rs rt<<1|1
#define pb(a,b) a.push_back(b);
#define FIN  freopen("1.in","r",stdin);
#define FOUT freopen("1.out","w",stdout);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,int> pss;
typedef unsigned long long ull;
const ll mod=1e9+7;
const ll inf=1e18;
const long double eps=1e-8;
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
const double pi=acos(-1);

int x,y,n;
bool vis[2030];
map<int,int> mp;

int bfs(int b,int d){
    queue<pii> q;
    q.push({b,d});
    while(!q.empty()){
        int b=q.front().fi,d=q.front().se;
        q.pop();
        if(vis[b]) continue;
        vis[b]=1;
        mp[d]++;
        if(b>1&&!vis[b-1]) q.push({b-1,d+1});
        if(b<n&&!vis[b+1]) q.push({b+1,d+1});
        if(b==x&&!vis[y]) q.push({y,d+1});
        if(b==y&&!vis[x]) q.push({x,d+1});
    }
    return 0;
}

int main(){
    TB
    cin>>n>>x>>y;
    for(int i=1;i<=n;i++){
        mst(vis)
        bfs(i,0);
    }
    for(int i=1;i<n;i++) cout<<mp[i]/2<<'\n';
    return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int sum = [=]()mutable{
    int res = 0;
    while(n > 0) {
      res += n%10;
      n /= 10;
    }
    return res;
  }();
  cout << (n%sum == 0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3612
import sys


def intersect(len, v1, v2):
    t = len / (v1 + v2)
    return v1 * t

def section_number(sections, position):
    i = [0.0]
    dis = reduce((lambda acc, d: list_append(acc, acc[-1] + d)), sections, i)
    s = 0
    for d in dis:
        if position <= d:
            return s
        s += 1

def list_append(lis, a):
    lis.append(a)
    return lis



for line in sys.stdin:
    sections = map(float, line.split(','))
    v2 = sections.pop()
    v1 = sections.pop()
    length = sum(sections)
    position = intersect(length, v1, v2)
    print section_number(sections, position)

Measured memory_bytes: 4364
#include <iostream>

using namespace std;

int dev(int*,int*,int);

int main(void){
	int a,b,gcd;

	while(cin >> a){
		cin >> b;
		gcd=1;

		gcd*=dev(&a,&b,2);
		for(int i=3;i<(a<b?a:b);i+=2)
			gcd*=dev(&a,&b,i);

		cout << gcd << " " << a*b*gcd << endl;
	}

	return 0;
}

int dev(int *a,int *b,int n){
	int fac=1;
	
	while(*a%n==0&&*b%n==0){
		*a /= n;
		*b /= n;
		fac *= n;
	}

	return fac;
}

Measured memory_bytes: 1164
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef string str;
typedef std::pair<ll,ll> pl;
typedef std::map<string, ll> msl;
typedef std::map<ll, ll> mll;
typedef std::vector<ll> vl;
const long double EPS = 1e-9;
 
#define rep(i, n) for(ll (i) = 0; (i) < (n) ; (i)++ )
#define For(i, a, b) for(ll (i) = (a); (i) < (b) ; (i)++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define tol(c) char((c)+0x20)
#define tou(c) char((c)-0x20)
#define pb push_back
#define mp make_pair
#define pr(a) cout << (a)
#define prl(a) cout << (a) << endl
#define prl2(a,b) cout << (a) << " " << (b) << endl
#define prs(a) cout << (a) << " "
#define yn(condition) if ((condition)) prl("Yes"); else prl("No");
#define YN(condition) if ((condition)) prl("YES"); else prl("NO");
#define rpr(i,n,ans) rep((i),(n)) prs((ans[(i)]))
#define cpr(i,n,ans) rep((i),(n)) prl((ans[(i)]))
#define in1(a) cin >> (a)
#define in2(a,b) cin >> (a) >> (b)
#define in3(a,b,c) cin >> (a) >> (b) >> (c)
#define in4(a,b,c,d) cin >> (a) >> (b) >> (c) >> (d)
#define rin1(i,n,a) rep((i),(n)) cin >> (a[(i)])
#define rin2(i,n,a,b) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)])
#define rin3(i,n,a,b,c) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)]) >> (c[(i)])
#define e1 first
#define e2 second
#define ctol(c) ll((c)) - ll('0')
#define ltos(n) to_string((n))
#define items(kv, v) for(auto &(kv): (v))
#define ndig(N, n) ctol(ll(ltos((N))[ll(ltos((N)).length()) - (n)]))
#define beto(a,b,c) (a) < (b) && (b) < (c)
#define betc(a,b,c) (a) <= (b) && (b) <= (c)
#define rsort(a,n) sort(a,a+n,greater<>())
 
const ll mod = 1e9 + 7;
const ll INF = mod * mod;
const ll MAX_N = 100;
 
int main(void){
    ll a,b;
    str s,t,u;

    in3(s,t,u);
    pr("A");
    pr(t[0]);
    prl("C");

    return 0;
}

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

#ifdef LOCAL
        #include "debug.h"
        #define input freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    #else
        #define debug(...) 42
        #define input ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#endif
    

bool check(vector<pair<int, int>> s) {
    int h = 0;
    for (pair<int, int> p : s) {
        int b = h+p.first;
        if (b < 0) return false;
        h += p.second;
    }
    return true;
}
int main() {
    input;
    int n;
    cin >> n;
    vector<pair<int, int>> ls, rs;
    int total = 0;
    for(int i = 0; i < n; i++) {
        string s;
        cin >> s;
        int h = 0, b = 0;
        for (char c : s) {
          if (c == '(') ++h; else --h;
          b = min(b, h);
        }
        if (h > 0) ls.emplace_back(b, h);
        else rs.emplace_back(b-h, -h);
        total += h;
    }
    sort(ls.rbegin(), ls.rend());
    sort(rs.rbegin(), rs.rend());
    if (check(ls) && check(rs) && total == 0) {
        cout << "Yes" << endl;
    } 
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 18840
#!/usr/bin/env python3
import sys
import collections


def solve(N: int, s: "List[str]", M: int, t: "List[str]"):
    cs = collections.Counter(s)
    ts = collections.Counter(t)

    res = 0
    for k,v in cs.items():
        t = v - ts[k]
        res = max(res,t)

    print(res)

    
             



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [ next(tokens) for _ in range(N) ]  # type: "List[str]"
    M = int(next(tokens))  # type: int
    t = [ next(tokens) for _ in range(M) ]  # type: "List[str]"
    solve(N, s, M, t)

if __name__ == '__main__':
    main()


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

int main() {
  long ansa=-1,ansb=-1;
  string s;
  cin >> s;
  for(long i=1;i<s.size();i++) if(s[i-1]==s[i]) ansa=i,ansb=i+1;
  for(long i=2;i<s.size();i++) if(s[i-2]==s[i])ansa=i-1,ansb=i+1;
  cout << ansa << " " << ansb << endl;
}

Measured memory_bytes: 3712
N, K = map(int, input().split())
A_list = list(map(int, input().split()))

place = [0]
table = [0] * N
table[0] = 1

while True:
    next_place = A_list[place[-1]] - 1
    if table[next_place] == 1:
        idx = place.index(next_place)
        loop = place[idx:]
        break
    table[next_place] = 1
    place.append(next_place)

if K < len(place):
    print(place[K] + 1)
else:
    print(loop[(K-idx)%len(loop)] + 1)

Measured memory_bytes: 32312
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

typedef pair<int,int> P;

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

    vector<int> e_out[n];
    vector<int> e_in[n];
    for(int i=0; i<m; ++i) {
        int a,b;
        cin >> a >> b;
        e_out[a-1].push_back(b-1);
        e_in[b-1].push_back(a-1);
    }

    queue<int> q;
    vector<int> deg(n);
    for(int i=0; i<n; ++i) {
        deg[i]=(int)e_in[i].size();
        if(deg[i]==0) q.push(i);
    }

    bool flag=false;
    vector<int> ans;

    while(!q.empty()) {
        if(q.size()!=1) flag=true;
        int p=q.front(); q.pop();
        ans.push_back(p);
        for(auto x : e_out[p]) {
            --deg[x];
            if(deg[x]==0) q.push(x);
        }
    }

    for(int i=0; i<n; ++i) cout << ans[i]+1 <<  endl;
    cout << (flag?1:0) << endl;

    return 0;
}

Measured memory_bytes: 4556
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

int main() {
    int N, A;

    cin >> N >> A;
    
    for (int i = 0; i <= A; i++) {
        if ((N - i) % 500 == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    int A, B;
    cin >> A >> B;
    cout << (A - 1) * (B - 1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int a,num[5];
  long long int sum=0;
  cin >> a;
  vector<int> vec(a);
  for (int i=0; i<a; i++){
    cin >> vec[i];
    sum += vec[i];
  }
  sort(vec.begin(),vec.end());
  cout << vec[0] << " " << vec[a-1] << " " << sum << endl;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
using ll = long long;
int32_t main(){
	ll n, m;
	cin >> m >> n;
	vector<ll> vs(n);
	for(int i=0; i<n; ++i) cin >> vs[i]; 
	sort(all(vs));
	multiset<ll> dff;
	for(int i=1; i<n; ++i) dff.insert(vs[i]-vs[i-1]);
	m-=1LL;
	while(m-- and not dff.empty()) dff.erase(prev(dff.end()));
	ll ans =0;
	for(auto x:dff) ans+=x;
	cout << ans << endl;
}

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

typedef struct position {
    int x = 0;
    int y = 0;
    void print(){
        cout << "x: " << x << ", y: " << y << endl;
    }
} Position;

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

    vector<pair<int, int>> red, blue;
    for (auto i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        red.emplace_back(x, y);
    }
    for (auto i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        blue.emplace_back(x, y);
    }
    sort(blue.begin(), blue.end());

    bool red_used[n] = { };
    for (auto i = 0; i < n; i++) {
        int red_y = -1;
        int red_index = -1;
        for (auto j = 0; j < n; j++) {
            if(red_used[j]) continue;
            if(blue[i].first > red[j].first and blue[i].second > red[j].second){
                if(red_y < red[j].second) {
                    red_y = red[j].second;
                    red_index = j;
                }
            }
        }
        if(red_index != -1) red_used[red_index] = true;
    }

    int ans = 0;
    for (auto i = 0; i < n; i++) if(red_used[i]) ans++;

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

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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), c
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  vll bps(n);
  vvll ps(n, vll(11, 0));
  rep(i, n){
    ll bp = 0;
    rep(_, 10){
      bp <<= 1;
      ll b;
      cin >> b;
      bp += b;
    }
    bps[i] = bp;
  }
  rep(i, n){
    rep(j, 11){
      ll p;
      cin >> p;
      ps[i][j] = p;
    }
  }

  ll ans = -INF;
  repLRE(s, 1, (1 << 10) - 1){
    ll tmp = 0;
    rep(i, n){
      ll j = __builtin_popcountll(bps[i] & s);
      tmp += ps[i][j];
    }
    chmax(ans, tmp);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3640
#include<stdio.h>
#include<string.h>
int main()
{
int a;
int b;
char op;
while(1)
{
 scanf("%d %c %d",&a,&op,&b);
 if(op=='?')
 {
  break;
 }
 else if(op=='+')
 {
 printf("%d\n",a+b);
 }
 else if(op=='-')
 {
 printf("%d\n",a-b);
 }
 else if(op=='*')
 {
 printf("%d\n",a*b);
 }
 else if(op=='/')
 {
 printf("%d\n",a/b);
 }

}
return 0;
}

Measured memory_bytes: 600
fun main(args:Array<String>?): Unit {
    val (_, d) = readLine()!!.trim().split(' ').map(String::toInt)
    val prize = readLine()!!.trim().split(' ').map(String::toInt)
    println(prize.filter{it > d}.let{ if (it.isEmpty()) "kusoge" else (it.sum() - d * it.size).toString() })
}


Measured memory_bytes: 34440
#include<bits/stdc++.h>
using namespace std;
long long n,m;
long long t[100010];
long long p;
struct P
{
    long long x,y;
}He[100010];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>t[i];
    }
    cin>>m;
    for(int i=1;i<=m;i++)
    {
        cin>>He[i].x>>He[i].y;
    }
    for(int i=1;i<=m;i++)
    {
        long long sum=0;
        for(int j=1;j<He[i].x;j++)
        {
            sum+=t[j];
         //   cout<<sum<<"A"<<endl;
        }
        sum+=He[i].y;
       // cout<<sum<<"B"<<endl;
        for(int j=He[i].x+1;j<=n;j++)
        {
            sum+=t[j];
         //   cout<<sum<<"C"<<endl;
        }
        cout<<sum<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
 int n,c=0;
  cin >> n;
  ll sum=0;
  for(int i=1;i<=n;i++){
   if(i%3 != 0 && i%5 != 0){
     sum = sum + i;  
   }
  }
  cout << sum << "\n";
  return 0;
}

Measured memory_bytes: 3596
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <iostream>
//end of libraries ;
#define INF 99999999999
#define N 300003
#define F first
#define S second
#define pb push_back
#define ll long long
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
int n  , x  , c;
int gcd(int x , int y){
	if(x>y) swap(x,y);
	if(x==0) return y;
	else return gcd(y%x,x);
}
vector <int> dif;
int main(){
fcin;

	cin>>n>>x;
	vector<int>a(n);
	for(int i = 0 ; i < n ; i++) cin>>a[i];
	a.pb(x);
	sort(a.begin(),a.end());
	for(int i = 1 ; i < a.size() ; i++){
		dif.pb(a[i]-a[i-1]);
	}
	sort(dif.begin(),dif.end());
	c = gcd(dif[0],dif[1]);
	for(int i = 2 ; i < dif.size() ; i++){
		c = min(c,gcd(dif[i],dif[i-1]));
	}
	
	cout<<c<<endl;

}

Measured memory_bytes: 1528
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll isPrime(int n) 
{ 
	// Corner cases 
	if (n <= 1) 
		return 1; 
	if (n <= 3) 
		return 2; 

	// This is checked so that we can skip 
	// middle five numbers in below loop 
	if (n % 2 == 0 || n % 3 == 0) 
		return 1; 

	for (int i = 5; i * i <= n; i = i + 6) 
		if (n % i == 0 || n % (i + 2) == 0) 
			return 1; 

	return 2; 
} 

ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i,res%=1000000007; 
    return res; } 
 
 int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
  
 
ll findlcm(ll arr[], int n) 
{ 
   
    ll ans = arr[0]; 
  
    
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (gcd(arr[i], ans))); 
  
    return ans; 
} 
 
 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
      ll n;
      cin>>n;
      for(ll i=1;i<300000;i++)
      {
          if(i*i>n)
          {
              cout<<(i-1)*(i-1);
              break;
          }
          if(i*i==n)
          {
              cout<<i*i;
              break;
          }
      }
      
    } 
    return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
//const ll INF = 1e18;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);

int n,m;
vi a(60),b(60);
int graph[60][60];
int flag[60];

void dfs(int now){
	if(flag[now]) return;
	for(int i = 1; i <= n; i++){
		if(graph[now][i]){
			flag[now] = 1;
			dfs(i);
		}
	}
}

int main()
{
	cin >> n >> m;
	rep(i,m){
		cin >> a[i] >> b[i];
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = 1;
	}
	int ans = 0;
	for(int i = 0; i < m; i++){
		fill(flag,flag+60,0);
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = 0;
		dfs(1);
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = 1;
		for(int j = 1; j <= n; j++){
			if(!flag[j]){
				ans++;
				break;
			}
		}
		
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int a[16][16];

int main() {
    for (;;) {
        int n;
        scanf("%d", &n);
        if (n == 0) return 0;
        rep (i, n) rep (j, n) a[i][j] = 0;
        int x = n/2+1, y = n/2;
        rep (i, n*n) {
            while (a[x][y]) x = (x+1)%n, y = (y+n-1)%n;
            a[x][y] = i+1;
            x = (x+1)%n, y = (y+1)%n;
        }
        rep (i, n) {
            rep (j, n) printf("%4d", a[i][j]);
            printf("\n");
        }
    }
}

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

	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int min = 12;
		long n = scan.nextLong();
		if(n<10){System.out.println(1);}
		else{
		int k = (int)Math.sqrt(n);
		for(long i=1; i<k+1; i++){
			if(n%i==0){
				long j = n/i;
				int keta = f(i,j);
				if(keta<min){
					min = keta;
				}
			}
		}
		System.out.println(min);}
	}

	//F(A,B)を求めるメソッド
	public static int f(long a,long b){
		int aketa = 0;
		int bketa = 0;
		int cketa = 0;
		for(int i=1; i<11; i++){
			long xx = (long)Math.pow(10,i);
			long x = a/xx;
			long y = b/xx;
			if(x>=1&&x<10){
				aketa = i+1;
			}
			if(y>=1&&y<10){
				bketa = i+1;
			}
		}
		cketa = Math.max(aketa,bketa);
		return cketa;
	}
}

Measured memory_bytes: 22100
#include<stdio.h>
int main(void)
{
	int x,a,b;
	scanf("%d %d %d",&x,&a,&b);
	if(a>=b){
		printf("delicious\n");
	}
	else if(b-a<=x){
		printf("safe\n");
	}
	else{
		printf("dangerous\n");
	}
	return 0;
}

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

#define what_is(x) cerr << #x << " is " << x << endl; 
#define PI acos(-1)
#define hell 1000000007
#define HELL 998244353
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define mset(a,n) memset(a,n,sizeof a)
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define renn(i,a,b,p) for(__typeof((a) i=(a);i>=(b);i-=p)
#define ADD(a,b,c) ((a)%c+(b)%c)%c
#define SUB(a,b,c) ((a)%c-(b)%c+c)%c
#define MUL(a,b,c) (((a)%c)*((b)%c))%c
#define lbd lower_bound
#define ubd upper_bound
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define all(v) (v).begin(), (v).end()
#define sz(x) (ll)x.size()
#define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define bug(n) {outl(n);return;}
#define N 250001
#define pii pair<int,int>
#define M 1000000007
 
ll gcd(ll a,ll b){
 	if(a==0)
 		return b;
 	return gcd(b%a,a);
 }
ll vpow(ll a,ll b,ll p){
	if(b==0)
		return 1;
	if(b==1)
			return a;
	ll temp=vpow(a,b/2,p);
	temp*=temp;
	temp%=p;
	if(b%2==0)
		return temp;
	temp=temp*a;
	temp%=p;
	return temp;
}
 
ll inverseMod(ll a,ll b,ll p){
	ll temp=vpow(b,p-2,p);
	ll ans=temp*a;
	ans%=p;
	return ans;
}
 
ll minl(ll a,ll b){
	if(a>b)
		return b;
	return a;
}
ll maxl(ll a,ll b){
	if(a>b)
		return a;
	return b;
}



void solve(){
	char a;
	cin>>a;
	a++;
	cout<<a<<endl;
}

int main(){
    io;
     ll t=1;
   // cin>>t;
    fix(12);
    while(t--)
        solve();
    return 0;
}		


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

using namespace std;

#ifdef SG
	#include <debug.h>
#else
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned char uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

const ld pi = 3.1415926535897932384626433832795l;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

int main () {
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);
#ifdef SG
	freopen((problemname + ".in").c_str(), "r", stdin);
//	freopen((problemname + ".out").c_str(), "w", stdout);
#endif
	ll n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	b -= a;
	for (int i = 0; i < n; ++i) {
		ll l = (n - i - 1) * c - d * i, r = (n - i - 1) * d - i * c;
		if (b >= l && b <= r) {
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    long K, A, B;cin >> K >> A >> B;
    long sol = 0;
    if(B-A <=2) {
        cout << K+1;
    } else {
        if(K <= A){
            cout << K+1;
        } else {
            long diff = K-A+1;
            sol = A;
            if(diff % 2 == 0){
                sol += (B-A)*diff/2;
            } else {
                sol += (B-A)*(diff-1)/2+1;
            }
            cout << sol;
        }
    }
    return 0;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
s = list(input())
if s[k-1]=="A": 
	s[k-1] = "a"
elif s[k-1]=="B": 
	s[k-1] = "b"
else:
	s[k-1] = "c"
 
print("".join(s))

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

int five_num(int num, int i = 1)
{
  int buf_i = (int)pow(5, i);
  if (num / buf_i == 0) return 0;
  return num / (int)pow(5, i) + five_num(num, i + 1);
}

int main(void)
{
  int n;
  while (true)
  {
    cin >> n;
    if (n == 0) break;
    cout << five_num(n) << endl;
  }
  return 0;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "cycle"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

int v[MAXN];

void solve(){
	int n, ans;
	scanf("%d", &n);
	REP(i, 0, 2 * n){
		scanf("%d", &v[i]);
	}
	sort(v, v + 2 * n);
	ans = 0;
	for(int i = 0; i < 2 * n; i += 2){
		ans += v[i];
	}
	printf("%d\n", ans);
}	

int main(){

	//freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();	
	}
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,m=map(int,input().split())
    E=[[] for _ in range(n)]
    for _ in range(m):
        u,v,w=map(int,input().split())
        u-=1; v-=1
        E[u].append((v,w))
        E[v].append((u,-w))

    pos=[INF]*n # position
    def dfs(v)->bool:
        if(pos[v]!=INF): return True
        pos[v]=0
        Q=[v]
        while(Q):
            v=Q.pop()
            for nv,w in E[v]:
                if(pos[nv]==INF):
                    pos[nv]=pos[v]+w
                    Q.append(nv)
                else:
                    if(pos[nv]!=pos[v]+w):
                        return False
        return True
    for v in range(n):
        if(not dfs(v)):
            print("No")
            return
    print("Yes")
resolve()

Measured memory_bytes: 78368
#include <bits/stdc++.h>
using namespace std;
#define repr(i,k,n) for(int i = (k); i < (n); i++)
#define rep(i,n) repr(i,0,n)
#define ALL(a) begin(a),end(a)
const int INF = 114514810;
const int MOD = 1000000007;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,al,bl;
	string A,B;
	int ma=11,F;
	cin >> N;
	repr(i,1,sqrt(N)+100){
		if (N%i==0){
			A=to_string(i);
			B=to_string(N/i);
			al=A.size();
			bl=B.size();
			if (al>=bl){
				F=al;
			}else{
				F=bl;
			}
			if (ma>=F){
				ma=F;
			}
		}
	}
	cout << ma << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.12f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define Endl endl
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
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;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;


    UnionFind(ll N): par(N), siz(N, 1LL) {
        for (ll i = 0; i < N; ++i) par[i] = i;
    }

    void init(ll N) {
        par.resize(N);
        siz.assign(N, 1LL);
        for (ll i = 0; i < N; ++i) par[i] = i;
    }


    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }


    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool same(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};


int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int N,K,L; cin >> N >> K >> L;
    UnionFind road(N);
    UnionFind rail(N);
    int root[200200];
    Fill(root, 0);
    rep(i,0,K){
        int p,q; cin >> p >> q;
        p--; q--;
        road.unite(p,q);
    }
    rep(i,0,L){
        int r,s; cin >> r >> s;
        r--; s--;
        rail.unite(r,s);
    }

    map<pair<int,int>,int> mp;
    rep(i,0,N) mp[{road.root(i), rail.root(i)}]++;

    rep(i,0,N){
        if(i != 0) cout << " ";
        cout << mp[{road.root(i), rail.root(i)}];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 21268
#include <stdio.h>
#include <string.h>
int main(void){
  
  char S[50];
  char *w1 = "Sunny";
  char *w2 = "Cloudy";
  char *w3 = "Rainy";
  
  scanf("%s",S);
  if(strcmp(S,w1)==0){
    printf("Cloudy");
  }
  if(strcmp(S,w2)==0){
    printf("Rainy");
  }
  if(strcmp(S,w3)==0){
    printf("Sunny");
  }
  return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int n;
    cin >> n;
    vector<pll> ba(n);
    for (int i = 0; i < n; ++i) {
        cin >> ba[i].second >> ba[i].first;
    }
    sort(ba.begin(), ba.end());
    bool ok = true;
    ll time = 0;
    for (auto &t : ba) {
        time += t.second;
        if (time > t.first) {
            ok = false;
            break;
        }
    }
    if (ok)
        cout << "Yes"
             << "\n";
    else
        cout << "No"
             << "\n";
    return 0;
}

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

int main() {
  int a[3][3];
  cin >> a[0][0] >> a[0][1] >> a[1][1];
  for(int t=0; t<=300; t++) {
    a[0][2]=t-a[0][0]-a[0][1];
    a[2][1]=t-a[1][1]-a[0][1];
    a[2][2]=t-a[0][0]-a[1][1];
    a[1][2]=t-a[2][2]-a[0][2];
    a[1][0]=t-a[1][1]-a[1][2];
    a[2][0]=t-a[0][0]-a[1][0];
    bool f=1;
    for(int i=0; i<3; i++) {
      int x=0;
      for(int j=0; j<3; j++) x+=a[i][j];
      if(x!=t) f=0;
    }
    for(int i=0; i<3; i++) {
      int x=0;
      for(int j=0; j<3; j++) x+=a[j][i];
      if(x!=t) f=0;
    }
    if(a[0][0]+a[1][1]+a[2][2]!=t) f=0;
    if(a[2][0]+a[1][1]+a[0][2]!=t) f=0;
    if(!f) continue;
    for(int i=0; i<3; i++) {
      for(int j=0; j<3; j++) {
        if(j) cout << " ";
        cout << a[i][j];
      }
      cout << endl;
    }
    return 0;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=100010,mod=998244353;
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline int read(){
	int x=0,f=0;char ch=getchar();
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
int n,a[maxn],fac[maxn],fl,ans;
void hhh(int x){
	for(int i=1;i*i<=x;i++) if(x%i==0){
		fac[++fl]=i;
		if(i*i!=x) fac[++fl]=x/i;
	}
}
int gcd(int x,int y){
	return y?gcd(y,x%y):x;
}
int main(){
	n=read();
	FOR(i,1,n) a[i]=read();
	hhh(a[1]);
	FOR(i,2,n) ans=gcd(ans,a[i]);
	FOR(i,1,fl){
		int c=0;
		FOR(j,1,n) if(a[j]%fac[i]==0) c++;
		if(c>=n-1) ans=max(ans,fac[i]);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 640
#include<stdio.h>
int a,b,c,d;
int main()
{
    scanf("%d%d%d",&a,&b,&c);
    if(a<b)
    {
    	d=a;
    	a=b;
    	b=d;
	}
	if(a<c)
    {
    	d=a;
    	a=c;
    	c=d;
	}
	if(b<c)
    {
    	d=b;
    	b=c;
    	c=d;
	}
	printf("%d",10*a+b+c);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    int n;
    cin>>n;
    int lst[n];
    rep(i,n)cin>>lst[i];
    rep(i,n)lst[i]--;
    int res=0;
    rep(i,n-1){
        if(lst[i]==i){
            swap(lst[i],lst[i+1]);
            res++;
        }
    }
    if(lst[n-1]==n-1){
        res++;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 640
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();
		
		if(a < b){
			System.out.println("a < b");
		}
		
		else if(a > b){
			System.out.println("a > b");
		}

		else{
			System.out.println("a == b");
		}
		
	}

}

Measured memory_bytes: 26316