akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
int main(){
 ll a,b,x;cin>>a>>b>>x;
  if(a!=0)cout<<b/x-(a-1)/x<<endl;
  else cout<<b/x+1<<endl;
}





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

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> a(H);
  for (int i = 0; i < H; i++) {
    cin >> a.at(i);
  }
  
  vector<bool> row(H, false);
  vector<bool> col(W, false);
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (a[i][j] == '#') {
        row[i] = true;
        col[j] = true;
      }
    }
  }
  
  for (int i = 0; i < H; i++) {
    if (row[i]) {
      for (int j = 0; j < W; j++) {
        if (col[j]) {
          cout << a[i][j];
        }
      }
      cout << endl;
    }
  }
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
int dp(int i);
int n;
int c[200009],p[200009];
int memo[200009];

int main(){
  int l[200009];
  memset(memo,-1,sizeof(memo));
  memset(l,-1,sizeof(l));
  
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>c[i];
  }
  
  for(int i=n-1;i>=0;i--){
    if(i+1!=l[c[i]]){
      p[i]=l[c[i]];
    }
    else{
      p[i]=-1;
    }
    l[c[i]]=i;
  }
  
  cout<<dp(0)<<endl;
  return(0);
}

int dp(int i){
  long long rec;
  if(memo[i]!=-1)return memo[i];
  if(i==n)return 1;
  rec=dp(i+1);
  if(p[i]!=-1){
    rec+=dp(p[i]);
  }
  return memo[i]=rec%mod;
}


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

int N, S;

int main()
{
   while ( cin >> N && N>0)
   {
      int M, m, addup, i;
      M = -1;
      m = 1001;
      addup = 0;
      for ( i = 0; i<N; i++)
      {
         cin >> S;
         addup += S;
         if ( S > M) M = S;
         if ( S < m) m = S;
      }
   cout << (addup - M - m)/(N-2)  << endl;
   }
}

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

using namespace std;

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

const int N = 1e5 + 5;

int n,m,deg[N];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cin >> n >> m;
  for (int i = 1 ; i <= m ; i++) {
    int u,v;
    cin >> u >> v;
    deg[u]++;
    deg[v]++;
  }
  for (int i = 1 ; i <= n ; i++)
    if (deg[i] % 2) {
      cout << "NO\n";
      return 0;
    }
  cout << "YES\n";
}

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

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

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

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

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

vi d;
int tmp = -1;
int tmparg = -1;
void dfs(int now, int cnt, const vi &a) {
  d[now] = cnt;
  if(d[a[now]] != -1) {
    tmp = cnt + 1 - d[a[now]];
    tmparg = a[now];
    return;
  }
  dfs(a[now], cnt+1, a);
}

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

  ll n, k; cin >> n >> k;
  vi a(n);
  REP(i, n) {
    cin >> a[i];
    a[i]--;
  }

  d.resize(n, -1);
  dfs(0, 0, a);

  if(d[tmparg] >= k) {
    int pos = 0;
    REP(_, k) {
      pos = a[pos];
    }
    cout << pos + 1 << endl;
  } else {
    k -= d[tmparg];
    k %= tmp;
    int pos = tmparg;
    REP(_, k) {
      pos = a[pos];
    }
    cout << pos + 1 << endl;
  }


}
























Measured memory_bytes: 4784
#include <bits/stdc++.h>
#define lowbit(x) x&-x
using namespace std;

typedef long long ll;
static const int inf = 0x7fffffff;
static const int N = 1e5 + 10;
int n, a[N], cnt[N*10], pre[N*10];

void add (int x)
{
	for (int i = x; i <= N << 1; i += lowbit(i))
		++cnt[i];
}

ll query (int x)
{
	ll sum = 0;
	for (int i = x; i > 0; i -= lowbit(i))
		sum += cnt[i];
	return sum;
}

bool check (int x)
{
	for (int i = 1; i <= N << 1; ++i)
		cnt[i] = 0;
	pre[0] = 0;
	for (int i = 1; i <= n; ++i)
		pre[i] = pre[i-1] + (a[i] >= x ? 1 : -1);
	ll sum = 0;
	for (int i = 0; i <= n; ++i)
	{
		sum += query(pre[i] + N);
		add(pre[i]+N);
	}
	return sum >= 1ll * n * (n + 1) >> 2;
}

int main ()
{
	cin >> n;
	int l = 0, r = 0;
	for (int i = 1; i <= n; ++i)
		cin >> a[i], r = max(r, a[i]);
	int ans = 0;
	while (l <= r)
	{
		int mid = (l + r) >> 1;
		if (check(mid))
			l = mid + 1;
		else
			r = mid - 1;
	}
	cout << r;
	return 0;
}

Measured memory_bytes: 6784
i1 = int(input())
i2 = input().split(' ')
i3 = input().split(' ')

w = -1
s = 0

for i in range(i1):
  ii2 = int(i2[i])
  ii3 = int(i3[i])
#  print(ii2)
#  print(ii3)

  if w > -1:
    ii2 = w

  if ii2 > ii3 :
    #引ききれた場合
    s += ii3
    w = int(i2[i+1])
  else:
    s += ii2
    w = ii3 - ii2

    iii2 = int(i2[i+1])

    if iii2 > w:
      s += w
      w = iii2 - w
    else:
      s += iii2
      w = 0

print(s)

Measured memory_bytes: 78448
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<int, P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i, x) for (int i = 0; i < x; i++)
#define rep1(i, x) for (int i = 1; i <= x; i++)
#define rrep(i, x) for (int i = x - 1; i >= 0; i--)
#define rrep1(i, x) for (int i = x; i > 0; i--)
#define sor(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define lb(vec, a) lower_bound(vec.begin(), vec.end(), a)
#define ub(vec, a) upper_bound(vec.begin(), vec.end(), a)
#define uniq(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define mp1(a, b, c) P1(a, P(b, c))

const int INF = 1000000000;
const ll M = 1000000000;
const int dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const int dir_8[8][2] = {{1, 0},  {1, 1},   {0, 1},  {-1, 1},
                         {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

/*----------------------------------------------/
/- char         : %c  | char *       : %s  | short        : %hd
/- int          : %d  | long         : %ld | long long    : %lld
/- unsigned short:%hu | unsigned int : %u  | unsigned long: %lu
/- u_long long  : %llu| (octal)      : %o  | (hexadecimal): %x
/- float        : %f  | double       : %lf |
/----------------------------------------------*/

/*----------------------------------------------/
/- INT_MAX, LONG_MAX   : 1<<15 = 2.1*pow(10, 9)       (= 2147483647)
/- UINT_MAX, ULONG_MAX : 1<<16 = 4.2*pow(10, 9)       (= 4294967295)
/- LLONG_MAX           : 1<<63 = 9.2*pow(10, 18)      (= 9223372036854775807)
/- ULLONG_MAX          : 1<<64 = 1.8*pow(10, 19)      (= 18446744073709551615)
/----------------------------------------------*/

int n, a[100010], b[100010], c[100010];
// dp[i][j]:i日目にjを取った時の幸福度の総和の最大値
int dp[100010][3];

int main() {
    cin >> n;
    int a_, b_, c_;
    rep1(i, n) {
        scanf("%d%d%d", &a_, &b_, &c_);
        a[i] = a_;
        b[i] = b_;
        c[i] = c_;
    }
    dp[0][0] = 0;
    dp[0][1] = 0;
    dp[0][2] = 0;
    rep1(i, n) {
        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i];
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b[i];
        dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c[i];
    }

    cout << max(max(dp[n][0], dp[n][1]), dp[n][2]);

    /* ====================================== */
    cout << endl;
    return 0;
}

Measured memory_bytes: 2560
using System;

namespace abc055_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            ulong x = 1;
            for (int i = 1; i <= n; i++)
            {
                x = x * (ulong)i % 1000000007;
            }
            Console.WriteLine(x);
        }
    }
}

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

#include <bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pii>
#define read(FILE)  freopen(FILE, "r", stdin);
#define out(FILE) freopen(FILE, "w", stdout);
#define clr(x, y) memset(x,y,sizeof(x));
#define IO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define rep(i, m, n) for(int i=m ; i<n ; i++)
#define forr(i, m, n) for(int i=m ; i<=n ; i++)
#define endl '\n'
#define pb push_back
#define re return
const int N = 1e6 + 5;
const ll mod = 1e9 + 7;
using namespace std;

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


}


Measured memory_bytes: 3564
#code
n=int(input())
b=input()

b=b.split()

b=list(map(int,b))
a=list()
a.append(b[0])

for i in range(1,len(b)):
    
    
    a.append(min(b[i],b[i-1]))
if(n>2):
    a.append(b[len(b)-1])
if(n==2):
    a.append(b[0])
sum=0 
for i in range(len(a)):
    sum+=a[i]
print(sum)


Measured memory_bytes: 3064
from sys import stdin
from sys import setrecursionlimit as SRL; SRL(10**7)
rd = stdin.readline
rrd = lambda: map(int, rd().strip().split())

s = str(rd().strip())

pre =""
ans = 0

i = 0
while i < len(s):
    x = s[i]
    if x == pre:
        if i+1<len(s):
            x = x + s[i+1]
            ans += 1
            pre = x
        i += 2

    else:
        pre = x
        ans += 1
        i += 1

print(ans)


Measured memory_bytes: 41248
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define MAX_C 1000000001

int main() {
  int a, b, c, x ,y;
  cin >> a >> b >> c >> x >> y;
  ll pay = 0;

  int buy = min(x, y); 
  x -= buy;
  y -= buy;
  pay += buy * min(a + b, 2 * c);

  if (x > 0) pay += min(a, 2 * c) * x;
  if (y > 0) pay += min(b, 2 * c) * y;

  cout << pay << endl;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
void dump_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        ll a;
        string s;
        cin >> a;
        cin >> s;
        
        if (a >= 3200) cout << s << endl;
        else cout << "red" << endl;
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;

int a,b,c,N,d,e,f,r,p[301];
struct test{int x,y,z,w;};
test t[1000];

int main(){
	while(cin>>a>>b>>c){
		if(a+b+c==0)return 0;
		for(int i=1;i<=a+b+c;i++)p[i]=2;
		cin>>N;
		for(int i=0;i<N;i++){
			cin>>d>>e>>f>>r;
			t[i].x=d;t[i].y=e;t[i].z=f;t[i].w=r;
		}
		for(int i=0;i<N;i++)if(t[i].w==1){
			p[t[i].x]=1;p[t[i].y]=1;p[t[i].z]=1;
		}
		for(int i=0;i<N;i++)if(t[i].w==0){
			if(p[t[i].x]==1&&p[t[i].y]==1)p[t[i].z]=0;
			if(p[t[i].y]==1&&p[t[i].z]==1)p[t[i].x]=0;
			if(p[t[i].z]==1&&p[t[i].x]==1)p[t[i].y]=0;
		}
		for(int i=1;i<=a+b+c;i++)cout<<p[i]<<endl;
	}
}

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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))


int solve(string& x) {
    int L=x.size();

    int s=0;
    int cnt = 0;

    rep(i,L){
        if (x[i] == 'S') {
            ++s;
        }
        else if (x[i] == 'T') {
            --s;
            if (s < 0) {++cnt; s=0; }
        }
    }

    return cnt*2;
}

int main() {
    string x; cin >> x;
    cout << solve(x) << endl;
    // cout << (solve(N,a) ? "Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 640
n=gets.to_i
a=gets.split.map(&:to_i)

u1=[]
u2=[]

a.each_with_index{|h,i|
    i=i+1
    if h+i <= n
        u1[h+i]||=0;
        u1[h+i]+=1;
    end
    if i-h >= 0
        u2[i-h]||=0;
        u2[i-h]+=1;
    end
}

r = (0...u1.size).each_with_index.map{|x,i| u1[i]&&u2[i] ? u1[i]*u2[i] : 0 }.sum


print r

Measured memory_bytes: 32760
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

void solve() {
    map<int,int> mp;
    int N;
    cin >> N;
    REP(_,N) {
        int D;
        cin >> D;
        if(mp.count(D) == 0) mp[D] = 0;
        mp[D]++;
    }

    int M;
    cin >> M;
    REP(_,M) {
        int T;
        cin >> T;
        if (mp.count(T) == 0) {
            cout << "NO" << endl;
            return;
        }
        if (mp[T] == 0) {
            cout << "NO" << endl;
            return;
        }
        mp[T]--;
    }
    cout << "YES" << endl;

}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 12988
module ABC130

  ! <module>s to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none

  ! accessibility of <subroutine>s and <function>s in this <module>
  public  :: task_B

  ! contained <subroutine>s and <function>s are below
  contains

  subroutine task_B

    ! variables for this <subroutine>
    integer(INT32)                            :: num_bound_total
    integer(INT32)                            :: coordinate_limit
    integer(INT32), allocatable, dimension(:) :: coordinate_bound_ref
    integer(INT32), allocatable, dimension(:) :: coordinate_bound
    integer(INT32)                            :: coordinate_current

    ! support variables for this <subroutine>
    integer(INT32) :: counter

    ! STEP.01
    ! read out the number of bound
    ! read out the limit of coordinate
    read(unit=INPUT_UNIT, fmt=*) num_bound_total, coordinate_limit

    ! STEP.02
    ! allocate the arrays
    allocate(coordinate_bound_ref(1:num_bound_total  ))
    allocate(coordinate_bound    (1:num_bound_total+1))

    ! STEP.03
    ! read out the coordinate where to bound
    read(unit=INPUT_UNIT, fmt=*) coordinate_bound_ref(1:num_bound_total)

    ! STEP.04
    ! calculate the coordinate at the each bound
    coordinate_bound(1) = 0_INT32
    do counter = 2, num_bound_total+1, 1
      coordinate_bound(counter) = coordinate_bound(counter-1) + coordinate_bound_ref(counter-1)
    end do

    ! STEP.04
    ! output the result
    do counter = 1, num_bound_total, 1
      if (coordinate_bound(counter) .le. coordinate_limit .and. coordinate_bound(counter+1) .gt. coordinate_limit) then
        write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') counter
        exit
      end if
    end do

    if (counter .gt. num_bound_total) then
      write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') num_bound_total+1
    end if

    ! STEP.END
    return

  end subroutine task_B

end module ABC130


program main

  ! <module>s to import
  use, non_intrinsic :: ABC130

  ! require all variables to be explicitly declared
  implicit none

  call task_B

end program main

Measured memory_bytes: 256
fun main(args: Array<String>) {
  val (h, w) = readLine()!!.split(" ").map { it.toInt() }
  val a = Array(h) { readLine()!! }
  var row = BooleanArray(h) { i -> a[i].all { it == '.' } }
  var col = BooleanArray(w) { i -> a.all { it[i] == '.' } }
  for (i in 0 until h) {
    if (row[i]) continue
    println(a[i].filterIndexed { id, value -> !col[id] })
  }
}


Measured memory_bytes: 38000
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定 setprecision()
#include <list> //前後に数値を入れれる配列
#include <map> //map
#include <vector> //vecror

#define REP(i,m,n) for(ll i = (ll) (m);i < (ll) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = acos(-1); //円周率
ll mod = 1e9 + 7;


//提出コード



ll r;


int main() {
	
	cin >> r;
	if (r < 1200) {
		cout << "ABC" << endl;
	}
	else if (r < 2800) {
		cout << "ARC" << endl;
	}
	else cout << "AGC" << endl;





	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <cstdio>
using namespace std;
#define ll  long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
# define st(v) (v).begin(),(v).end()
#define   pr pair<int,int>
const int dx[4] = {1,0,0,-1};
const int dy[4] = {0,-1,1,0};
void solve(){
	int p ,q , r ;
	cin >> p >> q >> r ;
	cout << min(p+q , min(q+r,r+p));
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q=1;
    //cin >> q;
    while(q--)
        solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    ll n,sum=0;
    cin>>n;
    string x;
    map<string,ll> m;
    set<string> s;
    for(int i=0;i<n;i++) {cin>>x;sort(x.begin(),x.end());s.insert(x);m[x]++;}
    for(auto i=s.begin();i!=s.end();i++){
        //cout<<*i<<" ";
        sum+=(m[*i]*(m[*i]-1))/2;
    }    
    cout<<sum;
    return 0;
}

Measured memory_bytes: 20608
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort(reverse=True)
    return divisors

def checker(A,k):
    A.sort(reverse=True)
    if sum(A[sum(A) // d:]) <= k:
        return True
    return False

n,k = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

for d in make_divisors(sum(A)):
    buf = []
    for a in A:
        buf.append(a%d)
    #print(buf)
    if checker(buf,k):
        print(d)
        break

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define N               200005
#define ff              first
#define ss              second
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define mii             map<ll,ll>
#define pq_max          priority_queue<ll>
#define pq_min          priority_queue<ll,vi,greater<ll> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define inp(arr,n)      for(ll x=0;x<n;x++) cin>>arr[x];
#define w(x)            ll x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void fio(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int main(){
    fio();

    string s;
    cin>>s;

    int l = s.length();
    if(s[l-1] == 's') s += "es";
    else s += "s";

    cout<<s;

    return 0;
}

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

map<ll, int> prime_factor(ll n)
{
	map<ll, int> res;

	for(ll i = 2; i * i <= n; i++)
	{
		while(n % i == 0)
		{
			++res[i];
			n /= i;
		}
	}

	if (n != 1)
	{
		res[n] = 1;
	}

	return res;
}


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

	map<ll, int> mp = prime_factor(n);

	ll ans=0;
	for(auto mm: mp){
		int num=mm.second;

		int cnt=0, i=1;
		while(cnt+i<=num){
			ans++;
			cnt+=i;
			i++;
		}
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#define ll long long
#define INF 10000000000000000
#define MOD 998244353
using namespace std;


int main(){
    ll n;
    cin >> n;
    cout<<n<<":";
    while(true){
        int no=1;
        for(ll i=2; i*i<=n; i++){
            if(n%i==0){
                cout<<" "<<i;
                n/=i;
                no=0;
                break;
            }
        }
        if(no==1){
            cout<<" "<<n<<endl;
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include <limits>
#include <iomanip>
#include <queue>
#include <cmath>
#include <math.h>
#include <string>
#include <math.h>
#define PI 3.14159265359
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;

int main() {

	// 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);

	int x, y, z;
	cin >> x >> y >> z;

	cout << z << " " << x << " "  << y;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const ll MOD = 1e9 +7;

int main(){
    ll n,k,a[100010],ans=0,r=0;
    cin>>n>>k;
    rep(i,n) cin>>a[i];
    for(int i=40;i>=0;i--){
        ll mask =1LL<<i;
        ll cnt =0;
        rep(j,n){
            if(mask&a[j]) cnt++;
        }
        if(cnt>=n-cnt){
            ans+=mask*cnt;
        }
        else{
            if(r+mask<=k){
                ans+=mask*(n-cnt);
                r+=mask;
            }
            else ans +=mask*cnt;
        }
    }
    cout <<ans<<endl;
    return 0;
}

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

int main(){
  int N,K;
  cin >>N>>K;
  vector<int> h(N);
  for(int i=0;i<N;i++){
    cin >> h.at(i);
  }
  sort(h.begin(),h.end());
  int m=h.at(0);
  for(int i=0;i<N;i++){
    h.at(i) -= m;
  }
  long long int ans=9223372036854775807;
  int a;
  long long int c;
  for(int i=0;i<N;i++){
    c=h.at(i+K-1)-h.at(i);
    if(ans > c ){
      ans = c;
      a = i;
    }
    if(i+K == N) break;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
n, m = map(int, input().split())

NMmatrix = []

for i in range(n):
    NMmatrix.append(list(map(int, input().split())))

Bmatrix = []

for j in range(m):
    Bmatrix.append(int(input()))

ans = []
    
for k in range(n):
    SUM = 0
    for l in range(m):
        SUM += NMmatrix[k][l]*Bmatrix[l]
    ans.append(SUM)

for disp in range(len(ans)):
    print(ans[disp], end='\n')


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

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

    if ((a * b) % 2 == 0) {
        cout << "Even" << endl;
    }
    else {
        cout << "Odd" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;


int main() {
    int n;
    int cnt = 1;
    while ( cin >> n ) {
        if ( n == 0 ) continue;
        cout << "Case " << cnt++ << ": " << n << endl;
    }
    
    return 0;
}

Measured memory_bytes: 2992
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int[] DR = { 1, 1, 1, 0, -1, -1, -1, 0 };
	static int[] DC = { -1, 0, 1, 1, 1, 0, -1, -1 };

	public static void main(String[] args) {
		int[][] visited = new int[10][20];
		int turn = 0;
		while (true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0) break;
			char[][] f = new char[H][];
			for (int i = 0; i < H; ++i) {
				f[i] = sc.next().toCharArray();
			}
			ArrayList<HashSet<String>> set = new ArrayList<HashSet<String>>();
			for (int i = 0; i <= H * W; ++i) {
				set.add(new HashSet<String>());
			}
			String ans = "";
			for (int i = 0; i < H; ++i) {
				for (int j = 0; j < W; ++j) {
					for (int k = 0; k < 8; ++k) {
						++turn;
						StringBuilder sb = new StringBuilder();
						sb.append(f[i][j]);
						int cr = i;
						int cc = j;
						visited[cr][cc] = turn;
						while (true) {
							cr += DR[k];
							cc += DC[k];
							if (cr == -1) cr += H;
							if (cr == H) cr = 0;
							if (cc == -1) cc += W;
							if (cc == W) cc = 0;
							if (visited[cr][cc] == turn) break;
							visited[cr][cc] = turn;
							sb.append(f[cr][cc]);
							String str = sb.toString();
							if (str.length() > ans.length() || str.length() == ans.length() && str.compareTo(ans) < 0) {
								if (set.get(str.length()).contains(str)) {
									ans = str;
								} else {
									set.get(str.length()).add(str);
								}
							}
						}
					}
				}
			}
			System.out.println(ans.length() == 0 ? 0 : ans);
		}
	}
}

Measured memory_bytes: 188792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(...) cerr << "[(" << __LINE__ << ") " << (#__VA_ARGS__) << "]: " << __VA_ARGS__ << endl;

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

    ll x;
    cin >> x;

    ll duh = 100;
    int cnt = 0;
    while (duh < x) {
        duh *= 1.01;
        cnt++;
    }
    cout << cnt << "\n";
}


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

using namespace std;
int main(int argc, char **argv)
{
    int n,k;
    cin>>n;
    long long sum = 0;
    vector<int> v;
    for(int i = 0 ; i < n-1;i++){
        cin>>k;
        v.push_back(k);
    }
    
    for(int i = 0; i < n;i++){
        if(i == 0)
            sum += v[i];
        else if(i == n-1)
            sum += v[n-2];
        else 
            sum += min(v[i],v[i-1]);
    }
    cout<<sum;
	return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

const int INF = 1 << 29;

int main() {
    vector<int> v(3);
    rep (i, 3) cin >> v[i];
    sort(all(v));
    if (v[0] == 5 && v[1] == 5 && v[2] == 7) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
from collections import Counter

N = int(input())
S = input()

dic = Counter(S)
cnt = 0

for i in range(0,N-2):
  for j in range(i+1,N-1):
    if S[i] == S[j]:
      continue
    elif 2*j - i < N:
      if S[i] != S[2*j-i] and S[j] != S[2*j-i]:
        cnt += 1
        
print(dic["R"]*dic["B"]*dic["G"]-cnt)

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

int main()
{
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++)
  {
    cin >> d[i];
  }
  int ans = 0;
  for (int i = 0; i < n - 1; i++)
  {
    for (int j = i + 1; j < n; j++)
    {
      ans += d[i] * d[j];
    }
  }
  cout << ans << endl;
}


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

int main(){
	int n;
	string s;
	cin >> n >> s;
	int max = -1;
	for(int i = 0;i < n - 1;i++){
		//i文字目までと,i+1文字目からの2つに分ける
		vector<char> memo1;
		vector<char> memo2;
		for(int j = 0;j <= i;j++){
			bool a = true;
			if(!memo1.empty()){
				for(unsigned int k = 0;k < memo1.size();k++){
					if(s[j] == memo1[k]) a = false;
				}
			}
			if(a == true) memo1.push_back(s[j]);
		}
		
		for(int j = i+1;j < n;j++){
			bool a = true;
			if(!memo2.empty()){
				for(unsigned int k = 0;k < memo2.size();k++){
					if(s[j] == memo2[k]) a = false;
				}
			}
			if(a == true) memo2.push_back(s[j]);
		}

		int count = 0;
		for(unsigned int j = 0;j < memo1.size();j++){
			for(unsigned int k = 0;k < memo2.size();k++){
				if(memo1[j] == memo2[k]) count++;
			}
		}
		if(count > max) max = count;
	}
	cout << max << "\n";
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main{
  static String YES = "Yes", NO= "No";
  public static void main(String[] args) throws IOException {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt(), count = 0;
    for(int i=0; i<n; i++){
      if(sc.nextInt() == sc.nextInt()){
        if(++count == 3){
          System.out.println(YES);
          return;
        }
      }
      else{
        count =0;
      }
    }
    System.out.println(NO);
  }

  static class Scanner {
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s) {
      br = new BufferedReader(new InputStreamReader(s));
    }

    public Scanner(FileReader s) throws FileNotFoundException {
      br = new BufferedReader(s);
    }

    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens())
        st = new StringTokenizer(br.readLine());
      return st.nextToken();
    }

    public int nextInt() throws IOException {
      return Integer.parseInt(next());
    }

    public long nextLong() throws IOException {
      return Long.parseLong(next());
    }

    public String nextLine() throws IOException {
      return br.readLine();
    }

    public double nextDouble() throws IOException {
      return Double.parseDouble(next());
    }

    public boolean ready() throws IOException {
      return br.ready();
    }
  }
}

Measured memory_bytes: 32688
n = int(input())
a = list(map(int, input().split()))
aa = [2 if i % 4 == 0 else 1 if i % 2 == 0 else 0 for i in a]
a4, a2, a0 = aa.count(2),aa.count(1), aa.count(0)

if a2 == 0:
    a4 += 1

print("Yes" if a4 >= a0 else "No")

Measured memory_bytes: 15020
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
using static AtCoderSolve.Tool;

namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 2;

        static void Main(string[] args)
        {
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            var cin = new Scanner();
            int N = int.Parse(Console.ReadLine());
            List<Pair<int>> P = new List<Pair<int>>();

            for(var i = 0; i < N; i++)
            {
                P.Add(new Pair<int>(int.Parse(Console.ReadLine()), i));
            }

            P.Sort();
            long len = 1;
            long ans = N;
            for(var i = 0; i < N; i++)
            {
                if (i == 0) { continue; }
                if (P[i].index > P[i - 1].index)
                {
                    len++;
                }
                else
                {
                    ans = Min(ans, N - len);
                    len = 1;
                }
            }
            ans = Min(ans, N - len);

            Console.WriteLine(ans);


            //Console.Out.Flush();
        }


    }

    public class Scanner
    {
        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }

    public static class Tool
    {
        static public void Initialize<T>(ref T[] array, T initialvalue)
        {
            for(var i = 0; i < array.Length; i++)
            {
                array[i] = initialvalue;
            }
        }
    }

    struct Pair<T> : IComparable<Pair<T>> where T : IComparable<T>
    {
        public T variable;
        public int index;

        public Pair(T val, int i)
        {
            variable = val;
            index = i;
        }

        public int CompareTo(Pair<T> otherPair)
        {
            return variable.CompareTo(otherPair.variable);
        }

        public int CompareIndex(Pair<T> otherPair)
        {
            return index.CompareTo(otherPair.index);
        }
    }



}






Measured memory_bytes: 21724
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 1000000007LL
#define EPSILON 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair

#define FOR(i, a, b) for (ll i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (ll i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (ll i=(a); i >= b; i--)

#define MN 200005
int n;
int a[MN];
int deg[MN];

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

    cin >> n;
    FOR(i, 2, n){
        cin >> a[i];
        deg[a[i]]++;
    }
    FOR(i, 1, n) cout << deg[i] << "\n";

    return 0;
}


Measured memory_bytes: 5136
#include <iostream>
using namespace std;
const int INF = 1 << 30;

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

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

    int ans = INF;
    for (int i = 0; i < N; ++i) {
        int j = i + K - 1;
        if (j > N - 1) break;

        // 最初にx_iとx_jの近い方に行く
        // その後x_iからx_jへ、あるいはx_jからx_iへ移動する
        ans = min(ans, min(abs(x[i]), abs(x[j])) + x[j] - x[i]);
    }

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


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int a = sc.nextInt();

        int b = sc.nextInt();

        if ((1 <= a && a <= 9) && (1 <= b && b <= 9)) {
            System.out.println(a * b);
        } else {
            System.out.println("-1");
        }



    }
}



Measured memory_bytes: 21844
import java.util.*;

public class Main{

public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int[] mountains = new int[10];

for(int i=0; i<10; i++){
mountains[i] = sc.nextInt();
}

Arrays.sort(mountains);
System.out.println(mountains[9]);
System.out.println(mountains[8]);
System.out.println(mountains[7]);
}


}

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

int main ()
{
  string s;
  long long A[5],i;
  for (i = 0; i < 5; i++) {
    cin>>A[i];
    if(A[i]==0) cout<<i+1<<endl;
  }

  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define IO ios::sync_with_stdio(false);\
    cin.tie(0);\
    cout.tie(0);
using namespace std;
typedef long long LL;
const int maxn = 7e2+10;

int n;
char str[maxn][maxn];

bool judge(int x,int y)
{
//    int num = 1e8 / n / n;
//    for(int k=0; k<num; k++)
//    {
//        int i = rand() % n;
//        int j = rand() % n;
//        if(str[x+i][y+j]!=str[x+j][y+i])
//            return false;
//    }
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
        {
            if(str[i+x][j+y]!=str[x+j][y+i])
                return false;
        }
    }
    return true;
}

void solve()
{
    int ans = 0 ;
//    for(int i=0; i<n; i++)
//    {
    for(int j=0; j<n; j++)
    {
        if(judge(0,j))
            ans+=n;
    }
//    }
//    printf("%d\n",ans);
    cout<<ans<<endl;
}

int main()
{
#ifdef LOCAL_IM0QIANQIAN
    freopen("test.in","r",stdin);
#else
    IO;
#endif // LOCAL_IM0QIANQIAN
    srand(time(NULL));
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>str[i];
    for(int i=0; i<n+n; i++)
    {
        for(int j=0; j<n+n; j++)
        {
            if(i<n&&j<n)
                continue;
            str[i][j] = str[i%n][j%n];
        }
    }
    solve();
    return 0;
}


Measured memory_bytes: 640
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

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

#include <iostream>

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

	if (N == 1) { cout << "Hello World" << endl; }
	if (N == 2) {
		int A, B;
		cin >> A >> B;
		cout << A + B << endl;
	}
}

Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<atcoder/all>
#include<iostream>
#include<cstdint>
#include<cstddef>
using namespace std;
using namespace atcoder;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using usize = uint_fast64_t;
#define rep(i, n) for (usize i = 0; i < (usize)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i32 s;
cin >> s;
rep(i,s){
    cout << "ACL";
}
cout << endl;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
long long N,ans=0LL;
int main(){
    cin>>N;

    map<int,int>m;
    vector<long long>A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
        m[i-A[i]]++;
    }

    for(int i=0;i<N-1;i++){
        m[i-A[i]]--;
        ans+=m[i+A[i]];
    }
    cout<<ans<<endl;
    return 0;
}

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

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

Measured memory_bytes: 3724
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	int a[3],b,c,d,e;
	b=c=d=e=0;
	while(scanf("%d %d %d",&a[0],&a[1],&a[2])!=EOF){
		sort(a,a+3);
		if(a[0]+a[1]<=a[2]){
				cout << b << " " << c << " " << d << " " << e << endl;
				return 0;
		}
		b++;
		if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2])	c++;
		if(a[0]*a[0]+a[1]*a[1]>a[2]*a[2])	d++;
		if(a[0]*a[0]+a[1]*a[1]<a[2]*a[2])	e++;
	}
}

Measured memory_bytes: 1228
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC106_C solver = new ABC106_C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC106_C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            char[] charArray = in.nextLine().toCharArray();
            long k = in.nextLong();
            int ans = 1;
            for (int i = 0; i < k; i++) {
                if (charArray[i] != '1') {
                    ans = Integer.parseInt(String.valueOf(charArray[i]));
                    break;
                }
            }
            out.print(ans);

        }

    }
}



Measured memory_bytes: 22740
N = gets.to_i

ans = Float::INFINITY

def digit_sum(n)
  n.to_s.chars.map(&:to_i).inject(:+)
end

(1...N).each do |a|
  b = N - a
  c = digit_sum(a) + digit_sum(b)

  ans = c if ans > c
end

puts ans


Measured memory_bytes: 1916
i = list(map(int, input().split()))

if i[2] + i[4] <= i[0]:
    if i[2] - i[4] >= 0:
        if i[3] + i[4] <= i[1]:
            if i[3] - i[4] >= 0:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")


Measured memory_bytes: 5596
#include <iostream>
#include <cassert>

int main(int argc, char **argv)
{
    int A, B, C, D, E, F;
    std::cin >> A >> B >> C >> D >> E >> F;

    assert(1 <= A && A <= 30);
    assert(1 <= B && B <= 30 && A < B);
    assert(1 <= C && C <= 30);
    assert(1 <= D && D <= 30 && C < D);
    assert(1 <= E && E <= 100);
    assert(100 * A <= F && F <= 3000);

    float max = -1.0f;
    int max_water = 0, max_suger = 0;
    for(int i = 0; i < 30; i++){
        int water_a = 100*i*A;
        if(water_a > F) break;
        for(int j = 0; j < 30; j++){
            int water = water_a + 100*j*B;
            if(water == 0 || water > F) break;
            for(int k = 0; k < 3000; k++){
                int suger_a = k * C;
                if(water+suger_a > F) break;
                for(int l = 0; l < 3000; l++){
                    int suger = suger_a + l * D;
                    if(water+suger > F) break;
                    if(water/100 * E < suger) break;
                    float rate = ((float)suger) / (((float)(suger)) + ((float)(water)));
                    //std::cout << "w:" << water << ", s:" << suger << ", r:" << rate <<std::endl;
                    if(rate > max){
                        max_water = water;
                        max_suger = suger;
                        max = rate;
                    }
                }
            }
        }
    }
    std::cout << (max_suger + max_water) << " " << max_suger << std::endl;
    
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}



int main2() {
  int N; cin >> N;
  string s; cin >> s;
  int r = count(ALL(s), 'R');
  int b = count(ALL(s), 'B');
  if (r > b)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 256