akhauriyash/Code-Regression huggingface dataset:
from collections import Counter
from itertools import combinations, product
n = int(input())
s = input()
ct = {i : [] for i in "RGB"}
for i, _s in enumerate(s):
    ct[_s].append(i)

cnt = 1
for v in ct.values():
    cnt *= len(v)

for combi in product(ct["R"], ct["G"]):
    _min = min(combi) - abs(combi[0] - combi[1])
    _max = max(combi) + abs(combi[0] - combi[1])
    if _min >= 0 and s[_min] == "B":
        cnt -= 1
    if _max < n and s[_max] == "B":
        cnt -= 1
    if (combi[1] - combi[0]) % 2 == 0 and s[abs(combi[0] - combi[1]) // 2 + min(combi)] == "B":
        cnt -= 1
print(cnt)

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

using namespace std;

int main(){
	set<string> v;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		v.insert(s);
		
	}
	cout<<v.size()<<endl;
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  
  vector<long long> a(n);
  long long ll=1;
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    if(a.at(i)==0){
      cout << "0" << endl;
      return 0;
    }
  }
  for(int i=0;i<n;i++){
   if(a.at(i)>1000000000000000000/ll){
      cout << "-1" << endl;
      return 0;
    }else{
      ll=ll*a.at(i);
    }
  }
  
  cout << ll << endl;
  
  return 0;
}


Measured memory_bytes: 4048
n = gets.chomp.to_i
p = gets.chomp.split(' ').map(&:to_i)
q = gets.chomp.split(' ').map(&:to_i)
p_num = 0
q_num = 0

[*1..n].permutation(n).to_a.each.with_index(1) do |arr, i|
  p_num = i if p==arr
  q_num = i if q==arr
end

print((p_num - q_num).abs)


Measured memory_bytes: 6780
n = int(input())
a = list(map(int, input().split()))
m = 1000
i = 0
while i < n - 1:
    for j in range(i + 1, n):
        if a[i] < a[j]:
            m = m // a[i] * a[j] + m % a[i]
            i = j
        else:
            i = j
            break
print(m)

Measured memory_bytes: 61912
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
#define No cout<<"No"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    ll r;
    cin>>r;
    cout<<(r*r*3)<<endl;
    return 0;
}


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

using namespace std;

int main()
{
    int n;
    char current, neww;
    cin >> n;
    cin >> current;
    vector<char> slims;
    slims.push_back(current);
    while(--n)
    {
        cin >> neww;
        if(!(neww==current))
            slims.push_back(neww);
        current = neww;
    }
    cout << slims.size();
    return 0;
}


Measured memory_bytes: 512
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    S=input()
    n=len(S)

    if(n==1):
        print(1)
        return
    if(n==2):
        print(len(set(S)))
        return

    dp=[None]*(n+1)
    dp[0]=0
    dp[1]=1
    dp[2]=len(set(S[:2]))

    for i in range(3,n+1):
        if(S[i-1]!=S[i-2]):
            dp[i]=dp[i-1]+1
        else:
            dp[i]=dp[i-3]+2

    print(dp[-1])
resolve()

Measured memory_bytes: 41584
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)

func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func()
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx++
		return cur
	}
	this.initWordIdx = func() {
		idx = 0
	}
	return &this
}

func (me *ReaderEx) ScanAndSplit() (isScanned bool) {
	isScanned = me.baseScanner.Scan()

	me.words = strings.Fields(me.baseScanner.Text())
	me.initWordIdx()
	return
}

func (me *ReaderEx) Scan() (ok bool) {
	ok = me.baseScanner.Scan()
	return
}
func (me *ReaderEx) getString() string {
	return me.baseScanner.Text()
}

func (me *ReaderEx) getInt() int {
	n, err := strconv.Atoi(me.baseScanner.Text())
	defer func() {
		if err != nil {
			panic(err)
		}
	}()

	return n
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}
func solve(stdin io.Reader, stdout io.Writer) {
	r := NewScannerEx(stdin)
	r.Scan()
	p := r.getInt()
	r.ScanAndSplit()
	f := r.nextStringArray().toInts()
	a := make([]int, p)
	frac := make([]int, p)
	inv := func(v int) int {
		return pow(v, p-2, p)
	}

	opt := func(v int) int {
		return (v%p + p) % p
	}

	{
		frac[0] = 1
		fracLen := len(frac)
		for i := 1; i < fracLen; i++ {
			frac[i] = opt(i * frac[i-1])
		}
	}
	formula := make([]int, p)
	coref := make([]int, p)
	for i := 0; i < p; i++ {
		formula[i] = opt(frac[p-1] * inv(frac[i]) * inv(frac[p-1-i]))

		w := f[i]
		coref[p-1] = opt(coref[p-1] + w)
		for j := 0; j < p; j++ {
			coref[j] = opt(coref[j] - w)
			w = opt(w * -i)
		}

	}

	for i := 0; i < p; i++ {
		a[p-1-i] = opt(coref[i] * formula[i])
	}
	fmt.Fprintln(stdout, func(x string) string { return x[1 : len(x)-1] }(fmt.Sprint(a)))
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int now=0;
    int ans=-1;
    int cnt =0;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i =0;i<n;i++){
        if(a[now]==2){
            cnt++;
            ans = cnt;
            break;
        }
        now = a[now]-1;
        cnt ++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <cstdint>
#include <iomanip>
#include <set>
#include <map>
#include <unordered_map>
#include <cassert>
#include <queue>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);

int main(){
    ll n,y;
    std::cin >> n >> y;
    for(int i=0; i<=n; i++){
        for(int j=0; j<=n-i; j++){
            int k = n-i-j;
            if(10000*i+5000*j+1000*k==y){
                std::cout << i << " " << j << " " << k << "\n";
                return 0;
            }
        }
    }
    std::cout << "-1 -1 -1\n";
    return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;

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

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());

        int result = (n * a > b) ? b : (n * a);
        System.out.print(result);
    }
}

Measured memory_bytes: 21844
n = input()
l = [int(x) for x in list(str(n))]

if l[-1] == 2 or l[-1] == 4 or l[-1] == 5 or l[-1] == 7 or l[-1] == 9:
    print("hon")
if l[-1] == 0 or l[-1] == 1 or l[-1] == 6 or l[-1] == 8:
    print("pon")
if l[-1] == 3:
    print("bon")

Measured memory_bytes: 9184
#include <cstdio>

int main() {
		int a, b;
		int one = 0, two = 0, three = 0, four = 0;
		for ( int i = 0; i < 3; i++ ) {
				scanf("%d %d", &a, &b);
				if ( a == 1 ) one++;
				if ( a == 2 ) two++;
				if ( a == 3 ) three++;
				if ( a == 4 ) four++;
				
				if ( b == 1 ) one++;
				if ( b == 2 ) two++;
				if ( b == 3 ) three++;
				if ( b == 4 ) four++;
		}

		if ( one >= 3 || two >= 3 || three >= 3 || four >= 3 )
				printf("NO\n");
		else
				printf("YES\n");

		return 0;
}


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

int mmax(int a,int b,int c){
  if(a<b){
    return max(b,c);
  }else{
    return max(a,c);
  }
}

int main(){
  int i,N,K,a[200000];
  char ss[10000];
  scanf("%s",ss);
  K=ss[0]-'0';
  for(i=1;i<4;i++){
    N=ss[i]-'0';
    if(N==K){
      printf("Bad\n");
      return 0;
    }
    K=N;
  }
  printf("Good\n");
  return 0;
}

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

using namespace std;
typedef long long unsigned int ll;

ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

int main() {
  int N;
  cin >> N;
  vector<ll> As(N);
  ll A;
  for (int i = 0; i < N; ++i) {
    cin >> A;
    As[i] = A;
  }

  // sort(As.begin(), As.end());
  ll ans = gcd(As[0], As[1]);
  for (int i = 2; i < N; ++i) {
    ans = gcd(ans, As[i]);
  }

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



Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			int p = sc.nextInt();
			if ((n | m | p) == 0)
				break;
			int hit = 0;
			int sum = 0;
			for (int i = 0; i < n; i++) {
				int tmp = sc.nextInt();
				sum += tmp;
				if (i == m - 1) {
					hit = tmp;
				}
			}
			double rest = 1.0 * 100 * sum * (100 - p) / 100;
			int dist = (int) (rest / hit);
			System.out.println(hit != 0 ? dist : 0);
		}
	}
}

Measured memory_bytes: 12000
#include <stdio.h>
 
int main(void)
{
	int n,m,x,a[101],i,z=0,y=0;
	scanf("%d %d %d", &n, &m, &x);
	for(i = 0; i < m; i++){
		scanf("%d",&a[i]);
		if (x > a[i]){
			z = z + 1;
		} else if(x < a[i]){
			y = y + 1;
		}
	}
	if(z <= y) {
		printf("%d\n", z);
	}else if(z > y) {
		printf("%d\n", y);
	}
	return 0;
}

Measured memory_bytes: 128
#include<cstdio>

char a = 'a';//97
int n;
char str[50][52];
int az[26][50] = {};
int m;
int min = 99;
char ans[52];
int set = 0;

int main(){

  scanf("%d", &n);
  for(int l = 0; l < n; l++){
    scanf("%s", str[l]);
    m = 0;
    while(str[l][m] != '\0'){
      az[(int)str[l][m] - 97][l]++;
      m++;
    }
  }

  for(int l = 0; l < 26; l++){
    for(m = 0; m < n; m++){
      if(min > az[l][m]) min = az[l][m];
    }
    for(m = 0; m < min; m++){
      ans[set] = (char)(l+97);
      set++;
    }
    min = 99;
  }
  ans[set] = '\0';

  printf("%s", ans);

  return 0;
}


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

int main() {
    int N, A, B, res, ord_K;
    
    cin >> N >> A >> B;

    res = 0;
    for (int i = N; i >= 0; i--){
        int four = i/10000;
        int three = i/1000 - 10*four;
        int two = i/100 - 100*four - 10*three;
        int one = i/10 - 1000*four - 100*three - 10*two;
        int zero = i - 10000*four - 1000*three - 100*two - 10*one;

        int sum = four + three + two + one + zero;
        
        if (sum >= A and sum <= B){
            res = res + i;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int a = in.nextInt();
    int b = in.nextInt();
    System.out.println(sovle(a, b));
  }

  private static long sovle(int a, int b) {
    int[] arr = new int[1000];
    int res = 0;
    for (int i = 1; i < 1000; i++) {
      arr[i] = arr[i - 1] + i;
    }
    for (int i = 0; i < arr.length - 1; i++) {
      if (arr[i] - a == arr[i + 1] -b){
        res = arr[i] - a;
        break;
      }
    }
    return res;
  }

}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/10/23  Problem: ARC 092 B / Link: http://arc092.contest.atcoder.jp/tasks/arc092_b  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

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

	LL N;
	cin >> N;
	VI a(N), b(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}
	FOR(i, 0, N) {
		cin >> b[i];
	}
	VI A = a, B = b;
	int ans = 0;
	FOR(bit, 0, 30) {
		LL cnt = 0;
		LL T = 1 << bit;
		FOR(i, 0, N) {
			a[i] = A[i] % (2 * T);
			b[i] = B[i] % (2 * T);
		}
		SORT(b);
		FOR(i, 0, N) {
			cnt += lower_bound(ALL(b), 2 * T - a[i]) - lower_bound(ALL(b), 1 * T - a[i]);
			cnt += lower_bound(ALL(b), 4 * T - a[i]) - lower_bound(ALL(b), 3 * T - a[i]);
		}
		DD(d(cnt));
		ans |= ((cnt & 1) << bit);
	}



	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3456
matrix_a, matrix_b = [], []
inp, hid, out = map(int, input().split())
for _ in range(inp):
  matrix_a.append(list(map(int, input().split() )))

for _ in range(hid):
  matrix_b.append(list(map(int, input().split() )))

mul = [[0 for _ in range(out)] for _ in range(inp)]
for i in range(inp):
    for j in range(out):
        for k in range(hid):
            mul[i][j] += matrix_a[i][k] * matrix_b[k][j]

for i in range(inp):
  strings = ''
  for j in range(out):
    strings += str(mul[i][j]) + ' '
  print(strings[:-1])


Measured memory_bytes: 6888
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

vector<int> divisor(int x) {
  vector<int> res;
  for (int i = 1; i*i <= x; i++) {
    if (x%i == 0) {
      res.push_back(i);
      res.push_back(x/i);
    }
  }
  return res;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i+=2) {
    auto div = divisor(i);
    if (div.size() == 8)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

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

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)


int main(void){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(b<c || d<a){
    cout<<0<<endl;
  }else if(c>=a&&d>=b){
    cout<<b-c<<endl;
  }else if(c>=a&&b>=d){
    cout<<d-c<<endl;
  }else if(a>=c&&d>=b){
    cout<<b-a<<endl;
  }else if(a>=c&&b>=d){
    cout<<d-a<<endl;
  }else cout<<0<<endl;




return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;

typedef long long ll;
int num[200000];
int n,a,b;

bool judge(ll m)
{
    ll ty=m*b;
    ll sub=a-b;
    ll sum=0;
    for(int i=0;i<n;i++)
    {
        if(ty<num[i])
        {
            ll temp=num[i]-ty;
            sum+=temp/sub;
            if(temp%sub)
                sum++;
        }
    }
    if(sum<=m)
        return true;
    return false;
}

int main()
{
    ll Max=0;
    cin>>n>>a>>b;
    for(int i=0;i<n;i++)
    {
        cin>>num[i];
        Max+=num[i]/b+1;
    }
    sort(num,num+n);
    ll Min=1;
    while(Min<Max)
    {
        ll mid=(Max+Min)>>1;
        if(judge(mid))
            Max=mid;
        else
            Min=mid+1;
    }
    cout<<Min;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <queue>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
char sa[105],sb[105],sc[105];
cin>>sa>>sb>>sc;
int now='a';
int a=-1,b=-1,c=-1;
for(int i=0;i<315;i++){
if(now=='a') {a++; now=sa[a]; if(now!='a'&&now!='b'&&now!='c') {cout<<'A'; break;}}
else if(now=='b') {b++; now=sb[b]; if(now!='a'&&now!='b'&&now!='c') {cout<<'B'; break;}}
else {c++; now=sc[c]; if(now!='a'&&now!='b'&&now!='c') {cout<<'C'; break;}}
}
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

#define MAX 100000

int partition(int*,int,int);

int main(){
  int i,j,n,key,A[MAX];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  
  key=partition(A,0,n-1);

  for(i=0;i<n;i++){
    if(i>=1)printf(" ");

    if(i==key)
      printf("[%d]",A[i]);
    else
      printf("%d",A[i]);
  }

  printf("\n");
  return 0;
}
int partition(int *A,int p,int r){
  int i,j,x,tmp;

  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i=i+1;
      tmp=A[i];
      A[i]=A[j];
      A[j]=tmp;
    }
  }
  tmp=A[i+1];
  A[i+1]=A[j];
  A[j]=tmp;

  return i+1;
}

Measured memory_bytes: 992
#include <stdio.h>
#include <string.h>

void str_reverse(char s[], int num1, int num2)
{
  char box[1001] = {"\0"};
  int i;

  for (i = 0; i <= num2 -num1; i++) {
    box[i] = s[num2 - i];
  }
  for (i = 0; i <= num2 - num1; i++) {
    s[num1 + i] = box[i];
  }
}

void str_replace(char s[], char m[], int num1)
{
  int i = 0;
  
  while(m[i]) {
    s[num1 + i] = m[i];
    i++;
  }
}

void str_print(char s[], int num1, int num2)
{
  int i;

  for (i = num1; i <= num2; i++) {
    printf("%c", s[i]);
  }
  puts("");
}

int main(void) {
  char str[1001] = {"\0"};
  int q;
  int a, b;
  char p[1001] = {"\0"};
  int i;
  char dir[10] = {"\0"};
  char replace[] = "replace";
  char reverse[] = "reverse";
  char print[] = "print";

  scanf("%s", str);
  scanf("%d", &q);

  for (i = 0; i < q; i++) {
    scanf("%s", dir);
    if (strcmp(dir, replace) == 0) {
      scanf("%d %d %s", &a, &b, p);
      str_replace(str, p, a);
    }
    else if(strcmp(dir, reverse) == 0) {
      scanf("%d %d", &a, &b);
      str_reverse(str, a, b);
    }
    else if(strcmp(dir, print) == 0) {
      scanf("%d %d", &a, &b);
      str_print(str, a, b);
    }
  }

  
  
  return 0;
}


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

int n,m;
int c[30];
int dp[30][50010];

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

    cin>>n>>m;
    for(int i=0;i<m;i++)cin>>c[i];
    for(int i=0;i<30;i++){
        for(int j=1;j<50010;j++){
            dp[i][j]=INF;
        }
    }
    for(int i=1;i<=m;i++){
        for(int j=0;j<=n;j++){
            if(j-c[i-1]>=0)dp[i][j]=min(dp[i-1][j],dp[i][j-c[i-1]]+1);
            else dp[i][j]=dp[i-1][j];
        }
    }
    cout<<dp[m][n]<<endl;

}


Measured memory_bytes: 9048
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
/* start */

signed main(){
   IOS;
   int n; cin >> n;
   vector<int> next(n + 1), ok(n + 1);
   for(int i = 0; i < n; i++) {
      cin >> next[i + 1];
   }  
   int ans = 0, now = 1; // start
   while(++ans) {
      int cur = next[now]; 
      if(cur == 2) { // goal
         cout << ans << "\n";
         return 0;
      }
      if(!ok[cur]) ok[cur]++; 
      else {
         cout << "-1\n"; // loop
         return 0;
      }
      now = cur;
   }
}

Measured memory_bytes: 4764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, a, b;
  cin >> A >> B;
  
  if( A / 10000 + A / 1000 % 10 * 10 >= A % 100 )
    a = A/100;
  else
    a = A/100 + 1;
  
  if( B / 10000 + B / 1000 % 10 * 10 <= B % 100 )
    b = B/100;
  else
    b = B/100 - 1;

  cout << b-a+1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;

int main(){

	int n, ans=0, tmp=0;
	string s;
	cin >> n >> s;
	for(int i=0; i<s.size(); i++){
		if(s[i]=='I'){
			tmp++;
		} else {
			tmp--;
		}
		if(ans<tmp){
			ans=tmp;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
def dist(a,b,c,d):
    return abs(a-c)+abs(b-d)

n=int(input())
nx,ny=0,0
now=0
for i in range(n):
    t,x,y=map(int,input().split())
    if t-now>=dist(nx,ny,x,y) and (dist(nx,ny,x,y)-(t-now))%2==0:
        nx,ny=x,y
        now=t
    else:
        print('No')
        break
else:
    print('Yes')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int main(){
    int a, b; cin >> a >> b;
    string s; cin >> s;
    bool isOK = true;
    for(int i = 0; i < s.size(); ++i){
        if(i != a && s[i] == '-') isOK = false;
        if(s[a] != '-') isOK = false; 
    }
    if(isOK) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
    int len;
    string s;
    cin>>len>>s;
    //int len=s.size();
    ll s1=0,s2=0,s3=0,sum=0;
    for(int i=0;i<len;i++){
        if(s[i]=='R') sum+=s2*s3,s1++;
        if(s[i]=='G') sum+=s1*s3,s2++;
        if(s[i]=='B') sum+=s1*s2,s3++;
    }
    for(int i=0;i<len;i++){
        for(int j=i;j<len;j+=2){
            if(s[i]!=s[j] && s[i]!=s[(i+j)/2] && s[j]!=s[(i+j)/2]) sum--;
        }
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */


ll solve(){
    ll res = 0;
    
    ll N; cin >> N;
    vector<ll> X(N); for(auto& in:X) cin >> in;
    auto tX = X;
    sort(tX.begin(),tX.end());
    ll T = tX[N/2];
    
    for(int i = 0; i < N;i++){
        if(X[i] >= T){
            cout << tX[N/2-1] << endl;
        }else{
            cout << T << endl;
        }
    }
    
    
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 5376
//Link : https://atcoder.jp/contests/m-solutions2019/tasks/m_solutions2019_c

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 5005
#define inf 1000000000000000000LL

pair<int,int> in[N];
int H[N],P[N];

ll dp[N][N];
void solve() {
  int n;scanf("%d ", &n);
  for(int i=0;i<n;++i) {
    scanf("%d %d ", &H[i],&P[i]);
    in[i] = make_pair(H[i]+P[i],i);
  }
  sort(in,in+n);
  for(int i=0;i<=n;++i) {
    for(int j=0;j<=n;++j) {
      dp[i][j] = inf;
    }
  }
  dp[0][0] = 0;
  for(int i=0;i<n;++i) {
    int h = H[in[i].second],p = P[in[i].second];
    for(int j=i;j>=0;--j) {
      if(dp[i][j]==inf) {
        continue;
      }
      if(dp[i][j]<=h) {
        dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + p);
      }
      dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
    }
  }
  for(int i=n;i>=0;--i) {
    if(dp[n][i]!=inf) {
      printf("%d\n", i);
      return;
    }
  }
}

int main() {
    //freopen("input.txt","r",stdin);
    solve();
    return 0;
}


Measured memory_bytes: 195840
import java.util.*;

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

        //0回
        if(s.contains(t)){
            System.out.println(0);
          return;
        }

        char tj;
        char sj;
        int startcount = 0;
        int matchcount = 0;
        int min = 0;

        for(int i=0; i<s.length()-t.length()+1;i++){
            matchcount = 0;
            for(int j=0; j<t.length(); j++){
                tj = t.charAt(j);
                sj = s.charAt(j+startcount);
                if(tj==sj){
                    matchcount++;
                }
            }
            
            if(min==0 || min > t.length() - matchcount){
                min = t.length() - matchcount;
            }
            startcount ++;
        }
        System.out.println(min);
        sc.close();
    }
}


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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#define all(x) (x).begin(),(x).end()

const int MOD = 1e9 + 7;

void solve(){

}
int main(){
    int N;
    cin >> N;
    vector<int> a;
    a.push_back(N);

    int i = 0;
    int ans = 0;
    while(1) {
        if (a[i] == 4 || a[i] == 2 || a[i] == 1) {
            ans = i+4;
            break;
        } else {
            int v;
            if (a[i] % 2 == 0){
                v = a[i]/2;
            } else {
                v = 3*a[i]+1;
            }
            a.push_back(v);
        }
        ++i;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;

public class Main {
    public void solve(BufferedReader stdin, PrintWriter stdout) throws NumberFormatException, IOException {
        Pattern space = Pattern.compile(" ");
        int[] line = space.splitAsStream(stdin.readLine()).mapToInt(Integer::parseInt).toArray();
        int n = line[0];
        int k = line[1];
        long[] a = space.splitAsStream(stdin.readLine()).mapToLong(Long::parseLong).toArray();

        long sum = Arrays.stream(a).sum();
        List<Long> factors = new ArrayList<>();
        for (long x = 1; x * x <= sum; x++) {
            if (sum % x == 0) {
                factors.add(x);
                factors.add(sum / x);
            }
        }

        long ans = 1;
        for (long d : factors) {
            long[] c = new long[n];
            for (int x = 0; x < n; x++) {
                c[x] = a[x] % d;
            }
            Arrays.sort(c);

            long[] b1 = new long[n + 1];
            long[] b2 = new long[n + 1];
            for (int i = 0; i < n; i++) {
                b1[i + 1] = b1[i] + c[i];
                b2[i + 1] = b2[i] + (d - c[i]);
            }

            for (int x = 0; x <= n; x++) {
                long p = b1[x];
                long q = b2[n] - b2[x];
                if (p == q && p <= k) {
                    ans = Math.max(ans, d);
                }
            }
        }
        stdout.println(ans);
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter stdout = new PrintWriter(System.out, false);
        new Main().solve(stdin, stdout);
        stdout.flush();
    }
}


Measured memory_bytes: 42348
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n, k = rm()
a = rl()
for i in range(n-k):
    if a[k + i] > a[i]:
        print('Yes')
    else:
        print('No')




Measured memory_bytes: 49544
#include<bits/stdc++.h>
using namespace std;
int a[100005],b[100005],c[100005],dp[100005][3];

int main(){
	ios::sync_with_stdio(0);
	int n;
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i]>>b[i]>>c[i];
	dp[0][0]=a[0];
	dp[0][1]=b[0];
	dp[0][2]=c[0];
	for(int i=1;i<n;i++){
		dp[i][0]=a[i]+max(dp[i-1][1],dp[i-1][2]);
		dp[i][1]=b[i]+max(dp[i-1][0],dp[i-1][2]);
		dp[i][2]=c[i]+max(dp[i-1][0],dp[i-1][1]);
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 2560
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }


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

  if(b - a == c -  b) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#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>;

const int MAX = 5100000;
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;
}

int main() {
    ll ans;
    int x, y;
    cin >> x >> y;
    if ((x + y) % 3 != 0) {
        ans = 0;
    } else {
        int m = (2 * x - y) / 3;
        int n = x - 2 * m;
        if (m < 0 || n < 0) {
            ans = 0;
        } else {
            // 前処理
            COMinit();
            // 計算例
            ans = COM(m + n, m);
        }
    }
    cout << ans << endl;
}


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


int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    map<int,int> a;
    for(int i=1;i<n;++i)
    {
        int x; cin>>x; a[x]++;
    }
    for(int i=1;i<=n;++i) cout<<a[i]<<'\n';
}


Measured memory_bytes: 13028
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=3.1415926535897932384626433832795;
const ll INF = 1LL<<61;
const ll MINF = -1LL<<62;

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)


ll dp[10001];
ll h,n;
ll A[1001];
ll B[1001];

int main() {
	IO;
	cin>>h>>n;
	for(int i=0;i<n;++i) cin>>A[i]>>B[i];
	for(int i=0;i<=10000;++i) dp[i]=INF;
	dp[0]=0;
	
	for(int i=0;i<n;++i) {
		for(int j=A[i];j<=10000;++j) {
			dp[j]=min(dp[j-A[i]]+B[i], dp[j]);
		}
		for(int j=9999;j>=0;j--) {
			dp[j]=min(dp[j], dp[j+1]);
		}
	}
	
	cout<<dp[h]<<"\n";
	return 0;
}


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

int main(){
  int n;
  int a[200];
  cin >> n;
  int ans=0;
  
  for(int i=0;i<n;i++) cin >> a[i];
  int c=0;
  do{
  	c=0;
  	for(int i=0;i<n;i++){
    	if(a[i]%2==0) c++;
  	}
    if (c==n){
      for(int i=0;i<n;i++){
        a[i]=a[i]/2;
      }
      ans++;
    }
  }while(c==n);
  
  cout << ans << endl;
}
    
    
  
  

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

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define YN(y, n, b) (b? y : n)
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    string S;
    cin >> S;
    i32 N = S.size();
    Vec<i32> r(N, 0);
    r[0] = 1;
    Vec<i32> l(N, 0);
    l[N - 1] = 1;

    for (i32 i = 1; i < N; i++) {
        if (S[i] == 'R') r[i] = r[i - 1] + 1;
    }
    for (i32 i = N - 2; i >= 0; i--) {
        if (S[i] == 'L') l[i] = l[i + 1] + 1;
    }
    Vec<i32> a(N);
    i32 i = 0;
    for (i32 i = 0; i < N - 1; i += 2) {
        while (i < N - 1 && (l[i + 1] == 0 || l[i] > l[i + 1])) i++;
        a[i] = (i32)(ceil(r[i] / 2.0) + l[i + 1] / 2.0);
        a[i + 1] = (i32)(r[i] / 2.0 + ceil(l[i + 1] / 2.0));
    }
    for (i32 i = 0; i < N; i++) {
        cout << a[i];
        if (i != N - 1) cout << " ";
    }
    cout << endl;

}


Measured memory_bytes: 4496
#define NDEBUG

#include <unordered_map>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <utility>
#include <string>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <tuple>
#include <set>
#include <map>

// [0, max)
#define FOR0(var, max) for (sl (var) = 0; (var) < (max); ++(var))
// [min, max)
#define FORi(var, min, max) for (sl (var) = (min); (var) < (max); ++(var))
// [min, max)
#define FORi_INV(var, min, max) for (sl (var) = (max) - 1; (var) + 1 > (min); --(var))
#define FORITER(var, iter) for (auto (iter) = (var).begin(); (iter) != (var).end(); (iter)++)
#define FORITER_INV(var, iter) for (auto (iter) = (var).rbegin(); (iter) != (var).rend(); (iter)++)

// a < b < c
#define LTLT(a, b, c) (((a) < (b)) && ((b) < (c)))
// a <= b < c
#define LELT(a, b, c) (((a) <= (b)) && ((b) < (c)))
// a < b <= c
#define LTLE(a, b, c) (((a) < (b)) && ((b) <= (c)))
// a <= b <= c
#define LELE(a, b, c) (((a) <= (b)) && ((b) <= (c)))

#ifndef NDEBUG
#  define MASSERT(cond) m_assert(cond, __LINE__, #cond);
#else
#  define MASSERT(...)
#endif

using namespace std;

using uc = unsigned char;
using ui = unsigned int;
using ul = unsigned long long int;

using sc = signed char;
using si = signed int;
using sl = signed long long int;

using ld = long double;

void m_assert(const bool& cond, const sl& line, const char *condstr) {
  if (!cond) {
    cerr << "Assertion Failed: " << condstr << " at line " << line << endl;
    exit(1);
  }
}

static sl N;

void solve(void) {
  cout << N * N * N << endl;
}

int main(void) {
  cin >> N;
  solve();
  return 0;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
q = int(input())
l = []
for i in range(q):
    l.append(list(map(int,input().split())))
prime = [2]
A = 10+10**5
for L in range(3, A, 2):
    for L2 in prime:
        if L % L2 == 0:
            break
    else:
        prime.append(L)
like=[]
for num in prime:
    if (num+1)//2 in prime:
        like.append(num)
import bisect
for tmp in l:
    indl = bisect.bisect_left(like,tmp[0])
    indr = bisect.bisect_right(like,tmp[1])
    print(indr-indl)

Measured memory_bytes: 72028
import java.math.BigInteger;
import java.util.Scanner;

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

		BigInteger resultMul = new BigInteger("1");
		long resultMax = (long) Math.pow(10, 18);
		long tmp;

		for (long i=0;i<Num;i++) {
			tmp = sc.nextLong();
			if(tmp == 0) {
				resultMul = new BigInteger("0");
				break;
			}
			if(resultMul.compareTo(new BigInteger("0")) > 0) {
				resultMul = resultMul.multiply(new BigInteger(String.valueOf(tmp)));
				if(resultMul.compareTo(new BigInteger(String.valueOf(resultMax))) > 0) {
					resultMul = new BigInteger("-1");
				}
			}

		}

		System.out.println(resultMul.longValue());
		sc.close();

	}

}

Measured memory_bytes: 49364
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("ARC");}else{puts("ABC");}
#define MAX_N 200005

int main() {
    string s;
    cin >> s;
    if(s == "ABC")yn;
    return 0;
}




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

#define FastRead        ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl            "\n"

typedef long long ll;
typedef unsigned long long llu;

int main()
{
    FastRead

    ll a,b;
    vector<ll>x,y;
    map<ll,ll>mp;
    cin>>a>>b;

    for(ll i=1;i<=1024;i++)
    {
        ll check1 = i*0.08;
        if(check1==a)
        {
            x.push_back(i);
            mp[i]++;
        }
    }
    for(ll i=1;i<=1024;i++)
    {
        ll check2 = i*0.1;
        if(check2==b)
        {
            y.push_back(i);
            mp[i]++;
        }
    }

    for(auto it:mp)
    {
        if(it.second>=2)
        {
            cout<<it.first;
            return 0;
        }
    }

    cout<<-1;
}


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

int main() {
  int A,B,C;
  cin>>A>>B>>C;
  if(A==B and A==C){
    cout<<"No";
  }
  else if(A!=B and B!=C and A!=C){
    cout<<"No";
  }
  else{
    cout<<"Yes";
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
string s;

int main(){
	cin>>s;
	n=s.size();
	int a=0,b=0;
	for(int i=0;i<n;i++){
		if(s[i]=='1'^i%2==0) a++;
		else b++;
	}
	cout<<min(a,b)<<endl;
}

Measured memory_bytes: 512
countFigureLength :: Int -> Int
countFigureLength n = (3 ^ n) - (3 * (2 ^ n)) + 3

candidates :: Int -> [String]
candidates 1 = ["3", "5", "7"]
candidates n = [h:s | h <- ['3', '5', '7'], s <- candidates (n - 1)]

isSFT :: String -> Bool
isSFT s = elem '7' s && elem '5' s && elem '3' s

main = do
  s <- getLine
  let len = length s
      cs = takeWhile (<= s) $ candidates len
      sft = filter isSFT cs
      answer = length sft + sum (map countFigureLength [3..len -1])
  print answer


Measured memory_bytes: 1660
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <stack>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

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

using ll = long long;

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

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



int main() {

    ll n;
    cin >> n;
    double k;
    cin >> k;
    vector<double> s(n);
    rep(i, n) cin >> s[i];

    // 0がある
    bool is_zero = false;
    // すべてk以上
    bool over_k = true;
    rep(i, n) {
        if (s[i] == 0.0) is_zero = true;
        if (s[i] <= k) over_k = false;
    }

    if (is_zero) {
        cout << n << endl;
        return 0;
    }
    if (over_k && k >= 1.0) {
        cout << 0 << endl;
        return 0;
    }

    rep(i, n) s[i] = log(s[i]);
    k = log(k);

    vector<double> sum(n + 1, 0.0);
    rep(i, n) {
        sum[i + 1] = sum[i] + s[i];
    }

    auto copy = sum;

    for (int i = n - 1; i >= 0; --i) {
        chmin(copy[i], copy[i + 1]);
    }

    int ans = 0;
    rep(i, n) {
        chmax(ans, (int)(upper_bound(allof(copy), sum[i] + k) - copy.begin() - i - 1));
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
  int N;
  string S;
  cin >> N >> S;
  int len = S.size();
  
  for(int i=0; i<len; i++){
    S[i] += N;
    if(S[i] > 'Z') S[i] -= 26;
  }
  
  cout << S << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 1e+5+5;

int n;
int a[N],b[N],c[N];
LL vb[N],vc[N];

int main(){
	n=get();
	fo(i,1,n)a[i]=get();
	fo(i,1,n)b[i]=get();
	fo(i,1,n)c[i]=get();
	sort(a+1,a+1+n);
	sort(b+1,b+1+n);
	sort(c+1,c+1+n);
	int w=0;
	fo(i,1,n){
		while(w<n&&a[w+1]<b[i])w++;
		vb[i]=w;
	}
	fo(i,1,n)vb[i]=vb[i]+vb[i-1];
	w=0;
	fo(i,1,n){
		while(w<n&&b[w+1]<c[i])w++;
		vc[i]=vb[w];
	}
	LL ans=0;
	fo(i,1,n)ans+=vc[i];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
typedef long long ll;
const int INF = 100000000, mod = 1000000007;
const ll LLINF = 1LL << 50;
using namespace std;


int main() {
    char t[9];
    for (int i = 0; i <= 8; i++) cin >> t[i];
    cout << t[0] << t[4] << t[8] << endl;
    return 0;
}


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


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

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

using namespace std;

//#define int long long

using ll = long long;
using pii =  pair<int, int>;

const int IINF =  0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9+7;

#define for_(i, a, b) for(int i = (a);i < (b);++i)
#define rfor_(i, a, b) for(int i = (b)-1;i >= (a);--i)

#define rep(i, n) for_(i, 0, n)
#define rrep(i, n) rfor_(i, 0, n)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))

#define endl '\n'

const int limit = 100007;

int A, B, C;

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

  cin >> A >> B >> C;

  if(A==B && B==C) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 892