akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int array[] = new int[n];

        for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            array[i] = a;
        }

        for(int j = n - 1; j >= 0; j--){
            if(j == 0){
                System.out.print(array[j]);
            }else{
                System.out.print(array[j] + " ");
            }
        }
        System.out.println();
    }
}


Measured memory_bytes: 26244
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
fn main() {
    input! {//
        n:usize,
        s:Chars,
    }
    let mut rblack = s.iter().filter(|&&x| x == '#').count() as i64;
    let mut rwhite = s.iter().filter(|&&x| x == '.').count() as i64;
    let mut lwhite = 0i64;
    let mut lblack = 0i64;
    let mut ans = rwhite;
    for (i, &c) in s.iter().enumerate() {
        if c == '#' {
            lblack += 1;
            rblack -= 1;
        } else {
            lwhite += 1;
            rwhite -= 1;
        }
        ans = min(ans, lblack + rwhite);
    }
    println!("{}", ans);
}

const INF: i64 = 1 << 60;


Measured memory_bytes: 3076
def shuffle(s,n):
    if len(s) <= 1:
        return s
    ans = s[n:] + s[:n]
    return ans


def main():
    while True:
        strings = input()
        if strings == "-":
            break
        n = int(input())
        li = []
        for i in range(n):
            li.append(int(input()))
        for i in li:
            strings = shuffle(strings, i)
        print(strings)


if __name__ == "__main__":
    main()

Measured memory_bytes: 7688
n=int(input())
a=list(map(int,input().split()))
if 0 in a:
    print(0)
    exit()
for i in range(n):
    if i==0:
        ans=a[i]
    else:
        ans*=a[i]
        if ans>10**18:
            print(-1)
            exit()
print(ans)

Measured memory_bytes: 21600
#include <stdio.h>

int main(void)
{
	int i,a,b,sum,digit;

	while(scanf("%d %d",&a,&b)!=EOF) {
		sum=a+b;
		digit=0;
		if(sum==0) {
			digit=1;
		}else{
			while(sum) {
				digit++;
				sum/=10;
			}
		}
		printf("%d\n",digit);
	}
	return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>


using namespace std;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const double PI = acos(-1.0);
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define all(v) v.begin(), v.end()

inline void finish() {
	cout << -1 << endl;
	exit(0);
}

template <typename T>
inline void debug(vector<T> v) {
	cout << "[";
	for (ll i = 0; i < v.size() - 1; ++i) {
		cout << v[i] << ", ";
	}
	cout << v[v.size() - 1] << "]" << endl;
}

void Main();
inline void DebugMain() {
	while (true) {
		Main();
	}
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	bool debug = false;
	if (debug) {
		cout << "\x1b[41m" << "Debug Mode " << endl;
	}
	(debug) ? DebugMain() : Main();
	return 0;
}

inline void Main() {
	int N;
	string S;

	cin >> N >>S;

	if (N % 2 == 1) {
		cout << "No";
		return;
	}

	if (S.substr(0, N / 2) != S.substr(N / 2, N / 2)) {
		cout << "No";
		return;
	}

	cout << "Yes";
}

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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

constexpr int dx[] = {0, -1, 1, 0, -1, 1, -1, 1};
constexpr int dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

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

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int N = input();
    set<string> st;

    range(i, 0, N) {
        string s;
        cin >> s;

        st.insert(s);
    }

    cout << st.size() << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


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

// Function which return string by concatenating it. 
string repeat(string s, int n) 
{ 
    // Copying given string to temparory string. 
    string s1 = s; 
  
    for (int i=1; i<n;i++) 
        s += s1; // Concatinating strings 
  
    return s; 
} 
  
// Driver code 
int main() 
{ 
    string s = "ACL"; 
    int k;
    cin >> k; 
    cout << repeat(s, k) << endl;; 
    return 0; 
}

Measured memory_bytes: 3604
using System;
using static System.Console;

namespace AtCoder.Probrems.Solvers.ABC124
{
    public class C
    {
        static void Main(string[] args)
        {
            WriteLine(Solve());
        }

        public static long Solve()
        {
            var s = ReadLine();
            var zo = 0L;
            var oz = 0L;
            for (int i = 0; i < s.Length; i++)
            {
                if (i % 2 == 0)
                {
                    zo += s[i] == '0' ? 0 : 1;
                    oz += s[i] == '1' ? 0 : 1;
                }
                else
                {
                    zo += s[i] == '1' ? 0 : 1;
                    oz += s[i] == '0' ? 0 : 1;
                }
            }
            return Math.Min(zo, oz);
        }

        private const int MOD = 1000000007;
    }
}


Measured memory_bytes: 13200
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val S = sc.next()

    println((700 + (if (S(0) == 'o') {100} else {0}) + (if (S(1) == 'o') {100} else {0}) + (if (S(2) == 'o') {100} else {0})).toString)
  }
}

Measured memory_bytes: 25648
#include <stdio.h>

int main(){
    int N,A,B;
    scanf("%d %d %d", &N,&A,&B);
    int sum =0;
   
    for( int i =1; i <= N ; i++){
        int digitSum = 0;
        int temp = i;
        while (temp != 0){
            digitSum = digitSum + temp % 10;
            temp /=10;
        }
       
        if ( digitSum >= A && digitSum <= B){
            sum  += i;
        }

    }
    printf("%d\n", sum);

    return 0; 
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
int main(){
    string inp;
    int cnt=0;
    cin >>inp;
    int x =inp.size();
    if(x%2!=0){
        for(int i = 0; i <(x-1)/2; ++i){
            if(inp[i] != inp[x-1-i]){
                ++cnt;
            }
        }
        cout<< cnt;      
    }
    else{
        for(int i = 0; i <x/2; ++i){
            if(inp[i] != inp[x-1-i]){
                ++cnt;
            }
        }
        cout<<cnt;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int maxn=0x7fffff;

int main(){
	int i,j=0;
	string sa,sb,s;
	cin>>sa>>sb;
	for(i=0;i<sa.size();i++){
		cout<<sa[i];
		if(i<sb.size()) cout<<sb[i];
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong n;
llong s[105];
llong dp[105][10005];

llong dfs(llong i, llong j) {
    if (dp[i][j] != -1) return dp[i][j];
    if (i == n) {
        if (j % 10 == 0) return 0;
        else return j;
    }
    
    return dp[i][j] = max(dfs(i + 1, j + s[i]), dfs(i + 1, j));
}

int main() {
    for (int i = 0; i < 105; i++) {
        for (int j = 0; j < 10005; j++) {
            dp[i][j] = -1;
        }
    }

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }

    cout << dfs(0, 0) << endl;
    
    return 0;
}


Measured memory_bytes: 8448
#include<stdio.h>
#include<string.h>
int main(){
  char a[101],b[101];
  scanf("%s %s",a,b);
  int alen=strlen(a),blen=strlen(b),i;
  if(alen>blen){
    puts("GREATER");
    return 0;
  }
  else if(alen<blen){
    puts("LESS");
    return 0;
  }
  else{
    for(i=0;i<alen;i++){
      if(a[i]>b[i]){
        puts("GREATER");
        return 0;
      }
      else if(a[i]<b[i]){
        puts("LESS");
        return 0;
      }
    }
  }
  puts("EQUAL");
  return 0;
}

Measured memory_bytes: 1612
#include <bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for (ll i=x;i<=y;i++)
typedef long long ll;

inline int read()
{
    int x=0;
    char c=getchar();
    bool flag=0;
    while(c<'0'||c>'9')
	{
		if(c=='-') flag=1;
		c=getchar();
	}
    while(c>='0'&&c<='9')
	{
		x=(x<<3)+(x<<1)+c-'0';
		c=getchar();
	}
    return flag?-x:x;
}

int main()
{
	int n,m;
	cin>>n>>m;
	int l[m+1],r[m+1];
	int minv,maxv;
	minv=643436;
	maxv=-1;
	rep(i,1,m)
	{
		cin>>l[i]>>r[i];
		minv=min(minv,r[i]);
		maxv=max(maxv,l[i]);
	}
	if (minv<maxv)
	{
		cout<<0<<endl;
	}
	else
	{
		cout<<minv-maxv+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 1024
N=int(input())
F=N//3
B=N//5
fb=N//15
S=(N*(N+1))//2
Fizz=(3*F*(F+1))//2
Buzz=(5*B*(B+1))//2
FizzBuzz=(15*fb*(fb+1))//2
print(S-Fizz-Buzz+FizzBuzz)




Measured memory_bytes: 9104
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))

using namespace std;
typedef pair<int,int> P;
const int mod=1000000007;

int digitsum(int n,int b){
	if(b<2) return -1;
	if(n<b) return n;
	return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n);
vector<int> split(int n,int a);
string xal_number(int n,int x);
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
class Factorial{
private:
	vector<int> fac;
public:
	Factorial(int N){
		fac.push_back(1);
		rep(i,N) fac.push_back(fac[i]*(i+1)%mod);
	}
	int fact(int a){return fac[a];}
	int ifac(int a){return m_inv(fac[a]);}
	int cmb(int n,int r);
};
struct UnionFind {
    vector<int> par; // 親ノード
    UnionFind(int n = 1) { init(n);}
    void init(int n = 1) {
        par.resize(n);
        rep(i,n) par[i] = -1;
    }
    int root(int x) {
        if (par[x] <0) return x;
        else return par[x] = root(par[x]);      
    }
    int size(int x){ return -par[root(x)];}
    bool issame(int x, int y) {return root(x)==root(y);}
    bool connect(int x, int y);
};

signed main(){
	int N,M;
	cin>>N>>M;
	int INF=1<<29;
	vector<int> a(M),b(M),c(M);
	vector<vector<int>> dist(N,vector<int>(N,INF));
	rep(i,N) dist[i][i]=0;
	rep(i,M){
		cin>>a[i]>>b[i]>>c[i];
		a[i]--;b[i]--;
		dist[a[i]][b[i]]=c[i];
		dist[b[i]][a[i]]=c[i];
	}
	rep(k,N) rep(i,N) rep(j,N){
		if(dist[i][j]>dist[i][k]+dist[k][j]) dist[i][j]=dist[i][k]+dist[k][j];
	}
	int ans=M;
	rep(i,M){
		bool shortest=false;
		rep(j,N) if(dist[j][a[i]]+c[i]==dist[j][b[i]]) shortest=true;
		if(shortest) ans--;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; ll m; cin >> n >> m;
  vector<ll> A(n); rep(i, n) cin >> A[i];
  sort(all(A));
  vector<ll> sum(n+1);
  rep(i, n) sum[i+1] = sum[i] + A[i];
  auto bsearch = [&]() {
    auto test = [&](ll k) {
      ll cnt = 0;
      rep(i, n) {
        int j = lower_bound(all(A), k-A[i]) - begin(A);
        chmax(j, i);
        cnt += (n-j) * 2 - (i >= j);
      }
      return cnt <= m;
    };
    ll ok = longinf, ng = 0;
    while(ok-ng>1) {
      ll mid = (ok+ng)/2;
      (test(mid) ? ok : ng) = mid;
    }
    return ok;
  };
  ll ret = bsearch();
  ll ans = 0;
  ll cnt = 0;
  rep(i, n) {
    int j = lower_bound(all(A), ret-A[i]) - begin(A);
    chmax(j, i);
    cnt += (n-j) * 2 - (i >= j);
    ans += (A[i] * (n-j) + sum[n]-sum[j]) * 2 - (i >= j) * A[i] * 2;
  }
  ans += (m-cnt) * (ret-1);
  cout << ans << endk;
  return 0;
}


Measured memory_bytes: 4792
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a,b,c,ans;
	scanf("%d%d",&a,&b);
	if(a>b) {
		ans=a;
		a--;
		ans+=max(a,b);
	}
	else if(a==b) {
		ans=a+b; 
	}
	else if(a<b) {
		ans=b;
		b--;
		ans+=max(a,b);
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

void selectionSort(int A[],int N){
  int i,j,temp,cnt=0,minj;

  for(i=0;i<N-1;i++){
    minj=i;
    for(j=i;j<N;j++){
      if(A[j]<A[minj]){
        minj=j;}
    }
      temp=A[i];
        A[i]=A[minj];
        A[minj]=temp;
        if(i != minj) cnt++;

    }

    for(i=0;i<N;i++){
      if(i>0) printf(" ");
      printf("%d",A[i]);
        }
    printf("\n");

    printf("%d\n",cnt);
}

  int main(){

    int N,i,A[100];

    scanf("%d\n",&N);
    for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }

   selectionSort(A,N);


    return 0;
  }




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

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

typedef long long ll;
const int mx=1e5+5;
ll n,a,b;
ll ara[mx],temp[mx];;

bool check (ll T)
{
    ll c=a-b;
    for (int i=0;i<n;i++) temp[i]=max(ara[i]-T*b,0LL);
    ll ans=0;
    for (int i=0;i<n;i++) {
        ans+=ceil((double) temp[i]/c);
    }
    return ans<=T;
}
int main ()
{
    scanf ("%lld %lld %lld",&n,&a,&b);
    for (int i=0;i<n;i++) scanf ("%lld",&ara[i]);
    ll hi,lo,mid,ans;
    lo=1;   hi=1e9;
    while (lo<=hi) {
        mid=(lo+hi)/2;
        if (check(mid)) {
            ans=mid;
            hi=mid-1;
        }
        else lo=mid+1;
    }
    printf ("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <iomanip>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include <string.h>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pint;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int A, B, K;
    cin >> A >> B >> K;
    for (int i = A; i <= min(B, A + K - 1); i++)
    {
        cout << i << endl;
    }
    for (int i = max(B - K + 1, A + K); i <= B; i++)
    {
        cout << i << endl;
    }
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

const divNum = 1000000007

type data []int

func (d data) Len() int {
	return len(d)
}

func (d data) Swap(i, k int) {
	d[i], d[k] = d[k], d[i]
}

func (d data) Less(i, k int) bool {
	return d[i] > d[k]
}

func main() {
	c := input()
	sort.Sort(c)
	s := 0
	for i, v := range c {
		s += v * (2 + i) % divNum
		s %= divNum
	}
	s *= binary(len(c))
	s %= divNum
	fmt.Println(s)
}

func binary(n int) int {
	if n == 1 {
		return 1
	}
	c := 1
	l := 2*n - 2
	for i := 0; i < l; i++ {
		c *= 2
		c %= divNum
	}
	return c
}

func input() data {
	var n int
	fmt.Scan(&n)
	c := make([]int, n, n)
	for i := range c {
		fmt.Scan(&c[i])
	}
	return c
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
    #define REP(i,n) for(int i=0;i<n;i++)
    #define LOOP(i,x,n) for(int i=x;i<n;i++)
    #define ALL(v) (v).begin(),(v).end()
    #define PB push_back
    #define MP make_pair
    #define FIR first
    #define SEC second
    #define int long long
    using namespace std;
    const int MOD=1000000007;
    const int INF=1000000009;
     
    signed main(){
      int x,y,z;
      cin>>x>>y>>z;
      int ans=0;
      int tmp=0;
      LOOP(i,1,100000){
        if(i*y+(i+1)*z<=x){
          ans=max(ans,i);
        }
      }
      cout<<ans<<endl;
      return 0;
    }

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

int main()
{
   long long  n;
   cin>>n;
   long long  c,c5,sum;
   c=n/500;
   n=n%500;
   c5=n/5;
   sum=c*1000+c5*5;
   cout<<sum;
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# neg, zero, posに分けて、二分探索
N, K = lr()
A = np.array(lr()); A.sort()
neg = A[A<0]
zero = A[A==0]
pos = A[A>0]

def check(x):
    '''x以下の積がK個以上あるならTrueを返す'''
    cnt = 0  # 最後に２でわる
    if x >= 0:
        cnt += len(zero) * N
    cnt += (np.searchsorted(A, x//pos, side='right')).sum()
    cnt += (N - np.searchsorted(A, (-x-1)//(-neg), side='right')).sum()
    cnt -= np.count_nonzero(A*A <= x)
    assert cnt % 2 == 0
    return (cnt//2) >= K

ok = 10**18; ng = -10**18-1
while abs(ng-ok) > 1:
    mid = (ok+ng) // 2
    if check(mid):
        ok = mid
    else:
        ng = mid

print(ok)
# 30

Measured memory_bytes: 32328
#include <bits/stdc++.h>
#include <complex>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
const long double EPS = 1e-9;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main() {
    cin>>N>>S>>T;
    vec code(0);
    char last = S[0];
    ll temp = 0;
    reps(i,1,N){
        if(last != S[i]){
            code.push_back(temp);
            temp = 0;
        }else{
            ++temp;
        }
        last = S[i];
    }
    code.push_back(temp);
    //rep(i,code.size()) cout<<code[i]<<' ';
    ll ans = (code[0] == 1 ? 6 : 3);
    ll lcode = code[0];
    reps(i,1,code.size()){
        if(lcode == 1){
            (ans *= (code[i] == 1 ? 3LL : 1LL))%=MOD;
        }else{
            (ans *= 2LL)%=MOD;
        }
        lcode = code[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
function Main(input) {
  input=input.split("\n");
  if(input[input.length-1]===''){
    input.pop();
  }
  const A=input[0].split(' ')[0]-0;
  const B=input[1].split(' ')[0]-0;
  for(var i=1;i<=3;i++){
    if(A!==i&&B!==i){
      console.log(i);
    }
  }
}


//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(void){
    // Your code here!
    char model[6][4] = {"RGB", "RBG", "GRB", "GBR", "BRG", "BGR"};
    char s[4001];
    char target;
    int RGBcount[3] = {0,0,0};
    int RGBleft[3] = {0,0,0};
    int N;
    int modelno;
    long count = 0;
    
    scanf("%d",&N);
    scanf("%s",s);
    
    for(int i = 0; i < N; i++)
    {
        switch(s[i])
        {
            case 'R':
                RGBcount[0]++;
                break;
                
            case 'G':
                RGBcount[1]++;
                break;
                
            case 'B':
                RGBcount[2]++;
                break;
        }
    }
    
    for(int i = 0; i < N-2; i++)
    {
        switch(s[i])
        {
            case 'R':
                RGBcount[0]--;
                break;
                
            case 'G':
                RGBcount[1]--;
                break;
                
            case 'B':
                RGBcount[2]--;
                break;
        }
        //initialize
        RGBleft[0] = RGBcount[0];
        RGBleft[1] = RGBcount[1];
        RGBleft[2] = RGBcount[2];
        
        for(int j = i+1; j < N-1; j++)
        {
            switch(s[j])
            {
                case 'R':
                    RGBleft[0]--;
                    break;
                    
                case 'G':
                    RGBleft[1]--;
                    break;
                    
                case 'B':
                    RGBleft[2]--;
                    break;
            }
            
            if(s[i] != s[j])
            {
                modelno = 0;
                while(s[i] != model[modelno][0] || s[j] != model[modelno][1])
                {
                    modelno++;
                }
                target = model[modelno][2];
                //printf("modelno = %d, target = %c\n", modelno, target);
                
                switch(target)
                {
                    case 'R':
                        count += RGBleft[0];
                        break;
                        
                    case 'G':
                        count += RGBleft[1];
                        break;
                        
                    case 'B':
                        count += RGBleft[2];
                        break;
                }
                
                if(j+(j-i) < N)
                {
                    if(s[j+(j-i)] == target)
                    {
                        //printf("(!) i = %d(%c), j = %d(%c), k = %d(%c)\n", i, s[i], j, s[j], j+(j-i), s[j+(j-i)]);
                        count--;
                    }
                }
            }
            //printf("i = %d, j = %d\n",i,j);
            //printf("left:%d,%d,%d\n",RGBleft[0],RGBleft[1],RGBleft[2]);
        }
        //printf("count:%d,%d,%d\n",RGBcount[0],RGBcount[1],RGBcount[2]);
    }
    
    printf("%ld\n",count);
}


Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
const int maxn = 100+10;
int n,ans,beg[maxn],nxt[maxn*maxn],to[maxn*maxn],now[maxn],e;
bool vis[maxn];
struct node{int x,y;}red[maxn],blue[maxn];
inline void add(int x,int y){to[++e]=y,nxt[e]=beg[x],beg[x]=e;}
inline bool solve (int x)
{
	register int i;
	for(i=beg[x];i;i=nxt[i])
	{
		if(!vis[to[i]])
		{
			vis[to[i]]=true;
			if(!now[to[i]]||solve(now[to[i]]))
			{
				now[to[i]]=x;
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	register int i,j;
	cin >> n;
	for(i=1;i<=n;++i)scanf("%d%d",&red[i].x,&red[i].y);
	for(i=1;i<=n;++i)scanf("%d%d",&blue[i].x,&blue[i].y);
	for(i=1;i<=n;++i)
	for(j=1;j<=n;++j)
		if(red[i].x<blue[j].x&&red[i].y<blue[j].y)add(i,j);
	for(int i=1;i<=n;++i)
		memset(vis,0,sizeof(vis)),ans+=solve(i);
	printf("%d\n",ans);
	return 0;
}


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

#define int long long

int N, M;
vector<int> V(10);
int ans;

signed main()
{
    cin >> N >> M;
    for(int i = 0; i < N; i++)
    {
        int a;
        cin >> a;
        ans += a;
        int tmp = 1;
        for(int j = 0; j < 50; j++)
        {
            V.push_back(a / tmp - a / (tmp * 2));
            tmp *= 2;
        }
    }

    sort(V.rbegin(), V.rend());
    for(int i = 0; i < min(M, (int)V.size()); i++)
        ans -= V[i];

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 44332
n,k=map(int,input().split())

ans=0
for i in range(k+1,n+1):
    ans+=n//i*(i-k)
    if n%i>0:
        if k==0:
            ans+=n%i
        else:
            ans+=max(0,n%i-k+1)
    #print(ans)

print(ans)

Measured memory_bytes: 8804
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+5;

int vis[28];
vector<int>pos[28];
string s,t;
long long ans=0;
void No(){cout<<"-1\n";exit(0);}

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
	int prev=-1;
	cin>>s>>t;
	for(int i=0;i<(int)s.size();i++)
	{
		vis[s[i]-'a']=1;
		pos[s[i]-'a'].push_back(i);
	}
		
	for(int i=0;i<(int)t.size();i++)
	{
		char ch=t[i];
		if(!vis[ch-'a'])No();
	}
	
	vector<int>::iterator p;
	for(int i=0;i<(int)t.size();i++)
	{
		char ch=t[i];
		int id=ch-'a';
		p=upper_bound(pos[id].begin(),pos[id].end(),prev);
		if(p==pos[id].end())
		{
			ans+=s.size()-1-prev;
			p=upper_bound(pos[id].begin(),pos[id].end(),-1);
			ans+=*p+1;
			prev=*p;
		}
		else
		{
			int pp=*p;
			ans+=pp-prev;
			prev=pp;
		}
	}
	cout<<ans;

	return 0;
}

Measured memory_bytes: 1228
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

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

int main(){
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> A(Q);
  rep(i,Q) cin >> A[i];

  vector<int> B(N, 0);
  rep(i,Q) B[A[i]-1] += 1;
  
  long long int sum = accumulate(B.begin(), B.end(), 0);
  vector<long long int> p_v(N);
  int i = 0;
  for(auto &b:B){
    long long int point = K + b - sum;
    p_v[i] = point;
    i++;
  }

  for(auto &p:p_v){
    if(p <= 0) cout << "No" << endl;
    else cout << "Yes"<< endl;
  }
}
    


Measured memory_bytes: 2176
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int[] l = new int[n];
			IntStream.range(0, n).forEach(i -> l[i] = scanner.nextInt());
			scanner.nextLine();
			Arrays.sort(l);
			int sum = Arrays.stream(l).limit(n - 1).sum();
			if (sum > l[n - 1]) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}
	}
}

Measured memory_bytes: 28876
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int arr[n+1];
	cin>>arr[1];
	
	int hasil=1;
	int i=2;
	
	lari:
	while (i<=n)
	{
		cin>>arr[i];
		for (int j=1;j<=i-1;j++)
		{
			if (arr[j]<=arr[i])
			{
				continue;
			}
			else
			{
				i++;
				goto lari;

			}
		}
		hasil++;
		i++;
	}
	
	cout<<hasil<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/

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

	ll n, m;
	cin >> n >> m;
	vector<ll> a(m);
	rep(i, m) cin >> a[i];

	vector<bool> can(n + 1, true);
	rep(i, m) {
		can[a[i]] = false;
	}

	// 1歩か2歩進める
	vector<int> dp(n + 1, 0);
	dp[0] = 1;
	Rep(i, 1, n + 1) {
		if (!can[i]) continue;

		if (i == 1) {
			// 一つ前だけをみる
			dp[i] += dp[i - 1];
		}
		else {
			if (can[i - 1]) dp[i] += dp[i - 1];
			if (can[i - 2]) dp[i] += dp[i - 2];
		}
		dp[i] %= mod;
	}

	cout << dp[n] % mod << endl;

	return 0;
}


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

#include <boost/algorithm/string/classification.hpp>  // is_any_of
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/math/tools/minima.hpp>
#include <boost/multi_array.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>

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

namespace adaptor = boost::adaptors;
using namespace std;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::replace_all;
using boost::algorithm::split;
using boost::math::tools::brent_find_minima;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP
void Main()
{
	int n, m;
	cin >> n >> m;
	vector<int> V(m);
	rep(i, m)
			cin >>
		V.at(i);
	int sum;
	sum = accumulate(V.begin(), V.end(), 0);
	if (n - sum < 0)
		cout << -1 << endl;
	else
	{
		cout << n - sum << endl;
	}
}
// END

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


Measured memory_bytes: 3664
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<queue>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(a) (a).begin(),(a).end()
#define INF 100000000

vector<ll> dx  = {0, 0, -1, +1};  
vector<ll> dy = {-1, +1, 0, 0}; 

bool compare_by_b(pair<long, long> a, pair<long, long> b){
    return a.second < b.second;
}
 
int main(){
    ll h, w;
    cin >> h >> w;
    char a[h][w];
    rep(i, h)rep(j, w)cin >> a[i][j];
    ll ans = 0;
    ll dis[1010][1010];
    rep(i, 1010)rep(j, 1010)dis[i][j] = -INF;

    queue<pair<ll, ll>> q;
    rep(i, h)rep(j, w)if(a[i][j] == '#'){
        dis[i][j] = 0;
        q.push(make_pair(i, j));
    }

    
    while(!q.empty()){
        ll x = q.front().first;
        ll y = q.front().second;
        q.pop();
        ans = max(ans, dis[x][y]);
        rep(i, 4){
            ll nx = x + dx[i];
            ll ny = y + dy[i];
            if(nx >= 0 && nx < h && ny >=0 && ny < w){
                if(dis[nx][ny] < 0){
                    dis[nx][ny] = dis[x][y] + 1;
                    q.push(make_pair(nx, ny));
                }
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 25524
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
using namespace std;

typedef long long ll;
ll MOD = 1e9+7;

int main()
{
	int h,w;
	int nh,nw;
	int ans=0;
	cin>>h>>w;
	cin>>nh>>nw;
	ans=(h-nh)*(w-nw);
	cout<<ans<<endl;
	return 0;
}

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



Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x, y, z) max((x), max((y), (z)))
#define tmin(x, y, z) min((x), min((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
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;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
using Graph = vector<vector<ll>>;
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//cout << fixed << setprecision(10);


int main(){
    map<ll, ll> mp;
    ll n, m, d, t; cin >> n;
    rep(i, n){
        cin >> d;
        mp[d]++;
    }
    cin >> m;
    rep(i, m){
        cin >> t;
        if(mp.count(t) && mp[t] != 0) mp[t]--;
        else{
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 16136
import sys
from bisect import bisect_left
inpurt = sys.stdin.readline
a, b, q = map(int, input().split())
INF = 10 ** 11
s = [-INF] + [int(input()) for _ in range(a)] + [INF]
t = [-INF] + [int(input()) for _ in range(b)] + [INF]
x = [int(input()) for _ in range(q)]

for xi in x:
    index_s = bisect_left(s, xi)
    s1 = xi - s[index_s - 1]
    s2 = s[index_s] - xi
    index_t = bisect_left(t, xi)
    t1 = xi - t[index_t - 1]
    t2 = t[index_t] -xi
    print(min(max(s1, t1), max(s2, t2), min(s1, t2) * 2 + max(s1, t2), min(s2, t1) * 2 + max(s2, t1)))


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;


int main() {
	double n= 0,k =0,tmp = 0.5,kake=0;
	double ans = 0;
	cin >> n >> k;
	double up = ceil(log2(k));
	int cnt = log2(k) + 1;
	vector<double>table;
	table.push_back(1);
	rep(i, up) {
		table.push_back(tmp);
		tmp *= 0.5;
	}
	for (double i = 1; i <= n; i++) {
		ans += (1 / n) * table[ceil(log2((k > i)?k/i:1))];
	}
	cout << fixed << setprecision(12) << ans << endl;

	return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

namespace my
{
	//-----------------------------------------------------------------------------
	inline char cn()
	{
		static char buf[1000010],*p1=buf,*p2=buf;
		return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
	}
	#define cn getchar
	template<class TY>void read(TY &x)
	{
		x=0;int f1=1;char ch=cn();
		while(ch<'0'||ch>'9'){if(ch=='-')f1=-1;ch=cn();}
		while(ch>='0'&&ch<='9')x=x*10+(ch-'0'),ch=cn(); x*=f1;
	}
	char OP[1000030],Zhan[30];int op=0,Top;
	void fcheck(int type=0){if(type||op>=1000000)fwrite(OP,1,op,stdout),op=0;}
	template<class TY>inline void write(TY x)
	{
		if(x==0){OP[op++]='0';fcheck();return;}
		Top=0;while(x)Zhan[++Top]=x%10+'0',x/=10;
		while(Top)OP[op++]=Zhan[Top--];fcheck();
	}
	#define K_G OP[op++]=' '
	//----------------------------快读快输 ----------------------------------------
	
	//--------------------------------------------------------------------------------------------
	#define ll long long
	#define uint unsigned int
	#define ull unsigned long long
	#define INV(x) ksm(x,mod-2)
	const int maxn=100010,inf=1000000007;
	int mod=998244353;
	int ksm(int x,int y){int re=1;for(;(y&1?re=1ll*re*x%mod:0),y;y>>=1,x=1ll*x*x%mod);return re;}
	int fac[maxn],inv_fac[maxn],inv[maxn];
	void work_math()//阶乘
	{
		inv[1]=1;for(int i=2;i<=maxn-10;i++)inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
		fac[0]=inv_fac[0]=1;for(int i=1;i<=maxn-10;i++)fac[i]=1ll*fac[i-1]*i%mod;
		inv_fac[maxn-10]=INV(fac[maxn-10]);
		for(int i=maxn-11;i>=1;i--)inv_fac[i]=1ll*inv_fac[i+1]*(i+1)%mod;
	}
	struct disc{int x,y;};
	bool compp(disc x,disc y){return x.x<y.x;}
	void discretization(int *darr,int dn)//离散化 
	{
		static disc b[maxn];
		for(int i=1;i<=dn;i++)
		b[i].x=darr[i],b[i].y=i;
		sort(b+1,b+dn+1,compp);
		static int tot=0;b[0].x=-9666;
		for(int i=1;i<=dn;i++)
		if(b[i].x!=b[i-1].x)darr[b[i].y]=++tot;
		else darr[b[i].y]=tot;
	}
	template<class TY>TY gcd(TY x,TY y){return !y?x:gcd(y,x%y);}
	//----------------------------------------------板子---------------------------------------------
	
	//----------------------------------------------------------------------------------------------- 
	int n,a[3][maxn],sum[maxn],suf[maxn];
	
	void main()
	{
		read(n);
		for(int i=1;i<=2;i++)
		for(int j=1;j<=n;j++)read(a[i][j]);sum[0]=suf[n+1]=0;
		for(int i=1;i<=n;i++)sum[i]=sum[i-1]+a[1][i];
		for(int i=n;i>=1;i--)suf[i]=suf[i+1]+a[2][i];
		int ans=0;for(int i=1;i<=n;i++)ans=max(ans,sum[i]+suf[i]);
		write(ans);
		fcheck(1);return;
	}
}

int main(){my::main();return 0;}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;
    cin>>s>>t;
    int n=s.length();
    vector<vector<int> > a(26);
    vector<vector<int> > b(26);
    for(int i=0;i<n;i++){
        a[s[i]-'a'].pb(i);
        b[t[i]-'a'].pb(i);
    }
    int index=26;
    for(int i=0;i<26;i++){
        for(int j=0;j<index;j++){
            if(a[i]==b[j]){
                b.erase(b.begin()+j);
                index--;
                j--;
                break;
            }
            if(j+1==index){
                cout << "No"<<endl;
                return 0;
            }
        }
    }
    cout << "Yes"<<endl;

    return 0;
}


Measured memory_bytes: 3092
#include<iostream>
using namespace std;
using ll = long long;

ll gcd(ll x,ll y){
    return y==0 ? x : gcd(y,x%y);
}

ll lcm(ll x,ll y){
    return x/gcd(x,y)*y;
}

int main(){
    int n,m;
    string s,t;
    cin>>n>>m>>s>>t; 
    ll a=0,b=0;
    ll g=gcd(n,m);
    for(ll i=0;i<g;i++){
        if(s[i*n/g]!=t[i*m/g]){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<lcm(n,m)<<endl;
}

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

struct P {
    ll X;
    ll L;
    ll l;
    ll r;

    bool operator<(const P &another) const {
        return r < another.r;
    };
};

int main() {
    ll N;
    cin >> N;
    vector<P> A(N);
    rep(i, N) {
        cin >> A[i].X >> A[i].L;
        A[i].l = A[i].X - A[i].L;
        A[i].r = A[i].X + A[i].L;
    }
    sort(all(A));
		P now = A[0];
		int delc = 0;
		for(int i=1;i<N;i++){
			if(now.r > A[i].l){
				delc++;
			} else { 
				now = A[i];
			}
		}
    cout << N - delc << endl;
}

Measured memory_bytes: 3328
package main
import "fmt"
func main() {
  var n,a int
  fmt.Scan(&n)
  m := map[int]int{}
  for i:=0;i<n;i++ {
    fmt.Scan(&a)
    m[a]++
  }
  ans := "No"
  if len(m) == 1 {
    if m[0] == n { ans = "Yes" }
  } else if len(m) == 2 {
    if n%3 == 0 && m[0] == n/3 { ans = "Yes" }
  } else if len(m) == 3 {
    x := 0
    for k,v := range m {
      if v != n/3 { x = -1;break }
      x ^= k
    }
    if x == 0 { ans = "Yes" }
  }
  fmt.Println(ans)
}

Measured memory_bytes: 7936
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;

int mainsolve(){

	ll k;
	cin >> k;
	vector<ll> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	
	cout << a[k-1] << endl;

	return 0;
}

int main(){

	return mainsolve();
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <unordered_map>

using namespace std;

int main(){
    int N; cin >> N;
    unordered_map<int,int> mp;

    int a, max_a = 0, min_a = 2e5;
    for(int i=0;i<N;i++){
        cin >> a;
        mp[a]++;
        mp[a-1]++;
        mp[a+1]++;
        max_a = max(max_a, a);
        min_a = min(min_a, a);
    }

    int ans = 0;
    for(int i=min_a-1; i<=max_a+1;i++){
        ans = max(ans, mp[i]);
    }
    cout << ans << endl;
    return 0;

}

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

int main() {
  string S, T;
  cin >> S >> T;
  int counter = 0;
  for(int i = 0; i < 3; i++){
    if(S.at(i) == T.at(i)) counter++;
  }
  cout << counter << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int minimumChange(string S, string T) 
{ 
    int n = S.length(), m = T.length(); 
    int ans = 999999; 
    for (int i = 0; i < m - n + 1; i++) { 
        int minchg = 0; 
        for (int j = 0; j < n; j++) { 
            if (S[j] != T[i + j]) { 
                minchg++; 
            } 
        } 
        ans = min(minchg, ans); 
    }  
    return ans; 
} 
int main(){
  	string S,T;
  	getline(cin,S);
  	getline(cin,T);
    //cout<<S<<endl<<T;
  	cout<<minimumChange(T,S);
}

Measured memory_bytes: 3648
N = int(input())
first, second, num = 0, 0, 0
l = []
for i in range(N):
	n = int(input())
	if n > first:
		first, second, num = n, first, i
	elif n > second:
		second = n
for i in range(N):
	if i == num:
		print(second)
	else:
		print(first)

Measured memory_bytes: 4668
"use strict"
function main(input) {

	let tmp = null
	let boo = false
	//let i = 0

	input = input.split('\n')
	input[0] = input[0].split('')
	input[1] = input[1].split('')

	for(let i=0;i<input[0].length;i++)
	//while(boo == false || i < input[0].length )
	{
		tmp = input[0].pop()
		input[0].unshift(tmp)
		if(input[0].join('')==input[1].join(''))
		{
			boo = true
			console.log('Yes')
			break
		}else{

		}
		//i++

	}
	if(!boo) console.log('No')

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7500
def dfs(N, A, B, C, D, memo):
    if (N in memo):
        return memo[N]
    
    if (N == 0):
        return 0
    
    if (N == 1):
        return D
    
    ans = N * D
    if (N % 2 == 0):
        ans = min(ans, dfs(N // 2, A, B, C, D, memo) + A)
    else:
        rem = N % 2
        ans = min(ans, dfs((N - rem) // 2, A, B, C, D, memo) + A + rem * D)
        ans = min(ans, dfs((N + 2 - rem) // 2, A, B, C, D, memo) + A + (2 - rem) * D)
    
    if (N % 3 == 0):
        ans = min(ans, dfs(N // 3, A, B, C, D, memo) + B)
    else:
        rem = N % 3
        ans = min(ans, dfs((N - rem) // 3, A, B, C, D, memo) + B + rem * D)
        ans = min(ans, dfs((N + 3 - rem) // 3, A, B, C, D, memo) + B + (3 - rem) * D)
    
    if (N % 5 == 0):
        ans = min(ans, dfs(N // 5, A, B, C, D, memo) + C)
    else:
        rem = N % 5
        ans = min(ans, dfs((N - rem) // 5, A, B, C, D, memo) + C + rem * D)
        ans = min(ans, dfs((N + 5 - rem) // 5, A, B, C, D, memo) + C + (5 - rem) * D)
    
    memo[N] = ans
    return ans


def solve(N, A, B, C, D):
    memo = dict()
    ans = dfs(N, A, B, C, D, memo)
    print(ans)


T = int(input())
for _ in range(T):
    N, A, B, C, D = list(map(int, input().split()))
    solve(N, A, B, C, D)


Measured memory_bytes: 90792
n, k = map(int, input().strip().split())
L = list(map(int, input().strip().split()))
L = [v - 1 for v in L]

seen = set()
cur = 0
untillBackToIntersec = 0

while cur not in seen:
    seen.add(cur)
    untillBackToIntersec += 1
    cur = L[cur]

intersec = cur
cur = 0
beforeLoop = 0

while cur != intersec:
    cur = L[cur]
    beforeLoop += 1
if k<=beforeLoop:
    proceed=k
else:
    loopSize = untillBackToIntersec - beforeLoop
    proceed=(k - beforeLoop) % (loopSize) + beforeLoop
ans = 0

for _ in range(proceed):
    ans = L[ans]

print(ans + 1)

Measured memory_bytes: 32384
// In the name of god
#include <bits/stdc++.h>
#pragma GCC optimize("02")
#define F first
#define S second 
#define pb push_back
#define all(x) x.begin(),x.end()
#define fileoi freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
using namespace std;
using ll = long long;
const int maxn=2e5+5,inf=1e18+18,mod=1e9+7;
ll ans=inf,x;
string s,t;
int main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
	cin>>s>>t;
	for(int i=0;i<s.size();i++){
		if(i+t.size()-1>=s.size())break;
		x=0;
		for(int j=0;j<t.size();j++){
			if(s[i+j]!=t[j])x++;
		}
		ans=min(ans,x);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3656
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>

using namespace std;
int main()
{
    /*
    cin>>x;
    cout<<x<<endl;
    */
    int n,m,i,sum;
    cin>>n>>m;
    if(m%n==0)
        cout<<n+m<<endl;
    else
        cout<<m-n<<endl;
    return 0;
}


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

using namespace std;

int main(){
    string s;
    int p=0,ans=0;
    cin >> s;

    for(int i=0; i<s.size();i++){
        if (s[i]=='g' && p>=1){
            p -= 1;
            ans += 1;
        }
        else if (s[i]=='p'&& p>=1){
            p -= 1;
        }
        else if (s[i]=='g' && p==0){
            p+=1;
        }
        else if (s[i]=='p'&& p==0){
            ans -= 1;
            p += 1;
        }
        

        //cout << p << " " << ans << endl;

    }

    cout << ans << endl;



    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int main(){
  int n,j,i,count=0,alg=0,res[100],flag=1;
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
  scanf("%d",&res[i]);
  }
  while(flag!=0){
    flag = 0;
    for(j=n-1;j>=1;j--){
      if(res[j]<res[j-1]){
	alg = res[j];
	res[j] = res[j-1];
	res[j-1] = alg;
	flag = 1;
	count++;
      }
     
    }
  }
  for(i=0;i<n;i++){
    printf("%d",res[i]);
    if(i!=n-1)printf(" ");
  }
  printf("\n");
  printf("%d\n",count);
    return 0;
  }

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

typedef long long ll;
#define ABSOL(a) (a<0 ? (a*(-1)) : a)
#define rep(i, a, b) for(i = a; i < b; i++)
#define REP(i, a, b) for(i = a; i <= b; i++ )
#define scanstr(str) getline(cin, str)
#define pb push_back

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
  
  	int x;
  
  	cin >> x;
  	if(x == 0)
      cout << 1 << endl;
  	else
      cout << 0 << endl;
      
    return 0;
}

Measured memory_bytes: 3632
n, m = map(int, input().split())
a = []
for i in range(m):
  a.append(int(input()))
ans = 0
flag = 0
a = set(a)

#フィボナッチ数列の初期値を調節
dp = [0] * (n+1)
dp[0] = 1
if 1 in a:
  dp[1] = 0
else:
  dp[1] = 1
  
for i in range(2, n+1):
  if dp[i-2] == 0 and dp[i-1] == 0:
    ans = 0
    flag = 1
    break
  elif i in a:
    continue
  else:
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] = dp[i] % (10**9+7)
if flag == 0:
  ans = dp[n]
print(ans)

Measured memory_bytes: 13212
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;

    if((n-1)%(k-1) == 0 ){
        cout << (n-1)/(k-1) << endl;
    }else{
        cout << (n-1)/(k-1) + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256