akhauriyash/Code-Regression huggingface dataset:
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQUE(c)   sort(ALL((c)));(c).erase(unique(ALL((c))),(c).end())
# define LOWER(s)    transform(ALL((s)),(s).begin(),TL<char>)
# define UPPER(s)    transform(ALL((s)),(s).begin(),TU<char>)
# define FOR(i,a,b)  for(LL i=(a);i<(b);i++)
# define RFOR(i,a,b) for(LL i=(a);i>=(b);i--)
# define REP(i,n)    FOR(i,0,n)
# define INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)

int rui[550][550];
int n, w, h, s, t;
int pos[550][550];

int main() {
	while (cin >> n&&n) {
		REP(i, 550)REP(j, 550) {
			rui[i][j] = pos[i][j] = 0;
		}
		cin >> w >> h;
		REP(i, n) {
			int x, y;
			cin >> x >> y;
			pos[y][x]++;
		}
		cin >> s >> t;
		REP(i, 550) {
			REP(j, 550) {
				rui[i][j] = rui[i - 1][j] + rui[i][j - 1] - rui[i - 1][j - 1] + pos[i][j];
			}
		}
		int ans = 0;
		for (int i = t; i <= h; i++) {
			for (int j = s; j <= w; j++) {
				ans = max(ans, rui[i][j] - rui[i][j - s] - rui[i - t][j] + rui[i - t][j - s]);
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 5444
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=200005;
ll n,a[maxn],cnt1[maxn],cnt2[maxn];
map<ll,ll>mp;
int main(){
     cin>>n;
     for(int i=1;i<=n;i++){
     	cin>>a[i];
     	cnt1[i]=i+a[i];
     	mp[i-a[i]]++;
	 }
     ll ans=0;
	 for(int i=1;i<=n;i++){
	 	ans+=mp[i+a[i]];
	 } 
	 cout<<ans;
	 return 0;
}

Measured memory_bytes: 29412
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <functional>
#include <random> 
using namespace std;

#define rep(i, b, e) for(i = b; i < e; ++i)
#define repr(i, b, e) for (i = b; i >= e; --i)
#define ull unsigned long long int

#define M_DEBUG 1
#define PI 3.141592653589793


int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a, b;
    cin >> a >> b;
    if (a > 9 || b > 9) {
      cout << -1 << endl;
      return 0;
    }

    cout << a * b << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

      System.out.println(solve(s));
    } finally {
      scanner.close();
    }
  }

  private static int solve(String s) {
    int opt = s.replace("x", "").length();
    return 700 + opt * 100;
  }
}


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

int pow(int n){

        int ans = 1;
        for(int i=0;i<n;i++){
            ans *= 10;
        }
    return ans;

}

int main()
{
    string s,t,temp1,temp2;
    cin >> s;
    int n,m;
    

    while(s!="-"){
        cin >> n;
        rep(i,n){
            cin >>m;
            temp1 = s.substr(0,m);
            temp2 = s.substr(m,s.size()-m);
            s = temp2 + temp1;
        }

        cout << s << endl;
        cin >> s;

    }

    return 0;

}


Measured memory_bytes: 3172
using System;
using System.Linq;
using System.Collections.Generic;

public class Hello{
    public static void Main(){
        var N=int.Parse(Console.ReadLine());
        var list=new List<int>();
        string[]array=Console.ReadLine().Split(' ');
        for(var i=0;i<N;i++){
            list.Add(int.Parse(array[i]));
        }
        
        var sum__sum=list.Sum();
        var sum=0;
        var list_rev=new List<int>();
        for(var i=0;i<N;i++){
            list_rev.Add(list[0]);
            list.RemoveAt(0);
            sum=list_rev.Sum()-list.Sum();
            if(sum<0)sum=-sum;
            if(sum<sum__sum)sum__sum=sum;
        }
        Console.WriteLine(sum__sum);
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
typedef long long ll;
int main(int argc, char const *argv[]) {
    std::string w;
    std::cin >> w;
    std::map<char, ll> counter;
    bool flag = true;
    for (size_t i = 0; i < w.size(); i++) {
        counter[w[i]] += 1;
    }
    for (auto item : counter) { // forもまわせる
        if (item.second % 2 != 0) {
            std::cout << "No" << '\n';
            flag = false;
            break;
        }
    }
    if (flag) {
        std::cout << "Yes" << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[100100];
ll ans[100100];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin>>n>>m;
    ll a[n+2];
    dp[1]=0;
    for(ll i=2;i<=n+1;i++)
    {
        cin>>a[i];
        dp[i]=dp[i-1]+a[i];
    }
    ans[1]=0;
    map<ll,ll>m1;
    m1[0]=1;
    for(ll i=2;i<=n+1;i++)
    {
        ll rem=dp[i]%m;
        if(m1.count(rem)==0)
        {
            ans[i]=0;
            m1[rem]=i;
        }
        else
        {
            ans[i]=ans[m1[rem]]+1;
            m1[rem]=i;
        }
    }
    ll sum=0;
    for(ll i=2;i<=n+1;i++)
    {
        sum+=ans[i];
    }
    cout<<sum;
	return 0;
}

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

int main(){
    int a,b;
    cin >> a >> b;
    if((a >= 1)&&(a <= 9)&&(b >= 1)&&(b <= 9)){
        cout << a*b << endl;
    }
    else{
        cout << -1 << endl;
    }
    
    return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;
typedef pair<int,int> ii;

ll mod = 1000000007LL;

#define MAX 670
ll dp[MAX][2001];

void solve() {

}

int main() {
  int S;
  cin >> S;
  dp[0][0] = 1;
  /*
  rep(i,MAX-1) {
    for(int j=S;j>=0;--j) {
      REP(v,3,S+1) {
	if( j + v <= S ) {
	  ( dp[i+1][j+v] += dp[i][j] ) %= mod;
	}
      }
    }
  }
  */
  rep(i,MAX-1) {
    rep(j,S+1) {
      if( j-3 >= 0 ) {
	( dp[i+1][j] = dp[i][j-3] + dp[i+1][j-1] ) %= mod;
      }
    }
  }
  ll ans = 0;
  rep(i,MAX-1) {
    ( ans += dp[i][S] ) %= mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 13988
s=input()
#d=[0,1,2,3,4,5,6,7,8,9,10,11,12]
d=[[1,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0]]
t=1
p=0
for i in range(len(s)-1,-1,-1): #i->i+1,p->1-p
  #print(d[p])
  #print(t)
  c=s[i]
  if c=="?":
    for k in range(13):
      for j in range(10):
        #if d[p][k]==1:
        #  print((t*j+k)%13)
        d[1-p][(t*j+k)%13]+=d[p][k]
  else:
    x=int(c)
    for k in range(13):
      d[1-p][(k+t*x)%13]+=d[p][k]
  for k in range(13):
    d[p][k]=0
  for k in range(13):
    d[1-p][k]%=1000000007
  p=1-p
  t=t*10%13
#print(d)
print(d[len(s)%2][5])
#for i in range(10):
#  print((4+i*10)%13,(704+i*10)%13)

Measured memory_bytes: 43756
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, t;
    cin >> n >> t;
    vector<pair<lint, lint>> ab;
    vector<lint> zero;
    for (int i = 0; i < n; ++i) {
        lint a, b;
        cin >> a >> b;
        b++;
        if (a != 0) {
            ab.emplace_back(a, b);
        } else {
            zero.push_back(b);
        }
    }
    auto f = [](pair<lint, lint> l, pair<lint, lint> r) { return r.first * l.second < l.first * r.second; };
    sort(ab.begin(), ab.end(), f);
    sort(zero.begin(), zero.end());
    int na = ab.size();
    int nz = zero.size();
    vector<vector<lint>> dp(na + 1, vector<lint>(40, inf));
    dp[0][0] = 1;
    for (int i = 1; i <= na; ++i) {
        chmin(dp[i][0], 1LL);
        for (int j = 1; j < 40; ++j) {
            chmin(dp[i][j], dp[i - 1][j]);
            if (dp[i - 1][j - 1] < 1e10 && ab[i - 1].first * dp[i - 1][j - 1] < 1e10)
                chmin(dp[i][j], dp[i - 1][j - 1] + ab[i - 1].first * dp[i - 1][j - 1] + ab[i - 1].second);
        }
    }
    int ret = 0;
    for (int i = 0; i < 40; ++i) {
        if (dp[na][i] > t + 1)
            continue;
        int cnt = i;
        int iz  = 0;
        while (iz < nz && dp[na][i] + zero[iz] <= t + 1) {
            dp[na][i] += zero[iz];
            cnt++;
            iz++;
        }
        chmax(ret, cnt);
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 73708
#include <stdio.h>

int partition( int A[], int p, int r );
void swap( int A[], int i, int j );

#define MAX_N (100010)
int A[MAX_N];

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

    int index_partition = partition( A, 0, n-1 );

    for ( int i = 0; i < n; i++ ) {
	if ( i == index_partition ) {
	    printf("[%d]", A[i]);
	}
	else {
	    printf("%d", A[i]);
	}
	printf("%c", (i == n-1) ? '\n' : ' ');
    }

    return 0;
}


int partition( int A[], int p, int r )
{
    int part = A[r];
    int i = p - 1;
    
    for ( int j = p; j < r; j++ ) {
	if ( A[j] <= part ) {
	    i++;
	    swap( A, i, j );
	}
    }

    i++;
    swap( A, i, r );

    return i;
}


void swap( int A[], int i, int j )
{
    int tmp = A[i];
    A[i] = A[j];
    A[j] = tmp;
}

Measured memory_bytes: 1416
#include<stdio.h>

int main(void){
  int a,b,i,j=1,flag;
  
  while(scanf("%d %d",&a,&b),a,b)
    {
      flag=0;

      if(j!=1)printf("\n");
      
      for(i=a;i<=b;i++){
	  if(i%100==0 && i%400==0){
	      printf("%d\n",i);
	      flag=1;
	    }
	  else if(i%4==0 && i%100!=0){
	      printf("%d\n",i);
	      flag=1;	    
	    }
	}
      
      if(flag==0)printf("NA\n");
      
      j++;
    }
  return 0;
}

Measured memory_bytes: 0
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto X = RD;
	auto A = RD;
	auto B = RD;

	writeln((X - A) % B);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
#include <stdio.h>

int main( void )
{
  int a, b;
  
  scanf( "%d %d", &a, &b );
  
  printf( "%d\n", ( (a>=1)&&(a<=9)&&(b>=1)&&(b<=9) )? a*b: -1 );
  
  return 0;
}

Measured memory_bytes: 128
//Moh_K_Imar .......
//22/08/2020  ... 11,45
//Ya Rab....
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
int main(){
    ll r;
    cin>>r;
    cout<<2*r*3.14159<<endl;

    return 0;
}



Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
int main() {
    int sec;
    cin >> sec;
    int h,min,m,s;
    h = sec/3600;
    min = sec%3600;
    m = min/60;
    s = min%60;
    cout << h << ':' << m << ':' << s << endl;
}


Measured memory_bytes: 3088
from math import factorial
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

l = [i for i in range(1,N+1)]
ll = [i for i in range(1,N+1)]

a = 1
for i in range(N-1):
    idx = l.index(P[i])
    a += idx * factorial(N-1-i)
    del l[idx]
    
b = 1
for i in range(N-1):
    idx = ll.index(Q[i])
    b += idx * factorial(N-1-i)
    del ll[idx]
    
print(abs(a-b))   

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

int main(){
	string s;
	cin>>s;
	int i=0;
	int j = s.size()-1;
	int ans=0;
	while(i < j){
		if(s[i] != s[j]){
			ans++;
		}
		i++;
		j--;
	}
	cout<<ans<<"\n";
	return 0;
}

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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

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

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

template<typename T, size_t size> void fill(T (&ary)[size], const T& val){
    fill_n((T*)ary, size, val);
}

void solve() {
    //const i64 mod = 1'000'000'007;
    i64 N;
    string s;
    cin >> N >> s;
    
    i64 r=0,b=0;
    rep(i,0,N){
        if(s[i]=='R') ++r;
        else ++b;
    }

    if(r>b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
int main()
{
    Hello
    string s, t;
    cin >> s >> t;
    if(s == t)
        return cout << "Yes", 0;
    for(int i = 0; i < s.size(); i++){
        char temp = s.back();
        s.pop_back();
        s = temp + s;
       // cout << s << endl;
        if(s == t)
            return cout << "Yes", 0;
    }
    cout << "No";
    return 0;
}

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

using namespace std;

int main()
{
    int n, p;
    while (cin >> n >> p, n | p)
    {
        vector<int> stones_of_candidates(n, 0);
        int i = 0;
        while (true)
        {
            if (0 < p)
            {
                ++stones_of_candidates[i];
                --p;
            }
            else
            {
                p += stones_of_candidates[i];
                stones_of_candidates[i] = 0;
                if (all_of(stones_of_candidates.begin(), stones_of_candidates.end(), [](int x) { return x == 0; }))
                {
                    cout << i << endl;
                    break;
                }
            }


            if (i < n - 1)
            {
                ++i;
            }
            else
            {
                i = 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1192
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N =sc.nextInt();
		int[][] ab = new int[N][2];

		for(int i=0;i<N;i++) {
			ab[i][0] = sc.nextInt();
			ab[i][1] = sc.nextInt();
		}
		Arrays.sort(ab, (a,b)->Integer.compare(a[1], b[1]));

		int asum = 0;
		int b = 0;
		for(int i=0;i<N;i++) {
			asum += ab[i][0];
			b = ab[i][1];
			if(asum > b) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}


Measured memory_bytes: 110840
#include<stdio.h>
int main() 
{
	int a,b,c,d,e,k;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&e);
	scanf("%d",&k);
	if((e-a)<=k){
		printf("Yay!");
	}
	else{printf(":(");}
	return 0;
} 

Measured memory_bytes: 128
// C - Takahashi's Information
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	vvi C(3,vi(3)); rpz(i,3) rpz(j,3) cin>>C[i][j];
	vi A(3,INT_MAX), B(3,INT_MAX);
	A[0] = 0;
	rpz(j,3) B[j] = C[0][j];
	A[1] = C[1][0] - B[0];
	A[2] = C[2][0] - B[0];
	bool ans = true;
	rpz(i,3) rpz(j,3) if(C[i][j] != A[i]+B[j]) ans = false;
	puts(ans? "Yes":"No");
}

Measured memory_bytes: 256
"""

Wは100で固定する。
1行目でできるかぎり連結成分の数が多くなるようにする。


W=100で固定し、白黒格子上になるように列を組む。
白と黒どちらかが規定数をオーバーしたら次の行で調整を入れて数を減らす。
ここでは、白が規定数に達したと仮定しよう。
白色の数に調整を入れたら、次の行では
"""
A,B = map(int,input().split())
N = 100
n = N//2
grid = [["#"]*N for _ in range(N)]
for i in range(n,N):
    for j in range(N):
        grid[i][j] = "."

A -= 1
B -= 1

for i in range(0,A//n*2,2):
    for j in range(0,N,2):
        grid[i][j] = "."

for j in range(0,A%n*2,2):
    grid[A//n*2][j] = "."

grid = grid[::-1]
for i in range(0,B//n*2,2):
    for j in range(0,N,2):
        grid[i][j] = "#"

for j in range(0,B%n*2,2):
    grid[B//n*2][j] = "#"

print(" ".join([str(N),str(N)]))
for i in range(N):
    print("".join(grid[i]))


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T,class U>
istream& operator >> (istream&is, P<T,U>&p){
  is >> p.first >> p.second;
  return is;
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v){
    is >> e;
  }
  return is;
}

int main(){
  int n,m; cin >> n >> m;
  ll cnt = 0;
  for(int i = 1; i <= n; ++i){
    if(i >= m)cnt += n - i;
    if(i > m)cnt += (n/i-1)*(i-m)+max(n%i-m+1,0);
    cerr << endl;
  }
  cout << cnt << endl;
}



Measured memory_bytes: 3676
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<int32_t, int32_t>;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  string S, result;
  std::cin >> S;
  if(S=="ARC") {
    result = "ABC";
  } else {
    result = "ARC";
  }
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
//-std=c++11
#define print(x) printf("%.12f",x);
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define repr(i, n) for(int i=n-1;i>=0;i--)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define Repr(i,a,b) for(int i=a;i>=b;i--)
#define pii pair < int, int >
#define iter ::iterator
#define forit(a) for(it=a.begin();it!=a.end();it++)
typedef vector<int> vi;
typedef  long long ll;
const int inf = int(1e9);
const int mod = 998244353;
const int N = (int)2e5 + 5;


void solve(){
	string s;
	cin>>s;
	int ans1=0,ans2=0;
	for(int i=0;i<sz(s);i++){
		if(i%2==0){
			if(s[i]!='1')ans1++;
		}
		else{
			if(s[i]!='0')ans1++;
		}
	}
	for(int i=0;i<sz(s);i++){
		if(i%2==0){
			if(s[i]!='0')ans2++;
		}
		else{
			if(s[i]!='1')ans2++;
		}
	}
	cout<<min(ans1,ans2);

}


int main(){
	Red;
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef long long ll;
typedef pair<ll,ll> P;
const int INF=INT_MAX / 3;
const ll LINF=LLONG_MAX / 3LL;
#define CONST 1000000007
#define EPS (1e-8)
#define PB push_back
#define MP make_pair
#define sz(a) ((int)(a).size())
#define reps(i,n,m) for(int i=(n);i<int(m);i++)
#define rep(i,n) reps(i,0,n)
#define SORT(a) sort((a).begin(),(a).end())
ll mod(ll a,ll m){return (a%m+m)%m;}
int dx[9]={0,1,0,-1,1,1,-1,-1,0},dy[9]={1,0,-1,0,1,-1,1,-1,0};
ll n,m;
int r[300000];
int main(){
  cin>>n;
  rep(i,n){
    cin>>r[i];
    r[i]--;
  }
  int ans=0;
  rep(i,n){
    if(i<r[i]&&r[r[i]]==i)ans++;
  }
  cout<<ans<<endl;
  return 0;
}


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

typedef long long ll;

int main() {
    string S;
    cin >> S;
    int red = 0, blue = 0;
    rep(i, S.size()) {
        if (S[i] == '0') red++;
        else blue++;
    }
    cout << min(red, blue) * 2 << "\n";
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        int[] count = new int[1000005];
        for (int i = 0; i < 1000005; i++) count[i] = 0;
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
            count[arr[i]]++;
        }
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (count[arr[i]] > 1) continue;
            if (count[1] > 0 && arr[i] != 1) continue;
            if (count[1] > 1 && arr[i] == 1) continue;
            ans++;
            for (int j = 2; j <= Math.sqrt(arr[i]); j++) {
                if (arr[i] % j == 0) {
                    if (count[j] > 0) {
                        ans--;
                        break;
                    }
                    if (count[arr[i] / j] > 0) {
                        ans--;
                        break;
                    }
                }
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 63940
def test():
    n = int(input())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    d = []; ans = 0
    for i in range(n):
        ans = sum(a[:i+1])
        ans += sum(b[i:])
        d.append(ans)
    print(max(d))


if __name__ == "__main__":
    test()


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long N = long.Parse(str[0]);
		int M = int.Parse(str[1]);
		int[,]A = new int[M,2];
		for(var i=0;i<M;i++){
			string[] str2 = Console.ReadLine().Split();
			A[i,0] = int.Parse(str2[0]);
			A[i,1] = int.Parse(str2[1]);
		}
		var uf = new UnionFind((int)N+1);
		int[]C = new int[N];
		for(var i=0;i<N;i++){
			C[i] = 1;
		}
		long a = N*(N-1)/2;
		long[]ans = new long[M];
      	ans[M-1] = a;
		for(var i=M-1;i>=1;i--){
			if(uf.Root(A[i,0]) != uf.Root(A[i,1])){
				int ct1 = C[uf.Root(A[i,0])-1];
				int ct2 = C[uf.Root(A[i,1])-1];
				a -= ct1*ct2;
				uf.Unite(A[i,0],A[i,1]);
				C[uf.Root(A[i,0])-1] = ct1+ct2;
			}
			ans[i-1] = a;
		}
		for(var i=0;i<M;i++){
			Console.WriteLine(ans[i]);
		}
	}
}
public class UnionFind
{
    private int[] data;
	public UnionFind(int size){
        data = new int[size];
        for (int i = 0; i < size; i++) data[i] = -1;
    }
    public bool Unite(int x, int y){
        x = Root(x);
        y = Root(y);
        if (x != y){
            if (data[y] < data[x]){
                var tmp = y;
                y = x;
                x = tmp;
            }
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
	public bool IsSameGroup(int x, int y){
        return Root(x) == Root(y);
    }
    public int Root(int x){
        return data[x] < 0 ? x : data[x] = Root(data[x]);
    }
}

Measured memory_bytes: 18376
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] l = new int[n];
        for(int i = 0; i < n; i++){
            l[i] = sc.nextInt();
        }
        Arrays.sort(l);
        int sum = 0;
        for(int i = n-1; i >= n-k; i--){
            sum = sum + l[i];
        }
        System.out.print(sum);
    }
}

Measured memory_bytes: 21844
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ff first
#define ss second
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define print_time cerr << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define ull unsigned long long
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
int gcd(int x,int y)
{
    if(y==0)
	return x;
    else
	return gcd(y,x%y);
}
int expo(int n,int m,int p)   //modULAR EXPONENTIATION
{
    int r=1;
    n=n%p;
    while(m>0)
    {
	if(m%2)
	    r=(r*n)%p;
	n=(n*n)%p;
	m=m/2;
    }
    return r%p;
}
bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;
 
    // This is checked so that we can skip 
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;
 
    for (int i=5; i*i<=n; i=i+6)
	if (n%i == 0 || n%(i+2) == 0)
	   return false;
 
    return true;
}
vector<int> z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
	if (i <= r)
	    z[i] = min (r - i + 1, z[i - l]);
	while (i + z[i] < n && s[z[i]] == s[i + z[i]])
	    ++z[i];
	if (i + z[i] - 1 > r)
	    l = i, r = i + z[i] - 1;
    }
    return z;
}
int32_t main()
{
   IOS;
  /* #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin); 
   freopen("output.txt","w",stdout);
   #endif
   /********************* Code starts here ***********************/     
   int n,k;
   cin>>n>>k;
   int ans=0;
   if(k%2==0)
   {
   	int c=0;
   	for(int i=1;i<=n;i++)
   	{
   		if(i%k==(k/2))
   			c++;
   	}
   	ans=c;
   	if(c>=2)
   	{
   		ans=ans+((c*(c-1)))*3;
   		if(c>=3)
   		{
   			ans=ans+(c*(c-1)*(c-2));
   		}
   	}
   	//cout<<ans<<endl;
   }
   int c=0;
   for(int i=1;i<=n;i++)
   {
   	if(i%k==0)
   		c++;
   }
   ans=ans+c;
   if(c>=2)
   {
	ans=ans+((c*(c-1)))*3;
	if(c>=3)
	{
		ans=ans+(c*(c-1)*(c-2));
	}
   }
   cout<<ans<<endl;
} 						

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <string.h>
#include <cstdarg>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;


// Extended Print Func
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& input){
    os << "[ ";
    REP(i, input.size()){
        os << input[i];
        if (i < input.size()-1) { os << " "; }
    }
    os << " ]";
    return os;
}
void print() { std::cout << "\n"; }
template<class T, class... A> void print(const T& first, const A&... rest) { std::cout << first << " "; print(rest...); }
template<class... A> void print(const A&... rest) { print(rest...); }



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  vector<ll> H(N);
  REP(i, N) { cin >> H[i]; }

  ll ans = 0;
  ll cnt = 0;
  REP(i, N-1){
      if (H[i] >= H[i+1]) {
          cnt++;
          ans = max(ans, cnt);
      } else {
          cnt = 0;
      }
  }

  std::cout << ans << "\n";  
  return 0;
}

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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<int> a;
  rep(i, n) a.push_back(s[i] - '0');
  ll ans = 0;
  rep(bit, 1<<(n-1)) {
    ll now = a[0];
    rep(i, n-1) {
      if (bit & 1<<i) {
        ans += now;
        now = 0;
      }
      now = now * 10 + a[i + 1];
    }
    ans += now;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
n = STDIN.gets.to_i
s = [STDIN.gets.chomp.split(''), STDIN.gets.chomp.split('')]

ans = 1 # パターン数
x = 0 # 次にチェックする座標
l = nil # 最後にチェックしたのが縦だったらtrue

if s[0][0] == s[1][0] # 最初が縦パターン
  ans *= 3
  x = 1
  l = true
else ## 横パターン
  ans *= 6
  x = 2
  l = false
end

loop do
  break if x > n-1
  if s[0][x] == s[1][x] && l # 縦->縦
    ans *= 2
    x += 1
    l = true
  elsif s[0][x] == s[1][x] && !l # 横->縦
    x += 1
    l = true
  elsif s[0][x] != s[1][x] && l # 縦->横
    ans *= 2
    x += 2
    l = false
  elsif s[0][x] != s[1][x] && !l # 横->横
    ans *= 3
    x += 2
    l = false
  end
end

puts ans % 1000000007


Measured memory_bytes: 3836
N=int(input())
A=[0]+list(map(int,input().split()))

#累積和
#C[index]=A[1]+...+A[index](1<=index<=N)
C=[0]*(N+1)
C[1]=A[1]
for index1 in range(2,N+1):
    C[index1]+=C[index1-1]+A[index1]

DP=[[0]*(N+1) for index2 in range(N+1)]


def mincost(i,j):   #i<=j
    global A
    global DP

    if DP[i][j]>0:
        return DP[i][j]
    if i==j:
        return DP[i][j]
    else:
        res=float('inf')
        sum=C[j]-C[i-1]
        for k in range(i,j):
            res=min(res,mincost(i,k)+mincost(k+1,j)+sum)
        DP[i][j]=res
        return DP[i][j]

mincost(1,N)
print(DP[1][N])

#for index3 in range(N+1):
    #string=''
    #for index4 in range(N+1):
        #string+=str(DP[index3][index4])+' '
    #print(string)


Measured memory_bytes: 44764
#include <stdio.h>

void Hantei(int p[3])
{
  int flg=0;
  int sum=p[0]+p[1]+p[2];
  if(p[0]==100 || p[1]==100 || p[2]==100)
    {
      printf("A\n");
      return;
    }
  if((p[0]+p[1])>=180)
    {
      printf("A\n");
      return;
    }
  if(sum>=240)
    {
      printf("A\n");
      return;
    }
  if(sum>=210)
    {
      printf("B\n");
      return;
    }
  if(sum>=150 && (p[0]>=80 || p[1]>=80))
    {
      printf("B\n");
      return;
    }

  printf("C\n");
}

int main(void)
{
  while(1)
    {
      int n;
      
      scanf("%d",&n);

      if(n==0)
	{
	  break;
	}

      int p[n][3];

      for(int i=0;i<n;i++)
	{
	  scanf("%d %d %d",&p[i][0],&p[i][1],&p[i][2]);
	}

      for(int i=0;i<n;i++)
	{
	  Hantei(p[i]);
	}
    }

  return 0;
}

Measured memory_bytes: 1012
s = input()
q = int(input())
cnt = 0
front = ''
rear = ''
for _ in range(q):
    t = input()
    if t[0] == '1':
        cnt += 1
    elif t[2] == '1':
        if cnt%2 == 1:
            rear = rear + t[4]
        else:
            front = front + t[4]
    else:
        if cnt%2 == 1:
            front = front + t[4]
        else:
            rear = rear + t[4]
if cnt%2 == 1:
    s = (front[::-1] + s + rear)[::-1]
else:
    s = front[::-1] + s + rear
print(s)


Measured memory_bytes: 4212
/*
  AUTHOR:SOURABH
  CREATED:07:03:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<ll , null_type, less< ll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    //freopen("in.txt","r",stdin);
    //freopen(2 "out.txt","w",stdout);

    ll t,a,b,c,i,m,x,y,mi1,mi2,ans;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>a>>b>>m;
        mi1=mi2=1e9;
        vll aa(a);
        fn(i,a)
        {
            cin>>aa[i];
            mi1=min(mi1,aa[i]);
        }
        vll bb(b);
        fn(i,b)
        {
            cin>>bb[i];
            mi2=min(mi2,bb[i]);
        }
        ans=mi1+mi2;
        fn(i,m)
        {
            cin>>x>>y>>c;
            ans=min(aa[x-1]+bb[y-1]-c,ans);
        }
        cout<<ans;
    }
    return 0;
}

















Measured memory_bytes: 1792
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))

def lamp(A):
  B = [0] * N
  for i in range(N):
    l = max(0, i - A[i])
    r = min(N - 1, i + A[i])
    #print(l, r)
    B[l] += 1
    if r + 1 < N:
      B[r + 1] -= 1
  
  A[0] = B[0]
  for i in range(1, N):
    A[i] = A[i - 1] + B[i]
  return A

r = min(41, K)
for i in range(r):
  A = lamp(A)
  
for i in range(N):
  print(A[i], end = " ")
print("")


Measured memory_bytes: 145556
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  while(1){
    int n;
    cin >> n;
    if(n==0)break;
    vector<int> ca(n*2+1,-1);
    int a;
    for(int i=0;i<n;i++){
      cin >> a;
      ca[a]=1;
    }
    int tu=1;//1st
    int t=n;
    int h=n;
    while(t!=0&&h!=0){
      for(int i=1;i<=n*2;i++){
	if(ca[i]==tu){
	  ca[i]=2;
	  if(tu==1)t--;
	  else h--;
	  if(t==0||h==0)break;
	  tu*=-1;
	}
      }
      tu*=-1;
    }
    int cou=0;
    for(int i=1;i<=n*2;i++){
      if(ca[i]!=2){cou++;
  }
    }
    if(t==0){
      cout << cou << endl;
      cout << 0 << endl;
    }
    else {
      cout << 0 << endl;
      cout << cou << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3048
N = gets.to_i
num = gets.strip.split.map(&:to_i)
if N <= 2 then
  puts 0
else
  cnt = 0
  for i in 0..(N-3)
    for k in (i+1)..(N-2)
      for j in (k+1)..(N-1)
        new =[num[i],num[k],num[j]].map(&:to_i)
        if 2*new.max<new.sum && new.size == new.uniq.size then
         cnt += 1
        end
      end
    end
  end
  puts cnt
end

Measured memory_bytes: 14268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll X;
    cin>>X;
    if(X==2){
        cout<<2<<endl;
        return 0;
    }
    rep(0,i,1e5){
       rep(2,j,X+i){
           if((X+i)%j==0)break;
           if(X+i-1==j){
               cout<<X+i<<endl;
               return 0;
           }
       } 
    }
}


Measured memory_bytes: 256
import sys
import numpy as np

readline = sys.stdin.buffer.readline

N, K = map(int, readline().split())
A = np.array(list(map(int, readline().split())))
F = np.array(list(map(int, readline().split())))

A = np.sort(A)[::-1]
F = np.sort(F)


def binary_search(min_n, max_n):

    while max_n - min_n != 1:
        tn = (min_n + max_n) // 2
        if judge(tn):
            max_n = tn
        else:
            min_n = tn

    return max_n


def judge(tn):

    k = 0
    if np.maximum(0, A - tn // F).sum() <= K:
        return True
    else:
        return False


def solve():

    ans = binary_search(-1, 10**12)
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 30988
N=int(input())
Z=list(map(int,input().split()))
from collections import Counter
c=Counter(Z[::2]).most_common(2)+[(0,0)]
c2=Counter(Z[1::2]).most_common(2)+[(0,0)]
if c[0][0]!=c2[0][0]:
    print(N-c[0][1]-c2[0][1])
else:
    print(min(N-c[1][1]-c2[0][1],N-c[0][1]-c2[1][1]))

Measured memory_bytes: 20712
#include<stdio.h>

int main(void){   int a,b;   scanf("%d %d",&a,&b);

  if(a<b){     printf("a < b\n");   }   if(a>b){      printf("a > b\n");   }   if(a==b){     printf("a == b\n");   }   return 0; }

 

Measured memory_bytes: 580
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int N;

    long long W;

    scanf("%d%lld", &N, &W);

    long long dp[N+1][N+1][301];

    long long w[N], v[N];

    for(int i = 0; i < N; i++){
        scanf("%lld%lld", &w[i], &v[i]);
    }

    for(int i = 0; i <= N; i++){
        for(int j = 0; j <= N; j++){
            for(int k = 0; k <= 300; k++){
                dp[i][j][k] = 0;
            }
        }
    }

    long long b = w[0];

    for(int i = 1; i <= N; i++){
        long long t = w[i-1]-b;
        for(int j = 1; j <= N; j++){
            for(int k = 0; k <= 300; k++){
                dp[i][j][k] = dp[i-1][j][k];
                if(t <= k && dp[i][j][k] < dp[i-1][j-1][k-t] + v[i-1]){
                    dp[i][j][k] = dp[i-1][j-1][k-t] + v[i-1];
                }
            }
        }
    }

    long long ans = 0;

    for(int i = 1; i <= N; i++){
        for(int j = 0; j <= 300; j++){
            if(b * i + j <= W && ans < dp[N][i][j]){
                ans = dp[N][i][j];
            }
        }
    }

    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 25676
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int a[3];

int main()
{
    scanf("%d%d%d",&a[0],&a[1],&a[2]);
    sort(a,a+3);
    printf("%d\n",a[2]*10+a[1]+a[0]);
    return 0;
}


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

const int N = 5000;
typedef long long LL;

LL n, cnt;
char ch[N];

int main() {
	cin>>n;
	while(n > 0) {
		if(n%26 == 0) ch[++cnt] = 'z', n -= 1;
		else ch[++cnt] = (char)(n%26 + 'a' - 1);
		n /= 26;
	}
	for(int i = cnt; i; i--) cout<<ch[i];
	return 0;
}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scanner = new Scanner(System.in);

		//入力表示
		int N= scanner.nextInt();
		String S = scanner.next();
		
		String T ="";
		String F ="";
		
		T =S.substring(0, S.length()/2);
		F =S.substring(S.length()/2,N);
		
		if( T.equals(F)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}
}

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

#define w cout
#define e '\n'
#define int long long
#define sz(x) (int)x.size()	
template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

const int N = 1e6;

signed main() {
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n , p; cin >> n >> p;
	string s; cin >> s;
	int ans = 0 ,m = 0;
	if(10 % p == 0) {
		for(int i = 0 ;i < n; i ++) {
			if((s[i] - '0') % p == 0) ans += i + 1;
		}
		w << ans ;
		return 0;
	}
	map<int ,int > mm;
	mm[0]++;
	int base = 1;
	int sum = 0;
	for (int i = n - 1; i >= 0; --i) {
    sum += base * (s[i] - '0');
    sum %= p;
    mm[sum]++;
    base *= 10;
    base %= p;
  }
	for(auto i : mm) {
		ans += i.second * (i.second - 1) / 2;
	}
	w << ans;
}


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

typedef vector <int> vi;
typedef pair< int , int > pii;
#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{
	FIO
	int x;
  	cin >> x;
  	if(x>=30)
      cout << "Yes\n";
  	else
      cout << "No\n";
	return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  int a,b,c;

  cin >>  a >> b >> c ;


  if(a==b&&b==c) cout << 1 << endl;

  else if(c==b) cout << 2 << endl;

  else if(c==a) cout << 2 << endl;

  else if(b==a) cout << 2 << endl;

  else cout << 3 << endl;


  
  return 0;
}

Measured memory_bytes: 256
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=5e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll n,m,ans=0,cnt=0,a[100005]={};
  cin >> n >> m;
  map<ll,ll> mp;
  for(int i=1; i<=n; i++) {
    cin >> a[i];
  }
  mp[0]++;
  for(int i=1; i<=n; i++) {
    a[i]+=a[i-1];
    mp[a[i]%m]++;
  }
  for(auto p:mp) {
    ans+=p.second*(p.second-1)/2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 4992
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

#define N 200000

void srand_() {
	struct timeval tv;

	gettimeofday(&tv, NULL);
	srand(tv.tv_sec ^ tv.tv_usec);
}

int rand_(int n) {
	return (rand() * 76543LL + rand()) % n;
}

int compare(const void *a, const void *b) {
	int ia = *(int *) a;
	int ib = *(int *) b;

	return ia - ib;
}

void sort(int *aa, int n) {
	int i, j, tmp;

	srand_();
	for (i = 0; i < n; i++) {
		j = rand_(i + 1);
		tmp = aa[i], aa[i] = aa[j], aa[j] = tmp;
	}
	qsort(aa, n, sizeof *aa, compare);
}

int main() {
	static int aa[N];
	int n, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	sort(aa, n);
	for (i = 0; i + 1 < n; i++)
		if (aa[i] == aa[i + 1]) {
			printf("NO\n");
			return 0;
		}
	printf("YES\n");
	return 0;
}


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

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=a;i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(a>b)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

//CodeChef Persistent Oak
struct HLD{
	const vvc<int>&g;
	int n,cnt;
	vi sub,in,out,par,head,dep;
	int dfs1(int v,int p,int d){
		par[v]=p;
		dep[v]=d;
		for(auto to:g[v])if(to!=p)
			sub[v]+=dfs1(to,v,d+1);
		return sub[v];
	}
	void dfs2(int v,int p,int h){
		in[v]=cnt++;
		head[v]=h;
		pi mx(-1,-1);
		int i=0;
		for(auto to:g[v])if(to!=p)
			chmax(mx,pi(sub[to],i++));
		i=0;
		for(auto to:g[v])if(to!=p&&mx.b==i++)
			dfs2(to,v,h);
		i=0;
		for(auto to:g[v])if(to!=p&&mx.b!=i++)
			dfs2(to,v,to);
		out[v]=cnt;
	}
	HLD(const vvc<int>&gg,int r):g(gg),n(g.size()),cnt(0),
		sub(n,1),in(n),out(n),par(n,-1),head(n),dep(n){
		dfs1(r,-1,0);
		dfs2(r,-1,r);
	}
	int lca(int a,int b){
		while(head[a]!=head[b]){
			if(dep[head[a]]>dep[head[b]])
				swap(a,b);
			b=par[head[b]];
		}
		if(dep[a]>dep[b])
			swap(a,b);
		return a;
	}
};

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	
	int n;cin>>n;
	vvc<int> t(n);
	rep(i,n){
		int m;cin>>m;
		rep(_,m){
			int c;cin>>c;
			t[i].pb(c);
		}
	}
	
	auto hld=HLD(t,0);
	
	int q;cin>>q;
	rep(_,q){
		int u,v;cin>>u>>v;
		cout<<hld.lca(u,v)<<"\n";
	}
}



Measured memory_bytes: 40936
#include<stdio.h>
signed main(){
    int x[5];
    int i;
    for(i=0;i<5;i++){
        scanf("%d",&x[i]);
    }
     for(i=0;i<5;i++){
        if(x[i]==0){
            printf("%d\n",i+1);
        }
    }
    return(0);
}

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

int main(){
  ll n;cin >> n;
  ll ans = 0;
  for(ll j=1;j<=n;++j){
    for(ll i=j;i<=n;i+=j){
      ans += i;
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define IOS             ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define watch(x);       cout << "\n" <<  #x << " is: " << x << "\n";
#define ll              long long int
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define pb              push_back
#define nl              cout<<"\n"
#define gcd(a,b)        __gcd(a,b)
#define sq(a)           (a)*(a)
#define loop(i,a,b)     for (int i = a; i <= b; i++)
#define rloop(i,a,b)    for (int i = a; i >= b; i--)
#define sz(a)           a.size()
#define mod             1000000007
#define PI              2*acos(0.0)

int main()
{
    IOS
    int T=1;
    //cin>>T;
    while(T--)
    {
        ll n;
        cin >> n;
        vector<ll> v(n+1,1);

        for (ll i = 2; i <= n; i++)
        {
            for (ll j = i; j <= n; j+=i) v[j]++;
        }
        ll ans = 0;
        for (ll i = 1; i <= n; i++)
        {
            ans += (i)*v[i];
        }
        cout << ans ;

    }
    return 0;
}


Measured memory_bytes: 81340