akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

const ll MOD = 1000000007;

struct mint {
    ll x;
    mint(ll x = 0) : x((x % MOD + MOD) % MOD) {
    }
    mint operator-() const {
        return mint(-x);
    }
    mint &operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint &operator-=(const mint a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint &operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t / 2);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime MOD
    mint inv() const {
        return pow(MOD - 2);
    }
    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

ostream &operator<<(ostream &os, const mint &a) {
    return os << a.x;
}
int main() {
    ll N, K;
    cin >> N >> K;

    vec<ll> A(N);
    rep(i, N) cin >> A[i];
    sort(all(A), greater<ll>());

    mint ans = 1;
  
    if(K % 2 == 1 && A[0] < 0) {
      rep(i,K) ans*=A[i];
      cout << ans << endl;
      return 0;
    }
  
    ll l = 0, r = N - 1;

    if (K % 2 == 1) ans *= A[0], l = 1;

    rep(_, K / 2) {
        if (A[l] * A[l + 1] > A[r] * A[r - 1]) {
            ans *= A[l] * A[l + 1];
            l += 2;
        } else {
            ans *= A[r] * A[r - 1];
            r -= 2;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 4808
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] = new int[n];
		for(int i=1; n >= i; ++i){
			if(i%2 == 0) {
				int ai = sc.nextInt();
				int aiplus = sc.nextInt();
				a[n/2 - i/2] = aiplus;
				a[n/2 + i/2 -1] = ai;
				if (i == n) {
					for (int j=0; n > j; j++) {
						System.out.print(a[j] + " ");
					}
				}
			} else if(i == n) {
				int an = sc.nextInt();
				a[n-1] = an;
				for (int j=n-1; j>=0; j--) {
					System.out.print(a[j] + " ");
				}
			}
		}
	}
}


Measured memory_bytes: 92420
#include<bits/stdc++.h>
using namespace std;
string s;
struct node
{
    int a[26];
    node()
    {
        memset(a,0,sizeof(a));
    }
};
node d[52];
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t,i,j,n,m,l,r;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>s;
        m=s.size();
        for(char c:s)
        {
            l=c-97;
            d[i].a[l]++;
        }
    }
    s.clear();
    for(i=0;i<26;i++)
    {
        l=INT_MAX;
        for(j=0;j<n;j++)
        {
            l=min(l,d[j].a[i]);
        }
        for(j=0;j<l;j++)
        {
            s+=(char)(i+97);
        }
    }
    cout<<s<<"\n";
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    char s[19],x=',';
    int i;
    scanf("%s",&s);
    for(i=0;s[i]!='\0';i++)
    {

        if(s[i]==',')
        {
            s[i]=' ';
        }
    }
    printf("%s\n",s);
    return 0;
}


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

typedef long long ll;
typedef long double ld;

ll dp[200005];

const int MX = 1000000;
const int INF = 1000000000;

struct line{
    ll a, b;
    ll val(ll x){
        return a*x+b;
    }
} seg[4000005];

void init(int node, int l, int r){
    seg[node].a = INF;
    seg[node].b = INF;
    if(l == r) return;
    int mid = (l+r)/2;
    init(node*2, l, mid);
    init(node*2+1, mid+1, r);
}

ll query(int node, int l, int r, int x){
    if(l == r) return seg[node].val(x);
    int mid = (l+r)/2;
    if(x <= mid){
        return min(seg[node].val(x), query(node*2, l, mid, x));
    }
    return min(seg[node].val(x), query(node*2+1, mid+1, r, x));
}

void add_line(int node, int l, int r, line p){
    ll a = seg[node].val(l);
    ll b = p.val(l);
    ll c = seg[node].val(r);
    ll d = p.val(r);
    if(a <= b && c <= d) return;
    if(a >= b && c >= d){
        seg[node] = p;
        return;
    }
    int mid = (l+r)/2;
    add_line(node*2, l, mid, p);
    add_line(node*2+1, mid+1, r, p);
}

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n;
    ll c;
    cin >> n >> c;
    init(1, 1, MX);
    for(int i=1; i<=n; i++){
        ll x;
        cin >> x;
        dp[i] = query(1, 1, MX, x);
        dp[i] += x*x + c;
        if(i == 1) dp[i] = 0;
        line p = {-2*x, dp[i] + x*x};
        add_line(1, 1, MX, p);
    }
    cout << dp[n];
    return 0;
}


Measured memory_bytes: 37760
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000000000+7
using namespace std;
typedef long long ll;

int main(){
  int n, m; cin >> n >> m;
  vector<vector<bool>> vec(n, vector<bool>(m, false));
  rep(i, 0, n){
    int k;  cin >> k;
    rep(j, 0, k){
      int a;  cin >> a;
      a--;
      vec[i][a] = true;
    }
  }
  int ans = 0;
  rep(i, 0, m){
    bool like = true;
    rep(j, 0, n){
      if(!vec[j][i])  like = false;
    }
    if(like)  ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
from sys import stdin
readline = stdin.readline


from fractions import Fraction
from fractions import gcd
from functools import reduce

from collections import namedtuple
Runner = namedtuple('Runner', 'd v')

def common_denominator(r0, ri):
    return Fraction(r0.d * ri.v, r0.v * ri.d).denominator

def lcm(a, b):
    return a * b / gcd(a, b)

while True:
    n = int(readline())
    if n == 0:
        break
    runners = [Runner(*map(int, readline().split())) for _ in range(n)]
    
    denominators = [common_denominator(runners[0], ri) for ri in runners[1:]]
    
    round_of_0 = int(reduce(lcm, denominators))
    time = Fraction(runners[0].d * round_of_0, runners[0].v)
    
    for ri in runners:
        print(time * ri.v / ri.d)

Measured memory_bytes: 14768
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        // a(n) = Sum_{k=1..n} k/2 * floor(n/k) * floor(1 + n/k)
        
        long ans = 0;
        for (long k = 1; k <= n; k++) {
            long now = (n / k) * (1 + (n / k)) * k / 2;
            ans += now;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35672
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }

void _main() {
  ll S;
  cin >> S;

  int t = S % 100;
  S /= 100;

  int ans = inf;
  while (S != 0) {
    t += (S % 10) * 100;
    chmin(ans, abs(753-t));
    t /= 10;
    S /= 10;
  }

  cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		 //sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;
int main() {
    int N;
    cin>>N;
    vector<ll> x(N),y(N),h(N);
    int id = 0;
    for(int i = 0; i < N; ++i){
        cin>>x[i]>>y[i]>>h[i];
        if(h[i]>0){
            id = i;
        }
    }

    for(int a = 0; a <= 100; ++a){
        for(int b = 0; b <= 100; ++b){
            bool AllOK = true;
            ll H = h[id] + abs(a - x[id]) + abs(b - y[id]);
            //if(H == 0) continue;
            for(int i = 0; i < N; ++i){
                ll nowH = max(ll(0),H - abs(a-x[i]) - abs(b-y[i]));
                if(nowH != h[i]){
                    AllOK = false;
                }
            }
            if(AllOK){
                cout<<a<<" "<<b<<" "<<H<<endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5+10;
bool dp[N];
int n,k;
//dp[i] True if first player is winning with i coins remaining
int main(){
    scanf("%d%d",&n,&k);
    std::vector<int> a(n);
    for(int i=0;i<n;++i)cin>>a[i];
    for(int stones=0;stones<=k;++stones){
        for(int x:a){
            if(stones>=x && !dp[stones-x]){
                dp[stones] = 1;
            }
        }
    }
    if(dp[k]){
        std::cout << "First" << std::endl;
    }else{
        cout<<"Second"<<endl;
    }
    return 0;
}

Measured memory_bytes: 384
n = input()
r = range(0,52)
for i in range(0,n):
	x = map(str,raw_input().split(" "))
	y = (int(x[1])-1)/13
	if x[0] == "S":
		y = 0
	elif x[0] == "H":
		y = 1
	elif x[0] =="C":
		y = 2
	else:
		y = 3
	z = (int(x[1])-1)
	r.remove(y*13+z)
s = "S"
for j in range(0,len(r)):
	y = r[j]/13
	z = r[j]%13
	if y ==1:
		s = "H"
	elif y ==2:
		s = "C"
	elif y ==3:
		s ="D"
	print s+" "+str(z+1)

Measured memory_bytes: 4252
import collections

MOD = pow(10, 9)+7

def main():
    N = int(input())
    A = list(map(int, input().split()))
    Acount = collections.Counter(A)
    Aitem = list(zip(*Acount.items()))
    ans = 1
    flag = True
    if N == 1:
        if Acount[0] != 1:
            flag = False
    elif N%2 == 0:
        if set(Aitem[1]) != {2}:
            flag = False
        for a in Aitem[0]:
            if a%2 == 0:
                flag = False
                break
    else:
        if set(Aitem[1]) != {1, 2}:
            flag = False
        if Acount[0] != 1:
            flag = False
        for a in Aitem[0]:
            if a%2 == 1:
                flag = False
                break
    if flag:
        for a in Aitem[1]:
            ans = (ans * a)%MOD
    else:
        ans = 0
    print(ans%MOD)

if __name__ == "__main__":
    main()


Measured memory_bytes: 19936
use std::io;
fn read<T: std::str::FromStr>() -> Vec<T>{
    let mut t = String::new();
    io::stdin().read_line(&mut t).unwrap();
    t.trim().split_whitespace().map(|x| x.parse().ok().unwrap()).collect()
}
fn main() {
    let r : Vec<i32> = read();
    let s = r[1] / r[0];
    if s < r[2] {
        print!("{}", s);
    } else {
        print!("{}", r[2]);
    }
}



Measured memory_bytes: 4476
#include <bits/stdc++.h>
#include <variant>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

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


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int L;
  L = S.length();
  
  if (S[L-1] == 's'){
    S = S + "es";
     cout << S <<endl;    
  }else{
    S = S + "s";
      cout << S <<endl;
  }


}

   
    


Measured memory_bytes: 3632
N,K = map(int,input().split())
p = list(map(int,input().split()))
s = sum(p[:K])
maxs = s
for i in range(N-K):
    s = s - p[i] + p[K+i]
    maxs = max(maxs,s)
ans = (maxs + K)/2
print(ans)

Measured memory_bytes: 24808
using System;
using System.Linq;

class ABC{
    static void Main(string[] args){
        const int baseValue = 700;
        const int toppingValue = 100;
        string order = Console.ReadLine();
        int topping = order.Count(x => x == 'o');
        Console.WriteLine(baseValue + toppingValue*topping);
    }
}

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

ll mod = 1000000007;

ll modpow(ll a, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

int main() {
  ll n;
  cin >> n;
  ll ans = modpow(10, n) - 2*modpow(9, n) + modpow(8, n);
  ans %= mod;
  ans = (ans + mod) % mod;
  cout << ans << endl;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<deque>
#include<algorithm>
#include<math.h>

using namespace std;
int main() {
	
	//D
	int n;
	string s;
	cin >> n;
	cin >> s;
	s[n] = s[0];
	//SS, SW, WS, WW
	int i, j;
	char t[100003];
	for (j = 0; j < 4; j++) {
		if (j == 0) {
			t[0] = 'S';
			t[1] = 'S';
		}
		else if (j == 1) {
			t[0] = 'S';
			t[1] = 'W';
		}
		else if (j == 2) {
			t[0] = 'W';
			t[1] = 'S';
		}
		else if (j == 3) {
			t[0] = 'W';
			t[1] = 'W';
		}
		for (i = 1; i <= n; i++) {
			if (t[i] == 'S') {
				if (s[i] == 'o') {
					t[i + 1] = t[i - 1];
				}
				else if (s[i] == 'x') {
					if (t[i - 1] == 'S') {
						t[i + 1] = 'W';
					}
					else {
						t[i + 1] = 'S';
					}
				}
			}
			else if (t[i] == 'W') {
				if (s[i] == 'x') {
					t[i + 1] = t[i - 1];
				}
				else if (s[i] == 'o') {
					if (t[i - 1] == 'S') {
						t[i + 1] = 'W';
					}
					else {
						t[i + 1] = 'S';
					}
				}
			}
		}
		if (t[0] == t[n] && t[1] == t[n + 1]) {
			for (i = 0; i < n; i++) {
				cout << t[i];
			}
			cout << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
	
	//C
	/*long long int n, m;
	cin >> n >> m;
	if (n >= m / 2) {
		cout << m / 2 << endl;
		return 0;
	}
	else {
		cout << n + (m - 2 * n) / 4 << endl;
		return 0;
	}
	*/
}

Measured memory_bytes: 3788
import java.util.Scanner;
import java.util.Map;
import java.util.HashMap;

public class Main {
    public static void main (String[] args) {

        Map<String, Integer> ms = new HashMap<String, Integer>();
        Map<String, Integer> mt = new HashMap<String, Integer>();

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            String s = sc.next();
            ms.put(s, (ms.containsKey(s)? ms.get(s)+1 : 1));
        }

        int m = sc.nextInt();
        for (int i = 0; i < m; i++) {
            String t = sc.next();
            mt.put(t, (mt.containsKey(t)? mt.get(t)+1 : 1));
        }

        int ans = 0;
        for (String s : ms.keySet()) {
            int plus = ms.get(s);
            int minus = (mt.containsKey(s)? mt.get(s) : 0);

            ans = Math.max(ans, plus - minus);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<iostream>
#define K 100001
using namespace std;
int main()
{
  int n,ans;
  int a[K];
  int b[K]={0};
  ans=0;
  scanf("%d",&n);
  for(int i=0;i<n;i++)
    {
      scanf("%d",&a[i]);
      if(a[i]>n)
	{
	  ans++;
	}
      else
	{
	  b[a[i]]++;
	}
    }
  for(int i=0;i<K;i++)
    {
      if(b[i]<i)
	{
	  ans+=b[i];
	}
      else if(b[i]>i)
	{
	  ans+=b[i]-i;
	}
    }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
    static long[][] dp;
    static long[] s;
    static int N;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        int[] a = new int[N];
        s = new long[N+1];
        s[0] = 0;
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
            s[i+1] = s[i] + a[i];
        }
        dp = new long[N][N];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    dp[i][j] = 0;
                } else {
                    dp[i][j] = -1;
                }
            }
        }
        System.out.println(rec(0,N-1));
    }
    public static long rec(int left, int right) {
        if (dp[left][right] != -1) return dp[left][right];
        long ans = s[N] * (long) N;
        for(int k = left; k < right; k++) {
            ans = Math.min(rec(left,k) + rec(k+1,right), ans);
        }
        ans += s[right + 1] - s[left];
        dp[left][right] = ans;
        return ans;
    }
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 10000000000
using ll = long long;
using Graph = vector<vector<int>>;

//二項係数を求める。
const int MAX = 510000;
const int MOD = 1000000007;

ll 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;
    }
}

// 二項係数計算
ll 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(){
  ll N,K; cin>>N>>K;
  COMinit();
  ll res = 0;
  for(ll z = 0; z <= min(K,N-1); z++){
    //z は 0　の個数
    if(z==0)res+=1;
    else if(z==1)res+=N*(N-1);
    else{
      ll tmp = COM(N,z);
      tmp *= COM(N-1,N-z-1);
      tmp %= MOD;
      res += tmp;
    }
    res %= MOD;
  }
  cout<<res<<endl;
}

Measured memory_bytes: 12160
/*
 * 	Roses are red
 * 		Violets are blue
 * 			I cried
 * 				And so did you
 */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#ifndef rd
#define endl '\n'
#endif
#ifdef rd
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=2e18;
const int infi=1e9;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag,
		tree_order_statistics_node_update> oset;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
auto clk=clock();
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}

int powm(int a, int b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

void solve() {
	string s;
	cin>>s;
	if(sz(s)==2) {
		if(s[0]==s[1]) {
			cout<<"1 2"<<endl;
			return;
		}
	}
	set<char> lol;
	for(int i=0; i+2<sz(s); i++) {
		lol.clear();
		for(int j=i; j<i+3; j++)
			lol.insert(s[j]);
		if(sz(lol)<=2) {
			cout<<i+1<<" "<<i+3<<endl;
			return;
		}
	}
	cout<<"-1 -1"<<endl;
}

signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	while(t--)
		solve();
#ifdef rd
	cout<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define per(i,n) for(int i = n; i >= 0; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for(int i = 0; i < n-1; i++) {
    int tmp = 0;
    string l = s.substr(0,i);
    string r = s.substr(i,n-i);
    for(char j = 'a'; j <= 'z'; j++) {
      if(l.find(j) != string::npos && r.find(j) != string::npos) tmp++;
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	string s,t;
	cin>>s>>t;
	int n=s.size();
	if(t.substr(0,n)==s) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

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

int main() {
  int H,W;
  cin >> H >> W;
  vector<string> map(H);
  
  for(int i=0;i < H;i++)
    cin >> map.at(i);
  
  for(int i=0;i < W+2; i++)
    cout << "#";
  cout << endl;
  for(int i=0;i < H; i++) {
    cout << "#";
    cout << map.at(i);
    cout << "#" << endl;
  }
  for(int i=0;i < W+2; i++)
    cout << "#";
  cout << endl;  
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		Set<String> set = new HashSet<>();

		StringBuilder sb = new StringBuilder();

		for (int i = 0; i < n; i++) {
			String[] str = br.readLine().split(" ");

			if(str[0].equals("insert")){
				set.add(str[1]);
			}else {
				if((set.contains(str[1])) !=false){
					sb.append("yes");
					sb.append("\n");
				}else {
					sb.append("no");
					sb.append("\n");
				}
			}


		}

		System.out.print(sb);
	}

}

Measured memory_bytes: 197152
from heapq import heappush, heappop
from collections import deque
import re
import math
import functools
import itertools
import fractions

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))


INF = 1 << 29


def mk1d(n, val=INF):
    return [val for i in range(n)]

def mk2d(h, w, val=INF):
    return [[val for i in range(w)]for i in range(h)]

DIV = 998244353


def convolve(a, b):
    p, g = 1107296257, 5
    n0, n1 = len(a), len(b)
    n = 1 << (max(n0, n1) - 1).bit_length() + 1
    a = a + [0] * (n-n0)
    b = b + [0] * (n-n1)
    w = pow(g, (p - 1) // n, p)
    invw = pow(w, p-2, p)

    def fft(f):
        d = n // 2
        v = w
        while d >= 1:
            u = 1
            for i in range(d):
                for j in range(i, n, 2*d):
                    f[j], f[j+d] = (f[j] + f[j+d]) % p, u * (f[j] - f[j+d]) % p
                u = u * v % p
            v = v * v % p
            d //= 2

    def ifft(f):
        d = 1
        while d < n:
            v = pow(invw, n // (2 * d), p)
            u = 1
            for i in range(d):
                for j in range(i, n, 2*d):
                    f[j+d] *= u
                    f[j], f[j+d] = (f[j] + f[j+d]) % p, (f[j] - f[j+d]) % p
                u = u * v % p
            d *= 2

    fft(a), fft(b)
    for i in range(n):
        a[i] = a[i] * b[i] % p
    ifft(a)
    invn = pow(n, p - 2, p)
    return [a[i] * invn % p for i in range(n0 + n1 - 1)]


def gcd(a, b):
    if(b == 0):
        return a
    return gcd(b, a % b)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def lcm(*numbers):
    return functools.reduce(lcm_base, numbers, 1)


def lcm_list(numbers):
    return functools.reduce(lcm_base, numbers, 1)

def main():
    N,M = isRaw()
    As = isRaw()
    As2 = [a//2 for a in As]
    div2X =2
    while True:
        divResult = sum([a%div2X==0 for a in As])
        if divResult != len(As2):
            if divResult != 0:
                return 0
            break
        div2X *=2
    lcm = lcm_list(As2)
    nCM = M//lcm
    return (nCM+1)//2

if __name__ == "__main__":
    print(main())


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

int main(void) {
    int a, b, c, t;
    
    cin >> a >> b >> c;
    
    if (a > b) {t = b; b = a; a = t;}
    if (b > c) {t = c; c = b; b = t;}
    if (a > b) {t = b; b = a; a = t;} //?????????????\???????????????????
    
    cout << a << " " << b << " " << c << endl;
    
    return 0;
    }

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vvl = vector<vector<ll>>;
using vl  = vector<ll>;
#define _GLIBCXX_DEBUG
#define acc_io cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(ll i=sta;i<end;i++)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
const ll MOD = 1000000007;
const double PI = acos(-1);  
//name[i]   -> vl  name(i)
//name[i][j]-> vvl name(i,vl(j))
//or-> ||
//map<int,int>mp

ll n;
ll ans;
//string s;
signed main(){
	acc_io;
	ans=0;
	cin>>n;
	set<int>a;
	ll b;
	rep(i,0,n){
		cin>>b;
		if(a.count(b))	a.erase(b);
		else			a.insert(b);
	}
	ans=a.size();
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4992
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static final Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	List<Integer>[] paths;
	double[] dp = new double[650];
	int N,M;
	double res = 1<<60;

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		N = nextInt();
		M = nextInt();
		paths = new List[N+1];
        for (int i=0;i<=N;i++) {
            paths[i] = new ArrayList<>();
        }

		for(int i=1;i<=M;i++) {
			int s,t;
			s = nextInt();
			t = nextInt();
			paths[s].add(t);
		}
	    for(int i=0;i<N;i++) {
	        f(i);
	    }
	    out.println(res);
	}

	void f(int block) {
	    dp[N] = 0;
	    for(int i=N-1;i>=1;i--) {
	        double sum = 0.0;
	        double maxi = 0.0;
	        int num = paths[i].size();
	        for(Integer to : paths[i]) {
	        	//out.println(to);
	            sum += dp[to];
	            maxi = Math.max(maxi, dp[to]);
	        }
	        if(i == block && num >= 2) {
	            num--;
	            sum -= maxi;
	        }
	        dp[i] = sum / num + 1;
	    }
	    res = Math.min(res, dp[1]);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

	long gcd(long m,long n) {
		if (m<n) return gcd(n,m);
		if (n==0)return m;
		return gcd(n,m%n);
	}
}

Measured memory_bytes: 68328
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int n,s;
    while(cin>>n>>s,n||s){
        vector<int>V(n);
        for(int i=0;i<n;i++)cin>>V[i];
        sort(V.begin(),V.end());
        int cnt=0;
        for(int i=0;i<n;i++){
            int left=s-V[i];
            cnt+=V.end()-upper_bound(V.begin()+i+1,V.end(),left);
        }
        cout<<cnt<<endl;
    }
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;
    return 0;
}

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

static const long N = 100;

int main(){
	long n, p[N + 1], m[N + 1][N + 1];
	cin >> n;
	for (long i = 1; i <= n; i++){
		cin >> p[i - 1] >> p[i];
	}

	for (long i = 1; i <= n; i++) m[i][i] = 0;
	for (long l = 2; l <= n; l++){
		for (long i = 1; i <= n - l + 1; i++){
			long j = i + l - 1;
			m[i][j] = (1 << 21);
			for (long k = i; k <= j - 1; k++){
				m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
			}
		}
	}

	cout << m[1][n] << endl;

	return 0;
}

Measured memory_bytes: 1240
/*"Success isn't permanent, failure isn't fatal,
                                      it's the courage to continue that counts"*/
#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;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const int mod=1e9+7;         
const int N=41;

int main()
{
	ll n,a,b;

	lscn(n); lscn(a); lscn(b);

	ll ans=(n/(a+b))*a;

	ll rem=n%(a+b); ans+=min(rem,a);

	lpri(ans);

    return 0;
}


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

using namespace std;

#define N 300000

int n,f[N],g[N],dp[1<<26];
char s[N];

void upd(int &x,int y){x=min(x,y);}

int main(){
	scanf("%s",s+1); n=strlen(s+1);
	for (int i=1;i<=n;++i){
		f[i]=f[i-1];
		f[i]^=1<<(s[i]-'a');
	}
	memset(dp,0x3f,sizeof dp); dp[0]=0;
	for (int i=1;i<=n;++i){
		g[i]=n;
		upd(g[i],dp[f[i]]+1);
		for (int j=0;j<26;++j){
			upd(g[i],dp[f[i]^(1<<j)]+1);
		}
		upd(dp[f[i]],g[i]);
	}
	printf("%d\n",g[n]);
	
	return 0;
}
			

Measured memory_bytes: 264576
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

signed main() {
    int N;
    cin >> N;
    int A[N];
    for (int i = 0; i < N; i++) cin >> A[i];

    int ret = gcd(A[0], A[1]);

    for (int i = 2; i < N; i++) {
        ret = gcd(ret, A[i]);
    }

    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    string s, t;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (char(s[i]) != 'A') t += s[i];
    }
    
    if (t == "KIHBR") {
        int a[6] = {}, i = 0;
        while (char(s[i]) != 'K') {
            a[0]++; i++;
        }
        i++;
        while (char(s[i]) != 'I') {
            a[1]++; i++;
        }
        i++;
        while (char(s[i]) != 'H') {
            a[2]++; i++;
        }
        i++;
        while (char(s[i]) != 'B') {
            a[3]++; i++;
        }
        i++;
        while (char(s[i]) != 'R') {
            a[4]++; i++;
        }
        i++;
        while (i < s.size()) {
            a[5]++; i++;
        }
        if (a[0] <= 1 && a[1] == 0 && a[2] == 0 && a[3] <= 1 && a[4] <= 1 && a[5] <= 1) {
            cout << "YES" << endl;
        }
        else cout << "NO" << endl;
    }
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#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 (a>b) { a=b; return 1; } return 0; }

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

    int N; cin >> N;
    vel T(N), A(N); rep(i,N) cin >> T[i]; rep(i,N) cin >> A[i];

    ll ans = 1LL;
    if(T[0] > A[0] or T[N-1] < A[N-1]) {cout << 0 << endl; return 0;}
    rep1(i,N-1) {
        if(T[i] > T[i-1] and A[i] > A[i+1]) {
            if(T[i] != A[i]) { cout << 0 << endl; return 0; }
        }
        else if(T[i] > T[i-1] and A[i] == A[i+1]) {
            if(T[i] > A[i]) { cout << 0 << endl; return 0; }
        }
        else if(T[i] == T[i-1] and A[i] > A[i+1]) {
            if(A[i] > T[i]) { cout << 0 << endl; return 0; }
        }
        else { ans *= min(A[i], T[i]); ans %= mod; }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef   long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define B 998244353ll
#define C 1000000000000000000ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI 3.1415926535

double dp[3002][3002];

int main() 
{
    FAST;
    ll n;
    cin>>n;
    double p[n];
    for(int i=0;i<n;i++)
        cin>>p[i];
    dp[0][0]=1-p[0];
    dp[0][1]=p[0];
    for(int i=1;i<n;i++)
    {
        dp[i][0]=dp[i-1][0]*(1-p[i]);
        for(int j=1;j<=i+1;j++)
            dp[i][j]=(dp[i-1][j]*(1-p[i]))+(dp[i-1][j-1]*p[i]);
    }
    cout.precision(12);
    double ans=0;
    for(int i=(n+1)/2;i<=n;i++)
        ans+=dp[n-1][i];
    cout<<ans;
    return 0;
}

Measured memory_bytes: 68992
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PI;
typedef pair<LL, LL> PLL;
const LL MOD = 1000000007LL;
const int inf = 1e9;
const LL INF = 1e18;
char s[50][51];
int dist[50][50];
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
int main() {
	int H, W;
	cin >> H >> W;
	int tot = 0;
	for (int i = 0; i < H; i++) {
		cin >> s[i];
		for (int j = 0; j < W; j++) if (s[i][j] == '.') tot++;
	}
	memset(dist, -1, sizeof(dist));
	dist[0][0] = 1;
	queue<PI> Q;
	Q.push(PI(0, 0));
	while (!Q.empty()) {
		PI p = Q.front(); Q.pop();
		int x = p.first, y = p.second;
		if (x == W - 1 && y == H - 1) break;
		for (int i = 0; i < 4; i++) {
			int nx = x + dx[i];
			int ny = y + dy[i];
			if (0 > nx || nx >= W || 0 > ny || ny >= H || s[ny][nx]=='#' || dist[ny][nx] != -1) continue;
			dist[ny][nx] = dist[y][x] + 1;
			Q.push(PI(nx, ny));
		}
	}
	if (dist[H - 1][W - 1] == -1) {
		cout << -1 << endl;
	}
	else {
		cout << tot - dist[H - 1][W - 1] << endl;
	}
}

Measured memory_bytes: 256
num_T = 0
num_H = 0


turnCount = int(input())
for i in range(turnCount):
    T, H = input().split(" ")
    if T == H:
        num_T += 1
        num_H += 1
    elif T > H:
        num_T += 3
    else:
        num_H += 3
    
print(f"{num_T} {num_H}")
    


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

int main()
{
    int n,l;
    cin>>n>>l;
    string s[n];
    for(int i=0;i<n;i++)
        cin>>s[i];
        sort(s,s+n);
    for(int i=0;i<n;i++)
        cout<<s[i];

  return 0;
}


Measured memory_bytes: 256
a, b = map(int, input().split())
if a == b:
    ans = a
elif a % 2 == 0:
    if (b - a) % 4 == 0:
        ans = 0 ^ b
    elif (b - a) % 4 == 2:
        ans = 1 ^ b
    elif (b - a) % 4 == 1:
        ans = 1
    else:
        ans = 0
else:
    if (b - a) % 4 == 0:
        ans = a ^ 0
    elif (b - a) % 4 == 2:
        ans = a ^ 1
    elif (b - a) % 4 == 1:
        ans = a ^ 0 ^ b
    else:
        ans = a ^ 1 ^ b
print(ans)

Measured memory_bytes: 3064
import math
from functools import reduce

def gcd_mul(*numbers):
    return reduce(math.gcd, numbers)

k = int(input())

result = 0
# for c in range(1, k+1):
    # for b in range(c+1, k+1):
        # for a in range(b+1, k+1):
            # result += gcd(a, b, c)

result_1 = 0
for num in range(1, k+1):
    result_1 += num

result_2 = 0
for num_one in range(1, k+1):
    for num_two in range(num_one+1, k+1):
        result_2 += math.gcd(num_one, num_two)

result_2 *= 6

result_3 = 0
for num_one in range(1, k+1):
    for num_two in range(num_one+1, k+1):
        for num_three in range(num_two+1, k+1):
            result_3 += gcd_mul(num_one, num_two, num_three)

result_3 *= 6

# print(result_1, result_2, result_3)

result = result_1 + result_2 + result_3
print(result)

Measured memory_bytes: 69212
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<string>
#include <ios>     
#include <iomanip> 
using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

llong gcd(llong a, llong b) {
	if (a < b) swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}

llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}

//ここまで共通

int N;
llong H;
vector<pair<llong, llong>> P;
llong maxA = 0;
llong minB = 0;
llong ANS = 0;

bool ope1(pair<llong, llong> a, pair<llong, llong>b) {
	return a.second > b.second;
}

int main() {
	cin >> N >> H;
	for (int i = 0; i < N; i++) {
		llong a, b;
		cin >> a >> b;
		maxA = max(maxA, a);
		pair<llong, llong>p = make_pair(a, b);
		P.push_back(p);
	}

	for (int i = 0; i < N; i++) {
		if (P[i].first == maxA) {
			if (minB == 0) minB = P[i].second;
			else minB = min(minB, P[i].second);
		}
	}

	

	sort(P.begin(), P.end(), ope1);
	int i = 0;
	bool F = true;

	while (H > 0) {
		if (H <= minB) {
			ANS++;
			break;
		}
		if (P[i].first == maxA && P[i].second == minB && F) {
			pair<llong, llong> k = make_pair(0, 0);
			P.push_back(k);
			i++;
			F = false;
		}
		if (P[i].second > maxA) {
			H -= P[i].second;
			pair<llong, llong> k = make_pair(0, 0);
			P.push_back(k);
			i++;
			ANS++;
		}
		else {
			llong J = (H - minB) / maxA;
			if ((H - minB) % maxA != 0) J++;
			ANS += J;
			H -= maxA * J;
			
		}
		

		if (H <= 0) break;
	}

	cout << ANS;
}

Measured memory_bytes: 6384
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;

int main(){
  char c; cin >> c;
  if(c >= 'a' && c <= 'z'){
    cout << 'a' << endl;
  }
  else{
    cout << 'A' << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0000
{
    public class Program

    {
        public static void Main(string[] args)
        {

            for (int i = 1 ; i < 10 ; i++)
            {
                for (int j = 1 ; j < 10 ; j++)
                {
                    Console.WriteLine("{0}x{1}={2}",i,j,i*j);
                }
            }
        }


        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
        static string WriteAr(int[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(double[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(long[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }

    }

}



Measured memory_bytes: 15684
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		
		int n,ave,counter;
		
		while(true) {
		n = sc.nextInt();
		if(n==0) {break;}
		
		ave = 0;
		counter=0;
		
		int[] income = new int[n];
		
		for(int i=0; i<n; i++) {
			income[i] = sc.nextInt();
			ave += income[i];
		}
		ave /= n;
		
		for(int j:income) {
			if(j<=ave) {
				counter++;
			}
		}
		System.out.println(counter);
		
		}
		sc.close();
	}

}



Measured memory_bytes: 59136
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define N 15
#define bit(i) (1 << i)

using namespace std;

int n, m;
int f[5000];

inline void cmin(int &u, const int delta) { (u > delta) && (u = delta); }
inline int Rd() {
	int x = 0; char ch = getchar();
	while(!isdigit(ch)) ch = getchar();
	while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
	return x;
}

int main() {
	n = Rd(), m = Rd();
	int upp = 1 << n;
	memset(f, 32, sizeof f), f[0] = 0;
	for(int i = 1; i <= m; ++i) {
		int a = Rd(), b = Rd(), mask = 0;
		for(int j = 1; j <= b; ++j) {
			int v = Rd();
			mask |= bit(v - 1);
		}
		for(int sta = 0; sta < upp; ++sta) {
			cmin(f[sta | mask], f[sta] + a);
		}
	}
	
	if(f[upp - 1] == f[4999]) {
		puts("-1");
		return 0;
	}
	cout << f[upp - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
import Data.Char

main :: IO ()
main = getLine >>= putStrLn . main'

main' :: String -> String
main' xs
  | (read xs `mod` f xs) == 0 = "Yes"
  | otherwise                 = "No"
  where
    f :: String -> Int
    f (x:[]) = digitToInt x
    f (x:xs) = (digitToInt x) + (f xs)

Measured memory_bytes: 508
package main
import(
	. "fmt"
)
func four(N int)int{

	N-=4
	if N==0{
		Println("Yes")
		return 1
	}else if N<=0{
		return 0
	}
	Ans1:=four(N)
	if Ans1==1{
		return 1
	}
	Ans1=seven(N)
	if Ans1==1 {
		return 1
	}
	return 0

}
func seven(N int)int{
	N-=7
	if N==0{
		Println("Yes")
		return 1
	}else if N<=0{
		return 0
	}
	Ans1:=four(N)
	if Ans1==1{
		return 1
	}
	Ans1=seven(N)
	if Ans1==1 {
		return 1
	}
	return 0
}


func main(){
	N:=0
	Ans1:=0
	Scanf("%d",&N)
	Ans1=four(N)
	if Ans1==0{
		Ans1=seven(N)
	}
	if Ans1==0{
		Println("No")
	}
}

Measured memory_bytes: 512
#include <string>
#include <iostream>
#include <vector>

using namespace std;
int main()
{
	std::string input;
	std::vector<int> length;
	while(getline(std::cin, input, ' '))
	{
		length.emplace_back(std::stoi(input));
	}

	if(length.empty())
	{
		std::cout<< "No" << std::endl;
		return 0;
	}
	for(int& num : length)
	{
		if(num != length[0])
		{
			std::cout<< "No" << std::endl;
			return 0;
		}
	}
	std::cout<< "Yes" << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

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

int main() {
    int n;
    cin >> n;
    vec a(n);
    rep(i, n) cin >> a[i];

    int g = 0;
    rep(i, n) g = gcd(g, a[i]);

    cout << g << endl;
    return 0;
}

Measured memory_bytes: 640
N,A,B,C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10**9
def dfs(cur,a,b,c):
    if cur == N:
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c) > 0 else INF
    ret0 = dfs(cur+1,a,b,c)
    ret1 = dfs(cur+1,a+l[cur],b,c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)
print(dfs(0,0,0,0))

Measured memory_bytes: 3064