akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int mod = 1e9+7;
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
ull llrand() {ull r = 0;for(int i = 0; i < 5; ++i){r = (r << 15)|(rand() & 0x7FFF);}return r & 0xFFFFFFFFFFFFFFFFULL;}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};
/*---------------------------------------------------------------------------------------------------------------------*/

const int M = 100001;


int main(){
    //freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);



    int a , b , c , d , e , f;

    cin >> a >> b >> c >> d >> e >> f;

    double ans = 0.0;
    int one = 0 , two = 0;

    for(int i1 = 0 ; i1 <= 500 ; i1++){
            if(i1*a*100 > f) break;
        for(int i2 = 0 ; i2 <= 500 ; i2++){
            if(100*(i1*a + i2*b) > f) continue;
            for(int i3 = 0 ; i3 <= 500 ; i3++){

                int water = 100*(i1*a + i2*b);
                int sugar = i3*c;

                if(e*(i1*a + i2*b) < sugar) continue;
                if(sugar + water > f) continue;

                for(int i4 = 0 ; i4 <= 500 ; i4++){

                    water = 100*(i1*a + i2*b);
                    sugar = i3*c + i4*d;
                    if(i1 == 1 && i3 == 1 && i2+i4 == 0){
                       // cout<<water<<"  "<<sugar<<endl;
                    }
                    if(e*(i1*a + i2*b) < sugar) continue;
                    if(sugar + water > f) continue;

                    double density = (sugar*1.0)/(sugar*1.0 + water*1.0);
                    if(density > ans){
                       // cout<<density<<"  "<<ans<<"  "<<water<<"  "<<sugar<<endl;
                        ans = density;
                        one = water + sugar;
                        two = sugar;
                    }

                }
            }
        }
    }

    if(ans == 0){
        one = 100*(min(a , b));
        two = 0;
    }
    cout<<one<<" "<<two;














}














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

int main()
{
  string S;cin>>S;string ans="NO";
  for(int f=0;f<S.size();f++)for(int m=0;m<S.size();m++)
  {
    if(f+m>S.size())continue;
    int l=S.size()-f-m;
    string check;
    for(int i=0;i<f;i++)check+=S[i];
    for(int i=f+m;i<S.size();i++)check+=S[i];
    if(check=="keyence")ans="YES";
  }
  cout<<ans<<endl;
}

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

using namespace std;

int main() {
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int n;
  scanf("%d", &n);
  if (n == 1) {
    puts("Hello World");
  } else {
    int a, b;
    scanf("%d %d", &a, &b);
    printf("%d\n", a + b);
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
typedef pair<ll,mp> mmp;
#define inf 1e9



int main(){
	int n,m;
	cin>>n>>m;
	vector<vector<int> > g(n);
	for(int i=0;i<m;i++){
	    int u,v;
	    cin>>u>>v;
	    u--,v--;
	    g[u].push_back(v);
	}
	int s,t;
	cin>>s>>t;
	s--,t--;
	vector<vector<ll> > gg(n);
	priority_queue<mp,vector<mp> ,greater<mp> > q;
	q.push(mp(0,s) );
	vector<vector<bool> > used(n,vector<bool>(3,false) );
	while(!q.empty()){
		mp now = q.top();
		q.pop();
		ll nn = now.second;
		ll cnt = now.first;
		if(nn == t &&cnt%3 == 0){
			cout<<cnt/3<<endl;
			return 0;
		}
		if(used[nn][cnt%3])continue;
		used[nn][cnt%3] = true;
		for(int i=0;i<g[nn].size();i++){
			ll next = g[nn][i];
			//if(used[nn][(cnt+1)%3])continue;
			q.push(mp(cnt+1,next) );
		}

	}
	cout<<-1<<endl;


	return 0;
}


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

int main(){
  int r,g,b,num;
  cin >> r ;
  cin >> g ;
  cin >> b ;
  
  num = 10*g + b ;
  if(num%4==0){
    cout << "YES" << endl ;
  }else{
  	cout << "NO" << endl ;
  }
  return 0 ;
}

Measured memory_bytes: 256
n = input()
keta = len(n)
if n[0] == '9':
    # 9999
    if n[1:] == '9'*(keta-1):
        print(9*keta)
    # 9899
    else:
        print(9*keta-1)
else:
    # 49999
    if n[1:] == '9'*(keta-1):
        print(int(n[0]) + 9*(keta-1))
    # 234
    else:
        print(int(n[0])-1 + 9*(keta-1))

Measured memory_bytes: 9040
// dile a la jardinera que traigo flores

#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define tm1 ff
#define tm2 ss.ff
#define tm3 ss.ss
#define sz(x) int(x.size())
#define all(v) (v).begin(),(v).end()
#define fill(x,v) memset(x,v,sizeof(x))
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define IFR(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;




int main(){
	fastio;	
	int n,h,w;cin>>n>>h>>w;
	cout<<(n-h+1)*(n-w+1)<<endl;


	return 0;
}



Measured memory_bytes: 256
from collections import defaultdict

N, M = map(int, input().split())

ball_count=[1 for _ in range(N)]
redExist=[0 for _ in range(N)]
redExist[0]=1
for m in range(M):
  x, y = map(int, input().split())
  #1オリジンから0オリジンに
  x-=1
  y-=1

  ball_count[x] -= 1
  ball_count[y] += 1
  if (redExist[x]):
    redExist[y]=True
  if ball_count[x] == 0:
    redExist[x]=False
print(len([b for b in redExist if b]))

Measured memory_bytes: 11336
#include <cstdio>
#include <vector>

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

  std::vector<int> a(n);
  for (int i=0; i<n; ++i)
    scanf("%d", &a[i]);

  std::vector<int> b;
  for (int i=n-1; i>=0; i-=2)
    b.emplace_back(a[i]);

  for (int i=n%2; i<n; i+=2)
    b.emplace_back(a[i]);

  for (int i=0; i<n; ++i)
    printf("%d%c", b[i], i+1<n? ' ':'\n');

  return 0;
}


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

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

    string s,t;

    cin >> s >> t;
    int n,m;
    n = (int)s.size();
    m = (int)t.size();

    int k,best = 1e9;
    for (int i = 0; i <= n-m; i++) {
    	k = 0;
    	int y = i;
    	for (int j = 0; j < m; j++) {
    		if (t[j] != s[y]) k++;
    		y++;
    	}
    	best = min(best, k);
    }

    cout << best << "\n";

    return 0;
}


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

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

const main = (input: string[][]) => {
  const [N, M] = input[0].map(Number);
  const A = input.slice(1, N + 1).map((line) => line[0]);
  const B = input.slice(N + 1, -1).map((line) => line[0]);

  for (let x = 0; x <= N - M; x++) {
    for (let y = 0; y <= N - M; y++) {
      let isMatched = true;

      for (let i = 0; i < M; i++) {
        if (B[i] !== A[y + i].slice(x, x + M)) {
          isMatched = false;
        }
      }

      if (isMatched) {
        return "Yes";
      }
    }
  }

  return "No";
};

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


Measured memory_bytes: 33188
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);i++)
#define FORE(x,arr) for(auto &x:arr)
#define FOR(i,a,n) for(int i=a;i<(int)(n);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) begin(c),end(c)
const int DX[4]={0,1,0,-1}, DY[4]={-1,0,1,0};
const int INF = 1e9;

struct node{
    int i;
    vector<node*> to;
};
typedef pair<node*,int> bfs;
int main(int argc, char const *argv[]) {
    int N,K;
    cin>>N>>K;
    vector<node> tree(N);
    vector<pii> edge(N-1);
    REP(i,N) tree[i].i=i;
    REP(i,N-1) {
        int A,B;
        cin>>A>>B;
        A--,B--;
        edge[i]=pii(A,B);
        tree[A].to.push_back(&tree[B]);
        tree[B].to.push_back(&tree[A]);
    }

    int m=INF;
    if(K%2==0) {
        REP(v,N) {
            vector<bool> reached(N,false);
            queue<bfs> q;
            q.push(bfs(&tree[v],0));
            int sum=0;
            while(!q.empty()) {
                node *n = q.front().first;
                int r = q.front().second; q.pop();
                if(r>K/2) sum++;
                reached[n->i]=true;  // 到達済み
                FORE(p,n->to) {
                    if(reached[p->i]) continue;
                    q.push(bfs(p,r+1));
                }
            }
            m=min(m,sum);
        }
    }
    else {
        REP(i,N-1) {
            int X=edge[i].first;
            int Y=edge[i].second;
            vector<int> d(N,INF);
            d[X]=0,d[Y]=0;

            vector<bool> reached(N,false);
            queue<bfs> q;
            q.push(bfs(&tree[X],0));
            while(!q.empty()) {
                node *n = q.front().first;
                int r = q.front().second; q.pop();
                d[n->i]=min(d[n->i],r);
                reached[n->i]=true;  // 到達済み
                FORE(p,n->to) {
                    if(reached[p->i]) continue;
                    q.push(bfs(p,r+1));
                }
            }

            fill(ALL(reached),false);
            q.push(bfs(&tree[Y],0));
            while(!q.empty()) {
                node *n = q.front().first;
                int r = q.front().second; q.pop();
                d[n->i]=min(d[n->i],r);
                reached[n->i]=true;  // 到達済み
                FORE(p,n->to) {
                    if(reached[p->i]) continue;
                    q.push(bfs(p,r+1));
                }
            }

            int sum=0;
            REP(i,N) {
                if(d[i]>=(K+1)/2) sum++;
            }
            m=min(m,sum);
        }
    }
    cout<<m<<endl;
    return 0;
}


Measured memory_bytes: 384
N = int(input())-1
alpha = ['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']

ans = ''

while True:
  temp = N % 26
  N = int(N/26)
  ans = alpha[temp] + ans
  
  if N == 0:
    break
  else:
    N -= 1
    
print(ans)

Measured memory_bytes: 9088
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N, K = list(map(int, sys.stdin.buffer.readline().split()))
_ = list(map(int, sys.stdin.buffer.readline().split()))

ans = math.ceil((N - 1) / (K - 1))
print(ans)


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

using namespace std;
#define REP(i, n) for(int i=0; i < (int)(n); ++i)
#define REPR(i, n) for(int i=n; i>= 0; --i)
#define FOR(i, m, n) for(int i=m; i<(n); ++i)

using ll = long long;

int main(){
    int N;
    cin >> N;
    vector<int> H(N);
    REP(i, N){
        cin >> H[i];
    }
    int ans = 0, cnt = 0;
    REP(i, N){
        if(i == N-1){
            ans = max(ans, cnt);
            break;
        }
        if(H[i] >= H[i+1]){
            cnt++;
        }
        else{
            ans = max(cnt, ans);
            cnt = 0;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
vector<long long> factors;
#define ll long long

#define pii pair<int,int>
#define pll pair<ll,ll>
#define _ <<'\n'
#define __ << ' '
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
int IT_MAX = 1 << 17;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
#define szz(x) (int)(x).size()
#define IOS ios_base::sync_with_stdio(false); cout.tie(0);cin.tie(0);
#define flush fflush(stdout)

ll mod(ll a, ll m)
{ return (a + (abs(a) / m) * m + m) % m; }

//****************************don't use int!!!!!!!****************************//
//***************************code starts here!!!!!****************************//

int main()
{
	IOS
	int a ,b,c;
	cin >> a >>b >> c;
	cout << min(b/a,c);
	return 0;
}

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

int main(){
    int n; cin >> n;
    ll h[n]; rep(i,n) cin >> h[i];
    int ans = 0;
    int tmp = 0;
    rep(i,n-1){
        if(h[i] >= h[i+1]) tmp++;
        else{
            if(ans < tmp) ans = tmp;
            tmp = 0;
        }
    }
    if(ans < tmp) ans = tmp;
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(void)
{
int i,j;
int a,b;

while(1){
scanf("%d %d",&a,&b);
if(a==0&&b==0){
break;
}
for(i=0;i<a;i++){
for(j=0;j<b;j++){
printf("#");
}
printf("\n");
}
printf("\n");
}

return 0;
}

Measured memory_bytes: 1000
//https://onlinejudge.u-aizu.ac.jp/courses/library/7/DPL/5/DPL_5_C

#include <bits/stdc++.h>

using namespace std;

long long MOD = 1e9 + 7;

long long powMod(long long x, long long k, long long m) {
    if (k == 0) return 1;
    if (k % 2 == 0) return (powMod((x * x + m) % m, k / 2, m) + m) % m;
    else return (x * powMod(x, k - 1, m) + m) % m;
}

long long extgcd(long long a, long long b, long long &x, long long &y) {
    long long g = a;
    x = 1;
    y = 0;
    if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
    return g;
}

long long invMod(long long a, long long m) {
    long long x, y;
    if (extgcd(a, m, x, y) == 1) return (x + m) % m;
    else return 0;
}

long long factorial(long long n, long long m) {
    if (n == 0) {
        return 1;
    } else {
        return (n * factorial(n - 1, m) + m) % m;
    }
}

long long binomial(long long n, long long k, long long m) {
    long long tmp = (factorial(n, m) * invMod(factorial(k, m), m) + m) % m;
    return (tmp * invMod(factorial(n - k, m), m) + m) % m;
}

int main() {
    long long n;//ボール
    long long k;//箱
    cin >> n >> k;

    long long ans = 0;
    for (long long i = 0; i < k; ++i) {
        long long tmp = (binomial(k, k - i, MOD) * powMod(k - i, n, MOD) + MOD) % MOD;
        if (i % 2 == 0) {
            ans = (ans + tmp + MOD) % MOD;
        } else {
            ans = (ans - tmp + MOD) % MOD;
        }
    }

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

/*
 * n人を3つのグループにわけるとする。
 * 3^n-C(3,2)2^n+C(3,1)1^n
 * これを一般化する。
 *
 */


Measured memory_bytes: 3128
#include <stdio.h>
int main(int argc, char const *argv[]) {
  int i,N,flag=0;
  int p[51];

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

  for(i=0;i<N;i++){
    if(p[i]!=i+1) flag++;
  }

  if(flag==0 || flag==2){
    printf("YES\n");
  }else{
    printf("NO\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long A, B, C; 
  cin >> A >> B >> C;
  A = A - C;
  C = C - A;
  
  if(A < 0) B = B + A;

  if(A < 0 && B < 0) cout << 0 << " " << 0 << endl; 
  else if (A < 0) cout << 0 << " " << B << endl;
  else cout << A << " " << B << endl; 
 }

Measured memory_bytes: 256
k,n = gets.chomp.split().map(&:to_i)
a = Array.new
b = Array.new
a = gets.chomp.split.map(&:to_i)
for i in 0..n-2
  b[i] = a[i+1]-a[i]
end
b[n-1]=k-a[n-1]+a[0]
c = b.each_with_index.min(n-1).map{|i|i[1]}
sum = 0
c.each{|i|sum += b[i]}
puts sum


Measured memory_bytes: 31316
n = int(input())
s = input().split()  # n個横並びに入力されるとき

for i in range(n):
    s[i] = int(s[i])

count = 1
biggest = s[0]

for i in range(n-1):
    if(biggest <= s[i+1]):
        count += 1
        biggest = s[i+1]

print(count)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007
#define dancila 3.14159265359
#define eps 1e-9

// #define fisier 1

using namespace std;

typedef long long ll;

int n, x, y, d[2002][2002], nr[2002];

vector<int> v[2002];

void bfs(int nod)
{
    deque<int> q;
    q.pb(nod);
    while(!q.empty())
    {
        int x = q[0];
        q.pop_front();
        for(int i = 0; i < v[x].size(); ++i)
        {
            int nxt = v[x][i];
            if(nxt == nod || d[nod][nxt] != 0)
                continue;
            d[nod][nxt] = d[nod][x] + 1;
            q.pb(nxt);
        }
    }
}
int main()
{

    #ifdef fisier
        ifstream f("input.in");
        ofstream g("output.out");
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> x >> y;
    for(int i = 1; i < n; ++i)
    {
        v[i+1].pb(i);
        v[i].pb(i+1);
    }
    v[x].pb(y);
    v[y].pb(x);
    for(int i = 1; i <= n; ++i)
        bfs(i);
    for(int i = 1; i <= n; ++i)
        for(int j = i+1; j <= n; ++j)
            nr[d[i][j]]++;
    for(int i = 1; i < n; ++i)
        cout << nr[i] << '\n';
    return 0;
}


Measured memory_bytes: 16000
#include<iostream>
#include<queue>

using namespace std;
static const int N = 100;
static const int INFTY = (1<<21);

int n, M[N][N];
int d[N];

void bfs(int s)
{
  queue<int> q;
  q.push(s);
  for( int i = 0; i < n; i++) d[i] = INFTY;
  d[s] = 0;
  int u;
  while( !q.empty() )
    {
      u = q.front(); q.pop();
      for( int v = 0; v < n; v++)
        {
          if( M[u][v] == 0 ) continue;
          if( d[v] != INFTY ) continue;
          d[v] = d[u] + 1;
          q.push(v);
        }
    }
    for( int i = 0; i < n; i++)
      {
        cout << i + 1 << " " << ( (d[i] == INFTY) ? (-1) : d[i] ) << endl;
      }
}

int main()
{
  int u, k, v;

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

  for( int i = 0; i < n; i++)
    {
      cin >> u >> k;
      u--;
      for( int j = 0; j < k; j++)
        {
          cin >> v;
          v--;
          M[u][v] = 1;
        }
    }

  bfs(0);

  return 0;
}



Measured memory_bytes: 3100
import sys
while True:
    try:
        word = input()
        if word == "-":
            break
        word_len = len(word)
        words_shuffle = []
        
        for i in range(word_len):
            words_shuffle.append(word[i])

        n = int(input())
        for i in range(n):
            h = int(input())
            words_shuffle = words_shuffle[h:] + words_shuffle[:h]

        for i in range(word_len-1):
                print(words_shuffle[i], end="")
        print(words_shuffle[-1])
        
    except EOFError:
        break

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

int main() {
  int N; cin >> N;
  vector<int> a(N); for (int i = 0; i < N; ++i) cin >> a[i];
  vector<int> b(N); for (int i = 0; i < N; ++i) cin >> b[i];
  int ans = 0;
  for (int k = 0; k <= 28; ++k) {
    int T = 1 << k;
    vector<int> ak(a); for (int i = 0; i < N; ++i) ak[i] %= 2 * T;
    vector<int> bk(b); for (int i = 0; i < N; ++i) bk[i] %= 2 * T;
    sort(begin(bk), end(bk));
    int n = 0;
    auto f = [&](int l, int u) {
      return lower_bound(begin(bk), end(bk), u) - lower_bound(begin(bk), end(bk), l);
    };
    for (auto&& x : ak) {
      int n1 = f(1 * T - x, 2 * T - x) % 2;
      int n2 = f(3 * T - x, 4 * T - x) % 2;
      n += n1 + n2;
      n %= 2;
    }
    ans ^= n << k;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3432
import java.util.*;
import java.io.*;
public class Main
{
	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine().trim();
		String t = br.readLine().trim();
		if(s.equals(t.substring(0, t.length()-1))){
		    System.out.println("Yes");
		}
		else{
		    System.out.println("No");
		}
	}
}


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

int main(){
  int q;
  vector<int>v;
  cin>>q;
  while(q--){
    int a,b;
    cin>>a;
    if(a!=2)cin>>b;
    if(!a)v.push_back(b);
    else if(a==1)cout<<v[b]<<endl;
    else v.erase(v.end()-1);
  }
}


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

int main(){
  string S;
  cin >> S;
  int N = S.size();
  int m = 0;
  for(int i = 0; i < N; i++){
    int c = 0;
    for(int j = i; j < N; j++){
      if(S[j] == 'A' || S[j] == 'C' || S[j] == 'G' || S[j] == 'T'){
        c += 1;
      }else{
        break;
      }
    }
    if(m < c){
      m = c;
    }
  }
  cout << m << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,k,q;
    scanf("%d %d %d",&n,&k,&q);
    int part[n];
    for (int i = 0; i < n; i++)
    {
        part[i]=0;
    }
    int a;
    for (int i = 0; i < q; i++)
    {
        scanf("%d",&a);
        part[a-1]++;
    }
    for (int i = 0; i < n; i++)
    {
        if(k-q+part[i]>0)printf("Yes\n");
        else printf("No\n");
    }
    return 0;
    
}

Measured memory_bytes: 896
#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() {
    ll N; cin >> N;
    ll ans = 0;

    if (N % 2 == 0) {
        N /= 2;
        while (N) {
            ans += N / 5;
            N /= 5;
        }
    }

    cout << ans << endl;
}


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

int main(){
    string s;
    cin >> s;
    if (s.size() < 4){
        cout << "No" << endl;
        return 0;
    }
    bool flag = true;
    string yaki = "YAKI";
    for (int i = 0; i < 4; i++){
        if (s[i] != yaki[i]) flag = false;
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using i128 = boost::multiprecision::int128_t;
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using VVV = vector<VV>;
using VVVll = vector<VVll>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(ll i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(ll i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const ld PI    = acos(-1.0);
const int MOD  = int(1e9)+7;


int main() {
  int t; cin >> t;
  rep(_, t) {
    int n; cin >> n;
    Vll a(n); cin >> a;
    string s; cin >> s;

    Vll b;
    bool ans = true;
    drep(i, n) {
      if (s[i] == '0') {
        for (auto v : b) chmin(a[i], a[i]^v);
        if (a[i]) b.push_back(a[i]);
      }
      else {
        for (auto v : b) chmin(a[i], a[i]^v);
        if (a[i]) ans = false;
      }
    }
    cout << (ans ? 0 : 1) << "\n";
  }
  return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <array>

using namespace std;

int main() {
  array<int,1501> x, y;
  array<int,1500001> t;
  int n, m;
  while (cin >> n >> m && n+m != 0) {
    y[0] = x[0] = 0;
    for (int i=1; i <= n; i++) {
      cin >> y[i];
      y[i] += y[i-1];
    }
    for (int i=1; i <= m; i++) {
      cin >> x[i];
      x[i] += x[i-1];
    }
    fill(t.begin(), t.begin()+max(n,m)*1000, 0);
    int cnt = 0;
    for (int i=0; i < n; i++) {
      for (int j=i+1; j <= n; j++)
        t[y[j]-y[i]]++;
    }
    for (int i=0; i < m; i++) {
      for (int j=i+1; j <= m; j++)
        cnt += t[x[j]-x[i]];
    }
    cout << cnt << endl;
  }
  return 0;
}

Measured memory_bytes: 8916
s = input()

a = s[0] == "A" and ("C" in s[2:-1]) and s[2:-1].count("C") == 1

s = list(s)
if "A" in s:
    s.remove("A")
else:
    print("WA")
    exit()
if "C" in s:
    s.remove("C")
else:
    print("WA")
    exit()

b = all(i.islower() for i in s)

if a and b:
    print("AC")
else:
    print("WA")

Measured memory_bytes: 3064
require 'prime'

def factorial(n)
  return 1 if n == 0
  (1..n).inject(1,:*)
end

n = gets.to_i
factors = factorial(n).prime_division
ans = 0
n3, n5, n15, n25, n75 = 0, 0, 0, 0, 0
factors.each do |f|
  n3 += 1 if f[1] >= 2
  n5 += 1 if f[1] >= 4
  n15 += 1 if f[1] >= 14
  n25 += 1 if f[1] >= 24
  n75 += 1 if f[1] >= 74
end
ans += (n3 - n5) * ((n5 * (n5 - 1)) / 2) + ((n5 * (n5 - 1) * (n5 - 2)) / 6) * 3 if n3 >= 3 && n5 >= 2
ans += (n5 - n15) * n15 + (n15 * (n15 - 1)) if n5 >= 2 && n15 >= 1
ans += (n3 - n25) * n25 + (n25 * (n25 - 1)) if n3 >= 2 && n25 >= 1
ans += n75
puts ans


Measured memory_bytes: 2172
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a[4];
	for(int i=0;i<4;i++){
		cin>>a[i];
	}
	sort(a,a+4);
	int flag=0;
	if(a[0]!=1){
		flag=1;
	}else{
		if(a[3]!=9){
			flag=1;
		}else{
			if(a[2]!=7){
				flag=1;
			}else{
				if(a[1]!=4){
					flag=1;
				} 
			}
		}
	}
	if(flag==1){
		cout<<"NO"<<endl;
	}else{
		cout<<"YES"<<endl;
	}
} 

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

int main(){
    string s;
    int ans;

    cin >>s;
    //cout << ans <<endl;
    cout <<s[0]<< s.length()-2 <<s[s.length()-1]<<endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


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

typedef long long int ll;

int main() {
    int N, A;
    cin >> N >> A;
    vector<int> v(N);
    for (auto& i : v) cin >> i;

    ll sum = 0LL;
    for (int i = 1; i <= N; i++) {
        int p = A * i;
        vector<vector<vector<ll> > > dp(N+1, vector<vector<ll> >(i+1, vector<ll>(p+1)));
        dp[0][0][0] = 1LL;
        for (int j = 0; j < N; j++) {
            for (int k = 0; k <= i; k++) {
                for (int l = 0; l <= p; l++) {
                    dp[j+1][k][l] += dp[j][k][l];
                    if (l + v[j] <= p && k+1 <= i) dp[j+1][k+1][l+v[j]] += dp[j][k][l];
                }
            }
        }

        sum += dp[N][i][p];
    }

    cout << sum << endl;

    return 0;
}


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

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

	long long int h;
	cin >> h;
	long long int x = log2(h);
	long long int res = pow(2,x+1) - 1;
	cout << res << '\n';
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<class U, class V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}

double distance(const pair<double,double> &a, const pair<double,double> &b) {
    return sqrt((a.first - b.first)*(a.first - b.first) + (a.second - b.second)*(a.second - b.second));
}

int main() {
    int N; cin >> N;
    vector<pair<double, double>> P(N);
    rep(i, N) cin >> P[i].first >> P[i].second;
    vector<int> order(N);
    rep(i, N) order[i] = i;
    double path_sum = 0.0;
    do {
        double path = 0.0;
        rep(i, N - 1) {
            int u = order[i], v = order[i + 1];
            path += distance(P[u], P[v]);
        }
        path_sum += path;
    } while(next_permutation(all(order)));
    repp(i, 1, N) path_sum /= i;
    cout.precision(10);
    cout << path_sum << "\n";
}


Measured memory_bytes: 256
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;

int main()
{
    int k , a, b;
    cin >> k >> a >> b;
    for(int i = a; i <= b; i++){
        if(i % k == 0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
ll INF=1e18+5;
//cout << std::fixed << std::setprecision(15) << y << endl;

int main(){
  string S; ll K;
  cin >> S >> K;
  
  ll ans = 0;
  ll cnt = 0;
  rep(i,0,S.size()){
    ll p = S[i] - '0';
    if(p == 1) cnt++;
    else{ans = p; break;}
  }
  if(K > cnt)  cout << ans << endl;
  else cout << 1 << endl;
  return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))

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

const int mod = 1000000007;

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

  int n;
  cin >> n;

  vector<long> a(n);
  fillLong(a, n);

  long res = 0;

  for(int i = n-2; i >= 0; i--) {
    if(a[i+1] == a[i]+1) {
      res++;
    } else {
      res+= a[i+1];
    }
  }

  bool canDo = a[0]==0;
  rep(i, n-1) {
    if(a[i] < a[i+1]-1) canDo = false;
  }

  cout << (canDo?res:-1) << endl;
}


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

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

    vector<int> ans(n, -1);
    for (int i = 0; i < m; ++i)
    {
        int a, b;
        cin >> a >> b;
        if (a == 1 && b == 0 && n != 1)
        {
            cout << -1 << endl;
            return 0;
        }
        if (ans[a - 1] == -1)
        {
            ans[a - 1] = b;
        }
        else if (ans[a - 1] != b)
        {
            cout << -1 << endl;
            return 0;
        }
    }

    if (ans[0] == -1)
        ans[0] = (n == 1) ? 0 : 1;

    rep(i, n) cout << max(ans[i], 0);
    cout << endl;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--)
#define reprev(i,n) reprrev(i,0,n)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<60;
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
struct UnionFind {
    vector<int> par, rank;
 
    UnionFind(int n) : par(n , -1), rank(n, 0) { }
    void init(int n) { par.assign(n, -1), rank.assign(n, 0); }
 
    int root(int x) {
        if (par[x] == -1) return x;
        else return par[x] = root(par[x]);
    }
 
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
 
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};
 
const int nmax = 8;
vector<int> graph[nmax];
 
int dfs(int v, int N, bool visited[nmax]){
  bool all_visited = true;
  
  rep(i,N){
    if(visited[i]==false)
      all_visited = false;
  }
  if(all_visited) return 1;
  
  int ret=0;
  
  for(auto next : graph[v]){
    if(visited[next]) continue;
    
    visited[next] = true;
    ret += dfs(next,N,visited);
    visited[next] = false;
  }
  return ret;
}
 
int main(){
    int N,M;
  	cin >> N >> M;
  	rep(i,M) {
      int a,b;
      cin >> a >> b;
      graph[a-1].pb(b-1);
      graph[b-1].pb(a-1);
    }
  
  	bool visited[nmax];
  	rep(i,N) visited[i]=false;
  
  	visited[0] = true;
  	cout << dfs(0,N,visited) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))


int main(void){
	int a,b,c;
	cin>>a>>b>>c;
	int ab,bc,ca;
	ab = abs(b-a);
	bc=abs(c-b);
	ca=abs(a-c);
	cout<<ab+bc+ca-max(ab,max(bc,ca))<<endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<map>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<time.h>
#include<vector>
#include<deque>
#define LL long long
#define ll long long
const LL MAX=1e5+10;
LL n,m,x,y,z,t;
char a[MAX];


int main()
{
    cin>>a+1;
    int len=strlen(a+1);
    int add1=0;
    int add2=0;
    for(int i=1;i<=len;i++)
    {
        if(a[i]>='A'&&a[i]<='Z')
            add1++;
    }
    for(int i=3;i<len;i++)
    {
        if(a[i]=='C')
            add2++;
    }
    if(a[1]=='A'&&add2==1&&add1==2)
        cout<<"AC"<<endl;
    else
        cout<<"WA"<<endl;
    return 0;
}



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

int main() {
    int c[3][3];
    rep(i,3)rep(j,3){
        cin >> c[i][j];
    }
    int a0,a1,a2;
    a0 = min({c[0][0],c[0][1],c[0][2]});
    a1 = min({c[1][0],c[1][1],c[1][2]});
    a2 = min({c[2][0],c[2][1],c[2][2]});

    int b0,b1,b2;
    bool flag = true;
    rep(i,3){
        bool cond1 = (c[0][i] - a0) == (c[1][i] - a1);
        bool cond2 = (c[0][i] - a0) == (c[2][i] - a2);
        bool cond3 = (c[1][i] - a1) == (c[2][i] - a2);
        if(!cond1 || !cond2 || !cond3) flag = false;
    }
    if(flag){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    if(a >= 13){
        cout << b << endl;
    }else if(a >= 6){
        cout << b/2 << endl;
    }else{
        cout << 0 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

int main()
{
    int sum=0;
    string s;
    getline(cin,s);
    rep(i,1,s.size())
    {
        if(s[i-1]!=s[i])sum++;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 512
N,M=map(int,input().split())
A=[[""]*N for i in range(N)]
B=[[""]*M for i in range(M)]
for y in range(N):
  A[y]=list(input())
for y in range(M):
  B[y]=list(input())
exist=False
for ly in range(N):
  for lx in range(N):
    if ly+M-1>=N or lx+M-1>=N:
      continue
    match=True
    for y in range(M):
      for x in range(M):
        if A[ly+y][lx+x]!=B[y][x]:
          match=False
    if match==True:
      exist=True
print("Yes" if exist==True else "No")


Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <unordered_map>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

int S,W;

int main(){
    cin>>S>>W;

    if(S<=W){
        cout<<"unsafe"<<endl;
    }else{
        cout<<"safe"<<endl;
    }
}

Measured memory_bytes: 3632
s = input()

if s == "SUN":
  print(7)
elif s == "MON":
  print(6)
elif s == "TUE":
  print(5)
elif s == "WED":
  print(4)
elif s == "THU":
  print(3)
elif s == "FRI":
  print(2)
elif s == "SAT":
  print(1)

Measured memory_bytes: 3060
#include <utility> // pair make_pair
using std::swap; // c++11
using std::pair;
using std::make_pair;
#include <tuple> // tuple(c++11) make_tuple(c++11)
using std::tuple; // get<address>(variable)
using std::make_tuple;
#include <string> // string stoi(c++11) stoll(c++11) to_string(c++11)
using std::string;
using std::stoi;
using std::stoll;
using std::to_string;
#include <queue> // queue priority_queue
using std::queue;
using std::priority_queue;
#include <stack> // stack
using std::stack;
#include <vector> // vector
using std::vector;
#include <map> // map
using std::map;
#include <set> // set
using std::set; // insert erase find count
#include <algorithm> // min max
using std::sort;
using std::lower_bound; // iterator,  >=
using std::upper_bound; // iterator,  >
using std::min;
using std::max;
using std::min_element; // iterator
using std::max_element; // iterator
#include <complex> // complex
using std::complex; // real imag
#include <iostream> // cin cout
using std::cin;
using std::cout;
using std::endl;
#include <iomanip> // setprecision fixed(manipulator)
using std::setprecision;
using std::fixed;
#include <cmath>
#include <cstdio>

#define lli long long int
#define INF (int)1e09
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define EFOR(i, m, n) for (int i = m; i <= n; i++)
#define RFOR(i, m, n) for (int i = m; i > n; i--)
#define REFOR(i, m, n) for (int i = m; i >= n; i--)
#define VSORT(v) sort((v).begin(), (v).end()) // sort vector
typedef pair<int, int> PI;
typedef tuple<int, int, int> TI;
template <typename T> using Vec = vector<T>; // c++11

int main(void) {
    Vec<long long int> lucas(87);
    lucas[0] = 2;
    lucas[1] = 1;
    FOR (i, 2, 87) {
        lucas[i] = lucas[i - 2] + lucas[i - 1];
    }
    int n;
    cin >> n;
    cout << lucas[n] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

//*
//遅延セグ木ここから
//↓ここを変える
typedef struct sayouso{ll k;}sayouso;
typedef struct atai{ll a,len;}atai;
//↑ここを変える

typedef struct node{sayouso T;atai x;}node;
node *lsegN,*lseg;
ll lsegNUM;

//↓ここから変える
sayouso sid={0};
atai aid={0,1};
atai xx(atai x,atai y){
	atai ret;
	ret.a=x.a+y.a;
	ret.len=x.len+y.len;
	return ret;
}
atai Tx(sayouso T,atai x){
	atai ret;
	ret.a=T.k*x.len+x.a;
	ret.len=x.len;
	return ret;
}
sayouso TT(sayouso S,sayouso T){
	sayouso ret;
	ret.k=S.k+T.k;
	return ret;
}
//↑ここまで変える

//要素数(2ベキ)でこれを呼ぶ
void lseguse(ll n){
	lsegN=(node*)calloc(2*n,sizeof(node));
	lsegNUM=n;
	lseg=lsegN+lsegNUM;
	rep(i,0,lsegNUM){
		lseg[i].x=aid;
		lseg[i].T=sid;
	}
	for(int i=lsegNUM-1;i>0;i--){
		lsegN[i].x=xx(lsegN[2*i].x,lsegN[2*i+1].x);
		lsegN[i].T=sid;
	}
}
//lseg[i].xに値を与えてから初期化
void lseginit(){
	for(int i=lsegNUM-1;i>0;i--)lsegN[i].x=xx(lsegN[2*i].x,lsegN[2*i+1].x);
}
void lsegupdatesub(ll l,ll r,sayouso T,ll i,ll cl,ll cr){
	if(l>=r)return;
	//disjointなとき
	if(cr<=l||r<=cl)return;
	//完全に含むとき
	if(l<=cl&&cr<=r){
		lsegN[i].T=TT(T,lsegN[i].T);
		return;
	}
	//どちらでもないとき
	//遅延伝播
	lsegN[2*i  ].T=TT(lsegN[i].T,lsegN[2*i  ].T);
	lsegN[2*i+1].T=TT(lsegN[i].T,lsegN[2*i+1].T);
	//再帰的に更新
	ll cm=(cl+cr)/2;
	lsegupdatesub(l,r,T,2*i  ,cl,cm);
	lsegupdatesub(l,r,T,2*i+1,cm,cr);
	//自身のnodeを更新
	lsegN[i].x=xx(Tx(lsegN[2*i].T,lsegN[2*i].x),Tx(lsegN[2*i+1].T,lsegN[2*i+1].x));
	lsegN[i].T=sid;
}
void lsegupdate(ll l,ll r,sayouso T){lsegupdatesub(l,r,T,1,0,lsegNUM);}
atai lsegcalcsub(ll l,ll r,ll i,ll cl,ll cr){
	if(l>=r)return aid;
	//完全に含むとき
	if(l<=cl&&cr<=r)return Tx(lsegN[i].T,lsegN[i].x);

	ll cm=(cl+cr)/2;
	//遅延伝播(変更はないので配るだけで良い)
	lsegN[2*i  ].T=TT(lsegN[i].T,lsegN[2*i  ].T);
	lsegN[2*i+1].T=TT(lsegN[i].T,lsegN[2*i+1].T);
	lsegN[i].x=Tx(lsegN[i].T,lsegN[i].x);
	lsegN[i].T=sid;

	//左側だけ
	if(r<=cm)return lsegcalcsub(l,r,2*i  ,cl,cm);
	//右側だけ
	if(cm<=l)return lsegcalcsub(l,r,2*i+1,cm,cr);
	//両方
	return xx(lsegcalcsub(l,r,2*i,cl,cm),lsegcalcsub(l,r,2*i+1,cm,cr));
}
atai lsegcalc(ll l,ll r){return lsegcalcsub(l,r,1,0,lsegNUM);}
//遅延セグ木ここまで
//*/

int main(){
	int n,q;
	scanf("%d%d",&n,&q);
	lseguse(1<<17);
	while(q--){
		int t,l,r;
		scanf("%d%d%d",&t,&l,&r);
		if(t==0){
			int x;
			scanf("%d",&x);
			sayouso T={x};
			lsegupdate(l,r+1,T);
		}else{
			printf("%lld\n",lsegcalc(l,r+1).a);
		}
	}
}


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

typedef long long ll;

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

    int n,cnt=0,odd=0;
    cin >> n;
    for(int i=0;i<n;i++){
        ll a;
        cin >> a;
        if(a%2==1) odd++;
        if(a%4==0) cnt++;
    }
    if((n%2==0 && odd<=cnt) || (n%2!=0 && odd-1<=cnt)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ
char in[110000];
int at[110000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	scanf("%s",in);
	int sz=0;
	for(int i=0;i<a-1;i++){
		if(in[i]=='A'&&in[i+1]=='C'){
			at[sz++]=i;
		}
	}
	while(b--){
		int p,q;scanf("%d%d",&p,&q);p--;q-=2;
		printf("%d\n",upper_bound(at,at+sz,q)-lower_bound(at,at+sz,p));
	}
}

Measured memory_bytes: 1024
n=int(input())
a=[]
c=[]
for _ in range(n):
    a.append(int(input()))
for i in a:
    c.append(i)

a.sort(reverse=True)

m_1=a[0]
m_2=a[1]
for i in range(n):
    if c[i]==m_1:
        print(m_2)
    else:
        print(m_1)



Measured memory_bytes: 14124
#include<iostream>
#include<string>

using namespace std;

int main(){
  string x;
  char N[27];
  int n[27]={0};

  //init
  for(int i=1; i<27; i++){
    N[i-1]=i+96;
    //cout <<N[i-1];
  }


  while(cin >>x){

    
    
    for(int i=0; i< (int)x.size(); i++){
      //大文字は全部小文字へ
      if( (65<=x[i])&&(x[i]<=90)){
	x[i]+=32;
      }

      //cnt
      for(int j=0; j<27; j++){
	if(x[i]==N[j]){
	  n[j]+=1;
	}
      }
    }
  }

 for(int i=0; i<26; i++){
   cout <<N[i]<<" : "<<n[i]<<endl;
 }

  
  return 0;
}



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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
    bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        Pred p;
        return p(left.second, right.second);
    }
};

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

    int N; cin >> N;
    string S; cin >> S;

    ll r = 0, g = 0, b = 0;
    rep(i, S.size()) {
        if (S[i] == 'R') r++;
        else if (S[i] == 'G') g++;
        else b++;
    }

    ll ans = r * g * b;

    rep(i, N) {
        REP(j, 1, N) {
            if (i - j < 0 || i + j >= N) continue;
            if (S[i] != S[i-j] && S[i] != S[i+j] && S[i-j] != S[i+j]) ans--;
        }
    }

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

Measured memory_bytes: 3584